Subversion Repositories basico

Rev

Rev 4 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 74
Line 25... Line 25...
25
from gi.repository.GdkPixbuf import Pixbuf
25
from gi.repository.GdkPixbuf import Pixbuf
26
26
27
from .log import get_logger
27
from .log import get_logger
28
from .sapnoteview import SAPNoteView
28
from .sapnoteview import SAPNoteView
29
29
30
#~ from .browser import WebBrowser
-
 
31
30
32
MONOSPACE_FONT = 'Lucida Console' if platform.system() == 'Windows' else 'monospace'
31
MONOSPACE_FONT = 'Lucida Console' if platform.system() == 'Windows' else 'monospace'
33
32
34
class GtkAppWindow(Gtk.ApplicationWindow):
33
class GtkAppWindow(Gtk.ApplicationWindow):
35
    def __init__(self, uiapp):
34
    def __init__(self, uiapp):
Line 42... Line 41...
42
        self.current_notes = {}
41
        self.current_notes = {}
43
42
44
        self.setup_window()
43
        self.setup_window()
45
        self.setup_widgets()
44
        self.setup_widgets()
46
        self.setup_app()
45
        self.setup_app()
47
        self.check_settings()
-
 
48
-
 
49
-
 
50
    def check_settings(self):
-
 
51
        # SAP module settings
-
 
52
        settings = self.sap.get_default_settings()
-
 
53
        for key in settings:
-
 
54
            try:
-
 
55
                self.sap.get_config_value(key)
-
 
56
            except:
-
 
57
                self.sap.set_config_value(key, settings[key])
-
 
58
                #~ self.log.warning("Setting '%s' does not exists" % setting)
-
 
59
46
60
47
61
    def setup_controller(self, uiapp):
48
    def setup_controller(self, uiapp):
62
        self.uiapp = uiapp
49
        self.uiapp = uiapp
63
        self.controller = uiapp.get_controller()
50
        self.controller = uiapp.get_controller()
Line 90... Line 77...
90
        # From docs: Don’t use this function. It sets the X xlib.Window
77
        # From docs: Don’t use this function. It sets the X xlib.Window
91
        # System “class” and “name” hints for a window.
78
        # System “class” and “name” hints for a window.
92
        # But I have to do it or it doesn't shows the right title. ???
79
        # But I have to do it or it doesn't shows the right title. ???
93
        self.set_wmclass (app_title, app_title)
80
        self.set_wmclass (app_title, app_title)
94
        self.set_role(app_title)
81
        self.set_role(app_title)
95
        #~ self.set_icon_from_file(self.env.get_var('ICONS') + '/basico.png')
-
 
96
        self.set_default_size(1024, 728)
82
        self.set_default_size(1024, 728)
97
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
83
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
98
        #~ self.connect('destroy', Gtk.main_quit)
84
        #~ self.connect('destroy', Gtk.main_quit)
99
        self.show_all()
85
        self.show_all()
100
86
Line 125... Line 111...
125
        #~ self.app.add_action(self.uif.create_action("view-projects", self.cb.refresh_view, 'projects'))
111
        #~ self.app.add_action(self.uif.create_action("view-projects", self.cb.refresh_view, 'projects'))
126
112
127
        # Components view
113
        # Components view
128
        views_menu.append_item(self.uif.create_item('View by components', 'app.view-components', ''))
114
        views_menu.append_item(self.uif.create_item('View by components', 'app.view-components', ''))
129
        self.app.add_action(self.uif.create_action("view-components", self.cb.refresh_view, 'components'))
115
        self.app.add_action(self.uif.create_action("view-components", self.cb.refresh_view, 'components'))
-
 
116
-
 
117
        # Component descriptions view
-
 
118
        views_menu.append_item(self.uif.create_item('View by component description', 'app.view-component-descriptions', ''))
-
 
119
        self.app.add_action(self.uif.create_action("view-component-descriptions", self.cb.refresh_view, 'description'))
130
120
131
        # Bookmarks view
121
        # Bookmarks view
132
        views_menu.append_item(self.uif.create_item('View bookmarks', 'app.view-bookmarks', ''))
