Subversion Repositories basico

Rev

Rev 400 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
340 t00mlabs 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
"""
4
# File: mod_win.py
5
# Author: Tomás Vírseda
6
# License: GPL v3
7
# Description: Gtk.ApplicationWindow implementation
8
"""
9
 
10
import os
11
import sys
12
import stat
13
import time
14
import platform
15
 
16
import gi
390 t00mlabs 17
gi.require_version('Gdk', '3.0')
340 t00mlabs 18
gi.require_version('Gtk', '3.0')
19
 
20
from gi.repository import GLib
21
from gi.repository import GObject
22
from gi.repository import Gtk
23
from gi.repository import Gdk
24
from gi.repository import Gio
25
from gi.repository import Pango
26
from gi.repository.GdkPixbuf import Pixbuf
27
 
28
from basico.core.mod_srv import Service
29
from basico.core.mod_env import APP, FILE, ATYPES
30
from basico.widgets.wdg_visor_sapnotes import SAPNotesVisor
31
from basico.widgets.wdg_visor_annotations import AnnotationsVisor
353 t00mlabs 32
from basico.widgets.wdg_visor_attachments import AttachmentsVisor
340 t00mlabs 33
from basico.widgets.wdg_visor_toolbar import VisorToolbar
34
from basico.widgets.wdg_about import About
35
from basico.widgets.wdg_settingsview import SettingsView
36
from basico.widgets.wdg_logviewer import LogViewer
37
from basico.widgets.wdg_annot import AnnotationWidget
38
from basico.widgets.wdg_statusbar import Statusbar
389 t00mlabs 39
from basico.widgets.wdg_browser import BasicoBrowser
340 t00mlabs 40
from basico.core.mod_log import get_logger
41
 
42
 
389 t00mlabs 43
class GtkAppWindow(Service, Gtk.ApplicationWindow):
340 t00mlabs 44
    def __init__(self, uiapp):
45
        self.setup_controller(uiapp)
389 t00mlabs 46
        # ~ self.get_logger(__class__.__name__)
340 t00mlabs 47
        self.get_services()
48
        self.srvgui.add_widget('uiapp', uiapp)
49
        self.app = self.srvgui.get_app()
50
        self.setup_window(uiapp)
374 t00mlabs 51
        self.setup_widgets()
340 t00mlabs 52
        self.run()
53
 
54
 
55
    def get_services(self):
374 t00mlabs 56
        # ~ self.srvbnr = self.controller.get_service("BNR")
340 t00mlabs 57
        self.srvgui = self.controller.get_service("GUI")
374 t00mlabs 58
        # ~ self.srvdtb = self.controller.get_service("DB")
340 t00mlabs 59
        self.srvuif = self.controller.get_service("UIF")
60
        self.srvicm = self.controller.get_service('IM')
61
        self.srvclb = self.controller.get_service('Callbacks')
374 t00mlabs 62
        # ~ self.srvant = self.controller.get_service('Annotation')
340 t00mlabs 63
 
64
 
65
    def setup_controller(self, uiapp):
66
        self.controller = uiapp.get_controller()
67
 
68
 
369 t00mlabs 69
    def get_signal(self, signal):
70
        return self.signals[key]
71
 
374 t00mlabs 72
 
340 t00mlabs 73
    def setup_window(self, uiapp):
74
        Gtk.Window.__init__(self, title=APP['name'], application=uiapp)
75
        icon = self.srvicm.get_icon('basico-component', 48, 48)
76
        self.set_icon(icon)
77
        # FIXME
78
        # From docs: Don’t use this function. It sets the X xlib.Window
79
        # System “class” and “name” hints for a window.
80
        # But I have to do it or it doesn't shows the right title. ???
390 t00mlabs 81
        # ~ self.set_wmclass (APP['name'], APP['name'])
82
        # ~ self.set_role(APP['name'])
83
 
84
        """
85
        Change Gtk+ Style
86
        """
87
        screen = Gdk.Screen.get_default()
88
        css_provider = Gtk.CssProvider()
89
        css_provider.load_from_path(FILE['CSS'])
90
        context = Gtk.StyleContext()
91
        context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
92
 
340 t00mlabs 93
        self.set_default_size(1024, 728)
94
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
389 t00mlabs 95
        self.setup_headerbar()
374 t00mlabs 96
 
