Subversion Repositories basico

Rev

Rev 125 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 125 Rev 130
1
#!/usr/bin/python
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
# File: sapnoteview.py
3
# File: sapnoteview.py
4
# Author: Tomás Vírseda
4
# Author: Tomás Vírseda
5
# License: GPL v3
5
# License: GPL v3
6
# Description: Workplace service
6
# Description: Workplace service
7
7
8
8
9
import traceback as tb
9
import traceback as tb
10
10
11
import gi
11
import gi
12
gi.require_version('Gdk', '3.0')
12
gi.require_version('Gdk', '3.0')
13
gi.require_version('Gtk', '3.0')
13
gi.require_version('Gtk', '3.0')
14
from gi.repository import Gdk
14
from gi.repository import Gdk
15
from gi.repository import Gtk
15
from gi.repository import Gtk
16
from gi.repository import Gio
16
from gi.repository import Gio
17
from gi.repository import GLib
17
from gi.repository import GLib
18
18
19
from .log import get_logger
19
from .log import get_logger
20
from .sapnoteviewmenu import SAPNoteViewMenu
20
from .sapnoteviewmenu import SAPNoteViewMenu
21
from .sapnoteviewvisor import SAPNoteViewVisor
21
from .sapnoteviewvisor import SAPNoteViewVisor
22
from .service import Service
22
from .service import Service
23
23
24
24
25
class DlgImportFromLaunchpad(Gtk.Dialog):
25
class DlgImportFromLaunchpad(Gtk.Dialog):
26
    def __init__(self, parent):
26
    def __init__(self, parent):
27
        Gtk.Dialog.__init__(self, "Import SAP Notes from Launchpad", parent, 0,
27
        Gtk.Dialog.__init__(self, "Import SAP Notes from Launchpad", parent, 0,
28
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
28
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
29
             Gtk.STOCK_OK, Gtk.ResponseType.OK))
29
             Gtk.STOCK_OK, Gtk.ResponseType.OK))
30
30
31
        self.set_default_size(600, 480)
31
        self.set_default_size(600, 480)
32
32
33
        scrolledwindow = Gtk.ScrolledWindow()
33
        scrolledwindow = Gtk.ScrolledWindow()
34
        scrolledwindow.set_hexpand(True)
34
        scrolledwindow.set_hexpand(True)
35
        scrolledwindow.set_vexpand(True)
35
        scrolledwindow.set_vexpand(True)
36
36
37
        textview = Gtk.TextView()
37
        textview = Gtk.TextView()
38
        self.textbuffer = textview.get_buffer()
38
        self.textbuffer = textview.get_buffer()
39
        self.textbuffer.set_text("This is some text inside of a Gtk.TextView. "
-
 
40
            + "Select text and click one of the buttons 'bold', 'italic', "
-
 
41
            + "or 'underline' to modify the text accordingly.")
-
 
-
 
39
        self.textbuffer.set_text("")
42
        scrolledwindow.add(textview)
40
        scrolledwindow.add(textview)
43
41
44
        box = self.get_content_area()
42
        box = self.get_content_area()
45
        box.add(scrolledwindow)
43
        box.add(scrolledwindow)
46
        self.show_all()
44
        self.show_all()
47
45
48
    def get_buffer(self):
46
    def get_buffer(self):
49
        istart, iend = self.textbuffer.get_bounds()
47
        istart, iend = self.textbuffer.get_bounds()
50
        return self.textbuffer.get_text(istart, iend, False)
48
        return self.textbuffer.get_text(istart, iend, False)
51
49
52
50
53
51
54
class Workplace(Service):
52
class Workplace(Service):
55
    def initialize(self):
53
    def initialize(self):
56
        '''
54
        '''
57
        Setup Workplace Service
55
        Setup Workplace Service
58
        '''
56
        '''
59
        self.get_services()
57
        self.get_services()
60
        self.setup_widgets()
58
        self.setup_widgets()
61
        self.setup_menus()
59
        self.setup_menus()
62
60
63
61
64
    def hello(self, *args):
-
 
-
 
62
    def show_import_dialog_launchpad(self, *args):
65
        self.log.debug("Import from Launchpad")