122
        views_menu.append_item(self.uif.create_item('View bookmarks', 'app.view-bookmarks', ''))
133
        self.app.add_action(self.uif.create_action("view-bookmarks", self.cb.refresh_view, 'bookmarks'))
123
        self.app.add_action(self.uif.create_action("view-bookmarks", self.cb.refresh_view, 'bookmarks'))
134
124
-
 
125
        # Category view
-
 
126
        views_menu.append_item(self.uif.create_item('View categories', 'app.view-categories', ''))
-
 
127
        self.app.add_action(self.uif.create_action("view-categories", self.cb.refresh_view, 'category'))
-
 
128
-
 
129
        # Chronologic order view
-
 
130
        views_menu.append_item(self.uif.create_item('View in chronologic order', 'app.chronologic-order', ''))
-
 
131
        self.app.add_action(self.uif.create_action("chronologic-order", self.cb.refresh_view, 'chronologic'))
-
 
132
-
 
133
        # Priority view
-
 
134
        views_menu.append_item(self.uif.create_item('View by priority', 'app.view-priority', ''))
-
 
135
        self.app.add_action(self.uif.create_action("view-priority", self.cb.refresh_view, 'priority'))
-
 
136
-
 
137
        # SAP Note Type view
-
 
138
        views_menu.append_item(self.uif.create_item('View by type', 'app.view-type', ''))
-
 
139
        self.app.add_action(self.uif.create_action("view-type", self.cb.refresh_view, 'type'))
135
140
136
        # Annotations view
141
        # Annotations view
137
        #~ TODO
142
        #~ TODO
138
        #~ views_menu.append_item(self.uif.create_item('View by annotations', 'app.view-annotations', ''))
143
        #~ views_menu.append_item(self.uif.create_item('View by annotations', 'app.view-annotations', ''))
139
        #~ self.app.add_action(self.uif.create_action("view-annotations", self.cb_show_dlnotes_window))
144
        #~ self.app.add_action(self.uif.create_action("view-annotations", self.cb_show_dlnotes_window))
Line 167... Line 172...
167
172
168
    def setup_menus(self):
173
    def setup_menus(self):
169
        self.setup_menu_views()
174
        self.setup_menu_views()
170
        #~ self.setup_menu_actions()
175
        #~ self.setup_menu_actions()
171
        #~ self.setup_menu_settings()
176
        #~ self.setup_menu_settings()
-
 
177
172
178
173
    def show_home_page(self, *args):
179
    def show_home_page(self, *args):
174
        notebook = self.gui.get_widget('notebook')
180
        notebook = self.gui.get_widget('notebook')
175
        notebook.set_current_page(0)
181
        notebook.set_current_page(0)
-
 
182
176
183
177
    def show_settings_page(self, *args):
184
    def show_settings_page(self, *args):
178
        sapnoteview = self.gui.get_widget('sapnoteview')
185
        sapnoteview = self.gui.get_widget('sapnoteview')
179
        sapnoteview.set_view('settings')
186
        sapnoteview.set_view('settings')
180
        notebook = self.gui.get_widget('notebook')
187
        notebook = self.gui.get_widget('notebook')
181
        notebook.set_current_page(2)
188
        notebook.set_current_page(2)
-
 
189
-
 
190
-
 
191
    def show_stats_page(self, *args):
-
 
192
        sapnoteview = self.gui.get_widget('sapnoteview')
-
 
193
        sapnoteview.set_view('stats')
-
 
194
        notebook = self.gui.get_widget('notebook')
-
 
195
        notebook.set_current_page(4)
-
 
196
182
197
183
    def show_browser_page(self, *args):
198
    def show_browser_page(self, *args):
184
        notebook = self.gui.get_widget('notebook')
199
        notebook = self.gui.get_widget('notebook')
185
        notebook.set_current_page(1)
200
        notebook.set_current_page(1)
186
201
Line 196... Line 211...
196
            revsearch.set_reveal_child(False)
211
            revsearch.set_reveal_child(False)
197
            revsearch.set_no_show_all(True)