390 t00mlabs 97
        self.maximize ()
340 t00mlabs 98
        self.show_all()
99
 
374 t00mlabs 100
 
340 t00mlabs 101
    def setup_headerbar(self):
102
        hb = self.srvgui.add_widget('gtk_headerbar_container', Gtk.HeaderBar())
103
        hb.set_show_close_button(True)
104
        hb.props.title = "Basico"
105
        hb.props.subtitle = "SAP Notes Manager for SAP Consultants"
106
        lhbox = self.setup_headerbar_left(hb)
107
        hb.pack_start(lhbox)
108
        rhbox = self.setup_headerbar_right(hb)
109
 
110
        hb.pack_end(rhbox)
111
        self.set_titlebar(hb)
112
        hb.show_all()
113
 
114
 
115
    def setup_headerbar_left(self, hb):
389 t00mlabs 116
        lhbox = self.srvgui.add_widget('gtk_hbox_hb_left', Gtk.HBox())
340 t00mlabs 117
        return lhbox
118
 
119
 
120
    def setup_headerbar_right(self, hb):
121
        rhbox = Gtk.HBox()
122
 
123
        ## Help togglebutton
124
        # ~ if self.srvuif.webkit_support():
125
            # ~ button = self.srvgui.add_widget('gtk_togglebutton_help', Gtk.ToggleButton())
126
            # ~ icon = self.srvicm.get_pixbuf_icon('basico-help', 24, 24)
127
            # ~ image = Gtk.Image()
128
            # ~ image.set_from_pixbuf(icon)
129
            # ~ button.set_image(image)
130
            # ~ button.set_relief(Gtk.ReliefStyle.NONE)
131
            # ~ button.connect('toggled', self.srvclb.gui_toggle_help_visor)
132
        # ~ else:
133
            # ~ button = self.srvgui.add_widget('gtk_button_help', Gtk.Button())
134
            # ~ icon = self.srvicm.get_pixbuf_icon('basico-help', 24, 24)
135
            # ~ image = Gtk.Image()
136
            # ~ image.set_from_pixbuf(icon)
137
            # ~ button.set_image(image)
138
            # ~ button.set_relief(Gtk.ReliefStyle.NONE)
139
            # ~ button.connect('clicked', self.srvclb.gui_lauch_help_visor)
140
 
141
        # ~ rhbox.pack_end(button, False, False, 0)
142
 
143
        ## System Menu
144
        button = Gtk.Button()
145
        icon = self.srvicm.get_pixbuf_icon('basico-menu-system', 24, 24)
146
        image = Gtk.Image()
147
        image.set_from_pixbuf(icon)
148
        button.set_image(image)
149
        button.set_relief(Gtk.ReliefStyle.NONE)
150
        popover = Gtk.Popover.new(button)
151
        self.srvgui.add_widget('gtk_popover_button_menu_system', popover)
152
        button.connect('clicked', self.srvclb.gui_show_popover, popover)
153
        rhbox.pack_end(button, False, False, 0)
154
 
155
        # Popover body
156
        box = Gtk.Box(spacing = 0, orientation="vertical")
157
        popover.add(box)
158
 
159
        ### About
160
        hbox = Gtk.Box(spacing = 0, orientation="horizontal")
161
        icon = self.srvicm.get_pixbuf_icon('basico-about', 48, 48)
162
        image = Gtk.Image()
163
        image.set_from_pixbuf(icon)
164
        label = Gtk.Label("About")
165
        hbox.pack_start(image, False, False, 3)
166
        hbox.pack_start(label, False, False, 3)
167
        button = Gtk.Button()
168
        button.add(hbox)
169
        button.set_relief(Gtk.ReliefStyle.NONE)
170
        button.connect('clicked', self.srvclb.gui_show_about)
171
        box.pack_end(button, False, False, 0)
172
 
173
        # ~ ### Help
174
        # ~ hbox = Gtk.Box(spacing = 0, orientation="horizontal")
175
        # ~ icon = self.srvicm.get_pixbuf_icon('basico-help', 48, 48)
176
        # ~ image = Gtk.Image()
177
        # ~ image.set_from_pixbuf(icon)
178
        # ~ label = Gtk.Label("Help")
179
        # ~ hbox.pack_start(image, False, False, 3)
180
        # ~ hbox.pack_start(label, False, False, 3)