63
        self.log.debug("Import from Launchpad")
66
        parent_window = self.gui.get_widget('mainwindow')
64
        parent_window = self.gui.get_widget('mainwindow')
67
        dialog = DlgImportFromLaunchpad(parent_window)
65
        dialog = DlgImportFromLaunchpad(parent_window)
68
        response = dialog.run()
66
        response = dialog.run()
69
67
70
        if response == Gtk.ResponseType.OK:
68
        if response == Gtk.ResponseType.OK:
71
            self.log.debug("The OK button was clicked")
69
            self.log.debug("The OK button was clicked")
72
            lines = dialog.get_buffer()
70
            lines = dialog.get_buffer()
73
            self.cb.import_notes_from_sapnet(lines)
71
            self.cb.import_notes_from_sapnet(lines)
74
        elif response == Gtk.ResponseType.CANCEL:
72
        elif response == Gtk.ResponseType.CANCEL:
75
            self.log.debug("The Cancel button was clicked")
73
            self.log.debug("The Cancel button was clicked")
76
74
77
        dialog.destroy()
75
        dialog.destroy()
78
76
79
77
80
    def setup_widgets(self):
78
    def setup_widgets(self):
81
        # Toolbar
79
        # Toolbar
82
        btnwpunfull = self.gui.get_widget('btnWPUnfullscreen')
-
 
83
        btnwpunfull.connect('clicked', self.uif.do_unfullscreen)
-
 
84
        imgwpunfull = self.gui.get_widget('imgWPUnfullscreen')
-
 
85
        icon = self.im.get_pixbuf_icon('unfullscreen', 24, 24)
-
 
86
        imgwpunfull.set_from_pixbuf(icon)
-
 
-
 
80
        #~ btnwpunfull = self.gui.get_widget('btnWPUnfullscreen')
-
 
81
        #~ btnwpunfull.connect('clicked', self.uif.do_unfullscreen)
-
 
82
        #~ imgwpunfull = self.gui.get_widget('imgWPUnfullscreen')
-
 
83
        #~ icon = self.im.get_pixbuf_icon('unfullscreen', 24, 24)
-
 
84
        #~ imgwpunfull.set_from_pixbuf(icon)
87
85
88
        icon = self.im.get_pixbuf_icon('addnote', 24, 24)
-
 
89
        imgwpaddnote = self.gui.get_widget('imgWPAddNote')
-
 
90
        imgwpaddnote.set_from_pixbuf(icon)
-
 
-
 
86
        #~ icon = self.im.get_pixbuf_icon('addnote', 24, 24)
-
 
87
        #~ imgwpaddnote = self.gui.get_widget('imgWPAddNote')
-
 
88
        #~ imgwpaddnote.set_from_pixbuf(icon)
91
89
92
90
93
        tgbshowmenu = self.gui.get_widget('tgbShowMenuView')
91
        tgbshowmenu = self.gui.get_widget('tgbShowMenuView')
94
        tgbshowmenu.connect('toggled', self.show_menu_view)
92
        tgbshowmenu.connect('toggled', self.show_menu_view)
95
        self.lblSelectedNotes = self.gui.get_widget('lblSelectedNotes')
93
        self.lblSelectedNotes = self.gui.get_widget('lblSelectedNotes')
96
94
97
        # Views
95
        # Views
98
        viewsbox = self.gui.get_widget('viewsbox')
96
        viewsbox = self.gui.get_widget('viewsbox')
99
        viewmenu = self.gui.add_widget('viewmenu', SAPNoteViewMenu(self.app))
97
        viewmenu = self.gui.add_widget('viewmenu', SAPNoteViewMenu(self.app))
100
        viewmenu.set_view('components')
98
        viewmenu.set_view('components')
101
        self.gui.swap_widget(viewsbox, viewmenu)
99
        self.gui.swap_widget(viewsbox, viewmenu)
102
100
103
        # SAP Notes Visor
101
        # SAP Notes Visor
104
        visorbox = self.gui.get_widget('notesbox')
102
        visorbox = self.gui.get_widget('notesbox')
105
        visor = self.gui.add_widget('visor', SAPNoteViewVisor(self.app))