212
            revsearch.set_no_show_all(True)
198
            revsearch.hide()
213
            revsearch.hide()
199
214
200
215
201
    def show_addsapnotes_dialog(self, *args):
-
 
202
        sapnoteview = self.gui.get_widget('sapnoteview')
-
 
203
        sapnoteview.set_view('download')
-
 
204
        notebook = self.gui.get_widget('notebook')
-
 
205
        notebook.set_current_page(1)
-
 
-
 
216
    def hide_props_window(self):
-
 
217
        hpnnotes = self.gui.get_widget('hpnNotesManager')
-
 
218
        boxprops = self.gui.get_widget('boxPropsWidget')
-
 
219
        size = hpnnotes.get_allocation()
-
 
220
-
 
221
        boxprops.set_no_show_all(True)
-
 
222
        boxprops.hide()
-
 
223
        hpnnotes.set_position(size.width)
-
 
224
-
 
225
-
 
226
    def show_props_window(self):
-
 
227
        hpnnotes = self.gui.get_widget('hpnNotesManager')
-
 
228
        boxprops = self.gui.get_widget('boxPropsWidget')
-
 
229
        size = hpnnotes.get_allocation()
-
 
230
-
 
231
        boxprops.set_no_show_all(False)
-
 
232
        boxprops.show_all()
-
 
233
        hpnnotes.show_all()
-
 
234
        hpnnotes.set_position(size.width/5*3)
-
 
235
-
 
236
-
 
237
    def switch_props_window(self, *args):
-
 
238
        tgbprops = self.gui.get_widget('tgbShowManage')
-
 
239
-
 
240
        if tgbprops.get_active():
-
 
241
            self.show_props_window()
-
 
242
        else:
-
 
243
            self.hide_props_window()
206
244
207
245
208
    def setup_widgets(self):
246
    def setup_widgets(self):
209
        self.mainbox = self.gui.get_widget('mainbox')
247
        self.mainbox = self.gui.get_widget('mainbox')
210
        self.mainbox.reparent(self)
248
        self.mainbox.reparent(self)
211
249
-
 
250
        statusbar = self.gui.get_widget('pgbMain')
-
 
251
        statusbar.set_text("")
-
 
252
        statusbar.set_show_text(True)
-
 
253
        statusbar.set_fraction(0.0)
212
        self.setup_menus()
254
        self.setup_menus()
213
-
 
-
 
255
        #~ self.tasks.setup_widgets()
214
        notesbox = self.gui.get_widget('notesbox')
256
        notesbox = self.gui.get_widget('notesbox')
215
        sapnoteview = SAPNoteView(self.controller)
257
        sapnoteview = SAPNoteView(self.controller)
216
        self.gui.add_widget('sapnoteview', sapnoteview)
258
        self.gui.add_widget('sapnoteview', sapnoteview)
217
        #~ self.log.debug("SAPNoteView widget added")
-
 
218
        self.gui.add_widget('combobox')
259
        self.gui.add_widget('combobox')
219
        search = self.gui.add_widget('stySearchInfo')
260
        search = self.gui.add_widget('stySearchInfo')
220
        #~ search.connect('search_changed', self.search_notes)
261
        #~ search.connect('search_changed', self.search_notes)
221
        search.connect('activate', self.cb.search_notes)
262
        search.connect('activate', self.cb.search_notes)
222
        self.setup_combobox()
-
 
-
 
263
        self.setup_combobox_search()
223
        self.swap_widget(notesbox, sapnoteview)
264
        self.swap_widget(notesbox, sapnoteview)
-
 
265
-
 
266
-
 
267
        self.setup_props_window()
-
 
268
224
269
225
        # Buttons
270
        # Buttons
226
        btnabout = self.gui.get_widget('btnAbout')
-
 
227
        btnabout.connect('clicked', self.uiapp.cb_show_about)
-
 
-
 
271
        # Task link button
-
 
272
        self.cb.check_task_link_button_status()
228
273
229
        btnsettings = self.gui.get_widget('btnSettings')
-
 
230
        btnsettings.connect('clicked', self.show_settings_page)
-
 