181
        # ~ button = Gtk.Button()
182
        # ~ button.add(hbox)
183
        # ~ button.set_relief(Gtk.ReliefStyle.NONE)
184
        # ~ button.connect('clicked', self.srvclb.gui_show_help)
185
        # ~ box.pack_end(button, False, False, 0)
186
 
187
        ### Log viewer
188
        hbox = Gtk.Box(spacing = 0, orientation="horizontal")
189
        icon = self.srvicm.get_pixbuf_icon('basico-logviewer', 48, 48)
190
        image = Gtk.Image()
191
        image.set_from_pixbuf(icon)
192
        label = Gtk.Label("Event viewer")
193
        hbox.pack_start(image, False, False, 3)
194
        hbox.pack_start(label, False, False, 3)
195
        button = Gtk.Button()
196
        button.add(hbox)
197
        button.set_relief(Gtk.ReliefStyle.NONE)
198
        button.connect('clicked', self.srvclb.gui_show_log)
199
        box.pack_end(button, False, False, 0)
200
 
201
        ### Settings
202
        # ~ hbox = Gtk.Box(spacing = 0, orientation="horizontal")
203
        # ~ icon = self.srvicm.get_pixbuf_icon('basico-settings', 48, 48)
204
        # ~ image = Gtk.Image()
205
        # ~ image.set_from_pixbuf(icon)
206
        # ~ label = Gtk.Label("Settings")
207
        # ~ hbox.pack_start(image, False, False, 3)
208
        # ~ hbox.pack_start(label, False, False, 3)
209
        # ~ button = Gtk.Button()
210
        # ~ button.add(hbox)
211
        # ~ button.set_relief(Gtk.ReliefStyle.NONE)
212
        # ~ button.connect('clicked', self.srvclb.gui_show_settings)
213
        # ~ box.pack_start(button, False, False, 0)
214
 
215
        ### Backup
216
        hbox = Gtk.Box(spacing = 0, orientation="horizontal")
217
        icon = self.srvicm.get_pixbuf_icon('basico-backup-restore', 48, 48)
218
        image = Gtk.Image()
219
        image.set_from_pixbuf(icon)
220
        label = Gtk.Label("Backup/Restore")
221
        hbox.pack_start(image, False, False, 3)
222
        hbox.pack_start(label, False, False, 3)
223
        button = Gtk.Button()
224
        button.add(hbox)
225
        button.set_relief(Gtk.ReliefStyle.NONE)
226
        box.pack_start(button, False, False, 0)
227
 
228
        box_bnr = Gtk.VBox()
229
        popover_bnr = Gtk.Popover.new(button)
230
        popover_bnr.set_position(Gtk.PositionType.LEFT)
231
        popover_bnr.add(box_bnr)
232
        self.srvgui.add_widget('gtk_popover_button_menu_system', popover_bnr)
233
        button.connect('clicked', self.srvclb.gui_show_popover, popover_bnr)
234
 
235
        hbox_backup = Gtk.VBox()
236
        button_backup = self.srvuif.create_button('basico-backup', 48, 48, '<b>Backup database</b> ')
237
        button_backup.connect('clicked', self.srvclb.gui_database_backup)
238
        box_bnr.pack_start(button_backup, False, False, 0)
239
        button_restore = self.srvuif.create_button('basico-restore', 48, 48, '<b>Restore from backup</b>')
240
        button_restore.connect('clicked', self.srvclb.gui_database_restore)
241
        # ~ button_cache = self.srvuif.create_button('basico-restore', 48, 48, '<b>Restore from cache</b>')
242
        # ~ button_cache.connect('clicked', self.srvbnr.restore_from_cache)
374 t00mlabs 243
 
340 t00mlabs 244
        box_bnr.pack_start(button_restore, False, False, 0)
245
        # ~ box_bnr.pack_start(button_cache, False, False, 0)
246
 
247
        return rhbox
248
 
249
 
250
    def setup_widgets(self):
405 t00mlabs 251
        # Statusbar
252
        statusbar = self.srvgui.add_widget('widget_statusbar', Statusbar(self.controller))
253
 
340 t00mlabs 254
        # Mainbox
255
        mainbox = self.srvgui.add_widget('gtk_vbox_container_main', Gtk.VBox())
256
        mainbox.set_hexpand(True)