103
        visor = self.gui.add_widget('visor', SAPNoteViewVisor(self.app))
106
        self.gui.swap_widget(visorbox, visor)
104
        self.gui.swap_widget(visorbox, visor)
107
105
-
 
106
        #~ toggled = visor.get_toggled()
-
 
107
        #~ bag = visor.get_bag()
-
 
108
        #~ label = self.gui.get_widget('lblSelectedNotes')
-
 
109
        #~ label.set_markup('<b><small>%d</small>/%d of <big>%d</big></b>' % (len(toggled), len(bag), self.db.get_total()))
108
110
109
    def get_services(self):
111
    def get_services(self):
110
        self.gui = self.app.get_service("GUI")
112
        self.gui = self.app.get_service("GUI")
111
        self.uif = self.app.get_service("UIF")
113
        self.uif = self.app.get_service("UIF")
112
        self.cb = self.app.get_service('Callbacks')
114
        self.cb = self.app.get_service('Callbacks')
113
        self.im = self.app.get_service('IM')
115
        self.im = self.app.get_service('IM')
114
116
115
117
116
    def show_menu_view(self, *args):
118
    def show_menu_view(self, *args):
117
        paned = self.gui.get_widget('boxMenuView')
119
        paned = self.gui.get_widget('boxMenuView')
118
        button = self.gui.get_widget('tgbShowMenuView')
120
        button = self.gui.get_widget('tgbShowMenuView')
119
        if button.get_active():
121
        if button.get_active():
120
            paned.show_all()
122
            paned.show_all()
121
        else:
123
        else:
122
            paned.hide()
124
            paned.hide()
123
125
124
    def setup_menu_views(self):
126
    def setup_menu_views(self):
125
        app = self.gui.get_app()
127
        app = self.gui.get_app()
126
128
127
        # View label
129
        # View label
128
        self.gui.add_widget('lblViewCurrent')
-
 
-
 
130
        #~ self.gui.add_widget('lblViewCurrent')
129
131
130
        ## Views Menu
132
        ## Views Menu
131
        views_menu = self.gui.add_widget('mnuviews', Gio.Menu())
133
        views_menu = self.gui.add_widget('mnuviews', Gio.Menu())
132
134
133
        # Last added view
135
        # Last added view
134
        #~ TODO
136
        #~ TODO
135
        #~ views_menu.append_item(self.uif.create_item('View last added', 'app.view-lastadded', ''))
137
        #~ views_menu.append_item(self.uif.create_item('View last added', 'app.view-lastadded', ''))
136
        #~ self.app.add_action(self.uif.create_action("view-lastadded", self.cb_show_dlnotes_window))
138
        #~ self.app.add_action(self.uif.create_action("view-lastadded", self.cb_show_dlnotes_window))
137
139
138
        # Most used view
140
        # Most used view
139
        #~ TODO
141
        #~ TODO
140
        #~ views_menu.append_item(self.uif.create_item('View most used', 'app.view-mostused', ''))
142
        #~ views_menu.append_item(self.uif.create_item('View most used', 'app.view-mostused', ''))
141
        #~ self.app.add_action(self.uif.create_action("view-mostused", self.cb_show_dlnotes_window))
143
        #~ self.app.add_action(self.uif.create_action("view-mostused", self.cb_show_dlnotes_window))
142
144
143
        # Tasks view
145
        # Tasks view
144
        views_menu.append_item(self.uif.create_item('View by tasks', 'app.view-tasks', 'emblem-system'))
146
        views_menu.append_item(self.uif.create_item('View by tasks', 'app.view-tasks', 'emblem-system'))
145
        app.add_action(self.uif.create_action("view-tasks", self.cb.refresh_view, 'tasks'))
147
        app.add_action(self.uif.create_action("view-tasks", self.cb.refresh_view, 'tasks'))
146
148
147
        # Projects view
149
        # Projects view
148
        #~ views_menu.append_item(self.uif.create_item('View by projects', 'app.view-projects', ''))
150
        #~ views_menu.append_item(self.uif.create_item('View by projects', 'app.view-projects', ''))
149
        #~ self.app.add_action(self.uif.create_action("view-projects", self.cb.refresh_view, 'projects'))