-
 
274
        # button quit
-
 
275
        image = self.gui.get_widget('imgBtnQuit')
-
 
276
        icon = self.im.get_pixbuf_icon('power', 48, 48)
-
 
277
        image.set_from_pixbuf(icon)
-
 
278
        button = self.gui.get_widget('btnQuit')
-
 
279
        button.connect('clicked', self.gui.quit)
231
280
232
        btnaddnote = self.gui.get_widget('btnStartDlNotes')
-
 
233
        btnaddnote.connect('clicked', self.cb.import_notes)
-
 
-
 
281
        # button about
-
 
282
        image = self.gui.get_widget('imgBtnAbout')
-
 
283
        icon = self.im.get_pixbuf_icon('about', 48, 48)
-
 
284
        image.set_from_pixbuf(icon)
-
 
285
        button = self.gui.get_widget('btnAbout')
-
 
286
        button.connect('clicked', self.uiapp.cb_show_about)
234
287
235
        refreshview = self.gui.get_widget('btnRefreshSAPNoteView')
-
 
236
        refreshview.connect('clicked', self.cb.refresh_and_clear_view)
-
 
-
 
288
        # button settings
-
 
289
        image = self.gui.get_widget('imgBtnSettings')
-
 
290
        icon = self.im.get_pixbuf_icon('settings', 48, 48)
-
 
291
        image.set_from_pixbuf(icon)
-
 
292
        button = self.gui.get_widget('btnSettings')
-
 
293
        button.connect('clicked', self.show_settings_page)
237
294
238
        btnShowAddSAPNotesDlg = self.gui.get_widget('btnShowAddSAPNotesDlg')
-
 
239
        btnShowAddSAPNotesDlg.connect('clicked', self.show_addsapnotes_dialog)
-
 
-
 
295
        # button stats
-
 
296
        image = self.gui.get_widget('imgBtnStats')
-
 
297
        icon = self.im.get_pixbuf_icon('chart', 48, 48)
-
 
298
        image.set_from_pixbuf(icon)
-
 
299
        button = self.gui.get_widget('btnShowStats')
-
 
300
        button.connect('clicked', self.show_stats_page)
240
301
241
        btnStopDlNotes = self.gui.get_widget('btnStopDlNotes')
-
 
242
        btnStopDlNotes.connect('clicked', self.cb.stop_dl_notes)
-
 
-
 
302
        # button show property details
-
 
303
        image = self.gui.get_widget('imgBtnShowProps')
-
 
304
        icon = self.im.get_pixbuf_icon('fingerprint', 48, 48)
-
 
305
        image.set_from_pixbuf(icon)
-
 
306
        button = self.gui.get_widget('btnShowProperties')
-
 
307
        button.connect('clicked', self.cb.show_properties)
243
308
244
        tgbsearch = self.gui.get_widget('tgbSearch')
-
 
245
        tgbsearch.connect('toggled', self.show_search)
-
 
-
 
309
        # button show manage window
-
 
310
        image = self.gui.get_widget('imgBtnShowManage')
-
 
311
        icon = self.im.get_pixbuf_icon('subwindow', 48, 48)
-
 
312
        image.set_from_pixbuf(icon)
-
 
313
        button = self.gui.get_widget('tgbShowManage')
-
 
314
        button.connect('toggled', self.switch_props_window)
-
 
315
-
 
316
        # button search
-
 
317
        image = self.gui.get_widget('imgBtnSearch')
-
 
318
        icon = self.im.get_pixbuf_icon('bsearch', 48, 48)
-
 
319
        image.set_from_pixbuf(icon)
-
 
320
        button = self.gui.get_widget('tgbSearch')
-
 
321
        button.connect('toggled', self.show_search)
246
        revsearch = self.gui.get_widget('revSearch')
322
        revsearch = self.gui.get_widget('revSearch')
247
        revsearch.hide()
323
        revsearch.hide()
248
        revsearch.set_no_show_all(True)
324
        revsearch.set_no_show_all(True)
249
325
250
        toggle= self.gui.get_widget('tgbFullScreen')
-
 