257
        paned = self.srvgui.add_widget('gtk_hpaned', Gtk.HPaned())
258
        paned.set_property('margin-bottom', 6)
364 t00mlabs 259
        paned.set_wide_handle(False)
389 t00mlabs 260
        paned.set_position(0)
340 t00mlabs 261
 
262
        # Paned
392 t00mlabs 263
        ## left pane (empty)
389 t00mlabs 264
        paned.add1(Gtk.Box())
374 t00mlabs 265
 
340 t00mlabs 266
        ## Right pane
267
        box = Gtk.VBox()
268
        box.set_hexpand(True)
345 t00mlabs 269
 
392 t00mlabs 270
        stack_main = self.setup_main_stack()
271
        box.pack_start(stack_main, True, True, 0)
272
 
273
 
274
        paned.add2(box)
275
        mainbox.pack_start(paned, True, True, 0)
276
 
405 t00mlabs 277
 
392 t00mlabs 278
        mainbox.pack_start(statusbar, False, False, 0)
279
 
280
        # Connect signals for visor annotations
281
        visor_annotations = self.srvgui.get_widget('visor_annotations')
400 t00mlabs 282
        visor_annotations.set_menuview_signals()
392 t00mlabs 283
        visor_annotations.set_active_categories()
284
        self.add(mainbox)
285
        self.show_all()
286
 
287
 
288
    def setup_main_stack(self):
389 t00mlabs 289
        # Main Stack (Visors / Settings / Help)
290
        stack_switcher = self.srvgui.add_widget('gtk_stack_switcher_main', Gtk.StackSwitcher())
291
        lhbox = self.srvgui.get_widget('gtk_hbox_hb_left')
292
        lhbox.pack_start(stack_switcher, False, False, 0)
293
 
340 t00mlabs 294
        stack_main = self.srvgui.add_widget('gtk_stack_main', Gtk.Stack())
389 t00mlabs 295
        stack_switcher.set_stack(stack_main)
296
        stack_switcher.set_property('icon-size', 3)
390 t00mlabs 297
        # ~ stack_main.connect('notify::visible-child', self.stack_changed)
340 t00mlabs 298
        stack_main.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
299
        stack_main.set_transition_duration(250)
300
 
392 t00mlabs 301
 
345 t00mlabs 302
        ### Visor stack child
392 t00mlabs 303
        stack_child = self.setup_stack_visors()
389 t00mlabs 304
        stack_main.add_titled(stack_child, "dashboard", "Dashboard")
305
        stack_main.child_set_property (stack_child, "icon-name", "basico-dashboard")
340 t00mlabs 306
 
389 t00mlabs 307
        ### Settings stack child
392 t00mlabs 308
        stack_child = self.setup_main_stack_settings()
389 t00mlabs 309
        stack_main.add_titled(stack_child, "settings", "Basico Settings")
310
        stack_main.child_set_property (stack_child, "icon-name", "basico-settings")
311
 
312
        ### Help stack child
392 t00mlabs 313
        stack_child = self.setup_main_stack_settings()
389 t00mlabs 314
        stack_main.add_titled(stack_child, "help", "Basico Help")
315
        stack_main.child_set_property (stack_child, "icon-name", "basico-help")
316
 
345 t00mlabs 317
        ### About stack child
389 t00mlabs 318
        # ~ stack_child = self.setup_stack_about()
319
        # ~ stack_main.add_titled(stack_child, "about", "About Basico")
340 t00mlabs 320
 
345 t00mlabs 321
        ### Log stack child
389 t00mlabs 322
        # ~ stack_child = self.setup_stack_log()
323
        # ~ stack_main.add_titled(stack_child, "log", "Event Viewer")
340 t00mlabs 324
 
392 t00mlabs 325
        return stack_main
340 t00mlabs 326
 
327
 
392 t00mlabs 328
    def setup_stack_visors(self):
340 t00mlabs 329
        box = Gtk.VBox()
330
        box.set_hexpand(True)
331
 
332
        ### Toolbar
333
        boxtoolbar = self.srvgui.add_widget('gtk_hbox_container_toolbar', Gtk.HBox())
334
        box.pack_start(boxtoolbar, False, False, 0)
335
        visortoolbar = self.srvgui.add_widget('visortoolbar', VisorToolbar(self.controller))