151
        #~ self.app.add_action(self.uif.create_action("view-projects", self.cb.refresh_view, 'projects'))
150
152
151
        # Components view
153
        # Components view
152
        views_menu.append_item(self.uif.create_item('View by components', 'app.view-components', ''))
154
        views_menu.append_item(self.uif.create_item('View by components', 'app.view-components', ''))
153
        app.add_action(self.uif.create_action("view-components", self.cb.refresh_view, 'components'))
155
        app.add_action(self.uif.create_action("view-components", self.cb.refresh_view, 'components'))
154
156
155
        # Component descriptions view
157
        # Component descriptions view
156
        views_menu.append_item(self.uif.create_item('View by description', 'app.view-component-descriptions', ''))
158
        views_menu.append_item(self.uif.create_item('View by description', 'app.view-component-descriptions', ''))
157
        app.add_action(self.uif.create_action("view-component-descriptions", self.cb.refresh_view, 'description'))
159
        app.add_action(self.uif.create_action("view-component-descriptions", self.cb.refresh_view, 'description'))
158
160
159
        # Bookmarks view
161
        # Bookmarks view
160
        views_menu.append_item(self.uif.create_item('View bookmarks', 'app.view-bookmarks', ''))
162
        views_menu.append_item(self.uif.create_item('View bookmarks', 'app.view-bookmarks', ''))
161
        app.add_action(self.uif.create_action("view-bookmarks", self.cb.refresh_view, 'bookmarks'))
163
        app.add_action(self.uif.create_action("view-bookmarks", self.cb.refresh_view, 'bookmarks'))
162
164
163
        # Category view
165
        # Category view
164
        views_menu.append_item(self.uif.create_item('View categories', 'app.view-categories', ''))
166
        views_menu.append_item(self.uif.create_item('View categories', 'app.view-categories', ''))
165
        app.add_action(self.uif.create_action("view-categories", self.cb.refresh_view, 'category'))
167
        app.add_action(self.uif.create_action("view-categories", self.cb.refresh_view, 'category'))
166
168
167
        # Chronologic order view
169
        # Chronologic order view
168
        views_menu.append_item(self.uif.create_item('View chronologically', 'app.chronologic-order', ''))
170
        views_menu.append_item(self.uif.create_item('View chronologically', 'app.chronologic-order', ''))
169
        app.add_action(self.uif.create_action("chronologic-order", self.cb.refresh_view, 'chronologic'))
171
        app.add_action(self.uif.create_action("chronologic-order", self.cb.refresh_view, 'chronologic'))
170
172
171
        # Priority view
173
        # Priority view
172
        views_menu.append_item(self.uif.create_item('View by priority', 'app.view-priority', ''))
174
        views_menu.append_item(self.uif.create_item('View by priority', 'app.view-priority', ''))
173
        app.add_action(self.uif.create_action("view-priority", self.cb.refresh_view, 'priority'))
175
        app.add_action(self.uif.create_action("view-priority", self.cb.refresh_view, 'priority'))
174
176
175
        # SAP Note Type view
177
        # SAP Note Type view
176
        views_menu.append_item(self.uif.create_item('View by type', 'app.view-type', ''))
178
        views_menu.append_item(self.uif.create_item('View by type', 'app.view-type', ''))
177
        app.add_action(self.uif.create_action("view-type", self.cb.refresh_view, 'type'))
179
        app.add_action(self.uif.create_action("view-type", self.cb.refresh_view, 'type'))
178
180
179
        # Annotations view
181
        # Annotations view
180
        #~ TODO
182
        #~ TODO
181
        #~ views_menu.append_item(self.uif.create_item('View by annotations', 'app.view-annotations', ''))
183
        #~ views_menu.append_item(self.uif.create_item('View by annotations', 'app.view-annotations', ''))
182
        #~ self.app.add_action(self.uif.create_action("view-annotations", self.cb_show_dlnotes_window))
184
        #~ self.app.add_action(self.uif.create_action("view-annotations", self.cb_show_dlnotes_window))
183
185
184
        # Set menu model in button
186
        # Set menu model in button
185
        btnviews = self.gui.get_widget('mnuBtnViews')
