Subversion Repositories basico

Rev

Rev 286 | Rev 290 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 286 Rev 287
Line 22... Line 22...
22
from gi.repository import Gdk
22
from gi.repository import Gdk
23
from gi.repository import Gio
23
from gi.repository import Gio
24
from gi.repository import Pango
24
from gi.repository import Pango
25
from gi.repository.GdkPixbuf import Pixbuf
25
from gi.repository.GdkPixbuf import Pixbuf
26
26
27
from basico.core.mod_env import APP, FILE
-
 
-
 
27
from basico.core.mod_srv import Service
-
 
28
from basico.core.mod_env import APP, FILE, ATYPES
28
from basico.widgets.wdg_menuview import SAPNoteViewMenu
29
from basico.widgets.wdg_menuview import SAPNoteViewMenu
29
from basico.widgets.wdg_visor_sapnotes import SAPNotesVisor
30
from basico.widgets.wdg_visor_sapnotes import SAPNotesVisor
30
from basico.widgets.wdg_visor_annotations import AnnotationsVisor
31
from basico.widgets.wdg_visor_annotations import AnnotationsVisor
31
from basico.widgets.wdg_visor_toolbar import VisorToolbar
32
from basico.widgets.wdg_visor_toolbar import VisorToolbar
32
from basico.widgets.wdg_about import About
33
from basico.widgets.wdg_about import About
33
from basico.widgets.wdg_settingsview import SettingsView
34
from basico.widgets.wdg_settingsview import SettingsView
34
from basico.widgets.wdg_logviewer import LogViewer
35
from basico.widgets.wdg_logviewer import LogViewer
35
from basico.widgets.wdg_annot import AnnotationWidget
36
from basico.widgets.wdg_annot import AnnotationWidget
36
from basico.widgets.wdg_statusbar import Statusbar
37
from basico.widgets.wdg_statusbar import Statusbar
-
 
38
from basico.core.mod_log import get_logger
37
39
38
40
39
class GtkAppWindow(Gtk.ApplicationWindow):
-
 
-
 
41
class GtkAppWindow(Gtk.ApplicationWindow, Service):
40
    def __init__(self, uiapp):
42
    def __init__(self, uiapp):
41
        self.setup_controller(uiapp)
43
        self.setup_controller(uiapp)
-
 
44
        self.get_logger(__class__.__name__)
42
        self.get_services()
45
        self.get_services()
43
        self.srvgui.add_widget('uiapp', uiapp)
46
        self.srvgui.add_widget('uiapp', uiapp)
44
        self.app = self.srvgui.get_app()
47
        self.app = self.srvgui.get_app()
45
        self.setup_window(uiapp)
48
        self.setup_window(uiapp)
46
        self.setup_widgets()
49
        self.setup_widgets()
Line 292... Line 295...
292
        box.pack_start(stack_main, True, True, 0)
295
        box.pack_start(stack_main, True, True, 0)
293
296
294
        ### Visor stack
297
        ### Visor stack
295
        stack_child = self.setup_stack_visor()
298
        stack_child = self.setup_stack_visor()
296
        stack_main.add_titled(stack_child, "visor", "SAP Notes Visor")
299
        stack_main.add_titled(stack_child, "visor", "SAP Notes Visor")
297
-
 
298
        ### SAP Note Visor tab
-
 
299
        # ~ tab_sapnote_visor = self.setup_tab_sapnote_visor()
-
 
300
        # ~ stack_main.add_titled(stack_child, "visor", "SAP Notes Visor")
-
 
301
-
 
302
        ### Annotation Visor tab
-
 
303
        # ~ tab_annotation_visor = self.setup_tab_annotations_visor()
-
 
304
        # ~ stack_main.add_titled(stack_child, "visor", "SAP Notes Visor")
-
 
305
300
306
        ### About stack
301
        ### About stack
307
        stack_child = self.setup_stack_about()
302
        stack_child = self.setup_stack_about()
308
        stack_main.add_titled(stack_child, "about", "About Basico")
303
        stack_main.add_titled(stack_child, "about", "About Basico")
309
304
Line 327... Line 322...
327
        stack_annot.set_transition_duration(2500)
322
        stack_annot.set_transition_duration(2500)
328
323
329
        stack_child = self.setup_stack_annotation()
324
        stack_child = self.setup_stack_annotation()
330
        stack_annot.add_titled(stack_child, "comment", "New comment")
325
        stack_annot.add_titled(stack_child, "comment", "New comment")
331
        stack_annot.child_set_property (stack_child, "icon-name", "basico-comments")
326
        stack_annot.child_set_property (stack_child, "icon-name", "basico-comments")