251
        toggle.connect('toggled', self.uif.fullscreen)
-
 
-
 
326
        # button import
-
 
327
        image = self.gui.get_widget('imgMnuBtnImport')
-
 
328
        icon = self.im.get_pixbuf_icon('import', 48, 48)
-
 
329
        image.set_from_pixbuf(icon)
-
 
330
        #~ button = self.gui.get_widget('mnuBtnImport')
-
 
331
        #~ button.connect('toggled', self.switch_props_window)
-
 
332
-
 
333
        # button refresh
-
 
334
        image = self.gui.get_widget('imgBtnRefresh')
-
 
335
        icon = self.im.get_pixbuf_icon('refresh', 48, 48)
-
 
336
        image.set_from_pixbuf(icon)
-
 
337
        button = self.gui.get_widget('btnRefreshSAPNoteView')
-
 
338
        button.connect('clicked', self.cb.refresh_and_clear_view)
-
 
339
-
 
340
-
 
341
        button = self.gui.get_widget('btnLinkTasksApply')
-
 
342
        button.connect('clicked', self.cb.link_tasks_to_sapnotes)
-
 
343
-
 
344
-
 
345
-
 
346
        btnaddnote = self.gui.get_widget('btnStartDlNotes')
-
 
347
        btnaddnote.connect('clicked', self.cb.import_notes)
-
 
348
-
 
349
-
 
350
-
 
351
        #~ btnShowAddSAPNotesDlg = self.gui.get_widget('btnShowAddSAPNotesDlg')
-
 
352
        #~ btnShowAddSAPNotesDlg.connect('clicked', self.show_addsapnotes_dialog)
-
 
353
-
 
354
        btnStopDlNotes = self.gui.get_widget('btnStopDlNotes')
-
 
355
        btnStopDlNotes.connect('clicked', self.cb.stop_dl_notes)
-
 
356
-
 
357
        #~ toggle= self.gui.get_widget('tgbFullScreen')
-
 
358
        #~ toggle.connect('toggled', self.uif.fullscreen)
252
        switch = self.gui.get_widget('schExpandCollapse')
359
        switch = self.gui.get_widget('schExpandCollapse')
253
        switch.connect('state-set', sapnoteview.expand_collapse)
360
        switch.connect('state-set', sapnoteview.expand_collapse)
254
        switch = self.gui.get_widget('schSelectNotesAllNone')
361
        switch = self.gui.get_widget('schSelectNotesAllNone')
255
        switch.connect('state-set', sapnoteview.select_all_none)
362
        switch.connect('state-set', sapnoteview.select_all_none)
256
363
257
        button = self.gui.get_widget('btnQuit')
-
 
258
        button.connect('clicked', self.gui.quit)
-
 
259
364
260
        # Actions button
365
        # Actions button
261
        button = self.gui.get_widget('mnuBtnActions')
366
        button = self.gui.get_widget('mnuBtnActions')
262
367
263
        # Prefs for SAP module
368
        # Prefs for SAP module
Line 266... Line 371...
266
371
267
        button = self.gui.add_widget('btnPrefsSAPCancel')
372
        button = self.gui.add_widget('btnPrefsSAPCancel')
268
        button.connect('clicked', self.cb.refresh_view)
373
        button.connect('clicked', self.cb.refresh_view)
269
374
270
        button = self.gui.add_widget('btnPrefsSAPReset')
375
        button = self.gui.add_widget('btnPrefsSAPReset')
271
        button.connect('clicked', self.sap.default_preferences)
-
 
-
 
376
        button.connect('clicked', self.cb.default_preferences)
272
377
273
        # Notebook Import Widget
378
        # Notebook Import Widget
274
        ntbimport = self.gui.add_widget('ntbAddSAPNotes')
-
 
275
-
 
276
        try:
-
 
277
            sap_settings = self.sap.get_custom_settings()
-
 
278
        except:
-
 
279
            self.log.error(self.controller.get_traceback())
-
 
280
            sap_settings = self.sap.get_default_settings()
-
 
281
            self.log.debug("SAP Default settings loaded")
-
 
-
 