336
        self.srvgui.swap_widget(boxtoolbar, visortoolbar)
337
 
389 t00mlabs 338
        ### Stack for visors
339
        stack_switcher = self.srvgui.add_widget('gtk_stack_switcher_visors', Gtk.StackSwitcher())
340
        rhbox = self.srvgui.get_widget('gtk_hbox_toolbar_stack_switcher')
341
        rhbox.pack_start(stack_switcher, False, False, 0)
342
 
343
        stack_visors = self.srvgui.add_widget('gtk_stack_visors', Gtk.Stack())
344
        stack_switcher.set_stack(stack_visors)
345
        stack_switcher.set_property('icon-size', 3)
390 t00mlabs 346
        stack_visors.connect('notify::visible-child', self.srvclb.stack_visor_changed)
389 t00mlabs 347
        stack_visors.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
348
        stack_visors.set_transition_duration(250)
349
        box.pack_start(stack_visors, True, True, 0)
350
 
351
        #### Stack for Visor SAP Notes
392 t00mlabs 352
        stack_child = self.setup_stack_visor_sapnotes()
390 t00mlabs 353
        stack_visors.add_titled(stack_child, "visor-sapnotes", "SAP Notes")
389 t00mlabs 354
        stack_visors.child_set_property (stack_child, "icon-name", "basico-sapnote")
355
 
356
        #### Stack for Visor Annotations
392 t00mlabs 357
        stack_child = self.setup_stack_visor_annotations()
389 t00mlabs 358
        stack_visors.add_titled(stack_child, "visor-annotations", "Annotations")
359
        stack_visors.child_set_property (stack_child, "icon-name", "basico-filter")
360
 
361
        #### Stack for Visor Annotations
392 t00mlabs 362
        stack_child = self.setup_stack_visor_attachments()
389 t00mlabs 363
        stack_visors.add_titled(stack_child, "visor-attachments", "Attachments")
364
        stack_visors.child_set_property (stack_child, "icon-name", "basico-attachment")
365
 
340 t00mlabs 366
        return box
367
 
368
    # ~ def setup_tab_help_visor(self):
369
        # ~ from basico.widgets.wdg_browser import BasicoBrowser
370
        # ~ box = Gtk.VBox()
371
        # ~ box.set_hexpand(True)
372
 
373
        # ~ ### Help Visor
374
        # ~ browser = BasicoBrowser()
375
        # ~ self.controller.debug(FILE['HELP_INDEX'])
376
        # ~ browser.load_url("file://%s" % FILE['HELP_INDEX'])
377
        # ~ box.pack_start(browser, True, True, 0)
378
        # ~ box.show_all()
379
        # ~ return box
380
 
381
 
392 t00mlabs 382
    def setup_stack_visor_sapnotes(self):
340 t00mlabs 383
        box = Gtk.VBox()
384
        box.set_hexpand(True)
385
 
386
        ### Visor
387
        scr = Gtk.ScrolledWindow()
388
        scr.set_hexpand(True)
389
        scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
390
        scr.set_shadow_type(Gtk.ShadowType.NONE)
391
        vwp = Gtk.Viewport()
392
        vwp.set_hexpand(True)
362 t00mlabs 393
        visor_sapnotes = self.srvgui.add_widget('visor_sapnotes', SAPNotesVisor(self.controller))
394
        visor_sapnotes.set_hexpand(True)
395
        visor_sapnotes.set_vexpand(True)
396
        vwp.add(visor_sapnotes)
340 t00mlabs 397
        scr.add(vwp)
398
        box.pack_start(scr, True, True, 0)
362 t00mlabs 399
        visor_sapnotes.show_all()
340 t00mlabs 400
        box.show_all()
401
        return box
402
 
403
 
392 t00mlabs 404
    def setup_stack_visor_annotations(self):
340 t00mlabs 405
        box = Gtk.VBox()
406
        box.set_hexpand(True)
407
 
408
        ### Visor
389 t00mlabs 409
 
410
        notebook = self.srvgui.add_widget('gtk_notebook_annotations_visor', Gtk.Notebook())
411
        notebook.set_show_border(False)
412
        notebook.set_hexpand(True)
413
        notebook.set_show_tabs(False)
414
 
415
        # Visor tab
340 t00mlabs 416
        scr = Gtk.ScrolledWindow()