332
-
 
333
        # ~ stack_child = self.setup_stack_annotation_link()
-
 
334
        # ~ stack_annot.add_titled(stack_child, "link", "New link")
-
 
335
        # ~ stack_annot.child_set_property (stack_child, "icon-name", "basico-browse")
-
 
336
327
337
        self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
328
        self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
338
        boxannotations.add(stack_annot)
329
        boxannotations.add(stack_annot)
339
330
340
331
Line 485... Line 476...
485
        hbox.pack_start(image, False, False, 3)
476
        hbox.pack_start(image, False, False, 3)
486
        hbox.pack_start(label, True, True, 3)
477
        hbox.pack_start(label, True, True, 3)
487
        menuviews.add(hbox)
478
        menuviews.add(hbox)
488
        lhbox.pack_start(menuviews, True, True, 3)
479
        lhbox.pack_start(menuviews, True, True, 3)
489
        lhbox.show_all()
480
        lhbox.show_all()
490
        # ~ tool.add(lhbox)
-
 
491
        # ~ tool.set_tooltip_markup('<b>Choose another view</b>')
-
 
492
        # ~ tool.set_expand(False)
-
 
493
        # ~ self.tool_bar.insert(tool, -1)
-
 
494
        box.pack_start(lhbox, False, False, 3)
481
        box.pack_start(lhbox, False, False, 3)
495
482
496
        ### Popover menuviews
483
        ### Popover menuviews
497
        popover = self.srvgui.add_widget('gtk_popover_button_menu_views', Gtk.Popover.new(menuviews))
484
        popover = self.srvgui.add_widget('gtk_popover_button_menu_views', Gtk.Popover.new(menuviews))
498
        menuviews.connect('clicked', self.srvclb.gui_show_popover, popover)
485
        menuviews.connect('clicked', self.srvclb.gui_show_popover, popover)
Line 571... Line 558...
571
558
572
        return box
559
        return box
573
560
574
561
575
    def setup_tab_menuview_annotations(self):
562
    def setup_tab_menuview_annotations(self):
576
        visor_annotations = self.srvgui.get_widget('visor_annotations')
-
 
577
        vbox_main = Gtk.VBox()
563
        vbox_main = Gtk.VBox()
578
        vbox_main.set_hexpand(False)
564
        vbox_main.set_hexpand(False)
579
        vbox_main.set_property('margin-top', 6)
565
        vbox_main.set_property('margin-top', 6)
580
        vbox_main.set_property('margin-left', 6)
566
        vbox_main.set_property('margin-left', 6)
581
        vbox_main.set_property('margin-right', 6)
567
        vbox_main.set_property('margin-right', 6)
582
        vbox_main.set_property('margin-bottom', 3)
568
        vbox_main.set_property('margin-bottom', 3)
583
569
584
        def create_panel_elem_button(icon, title):
570
        def create_panel_elem_button(icon, title):
585
            button = self.srvgui.add_widget('gtk_togglebutton_%s' % title, Gtk.ToggleButton())
571
            button = self.srvgui.add_widget('gtk_togglebutton_%s' % title, Gtk.ToggleButton())
586
            button.set_relief(Gtk.ReliefStyle.NONE)
572
            button.set_relief(Gtk.ReliefStyle.NONE)
587
            icon = self.srvicm.get_image_icon(icon, 24, 24)
-
 
-
 
573
            icon = self.srvicm.get_image_icon(icon, 36, 36)
588
            label = Gtk.Label('')
574
            label = Gtk.Label('')
589
            label.set_markup('<small>%s</small>' % title.capitalize())
-
 
-
 
575
            label.set_markup('%s' % title.capitalize())
590
            hbox_cat_elem = Gtk.HBox()
576
            hbox_cat_elem = Gtk.HBox()
591
            hbox_cat_elem.set_hexpand(False)
577
            hbox_cat_elem.set_hexpand(False)
592
            hbox_cat_elem.pack_start(icon, False, False, 3)
578
            hbox_cat_elem.pack_start(icon, False, False, 3)
593
            hbox_cat_elem.pack_start(label, False, False, 3)
579
            hbox_cat_elem.pack_start(label, False, False, 3)
594
            button.add(hbox_cat_elem)
580
            button.add(hbox_cat_elem)
595
581
596
            return button
582
            return button
597
583
598
        # Categories
584
        # Categories
599
        button = self.srvgui.add_widget('gtk_togglebutton_categories', Gtk.ToggleButton())
585
        button = self.srvgui.add_widget('gtk_togglebutton_categories', Gtk.ToggleButton())
600
        icon = self.srvicm.get_image_icon('basico-category', 48, 48)