187
        btnviews = self.gui.get_widget('mnuBtnViews')
186
        btnviews.set_menu_model(views_menu)
188
        btnviews.set_menu_model(views_menu)
187
        btnviews.clicked()
189
        btnviews.clicked()
188
190
189
191
190
    def toggle_toggled(self, action, state):
192
    def toggle_toggled(self, action, state):
191
        action.set_state(state)
193
        action.set_state(state)
192
        Gtk.Settings.get_default().set_property("gtk-application-prefer-dark-theme", state)
194
        Gtk.Settings.get_default().set_property("gtk-application-prefer-dark-theme", state)
193
195
194
196
195
    def setup_menu_actions(self):
197
    def setup_menu_actions(self):
196
        viewmenu = self.gui.get_widget('viewmenu')
198
        viewmenu = self.gui.get_widget('viewmenu')
197
        view = viewmenu.get_view()
199
        view = viewmenu.get_view()
198
200
199
        ### ACTIONS POPOVER
201
        ### ACTIONS POPOVER
200
        app = self.gui.get_app()
202
        app = self.gui.get_app()
201
203
202
        ## Action Menu
204
        ## Action Menu
203
        actions_menu = Gio.Menu()
-
 
-
 
205
        actions_menu = self.gui.add_widget('actions_menu', Gio.Menu())
204
206
205
        #~ # Browse SAP Notes
207
        #~ # Browse SAP Notes
206
        actions_menu.append_item(self.uif.create_item('Browse SAP Note(s)', 'app.actions-browse', 'browse'))
208
        actions_menu.append_item(self.uif.create_item('Browse SAP Note(s)', 'app.actions-browse', 'browse'))
207
        app.add_action(self.uif.create_action("actions-browse"))
209
        app.add_action(self.uif.create_action("actions-browse"))
208
210
209
        if view == 'bookmarks':
211
        if view == 'bookmarks':
210
            #~ Unbookmark SAP Note(s) items
212
            #~ Unbookmark SAP Note(s) items
211
            actions_menu.append_item(self.uif.create_item('Unbookmark SAP Note(s)', 'app.actions-unbookmark', 'bookmark'))
213
            actions_menu.append_item(self.uif.create_item('Unbookmark SAP Note(s)', 'app.actions-unbookmark', 'bookmark'))
212
            app.add_action(self.uif.create_action("actions-unbookmark"))
214
            app.add_action(self.uif.create_action("actions-unbookmark"))
213
        else:
215
        else:
214
            #~ Bookmark SAP Note(s) items
216
            #~ Bookmark SAP Note(s) items
215
            actions_menu.append_item(self.uif.create_item('Bookmark SAP Note(s)', 'app.actions-bookmark', 'bookmark'))
217
            actions_menu.append_item(self.uif.create_item('Bookmark SAP Note(s)', 'app.actions-bookmark', 'bookmark'))
216
            app.add_action(self.uif.create_action("actions-bookmark"))
218
            app.add_action(self.uif.create_action("actions-bookmark"))
217
219
218
        # Manage task
220
        # Manage task
219
        actions_menu.append_item(self.uif.create_item('Manage tasks', 'app.actions-manage-tasks', 'tasks'))
221
        actions_menu.append_item(self.uif.create_item('Manage tasks', 'app.actions-manage-tasks', 'tasks'))
220
        app.add_action(self.uif.create_action("actions-manage-tasks"))
222
        app.add_action(self.uif.create_action("actions-manage-tasks"))
221
223
222
        # Export submenu
224
        # Export submenu
223
        actions_export_submenu = Gio.Menu()
225
        actions_export_submenu = Gio.Menu()
224
226
225
        #~ Export to JSON
227
        #~ Export to JSON
226
        actions_export_submenu.append_item(self.uif.create_item('Export as JSON', 'app.actions-export-json', 'document-save'))
228
        actions_export_submenu.append_item(self.uif.create_item('Export as JSON', 'app.actions-export-json', 'document-save'))
227
        app.add_action(self.uif.create_action("actions-export-json"))
229
        app.add_action(self.uif.create_action("actions-export-json"))
228
        #~ Export to CSV
230
        #~ Export to CSV