417
        scr.set_hexpand(True)
418
        scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
419
        scr.set_shadow_type(Gtk.ShadowType.NONE)
420
        vwp = Gtk.Viewport()
421
        vwp.set_hexpand(True)
362 t00mlabs 422
        visor_annotations = self.srvgui.add_widget('visor_annotations', AnnotationsVisor(self.controller))
423
        visor_annotations.set_hexpand(True)
424
        visor_annotations.set_vexpand(True)
425
        vwp.add(visor_annotations)
340 t00mlabs 426
        scr.add(vwp)
389 t00mlabs 427
 
428
        tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation-visor', '<b>Annotations Visor</b>')
429
        notebook.append_page(scr, tab_widget)
430
 
431
        # Annotation Widget tab
432
        annotation_widget = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
433
        tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation-widget', '<b>Annotation Widget</b>')
434
        notebook.append_page(annotation_widget, tab_widget)
435
 
436
        box.pack_start(notebook, True, True, 0)
362 t00mlabs 437
        visor_annotations.show_all()
340 t00mlabs 438
        box.show_all()
439
        return box
440
 
441
 
392 t00mlabs 442
    def setup_stack_visor_attachments(self):
353 t00mlabs 443
        box = Gtk.VBox()
444
        box.set_hexpand(True)
445
 
446
        ### Visor
447
        scr = Gtk.ScrolledWindow()
448
        scr.set_hexpand(True)
449
        scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
450
        scr.set_shadow_type(Gtk.ShadowType.NONE)
451
        vwp = Gtk.Viewport()
452
        vwp.set_hexpand(True)
362 t00mlabs 453
        visor_attachments = self.srvgui.add_widget('visor_attachments', AttachmentsVisor(self.controller))
454
        visor_attachments.set_hexpand(True)
455
        visor_attachments.set_vexpand(True)
456
        vwp.add(visor_attachments)
353 t00mlabs 457
        scr.add(vwp)
458
        box.pack_start(scr, True, True, 0)
362 t00mlabs 459
        visor_attachments.show_all()
353 t00mlabs 460
        box.show_all()
461
        return box
462
 
374 t00mlabs 463
 
392 t00mlabs 464
    def setup_main_stack_about(self):
340 t00mlabs 465
        box = Gtk.VBox()
466
        box.set_hexpand(True)
467
        about = self.srvgui.add_widget('widget_about', About(self.controller))
468
        box.pack_start(about, True, True, 0)
469
        box.show_all()
470
        return box
471
 
472
 
392 t00mlabs 473
    def setup_main_stack_settings(self):
340 t00mlabs 474
        box = Gtk.VBox()
475
        box.set_hexpand(True)
476
        settings = self.srvgui.add_widget('widget_settings', SettingsView(self.controller))
477
        box.pack_start(settings, True, True, 0)
478
        box.show_all()
479
        return box
480
 
481
 
392 t00mlabs 482
    def setup_main_stack_log(self):
340 t00mlabs 483
        box = Gtk.VBox()
484
        box.set_hexpand(True)
485
        logviewer = self.srvgui.add_widget('widget_logviewer', LogViewer(self.controller))
486
        box.pack_start(logviewer, True, True, 0)
487
        box.show_all()
488
        return box
489
 
392 t00mlabs 490
    def setup_main_stack_help(self):
389 t00mlabs 491
        box = Gtk.VBox()
492
        box.set_hexpand(True)
493
        browser = BasicoBrowser()
494
        self.log.debug(FILE['HELP_INDEX'])
495
        help_page = "file://%s" % FILE['HELP_INDEX']
496
        browser.load_url(help_page)
497
        self.log.debug("Loading help page: %s", help_page)
498
        box.pack_start(browser, True, True, 0)
499
        box.show_all()
500
        return box
340 t00mlabs 501
 
389 t00mlabs 502
 
340 t00mlabs 503
    def run(self):
504
        viewmenu = self.srvgui.get_widget('viewmenu')
390 t00mlabs 505
        stack_visors = self.srvgui.get_widget('gtk_stack_visors')
506
 
507
        stack_visors.set_visible_child_name('visor-sapnotes')
340 t00mlabs 508
        viewmenu.set_view('collection')
509
        self.srvclb.gui_viewmenu_select_first_entry()
390 t00mlabs 510