-
 
-
 
586
        icon = self.srvicm.get_image_icon('basico-category', 64, 64)
601
        label = Gtk.Label('')
587
        label = Gtk.Label('')
602
        label.set_markup('<b>Categories</b>')
-
 
-
 
588
        label.set_markup('<big><b>Categories</b></big>')
603
        hbox_cat = Gtk.HBox()
589
        hbox_cat = Gtk.HBox()
604
        hbox_cat.set_hexpand(True)
590
        hbox_cat.set_hexpand(True)
605
        hbox_cat.pack_start(icon, False, False, 3)
591
        hbox_cat.pack_start(icon, False, False, 3)
606
        hbox_cat.pack_start(label, False, False, 3)
592
        hbox_cat.pack_start(label, False, False, 3)
607
        button.add(hbox_cat)
593
        button.add(hbox_cat)
Line 612... Line 598...
612
        vbox_revealer.set_hexpand(False)
598
        vbox_revealer.set_hexpand(False)
613
599
614
        for name in ['inbox', 'drafts', 'archived']:
600
        for name in ['inbox', 'drafts', 'archived']:
615
            button = create_panel_elem_button('basico-%s' % name.lower(), name)
601
            button = create_panel_elem_button('basico-%s' % name.lower(), name)
616
            self.srvgui.add_widget('gtk_button_category_%s' % name, button)
602
            self.srvgui.add_widget('gtk_button_category_%s' % name, button)
617
            # ~ button.connect('toggled', visor_annotations.set_visible_category, name)
-
 
618
            vbox_revealer.pack_start(button, False, False, 3)
603
            vbox_revealer.pack_start(button, False, False, 3)
619
604
620
        revealer.add(vbox_revealer)
605
        revealer.add(vbox_revealer)
621
        vbox_main.pack_start(revealer, False, False, 6)
606
        vbox_main.pack_start(revealer, False, False, 6)
622
607
623
        # Types
608
        # Types
624
        button = self.srvgui.add_widget('gtk_togglebutton_types', Gtk.ToggleButton())
609
        button = self.srvgui.add_widget('gtk_togglebutton_types', Gtk.ToggleButton())
625
        icon = self.srvicm.get_image_icon('basico-type', 48, 48)
-
 
-
 
610
        icon = self.srvicm.get_image_icon('basico-type', 64, 64)
626
        label = Gtk.Label('')
611
        label = Gtk.Label('')
627
        label.set_markup('<b>Types</b>')
-
 
-
 
612
        label.set_markup('<big><b>Types</b></big>')
628
        hbox_type = Gtk.HBox()
613
        hbox_type = Gtk.HBox()
629
        hbox_type.pack_start(icon, False, False, 3)
614
        hbox_type.pack_start(icon, False, False, 3)
630
        hbox_type.pack_start(label, False, False, 3)
615
        hbox_type.pack_start(label, False, False, 3)
631
        button.add(hbox_type)
616
        button.add(hbox_type)
632
        vbox_main.pack_start(button, False, False, 0)
617
        vbox_main.pack_start(button, False, False, 0)
633
618
634
        revealer = self.srvgui.add_widget('gtk_revealer_annotations_types', Gtk.Revealer())
619
        revealer = self.srvgui.add_widget('gtk_revealer_annotations_types', Gtk.Revealer())
635
        vbox_revealer = Gtk.VBox()
620
        vbox_revealer = Gtk.VBox()
636
        vbox_revealer.set_hexpand(False)
621
        vbox_revealer.set_hexpand(False)
637
622
638
        for name in ['FIXME', 'TODO', 'note', 'procedure', 'snippet', 'template', 'email', 'meeting']:
-
 
-
 
623
        for name in ATYPES:
639
            button = create_panel_elem_button('basico-annotation-type-%s' % name.lower(), name.lower())
624
            button = create_panel_elem_button('basico-annotation-type-%s' % name.lower(), name.lower())
640
            self.srvgui.add_widget('gtk_button_type_%s' % name.lower(), button)
625
            self.srvgui.add_widget('gtk_button_type_%s' % name.lower(), button)
641
            button.set_active(True)
626
            button.set_active(True)
642
            # ~ button.connect('toggled', visor_annotations.set_visible_annotation_type, name)
-
 
643
            vbox_revealer.pack_start(button, False, False, 3)
627
            vbox_revealer.pack_start(button, False, False, 3)
644
628
645
        revealer.add(vbox_revealer)
629
        revealer.add(vbox_revealer)
646
        vbox_main.pack_start(revealer, False, False, 6)
630
        vbox_main.pack_start(revealer, False, False, 6)
647
631