229
        actions_export_submenu.append_item(self.uif.create_item('Export as CSV', 'app.actions-export-csv', 'document-save'))
231
        actions_export_submenu.append_item(self.uif.create_item('Export as CSV', 'app.actions-export-csv', 'document-save'))
230
        app.add_action(self.uif.create_action("actions-export-csv"))
232
        app.add_action(self.uif.create_action("actions-export-csv"))
231
        #~ Export to TXT
233
        #~ Export to TXT
232
        actions_export_submenu.append_item(self.uif.create_item('Export to plaint text', 'app.actions-export-txt', 'document-save'))
234
        actions_export_submenu.append_item(self.uif.create_item('Export to plaint text', 'app.actions-export-txt', 'document-save'))
233
        app.add_action(self.uif.create_action("actions-export-txt"))
235
        app.add_action(self.uif.create_action("actions-export-txt"))
234
        #~ Export to BCO
236
        #~ Export to BCO
235
        #~ actions_export_submenu.append_item(self.uif.create_item('Export as Basico Package Object (BCO)', 'app.actions-export-bco', 'document-save'))
237
        #~ actions_export_submenu.append_item(self.uif.create_item('Export as Basico Package Object (BCO)', 'app.actions-export-bco', 'document-save'))
236
        #~ app.add_action(self.uif.create_action("actions-export-bco"))
238
        #~ app.add_action(self.uif.create_action("actions-export-bco"))
237
        actions_menu.append_submenu('Export', actions_export_submenu)
239
        actions_menu.append_submenu('Export', actions_export_submenu)
238
240
239
        # Refresh SAP Notes
241
        # Refresh SAP Notes
240
        #~ actions_menu.append_item(self.uif.create_item('Refresh selected SAP Notes', 'app.actions-other-refresh', 'refresh'))
242
        #~ actions_menu.append_item(self.uif.create_item('Refresh selected SAP Notes', 'app.actions-other-refresh', 'refresh'))
241
        #~ app.add_action(self.uif.create_action("actions-other-refresh"))
243
        #~ app.add_action(self.uif.create_action("actions-other-refresh"))
242
244
243
        # Delete SAP Notes
245
        # Delete SAP Notes
244
        actions_menu.append_item(self.uif.create_item('Delete selected SAP Notes', 'app.actions-other-delete', 'delete'))
246
        actions_menu.append_item(self.uif.create_item('Delete selected SAP Notes', 'app.actions-other-delete', 'delete'))
245
        app.add_action(self.uif.create_action("actions-other-delete"))
247
        app.add_action(self.uif.create_action("actions-other-delete"))
246
248
247
        item = actions_menu.append_item(self.uif.create_item('Select All SAP Notes', 'app.actions-select-all', 'select-all'))
249
        item = actions_menu.append_item(self.uif.create_item('Select All SAP Notes', 'app.actions-select-all', 'select-all'))
248
        action_toggle = Gio.SimpleAction.new_stateful("actions-select-all", None, GLib.Variant.new_boolean(False))
250
        action_toggle = Gio.SimpleAction.new_stateful("actions-select-all", None, GLib.Variant.new_boolean(False))
249
        action_toggle.connect("change-state", self.toggle_toggled)
251
        action_toggle.connect("change-state", self.toggle_toggled)
250
        self.log.debug(action_toggle)
252
        self.log.debug(action_toggle)
251
        app.add_action(action_toggle)
253
        app.add_action(action_toggle)
252
254
253
        # MnuButton valid with any modern version of Gtk (?> 3.10)
255
        # MnuButton valid with any modern version of Gtk (?> 3.10)
254
        btnactions = self.gui.get_widget('mnuBtnActions')
256
        btnactions = self.gui.get_widget('mnuBtnActions')
255
        btnactions.set_always_show_image(True)
257
        btnactions.set_always_show_image(True)
256
        btnactions.set_property("use-popover", True)
258
        btnactions.set_property("use-popover", True)
257
        btnactions.set_menu_model(actions_menu)
259
        btnactions.set_menu_model(actions_menu)
258
260
259
261
260
    def setup_menu_import(self):
262
    def setup_menu_import(self):