379
        #~ ntbimport = self.gui.add_widget('ntbAddSAPNotes')
282
380
-
 
381
        sap_settings = self.prefs.get_custom_settings()
283
        for setting in sap_settings:
382
        for setting in sap_settings:
284
            widget = self.gui.add_widget(setting)
-
 
285
            widget.set_text(sap_settings[setting])
-
 
-
 
383
            try:
-
 
384
                widget = self.gui.add_widget(setting)
-
 
385
                widget.set_text(sap_settings[setting])
-
 
386
            except:
-
 
387
                pass
-
 
388
286
389
287
        # Stats
390
        # Stats
288
        statsviewer = self.gui.add_widget('scrStatsViewer')
391
        statsviewer = self.gui.add_widget('scrStatsViewer')
289
392
290
        btnstats = self.gui.add_widget('btnStatsByCompMain')
393
        btnstats = self.gui.add_widget('btnStatsByCompMain')
Line 297... Line 400...
297
        btnstats.connect('clicked', self.cb.update_categories_stats)
400
        btnstats.connect('clicked', self.cb.update_categories_stats)
298
        iconwdg = self.gui.add_widget('imgStatsByCategory')
401
        iconwdg = self.gui.add_widget('imgStatsByCategory')
299
        icon = self.im.get_pixbuf_icon('category', 64, 64)
402
        icon = self.im.get_pixbuf_icon('category', 64, 64)
300
        iconwdg.set_from_pixbuf(icon)
403
        iconwdg.set_from_pixbuf(icon)
301
404
-
 
405
        self.hide_props_window()
302
        self.show_all()
406
        self.show_all()
303
        self.log.debug("GUI loaded")
407
        self.log.debug("GUI loaded")
-
 
408
-
 
409
-
 
410
    def setup_props_window(self):
-
 
411
        imgtitle = self.gui.get_widget('imgPropsTitle')
-
 
412
        icon = self.im.get_icon('fingerprint', 48, 48)
-
 
413
        imgtitle.set_from_pixbuf (icon)
-
 
414
        model = Gtk.TreeStore(str, str)
-
 
415
        trvprops = self.gui.add_widget('trvprops', Gtk.TreeView())
-
 
416
        trvprops.set_model(model)
-
 
417
-
 
418
        #~ ## key
-
 
419
        #~ renderer = Gtk.CellRendererText()
-
 
420
        #~ column = Gtk.TreeViewColumn('Id', renderer, text=0)
-
 
421
        #~ column.set_visible(False)
-
 
422
        #~ column.set_clickable(False)
-
 
423
        #~ column.set_sort_indicator(False)
-
 
424
        #~ trvprops.append_column(column)
-
 
425
-
 
426
        # Property
-
 
427
        renderer = Gtk.CellRendererText()
-
 
428
        renderer.set_alignment(1.0, 0.5)
-
 
429
        column = Gtk.TreeViewColumn('Property', renderer, markup=0)
-
 
430
        column.set_visible(True)
-
 
431
        column.set_expand(False)
-
 
432
        column.set_clickable(True)
-
 
433
        column.set_sort_indicator(True)
-
 
434
        trvprops.append_column(column)
-
 
435
-
 
436
        # Value
-
 
437
        renderer = Gtk.CellRendererText()
-
 
438
        renderer.set_alignment(0.0, 0.5)
-
 
439
        column = Gtk.TreeViewColumn('Value', renderer, markup=1)
-
 
440
        column.set_visible(True)
-
 
441
        column.set_expand(True)
-
 
442
        column.set_clickable(True)
-
 
443
        column.set_sort_indicator(True)
-
 
444
        trvprops.append_column(column)
-
 
445
        trvprops.show_all()
-
 
446
-
 
447
        trvprops.set_headers_visible(True)
-
 
448
        trvprops.set_enable_search(True)
-
 
449
        trvprops.set_grid_lines(Gtk.TreeViewGridLines.NONE)
-
 
450
        trvprops.set_search_column(1)
-
 
451
        #~ trvprops.connect('row-activated', self.double_click)
-
 
452
        selection = trvprops.get_selection()
-
 
453
        selection.set_mode(Gtk.SelectionMode.SINGLE)
-
 
454
        #~ trvprops.set_search_entry(self.pname)
-
 
455
-
 
456
        container = self.gui.get_widget('boxProps')
-
 
457
        self.gui.swap_widget(container, trvprops)
-
 
458
-
 
459
    def set_notes_manager_pane_position(self, pane, rectangle):
-
 
460
        pass
-
 
461
        #~ self.log.debug(type(pane.get_allocation()))
-
 
462
        position = rectangle.width/5*3
-
 
463
        pane.set_position(position)
-
 
464
        self.log.debug("Pane position: %s" % position)
-
 
465
304
466
305
467
306
    def __completion_func(self, completion, key, iter):
468
    def __completion_func(self, completion, key, iter):
307
        model = completion.get_model()
469
        model = completion.get_model()
308
        text = model.get_value(iter, 0)
470
        text = model.get_value(iter, 0)
Line 317... Line 479...
317
        completion = Gtk.EntryCompletion()
479
        completion = Gtk.EntryCompletion()
318
        completion.set_model(model)
480
        completion.set_model(model)
319
        completion.set_text_column(0)
481
        completion.set_text_column(0)
320
        completion.set_match_func(self.__completion_func)
482
        completion.set_match_func(self.__completion_func)
321
        search.set_completion(completion)
483
        search.set_completion(completion)
322
        #~ self.log.debug("Completion Key: %s" % key)
-
 
323
484
324
        stats = self.sap.get_stats()
-
 
-
 
485
        stats = self.db.get_stats()
325
486
326
        try:
487
        try:
327
            items = list(stats[key])
488
            items = list(stats[key])
328
            items.sort()
489
            items.sort()
329
            for item in items:
490
            for item in items:
Line 338... Line 499...
338
        key = model[treeiter][0]
499
        key = model[treeiter][0]
339
        self.gui.set_key('cmbvalue', key)
500
        self.gui.set_key('cmbvalue', key)
340
        self.setup_combobox_completions(key)
501
        self.setup_combobox_completions(key)
341
502
342
503
343
    def setup_combobox(self):
-
 
344
        combobox = self.gui.get_widget('combobox')
-
 
-
 
504
    def setup_combobox_search(self):
-
 
505
        combobox = self.gui.get_widget('cmbSearchInfo')
345
        model = Gtk.TreeStore(str, str)
506
        model = Gtk.TreeStore(str, str)
346
        combobox.set_model(model)
507
        combobox.set_model(model)
347
508
348
        ## key
509
        ## key
349
        cell = Gtk.CellRendererText()
510
        cell = Gtk.CellRendererText()
Line 378... Line 539...
378
        """
539
        """
379
        self.gui = self.controller.get_service("GUI")
540
        self.gui = self.controller.get_service("GUI")
380
        self.app = self.gui.get_app()
541
        self.app = self.gui.get_app()
381
        LOG_FILE = self.controller.get_file('LOG')
542
        LOG_FILE = self.controller.get_file('LOG')
382
        self.log = get_logger('GtkAppWindow', LOG_FILE)
543
        self.log = get_logger('GtkAppWindow', LOG_FILE)
383
        self.sap = self.controller.get_service("SAP")
-
 
-
 
544
        self.db = self.controller.get_service("DB")
384
        self.uif = self.controller.get_service("UIF")
545
        self.uif = self.controller.get_service("UIF")
385
        self.prefs = self.controller.get_service("Settings")
546
        self.prefs = self.controller.get_service("Settings")
386
        self.im = self.controller.get_service('IM')
547
        self.im = self.controller.get_service('IM')
387
        self.cb = self.controller.get_service('Callbacks')
548
        self.cb = self.controller.get_service('Callbacks')
-
 
549
        self.tasks = self.controller.get_service('Tasks')
388
550
389
551
390
    def swap_widget(self, container, combobox):
552
    def swap_widget(self, container, combobox):
391
        """Shortcut to GUI.swap_widget method
553
        """Shortcut to GUI.swap_widget method
392
        """
554
        """