261
        imgwpimport = self.gui.get_widget('imgWPImport')
-
 
262
        icon = self.im.get_pixbuf_icon('download', 24, 24)
-
 
263
        imgwpimport.set_from_pixbuf(icon)
-
 
-
 
263
        #~ imgwpimport = self.gui.get_widget('imgWPImport')
-
 
264
        #~ icon = self.im.get_pixbuf_icon('download', 24, 24)
-
 
265
        #~ imgwpimport.set_from_pixbuf(icon)
264
        viewmenu = self.gui.get_widget('viewmenu')
266
        viewmenu = self.gui.get_widget('viewmenu')
265
        view = viewmenu.get_view()
267
        view = viewmenu.get_view()
266
268
267
        ### ACTIONS POPOVER
269
        ### ACTIONS POPOVER
268
        app = self.gui.get_app()
270
        app = self.gui.get_app()
269
271
270
        ## Action Menu
272
        ## Action Menu
271
        actions_menu = Gio.Menu()
273
        actions_menu = Gio.Menu()
272
274
273
        # Import submenu
275
        # Import submenu
274
        #~ actions_import_submenu = Gio.Menu()
276
        #~ actions_import_submenu = Gio.Menu()
275
        # Import Basico Package
277
        # Import Basico Package
276
        actions_menu.append_item(self.uif.create_item('Import Basico Package', 'app.actions-import-basico', 'document-open'))
278
        actions_menu.append_item(self.uif.create_item('Import Basico Package', 'app.actions-import-basico', 'document-open'))
277
        #~ app.add_action(self.uif.create_action("actions-import-basico"))
279
        #~ app.add_action(self.uif.create_action("actions-import-basico"))
278
280
279
        # Import from JSON file
281
        # Import from JSON file
280
        actions_menu.append_item(self.uif.create_item('Import JSON file', 'app.actions-import-json', 'document-open'))
282
        actions_menu.append_item(self.uif.create_item('Import JSON file', 'app.actions-import-json', 'document-open'))
281
        app.add_action(self.uif.create_action("actions-import-json"))
283
        app.add_action(self.uif.create_action("actions-import-json"))
282
284
283
        #~ Import from SAP Launchpad
285
        #~ Import from SAP Launchpad
284
        actions_menu.append_item(self.uif.create_item('Import SAP Notes from SAP Launchpad', 'app.actions-import-launchpad', 'download'))
286
        actions_menu.append_item(self.uif.create_item('Import SAP Notes from SAP Launchpad', 'app.actions-import-launchpad', 'download'))
285
        #~ action = Gio.SimpleAction.new('app.actions-import-launchpad', None)
287
        #~ action = Gio.SimpleAction.new('app.actions-import-launchpad', None)
286
        #~ action.connect('activate', self.hello, 'download')
288
        #~ action.connect('activate', self.hello, 'download')
287
        app.add_action(self.uif.create_action("actions-import-launchpad", self.hello))
-
 
-
 
289
        app.add_action(self.uif.create_action("actions-import-launchpad", self.show_import_dialog_launchpad))
288
        #~ action) #
290
        #~ action) #
289
291
290
        #~ actions_menu.append_submenu('Import', actions_import_submenu)
292
        #~ actions_menu.append_submenu('Import', actions_import_submenu)
291
293
292
        # MnuButton valid with any modern version of Gtk (?> 3.10)
294
        # MnuButton valid with any modern version of Gtk (?> 3.10)
293
        btnactions = self.gui.get_widget('mnuBtnImport')
295
        btnactions = self.gui.get_widget('mnuBtnImport')
294
        btnactions.set_always_show_image(True)
296
        btnactions.set_always_show_image(True)
295
        btnactions.set_property("use-popover", True)
297
        btnactions.set_property("use-popover", True)
296
        btnactions.set_menu_model(actions_menu)
298
        btnactions.set_menu_model(actions_menu)
297
299
298
300
299
    def setup_menus(self):
301
    def setup_menus(self):
300
        self.setup_menu_views()
302
        self.setup_menu_views()
301
        self.setup_menu_import()
303
        self.setup_menu_import()
302
        self.setup_menu_actions()
304
        self.setup_menu_actions()
303
 
305