Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 388 → Rev 389

/branches/BR-0.4/basico/data/res/selenium/drivers/geckodriver.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/BR-0.4/basico/data/res/selenium/drivers/geckodriver.exe
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: branches/BR-0.4/basico/core/mod_win.py
===================================================================
--- branches/BR-0.4/basico/core/mod_win.py (revision 388)
+++ branches/BR-0.4/basico/core/mod_win.py (revision 389)
@@ -26,7 +26,6 @@
from basico.core.mod_srv import Service
from basico.core.mod_env import APP, FILE, ATYPES
-from basico.widgets.wdg_menuview import MenuView
from basico.widgets.wdg_visor_sapnotes import SAPNotesVisor
from basico.widgets.wdg_visor_annotations import AnnotationsVisor
from basico.widgets.wdg_visor_attachments import AttachmentsVisor
@@ -36,13 +35,14 @@
from basico.widgets.wdg_logviewer import LogViewer
from basico.widgets.wdg_annot import AnnotationWidget
from basico.widgets.wdg_statusbar import Statusbar
+from basico.widgets.wdg_browser import BasicoBrowser
from basico.core.mod_log import get_logger
-class GtkAppWindow(Gtk.ApplicationWindow, Service):
+class GtkAppWindow(Service, Gtk.ApplicationWindow):
def __init__(self, uiapp):
self.setup_controller(uiapp)
- self.get_logger(__class__.__name__)
+ # ~ self.get_logger(__class__.__name__)
self.get_services()
self.srvgui.add_widget('uiapp', uiapp)
self.app = self.srvgui.get_app()
@@ -81,7 +81,7 @@
self.set_role(APP['name'])
self.set_default_size(1024, 728)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
-
+ self.setup_headerbar()
#FIX: hack to avoid white background in widgets within a notebook tab
#FIXME: it should be managed by settings
# ~ screen = Gdk.Screen.get_default()
@@ -91,7 +91,6 @@
# ~ context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
# ~ self.maximize ()
- self.setup_headerbar()
self.show_all()
@@ -111,22 +110,22 @@
def setup_headerbar_left(self, hb):
# ~ '''Left headerbar side not used by now'''
- lhbox = Gtk.HBox()
+ lhbox = self.srvgui.add_widget('gtk_hbox_hb_left', Gtk.HBox())
### Dashboard / Visor
- hbox = Gtk.HBox()
- icon = self.srvicm.get_pixbuf_icon('basico-dashboard', 24, 24)
- image = Gtk.Image()
- image.set_from_pixbuf(icon)
- label = Gtk.Label()
- hbox.pack_start(image, False, False, 3)
- hbox.pack_start(label, False, False, 3)
- button = self.srvgui.add_widget('gtk_button_dashboard', Gtk.Button())
- button.add(hbox)
- button.set_relief(Gtk.ReliefStyle.NONE)
- lhbox.pack_start(button, False, False, 0)
- button.connect('clicked', self.srvclb.gui_show_dashboard)
+ # ~ hbox = Gtk.HBox()
+ # ~ icon = self.srvicm.get_pixbuf_icon('basico-dashboard', 24, 24)
+ # ~ image = Gtk.Image()
+ # ~ image.set_from_pixbuf(icon)
+ # ~ label = Gtk.Label()
+ # ~ hbox.pack_start(image, False, False, 3)
+ # ~ hbox.pack_start(label, False, False, 3)
+ # ~ button = self.srvgui.add_widget('gtk_button_dashboard', Gtk.Button())
+ # ~ button.add(hbox)
+ # ~ button.set_relief(Gtk.ReliefStyle.NONE)
+ # ~ button.connect('clicked', self.srvclb.gui_show_dashboard)
+
return lhbox
@@ -267,49 +266,24 @@
paned = self.srvgui.add_widget('gtk_hpaned', Gtk.HPaned())
paned.set_property('margin-bottom', 6)
paned.set_wide_handle(False)
- paned.set_position(300)
+ paned.set_position(0)
- # (Build first menuview)
- notebook_menuview = self.srvgui.add_widget('gtk_notebook_menuview', Gtk.Notebook())
- notebook_menuview.set_show_border(False)
- notebook_menuview.set_show_tabs(False)
- notebook_menuview.set_hexpand(True)
-
- # Menuview for SAP Notes
- menuview_sapnotes_page = self.setup_tab_menuview_sapnotes()
- menuview_sapnotes_page.set_hexpand(True)
- tab_widget = self.srvuif.create_notebook_tab_label('basico-sapnote', '<b>SAP Notes</b>')
- notebook_menuview.append_page(menuview_sapnotes_page, tab_widget)
-
- # Menuview for Annotations (I - Visor)
- menuview_annotation_page = self.setup_tab_menuview_annotations_visor()
- menuview_annotation_page.set_hexpand(True)
- tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation', '<b>Annotations Visor</b>')
- notebook_menuview.append_page(menuview_annotation_page, tab_widget)
-
- # Menuview for Annotations (II - Preview)
- # ~ menuview_annotation_page = self.setup_tab_menuview_annotations_preview()
- # ~ menuview_annotation_page.set_hexpand(True)
- # ~ tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation', '<b>Annotations Preview</b>')
- # ~ notebook_menuview.append_page(menuview_annotation_page, tab_widget)
-
# Paned
## left pane
- paned.add1(notebook_menuview)
- notebook_menuview.show_all()
+ paned.add1(Gtk.Box())
## Right pane
-
- # ~ vpaned = self.srvgui.add_widget('gtk_vpaned_visor', Gtk.VPaned())
- # ~ vpaned.set_property('margin-bottom', 6)
- # ~ vpaned.set_wide_handle(True)
- # ~ vpaned.set_position(0)
-
box = Gtk.VBox()
box.set_hexpand(True)
- # Main Stack (up)
+ # Main Stack (Visors / Settings / Help)
+ stack_switcher = self.srvgui.add_widget('gtk_stack_switcher_main', Gtk.StackSwitcher())
+ lhbox = self.srvgui.get_widget('gtk_hbox_hb_left')
+ lhbox.pack_start(stack_switcher, False, False, 0)
+
stack_main = self.srvgui.add_widget('gtk_stack_main', Gtk.Stack())
+ stack_switcher.set_stack(stack_main)
+ stack_switcher.set_property('icon-size', 3)
stack_main.connect('notify::visible-child', self.stack_changed)
stack_main.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
stack_main.set_transition_duration(250)
@@ -317,24 +291,33 @@
### Visor stack child
stack_child = self.setup_stack_visor()
- stack_main.add_titled(stack_child, "visor", "SAP Notes Visor")
+ stack_main.add_titled(stack_child, "dashboard", "Dashboard")
+ stack_main.child_set_property (stack_child, "icon-name", "basico-dashboard")
+ ### Settings stack child
+ stack_child = self.setup_stack_settings()
+ stack_main.add_titled(stack_child, "settings", "Basico Settings")
+ stack_main.child_set_property (stack_child, "icon-name", "basico-settings")
+
+ ### Help stack child
+ stack_child = self.setup_stack_settings()
+ stack_main.add_titled(stack_child, "help", "Basico Help")
+ stack_main.child_set_property (stack_child, "icon-name", "basico-help")
+
### About stack child
- stack_child = self.setup_stack_about()
- stack_main.add_titled(stack_child, "about", "About Basico")
+ # ~ stack_child = self.setup_stack_about()
+ # ~ stack_main.add_titled(stack_child, "about", "About Basico")
### Log stack child
- stack_child = self.setup_stack_log()
- stack_main.add_titled(stack_child, "log", "Event Viewer")
+ # ~ stack_child = self.setup_stack_log()
+ # ~ stack_main.add_titled(stack_child, "log", "Event Viewer")
- ### Settings stack child
- stack_child = self.setup_stack_settings()
- stack_main.add_titled(stack_child, "settings", "Basico Settings")
+
## Annotation widget stack child
- stack_child = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
- stack_main.add_titled(stack_child, "annotations", "Annotation widget")
+ # ~ stack_child = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
+ # ~ stack_main.add_titled(stack_child, "annotations", "Annotation widget")
paned.add2(box)
mainbox.pack_start(paned, True, True, 0)
@@ -343,15 +326,6 @@
statusbar = self.srvgui.add_widget('widget_statusbar', Statusbar(self.controller))
mainbox.pack_start(statusbar, False, False, 0)
- # Menu Views
- vbox = Gtk.VBox()
- viewsbox = self.srvgui.get_widget('gtk_box_container_views')
- viewmenu = self.srvgui.add_widget('viewmenu', MenuView(self.controller))
- viewmenu.set_hexpand(True)
- viewmenu.set_vexpand(True)
- vbox.pack_start(viewmenu, True, True, 0)
- self.srvgui.swap_widget(viewsbox, vbox)
-
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_annotations.connect_menuview_signals()
visor_annotations.set_active_categories()
@@ -369,31 +343,59 @@
visortoolbar = self.srvgui.add_widget('visortoolbar', VisorToolbar(self.controller))
self.srvgui.swap_widget(boxtoolbar, visortoolbar)
- ### Visor
- notebook = self.srvgui.add_widget('gtk_notebook_visor', Gtk.Notebook())
- signal = notebook.connect('switch-page', self.srvclb.gui_visor_switch_page)
- self.srvgui.add_signal('gtk_notebook_visor', 'switch-page', signal)
- notebook.set_show_border(False)
- notebook.set_hexpand(True)
+ ### Stack for visors
+
+ stack_switcher = self.srvgui.add_widget('gtk_stack_switcher_visors', Gtk.StackSwitcher())
+ rhbox = self.srvgui.get_widget('gtk_hbox_toolbar_stack_switcher')
+ rhbox.pack_start(stack_switcher, False, False, 0)
+
+ stack_visors = self.srvgui.add_widget('gtk_stack_visors', Gtk.Stack())
+ stack_switcher.set_stack(stack_visors)
+ stack_switcher.set_property('icon-size', 3)
+ stack_visors.connect('notify::visible-child', self.stack_changed)
+ stack_visors.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
+ stack_visors.set_transition_duration(250)
+ box.pack_start(stack_visors, True, True, 0)
+
+ #### Stack for Visor SAP Notes
+ stack_child = self.setup_tab_sapnote_visor()
+ stack_visors.add_titled(stack_child, "visor-sapnote", "SAP Notes")
+ stack_visors.child_set_property (stack_child, "icon-name", "basico-sapnote")
+
+ #### Stack for Visor Annotations
+ stack_child = self.setup_tab_annotations_visor()
+ stack_visors.add_titled(stack_child, "visor-annotations", "Annotations")
+ stack_visors.child_set_property (stack_child, "icon-name", "basico-filter")
+
+ #### Stack for Visor Annotations
+ stack_child = self.setup_tab_attachments_visor()
+ stack_visors.add_titled(stack_child, "visor-attachments", "Attachments")
+ stack_visors.child_set_property (stack_child, "icon-name", "basico-attachment")
+
+ # ~ notebook = self.srvgui.add_widget('gtk_notebook_visor', Gtk.Notebook())
+ # ~ signal = notebook.connect('switch-page', self.srvclb.gui_visor_switch_page)
+ # ~ self.srvgui.add_signal('gtk_notebook_visor', 'switch-page', signal)
+ # ~ notebook.set_show_border(False)
+ # ~ notebook.set_hexpand(True)
# ~ notebook.set_show_tabs(False)
# Notebook tab for SAP Notes Visor
- visor_sapnotes_page = self.setup_tab_sapnote_visor()
- visor_sapnotes_page.set_hexpand(True)
- tab_widget = self.srvuif.create_notebook_tab_label('basico-sapnote', '<b>SAP Notes</b>')
- notebook.append_page(visor_sapnotes_page, tab_widget)
+ # ~ visor_sapnotes_page = self.setup_tab_sapnote_visor()
+ # ~ visor_sapnotes_page.set_hexpand(True)
+ # ~ tab_widget = self.srvuif.create_notebook_tab_label('basico-sapnote', '<b>SAP Notes</b>')
+ # ~ notebook.append_page(visor_sapnotes_page, tab_widget)
# Notebook tab for SAP Notes Visor
- visor_annotations_page = self.setup_tab_annotations_visor()
- visor_annotations_page.set_hexpand(True)
- tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation', '<b>Annotations</b>')
- notebook.append_page(visor_annotations_page, tab_widget)
+ # ~ visor_annotations_page = self.setup_tab_annotations_visor()
+ # ~ visor_annotations_page.set_hexpand(True)
+ # ~ tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation', '<b>Annotations</b>')
+ # ~ notebook.append_page(visor_annotations_page, tab_widget)
# Notebook tab for Attachments Visor
- visor_attachments_page = self.setup_tab_attachments_visor()
- visor_attachments_page.set_hexpand(True)
- tab_widget = self.srvuif.create_notebook_tab_label('basico-attachment', '<b>Attachments</b>')
- notebook.append_page(visor_attachments_page, tab_widget)
+ # ~ visor_attachments_page = self.setup_tab_attachments_visor()
+ # ~ visor_attachments_page.set_hexpand(True)
+ # ~ tab_widget = self.srvuif.create_notebook_tab_label('basico-attachment', '<b>Attachments</b>')
+ # ~ notebook.append_page(visor_attachments_page, tab_widget)
# ~ # Notebook tab for Webbookmarks Visor
# ~ visor_annotations_page = self.setup_tab_annotations_visor()
@@ -411,14 +413,14 @@
# ~ notebook.child_set_property(visor_help_page, "tab-fill", False)
- notebook.child_set_property(visor_sapnotes_page, "tab-expand", True)
- notebook.child_set_property(visor_sapnotes_page, "tab-fill", False)
- notebook.child_set_property(visor_annotations_page, "tab-expand", True)
- notebook.child_set_property(visor_annotations_page, "tab-fill", False)
- notebook.child_set_property(visor_attachments_page, "tab-expand", True)
- notebook.child_set_property(visor_attachments_page, "tab-fill", False)
+ # ~ notebook.child_set_property(visor_sapnotes_page, "tab-expand", True)
+ # ~ notebook.child_set_property(visor_sapnotes_page, "tab-fill", False)
+ # ~ notebook.child_set_property(visor_annotations_page, "tab-expand", True)
+ # ~ notebook.child_set_property(visor_annotations_page, "tab-fill", False)
+ # ~ notebook.child_set_property(visor_attachments_page, "tab-expand", True)
+ # ~ notebook.child_set_property(visor_attachments_page, "tab-fill", False)
- box.pack_start(notebook, True, True, 0)
+ # ~ box.pack_start(notebook, True, True, 0)
return box
@@ -463,6 +465,15 @@
box.set_hexpand(True)
### Visor
+
+ notebook = self.srvgui.add_widget('gtk_notebook_annotations_visor', Gtk.Notebook())
+ # ~ signal = notebook.connect('switch-page', self.srvclb.gui_visor_annotations_switch_page)
+ # ~ self.srvgui.add_signal('gtk_notebook_visor', 'switch-page', signal)
+ notebook.set_show_border(False)
+ notebook.set_hexpand(True)
+ notebook.set_show_tabs(False)
+
+ # Visor tab
scr = Gtk.ScrolledWindow()
scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
@@ -474,7 +485,19 @@
visor_annotations.set_vexpand(True)
vwp.add(visor_annotations)
scr.add(vwp)
- box.pack_start(scr, True, True, 0)
+
+ tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation-visor', '<b>Annotations Visor</b>')
+ notebook.append_page(scr, tab_widget)
+
+ # Annotation Widget tab
+ annotation_widget = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
+ tab_widget = self.srvuif.create_notebook_tab_label('basico-annotation-widget', '<b>Annotation Widget</b>')
+ notebook.append_page(annotation_widget, tab_widget)
+
+ box.pack_start(notebook, True, True, 0)
+
+ # Annotation Widget tab
+
visor_annotations.show_all()
box.show_all()
return box
@@ -502,207 +525,6 @@
return box
- def setup_tab_menuview_sapnotes(self):
- ## Left view - SAP Notes Menu view
- box = self.srvgui.add_widget('gtk_vbox_container_menu_view', Gtk.VBox())
- box.set_property('margin-left', 0)
- box.set_property('margin-right', 0)
- box.set_property('margin-bottom', 0)
-
- # View combobox button/popover
- lhbox = Gtk.HBox()
- menuviews = self.srvgui.add_widget('gtk_button_menu_views', Gtk.Button())
- menuviews.set_relief(Gtk.ReliefStyle.NONE)
- hbox = Gtk.HBox()
- label = self.srvgui.add_widget('gtk_label_current_view', Gtk.Label())
- label.set_xalign(0.0)
- image = self.srvgui.add_widget('gtk_image_current_view', Gtk.Image())
- hbox.pack_start(image, False, False, 3)
- hbox.pack_start(label, True, True, 3)
- menuviews.add(hbox)
- lhbox.pack_start(menuviews, True, True, 3)
- lhbox.show_all()
- box.pack_start(lhbox, False, False, 3)
-
- ### Popover menuviews
- popover = self.srvgui.add_widget('gtk_popover_button_menu_views', Gtk.Popover.new(menuviews))
- menuviews.connect('clicked', self.srvclb.gui_show_popover, popover)
- box_views = Gtk.Box(spacing = 0, orientation="vertical")
- popover.add(box_views)
-
- box_views.pack_start(self.srvuif.create_menuview_button('collection'), False, False, 0)
- separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
- box_views.pack_start(separator, False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('component'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('description'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('bookmarks'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('category'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('chronologic'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('priority'), False, False, 0)
- box_views.pack_start(self.srvuif.create_menuview_button('type'), False, False, 0)
-
- ### Toolbar
- toolbar = Gtk.Toolbar()
- toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
-
- #### Filter entry tool
- tool = Gtk.ToolItem.new()
-
- hbox = Gtk.HBox()
- viewfilter = self.srvgui.add_widget('gtk_entry_filter_view', Gtk.Entry())
- completion = self.srvgui.get_widget('gtk_entrycompletion_viewmenu')
- viewfilter.set_completion(completion)
- viewfilter.connect('activate', self.srvclb.gui_viewmenu_filter)
-
- icon = self.srvicm.get_pixbuf_icon('basico-refresh')
- viewfilter.set_icon_from_pixbuf(Gtk.EntryIconPosition.PRIMARY, icon)
- viewfilter.set_icon_sensitive(Gtk.EntryIconPosition.PRIMARY, True)
- viewfilter.set_icon_tooltip_markup (Gtk.EntryIconPosition.PRIMARY, "Refresh and collapse")
-
- icon = self.srvicm.get_pixbuf_icon('basico-filter')
- viewfilter.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, icon)
- viewfilter.set_icon_sensitive(Gtk.EntryIconPosition.SECONDARY, True)
- viewfilter.set_icon_tooltip_markup (Gtk.EntryIconPosition.SECONDARY, "Click here to expand the tree")
- viewfilter.set_placeholder_text("Filter this view...")
-
- def on_icon_pressed(entry, icon_pos, event):
- if icon_pos == Gtk.EntryIconPosition.PRIMARY:
- viewmenu = self.srvgui.get_widget('viewmenu')
- viewmenu.refresh()
- elif icon_pos == Gtk.EntryIconPosition.SECONDARY:
- self.srvclb.expand_menuview()
-
- viewfilter.connect("icon-press", on_icon_pressed)
-
- hbox.pack_start(viewfilter, True, True, 0)
- tool.add(hbox)
- tool.set_expand(True)
- toolbar.insert(tool, -1)
-
- box.pack_start(toolbar, False, False, 0)
-
- ### View treeview
- box_trv = Gtk.VBox()
- box_trv.set_property('margin-left', 3)
- box_trv.set_property('margin-right', 3)
- box_trv.set_property('margin-bottom', 0)
- scr = Gtk.ScrolledWindow()
- scr.set_hexpand(True)
- scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
- scr.set_shadow_type(Gtk.ShadowType.IN)
- vwp = Gtk.Viewport()
- vwp.set_hexpand(True)
- viewsbox = self.srvgui.add_widget('gtk_box_container_views', Gtk.Box())
- viewsbox.set_hexpand(True)
- vwp.add(viewsbox)
- scr.add(vwp)
- box_trv.pack_start(scr, True, True, 0)
-
- box.pack_start(box_trv, True, True, 0)
-
- return box
-
-
- def setup_tab_menuview_annotations_visor(self):
- vbox_main = Gtk.VBox()
- vbox_main.set_hexpand(False)
- vbox_main.set_property('margin-top', 6)
- vbox_main.set_property('margin-left', 6)
- vbox_main.set_property('margin-right', 6)
- vbox_main.set_property('margin-bottom', 3)
-
-
- def create_panel_elem_button(icon, title):
- button = self.srvgui.add_widget('gtk_togglebutton_%s' % title, Gtk.ToggleButton())
- button.set_relief(Gtk.ReliefStyle.NONE)
- icon = self.srvicm.get_image_icon(icon, 36, 36)
- label = Gtk.Label('')
- label.set_markup('%s' % title.capitalize())
- hbox_cat_elem = Gtk.HBox()
- hbox_cat_elem.set_hexpand(False)
- hbox_cat_elem.pack_start(icon, False, False, 3)
- hbox_cat_elem.pack_start(label, False, False, 3)
- button.add(hbox_cat_elem)
-
- return button
-
- hbox_main = Gtk.HBox()
- hbox_main.set_homogeneous(True)
- vbox_main.pack_start(hbox_main, False, False, 0)
-
- separator = Gtk.Separator()
- vbox_main.pack_start(separator, False, False, 6)
-
- # Categories
- button = self.srvgui.add_widget('gtk_togglebutton_categories', Gtk.ToggleButton())
- button.set_relief(Gtk.ReliefStyle.NONE)
- icon = self.srvicm.get_image_icon('basico-category', 48, 48)
- label = Gtk.Label('')
- label.set_markup('<big><b>Categories</b></big>')
- hbox_cat = Gtk.HBox()
- hbox_cat.set_hexpand(True)
- hbox_cat.pack_start(icon, False, False, 3)
- hbox_cat.pack_start(label, False, False, 3)
- button.add(hbox_cat)
- hbox_main.pack_start(button, True, True, 6)
-
- revealer = self.srvgui.add_widget('gtk_revealer_annotations_categories', Gtk.Revealer())
- vbox_revealer = Gtk.VBox()
- vbox_revealer.set_hexpand(False)
-
- for name in ['inbox', 'drafts', 'archived']:
- button = create_panel_elem_button('basico-%s' % name.lower(), name)
- self.srvgui.add_widget('gtk_button_category_%s' % name, button)
- vbox_revealer.pack_start(button, False, False, 2)
-
- revealer.add(vbox_revealer)
- vbox_main.pack_start(revealer, False, False, 6)
-
- # Types
- button = self.srvgui.add_widget('gtk_togglebutton_types', Gtk.ToggleButton())
- button.set_relief(Gtk.ReliefStyle.NONE)
- icon = self.srvicm.get_image_icon('basico-type', 48, 48)
- label = Gtk.Label('')
- label.set_markup('<big><b>Types</b></big>')
- hbox_type = Gtk.HBox()
- hbox_type.set_hexpand(True)
-
- hbox_type.pack_start(icon, False, False, 3)
- hbox_type.pack_start(label, False, False, 3)
- button.add(hbox_type)
- hbox_main.pack_start(button, True, True, 0)
-
- revealer = self.srvgui.add_widget('gtk_revealer_annotations_types', Gtk.Revealer())
- vbox_revealer = Gtk.VBox()
- vbox_revealer.set_hexpand(False)
-
- hbox_sel = Gtk.HBox()
- switch = Gtk.Switch()
- switch.set_active(True)
- switch.set_state(True)
- switch.connect('state-set', self.srvclb.gui_switch_selection_atypes)
- label_select = Gtk.Label()
- label_select.set_markup("<b>All selected</b>")
- label = self.srvgui.add_widget('gtk_label_switch_select_atypes', label_select)
- hbox_sel.pack_start(label, False, False, 6)
- hbox_sel.pack_start(switch, False, False, 6)
- vbox_revealer.pack_start(hbox_sel, False, False, 6)
-
- for name in ATYPES:
- button = create_panel_elem_button('basico-annotation-type-%s' % name.lower(), name.lower())
- self.srvgui.add_widget('gtk_button_type_%s' % name.lower(), button)
- button.set_active(True)
- vbox_revealer.pack_start(button, False, False, 2)
-
- revealer.add(vbox_revealer)
- vbox_main.pack_start(revealer, False, False, 6)
-
- # ~ separator = Gtk.Separator()
- # ~ vbox_main.pack_start(separator, False, False, 6)
-
- return vbox_main
-
-
def setup_tab_menuview_annotations_preview(self):
vbox_main = Gtk.VBox()
return vbox_main
@@ -734,7 +556,19 @@
box.show_all()
return box
+ def setup_stack_help(self):
+ box = Gtk.VBox()
+ box.set_hexpand(True)
+ browser = BasicoBrowser()
+ self.log.debug(FILE['HELP_INDEX'])
+ help_page = "file://%s" % FILE['HELP_INDEX']
+ browser.load_url(help_page)
+ self.log.debug("Loading help page: %s", help_page)
+ box.pack_start(browser, True, True, 0)
+ box.show_all()
+ return box
+
def stack_changed(self, stack, gparam):
try:
pos = self.srvgui.get_key_value('current_paned_position')
@@ -746,10 +580,6 @@
# ~ self.set_visible_stack(visible_stack_name)
def run(self):
- # ~ visor_annotations = self.srvgui.get_widget('visor_annotations')
viewmenu = self.srvgui.get_widget('viewmenu')
viewmenu.set_view('collection')
- # ~ self.srvclb.gui_show_visor_annotations()
- # ~ annotations = self.srvant.search_term('')
- # ~ visor_annotations.populate(annotations)
self.srvclb.gui_viewmenu_select_first_entry()
/branches/BR-0.4/basico/services/srv_annotations.py
162,8 → 162,8
 
 
def get_metadata_from_aid(self, aid=None):
if aid is not None:
ANNOTATION_FILE_METADATA = LPATH['ANNOTATIONS'] + aid + '.json'
ANNOTATION_FILE_METADATA = LPATH['ANNOTATIONS'] + aid + '.json'
if os.path.exists(ANNOTATION_FILE_METADATA):
with open(ANNOTATION_FILE_METADATA, 'r') as fa:
annotation = json.load(fa)
return annotation
182,7 → 182,9
 
def get_metadata_value(self, aid, key):
metadata = self.get_metadata_from_aid(aid)
return metadata[key]
if metadata is not None:
return metadata[key]
return None
 
 
def is_valid(self, aid):
/branches/BR-0.4/basico/services/srv_callbacks.py
21,18 → 21,10
from basico.core.mod_srv import Service
from basico.core.mod_env import FILE, LPATH, ATYPES, APP
from basico.widgets.wdg_visor_sapnotes import SAPNotesVisor
from basico.widgets.wdg_visor_toolbar import VisorToolbar
from basico.widgets.wdg_cols import CollectionsMgtView
from basico.widgets.wdg_settingsview import SettingsView
 
# PROPKEYS = CSV headers. SAP Note metadata
PROPKEYS = ['id', 'title', 'type', 'componentkey',
'componenttxt', 'category', 'priority', 'releasedon',
'language', 'version']
 
# Extend PROPKEYS with custom basico metadata
PROPKEYS.extend (['Bookmark'])
 
class Callback(Service):
def initialize(self):
self.get_services()
54,31 → 46,31
def gui_visor_switch_page(self, notebook, page, page_num):
# 0|1|(2) -> SAP Notes Visor | Annotations Visor | (Help)
self.srvgui.set_key_value('current_visor_tab', page_num)
notebook_viewmenu = self.srvgui.get_widget('gtk_notebook_menuview')
paned = self.srvgui.get_widget('gtk_hpaned')
# ~ notebook_viewmenu = self.srvgui.get_widget('gtk_notebook_menuview')
# ~ paned = self.srvgui.get_widget('gtk_hpaned')
self.log.debug("Visor page switched to: %d", page_num)
 
if page_num == 0:
self.srvuif.set_widget_visibility('gtk_button_menu_views', True)
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', True)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
visible_filter = visor_sapnotes.get_visible_filter()
visor_sapnotes.update_total_sapnotes_count()
paned.set_position(400)
notebook_viewmenu.set_current_page(0)
# ~ paned.set_position(400)
# ~ notebook_viewmenu.set_current_page(0)
elif page_num == 1:
self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_annotations.populate()
paned.set_position(400)
notebook_viewmenu.set_current_page(1)
# ~ paned.set_position(400)
# ~ notebook_viewmenu.set_current_page(1)
else:
self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
# ~ self.srvuif.set_widget_visibility('gtk_button_menu_views', False)
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
visor_attachments = self.srvgui.get_widget('visor_attachments')
visor_attachments.populate()
paned.set_position(0)
# ~ paned.set_position(0)
# ~ notebook_viewmenu.set_current_page(2)
 
def gui_show_visor_sapnotes(self):
276,34 → 268,24
 
 
def gui_show_about(self, *args):
notebook_menuview = self.srvgui.get_widget('gtk_notebook_menuview')
about = self.srvgui.get_widget('widget_about')
stack = self.srvgui.get_widget('gtk_stack_main')
 
stack.set_visible_child_name('about')
self.gui_hide_popover(self.srvgui.get_widget('gtk_popover_button_menu_system'))
self.srvuif.set_widget_visibility('gtk_label_total_notes', False)
self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
# ~ self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
self.srvuif.grab_focus()
 
notebook_menuview.hide()
self.gui_annotation_widget_hide()
about.grab_focus()
 
 
def gui_show_log(self, *args):
notebook_menuview = self.srvgui.get_widget('gtk_notebook_menuview')
logviewer = self.srvgui.get_widget('widget_logviewer')
stack = self.srvgui.get_widget('gtk_stack_main')
 
logviewer.update()
self.gui_hide_popover(self.srvgui.get_widget('gtk_popover_button_menu_system'))
stack.set_visible_child_name('log')
self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
 
notebook_menuview.hide()
self.gui_annotation_widget_hide()
logviewer.grab_focus()
# ~ self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
self.srvuif.statusbar_msg("Displaying application log")
self.srvuif.grab_focus()
 
 
def gui_show_settings(self, button):
310,15 → 292,13
notebook_menuview = self.srvgui.get_widget('gtk_notebook_menuview')
stack = self.srvgui.get_widget('gtk_stack_main')
view_settings = self.srvgui.get_widget('widget_settings')
 
stack.set_visible_child_name('settings')
view_settings.update()
self.gui_hide_popover(self.srvgui.get_widget('gtk_popover_button_menu_system'))
self.srvuif.set_widget_visibility('gtk_label_total_notes', False)
self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
# ~ self.srvuif.set_widget_visibility('gtk_button_dashboard', True)
 
notebook_menuview.hide()
self.gui_annotation_widget_hide()
view_settings.grab_focus()
self.srvuif.statusbar_msg("Displaying application settings")
 
325,14 → 305,14
 
def gui_show_dashboard(self, *args):
stack = self.srvgui.get_widget('gtk_stack_main')
notebook_menuview = self.srvgui.get_widget('gtk_notebook_menuview')
# ~ notebook_menuview = self.srvgui.get_widget('gtk_notebook_menuview')
viewmenu = self.srvgui.get_widget('viewmenu')
current_view = viewmenu.get_view()
 
notebook_menuview.show_all()
stack.set_visible_child_name('visor')
# ~ notebook_menuview.show_all()
stack.set_visible_child_name('dashboard')
self.gui_hide_popover(self.srvgui.get_widget('gtk_popover_button_menu_system'))
self.srvuif.set_widget_visibility('gtk_button_dashboard', False)
# ~ self.srvuif.set_widget_visibility('gtk_button_dashboard', False)
 
if current_view == 'annotation':
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
359,15 → 339,18
 
 
def gui_annotation_widget_show(self, aid, action='create'):
notebook = self.srvgui.get_widget('gtk_notebook_annotations_visor')
widget_annotation = self.srvgui.get_widget('widget_annotation')
# ~ stack_annotation = self.srvgui.get_widget('stack_annotation')
stack_main = self.srvgui.get_widget('gtk_stack_main')
widget = self.srvgui.get_widget('gtk_label_timestamp_created')
# ~ vpaned = self.srvgui.get_widget('gtk_vpaned_visor')
# ~ vpaned.set_position(0)
stack_visors = self.srvgui.get_widget('gtk_stack_visors')
 
stack_visors.set_visible_child_name("visor-annotations")
notebook.set_current_page(1)
self.srvuif.set_widget_visibility('visortoolbar', False)
 
if action == 'create':
self.gui_annotation_widget_clear()
widget_annotation.clear()
if aid == '':
aid = self.srvant.gen_aid()
else:
382,7 → 365,7
self.log.debug("Action: %s annotation with Id: %s", action, aid)
 
widget_annotation.set_metadata_to_widget(aid, action)
stack_main.set_visible_child_name('annotations')
# ~ stack_main.set_visible_child_name('annotations')
 
self.srvuif.grab_focus()
 
659,6 → 642,8
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
viewmenu = self.srvgui.get_widget('viewmenu')
notebook = self.srvgui.get_widget('gtk_notebook_annotations_visor')
notebook.set_current_page(0)
 
aid = widget_annotation.get_aid_from_widget()
annotation = widget_annotation.get_metadata_from_widget()
673,19 → 658,22
self.srvuif.statusbar_msg('New annotation created: %s' % title, True)
visor_annotations.populate()
visor_sapnotes.populate()
self.gui_annotation_widget_clear()
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
widget_annotation.clear()
self.srvuif.set_widget_visibility('visortoolbar', True)
self.srvuif.grab_focus()
 
 
def action_annotation_cancel(self, *args):
statusbar = self.srvgui.get_widget('widget_statusbar')
self.gui_annotation_widget_clear()
page = self.srvgui.get_key_value('current_visor_tab')
notebook = self.srvgui.get_widget('gtk_notebook_visor')
notebook.set_current_page(page)
# ~ paned = self.srvgui.get_widget('gtk_hpaned')
# ~ paned.set_position(300)
widget_annotation = self.srvgui.get_widget('widget_annotation')
notebook = self.srvgui.get_widget('gtk_notebook_annotations_visor')
notebook.set_current_page(0)
 
widget_annotation.clear()
self.srvuif.set_widget_visibility('visortoolbar', True)
# ~ page = self.srvgui.get_key_value('current_visor_tab')
# ~ notebook = self.srvgui.get_widget('gtk_notebook_visor')
# ~ notebook.set_current_page(page)
self.log.debug('Annotation canceled')
self.srvuif.statusbar_msg("Annotation canceled")
self.gui_show_dashboard()
813,32 → 801,6
self.srvuif.statusbar_msg(msg, True)
 
 
def gui_annotation_widget_clear(self):
a_wdg_timestamp = self.srvgui.get_widget('gtk_label_human_timestamp')
a_wdg_timestamp_created = self.srvgui.get_widget('gtk_label_timestamp_created')
a_wdg_title = self.srvgui.get_widget('gtk_entry_annotation_title')
a_wdg_type = self.srvgui.get_widget('gtk_combobox_annotation_type')
a_wdg_text = self.srvgui.get_widget('gtk_textview_annotation_text')
a_wdg_link = self.srvgui.get_widget('gtk_entry_annotation_link')
a_wdg_link_button = self.srvgui.get_widget('gtk_link_button_annotation_link')
a_wdg_link_type = self.srvgui.get_widget('gtk_combobox_annotation_link_type')
 
a_wdg_timestamp.set_text('')
a_wdg_timestamp_created.set_text('')
a_wdg_title.set_text('')
textbuffer = a_wdg_text.get_buffer()
textbuffer.set_text('')
a_wdg_link.set_text('')
a_wdg_link_button.set_uri('')
self.gui_annotation_widget_hide()
 
 
def gui_annotation_widget_hide(self):
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
self.log.debug("Fix gui_annotation_widget_hide callback!")
 
 
 
def gui_annotation_previous_row(self, *args):
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_annotations.row_previous()
/branches/BR-0.4/basico/services/srv_uif.py
217,9 → 217,12
 
 
def get_combobox_text(self, combobox, col):
treeiter = combobox.get_active_iter()
model = combobox.get_model()
return model[treeiter][col]
try:
treeiter = combobox.get_active_iter()
model = combobox.get_model()
return model[treeiter][col]
except:
return ''
 
 
def set_combobox_active(self, combobox, value):
/branches/BR-0.4/basico/widgets/wdg_annot.py
135,12 → 135,6
tool = Gtk.ToolItem()
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
 
scope_model = Gtk.ListStore(str)
scope = Gtk.ComboBox.new_with_model_and_entry(scope_model)
self.srvgui.add_widget('gtk_combobox_annotation_scope', scope)
scope.set_entry_text_column(0)
scope.set_wrap_width(4)
 
completion = Gtk.EntryCompletion()
completion.set_match_func(self.completion_match_func)
completion_model = Gtk.ListStore(str)
148,19 → 142,18
completion.set_text_column(0)
completion.set_inline_completion(True)
completion.set_inline_selection(True)
entry = scope.get_child()
entry.set_completion(completion)
entry.connect('activate', self.scope_activated)
scope = self.srvgui.add_widget('gtk_entry_annotation_scope', Gtk.Entry())
scope.set_completion(completion)
scope.connect('activate', self.scope_activated)
 
max_width = 0
for title in self.srvclt.get_collections_name():
if len(title) > max_width:
max_width = len(title)
scope_model.append([title])
completion_model.append([title])
 
entry.set_width_chars(max_width)
entry.set_placeholder_text('Scope')
scope.set_width_chars(max_width)
scope.set_placeholder_text('Scope')
 
vbox.pack_start(scope, True, True, 0)
tool.add(vbox)
561,7 → 554,7
a_wdg_type = self.srvgui.get_widget('gtk_combobox_annotation_type')
a_wdg_category = self.srvgui.get_widget('gtk_combobox_annotation_category')
a_wdg_priority = self.srvgui.get_widget('gtk_combobox_annotation_priority')
a_wdg_scope = self.srvgui.add_widget('gtk_combobox_annotation_scope')
a_wdg_scope = self.srvgui.get_widget('gtk_entry_annotation_scope')
a_wdg_human_timestamp = self.srvgui.get_widget('gtk_label_human_timestamp')
a_wdg_timestamp_created = self.srvgui.get_widget('gtk_label_timestamp_created')
a_wdg_text = self.srvgui.get_widget('gtk_textview_annotation_text')
585,8 → 578,11
except:
a_wdg_priority.set_active_iter(self.srvgui.get_widget('annotation_priority_Normal'))
 
try:
a_wdg_scope.set_text(annotation['Scope'])
except:
a_wdg_scope.set_text('')
 
 
self.srvuif.set_textview_text(a_wdg_text, open(ANNOTATION_FILE_CONTENT).read())
a_wdg_link.set_text(annotation['Link'])
a_wdg_link_button.set_uri(annotation['Link'])
610,7 → 606,7
a_wdg_type = self.srvgui.get_widget('gtk_combobox_annotation_type')
a_wdg_category = self.srvgui.get_widget('gtk_combobox_annotation_category')
a_wdg_priority = self.srvgui.get_widget('gtk_combobox_annotation_priority')
a_wdg_scope = self.srvgui.add_widget('gtk_combobox_annotation_scope')
a_wdg_scope = self.srvgui.get_widget('gtk_entry_annotation_scope')
a_wdg_text = self.srvgui.get_widget('gtk_textview_annotation_text')
a_wdg_link = self.srvgui.get_widget('gtk_entry_annotation_link')
a_wdg_link_type = self.srvgui.get_widget('gtk_combobox_annotation_link_type')
623,7 → 619,7
annotation['Type'] = self.srvuif.get_combobox_text(a_wdg_type, 1)
annotation['Category'] = self.srvuif.get_combobox_text(a_wdg_category, 1)
annotation['Priority'] = self.srvuif.get_combobox_text(a_wdg_priority, 1)
annotation['Scope'] = self.srvuif.get_combobox_text(a_wdg_scope, 0)
annotation['Scope'] = a_wdg_scope.get_text()
annotation['Content'] = self.srvuif.get_textview_text(a_wdg_text)
annotation['Link'] = a_wdg_link.get_text()
annotation['LinkType'] = self.srvuif.get_combobox_text(a_wdg_link_type, 0)
631,6 → 627,27
return annotation
 
 
def clear(self):
a_wdg_timestamp = self.srvgui.get_widget('gtk_label_human_timestamp')
a_wdg_timestamp_created = self.srvgui.get_widget('gtk_label_timestamp_created')
a_wdg_title = self.srvgui.get_widget('gtk_entry_annotation_title')
a_wdg_type = self.srvgui.get_widget('gtk_combobox_annotation_type')
a_wdg_text = self.srvgui.get_widget('gtk_textview_annotation_text')
a_wdg_link = self.srvgui.get_widget('gtk_entry_annotation_link')
a_wdg_link_button = self.srvgui.get_widget('gtk_link_button_annotation_link')
a_wdg_link_type = self.srvgui.get_widget('gtk_combobox_annotation_link_type')
a_wdg_scope = self.srvgui.get_widget('gtk_entry_annotation_scope')
 
a_wdg_timestamp.set_text('')
a_wdg_timestamp_created.set_text('')
a_wdg_title.set_text('')
a_wdg_scope.set_text('')
textbuffer = a_wdg_text.get_buffer()
textbuffer.set_text('')
a_wdg_link.set_text('')
a_wdg_link_button.set_uri('')
 
 
def stack_changed(self, stack, gparam):
paned = self.srvgui.get_widget('gtk_hpaned')
pos = paned.get_position()
648,6 → 665,9
return
 
atype = self.srvant.get_metadata_value(aid, 'Type')
if atype is None:
return
 
browser = self.srvgui.get_widget('annotation_browser')
# ~ self.log.debug("Execute asciidoc for current annotation: %s", self.sid)
try:
/branches/BR-0.4/basico/widgets/wdg_browser.py
14,17 → 14,17
gi.require_version('WebKit2', '4.0')
from gi.repository import WebKit2 as WebKit
WEBKIT_RELEASE = 4
 
except:
gi.require_version('WebKit', '3.0')
from gi.repository import WebKit
WEBKIT_RELEASE = 3
 
from gi.repository import Gtk
 
 
from basico.core.mod_wdg import BasicoWidget
 
class BasicoBrowser(BasicoWidget, Gtk.VBox):
def __init__(self, app):
# ~ def __init__(self, *args, **kwargs):
36,12 → 36,14
self.log.debug("Using WebKit2 (4.0)")
else:
self.log.debug("Using WebKit (3.0)")
 
# ~ session = WebKit.get_default_session()
# ~ session.set_property("ssl-use-system-ca-file", True)
self.webview = WebKit.WebView()
 
settings = self.webview.get_settings()
if WEBKIT_RELEASE == 3:
 
settings.set_property('enable-developer-extras', False)
settings.set_property('enable-default-context-menu', True)
settings.set_property('default-encoding', 'utf-8')
/branches/BR-0.4/basico/widgets/wdg_menuview.py
248,7 → 248,7
def row_changed(self, selection):
if self.current_status is None:
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
self.srvclb.gui_show_visor_sapnotes()
self.log.warning("gui_show_visor_sapnotes!!!")
 
try:
model, treeiter = selection.get_selected()
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
36,7 → 36,7
self.set_homogeneous(False)
self.bag = []
self.get_services()
self.setup_left_panel()
self.setup_panel()
self.set_initial_panel_button_status()
self.setup_visor()
self.icons = {}
81,10 → 81,108
self.sorted_model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
 
 
def setup_left_panel(self):
pass
def setup_panel(self):
vbox_main = Gtk.VBox()
self.pack_start(vbox_main, False, False, 3)
separator = Gtk.Separator(orientation = Gtk.Orientation.VERTICAL)
self.pack_start(separator, False, False, 3)
vbox_main.set_hexpand(False)
vbox_main.set_property('margin-top', 6)
vbox_main.set_property('margin-left', 6)
vbox_main.set_property('margin-right', 6)
vbox_main.set_property('margin-bottom', 3)
 
 
def create_panel_elem_button(icon, title):
button = self.srvgui.add_widget('gtk_togglebutton_%s' % title, Gtk.ToggleButton())
button.set_relief(Gtk.ReliefStyle.NONE)
icon = self.srvicm.get_image_icon(icon, 36, 36)
label = Gtk.Label('')
label.set_markup('%s' % title.capitalize())
hbox_cat_elem = Gtk.HBox()
hbox_cat_elem.set_hexpand(False)
hbox_cat_elem.pack_start(icon, False, False, 3)
hbox_cat_elem.pack_start(label, False, False, 3)
button.add(hbox_cat_elem)
 
return button
 
hbox_main = Gtk.HBox()
hbox_main.set_homogeneous(True)
vbox_main.pack_start(hbox_main, False, False, 0)
 
separator = Gtk.Separator()
vbox_main.pack_start(separator, False, False, 6)
 
# Categories
button = self.srvgui.add_widget('gtk_togglebutton_categories', Gtk.ToggleButton())
button.set_relief(Gtk.ReliefStyle.NONE)
icon = self.srvicm.get_image_icon('basico-category', 48, 48)
label = Gtk.Label('')
label.set_markup('<big><b>Categories</b></big>')
hbox_cat = Gtk.HBox()
hbox_cat.set_hexpand(True)
hbox_cat.pack_start(icon, False, False, 3)
hbox_cat.pack_start(label, False, False, 3)
button.add(hbox_cat)
hbox_main.pack_start(button, True, True, 6)
 
revealer = self.srvgui.add_widget('gtk_revealer_annotations_categories', Gtk.Revealer())
vbox_revealer = Gtk.VBox()
vbox_revealer.set_hexpand(False)
 
for name in ['inbox', 'drafts', 'archived']:
button = create_panel_elem_button('basico-%s' % name.lower(), name)
self.srvgui.add_widget('gtk_button_category_%s' % name, button)
vbox_revealer.pack_start(button, False, False, 2)
 
revealer.add(vbox_revealer)
vbox_main.pack_start(revealer, False, False, 6)
 
# Types
button = self.srvgui.add_widget('gtk_togglebutton_types', Gtk.ToggleButton())
button.set_relief(Gtk.ReliefStyle.NONE)
icon = self.srvicm.get_image_icon('basico-type', 48, 48)
label = Gtk.Label('')
label.set_markup('<big><b>Types</b></big>')
hbox_type = Gtk.HBox()
hbox_type.set_hexpand(True)
 
hbox_type.pack_start(icon, False, False, 3)
hbox_type.pack_start(label, False, False, 3)
button.add(hbox_type)
hbox_main.pack_start(button, True, True, 0)
 
revealer = self.srvgui.add_widget('gtk_revealer_annotations_types', Gtk.Revealer())
vbox_revealer = Gtk.VBox()
vbox_revealer.set_hexpand(False)
 
hbox_sel = Gtk.HBox()
switch = Gtk.Switch()
switch.set_active(True)
switch.set_state(True)
switch.connect('state-set', self.srvclb.gui_switch_selection_atypes)
label_select = Gtk.Label()
label_select.set_markup("<b>All selected</b>")
label = self.srvgui.add_widget('gtk_label_switch_select_atypes', label_select)
hbox_sel.pack_start(label, False, False, 6)
hbox_sel.pack_start(switch, False, False, 6)
vbox_revealer.pack_start(hbox_sel, False, False, 6)
 
for name in ATYPES:
button = create_panel_elem_button('basico-annotation-type-%s' % name.lower(), name.lower())
self.srvgui.add_widget('gtk_button_type_%s' % name.lower(), button)
button.set_active(True)
vbox_revealer.pack_start(button, False, False, 2)
 
revealer.add(vbox_revealer)
vbox_main.pack_start(revealer, False, False, 6)
 
# ~ separator = Gtk.Separator()
# ~ vbox_main.pack_start(separator, False, False, 6)
 
return vbox_main
 
def set_visible_categories(self, togglebutton):
types = self.srvgui.get_widget('gtk_togglebutton_types')
revealer = self.srvgui.get_widget('gtk_revealer_annotations_categories')
140,7 → 238,7
scr = Gtk.ScrolledWindow()
scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scr.set_shadow_type(Gtk.ShadowType.NONE)
scr.set_shadow_type(Gtk.ShadowType.IN)
self.treeview = Gtk.TreeView()
scr.add(self.treeview)
scr.set_hexpand(True)
166,7 → 264,7
self.srvgui.add_widget('gtk_model_annotation', self.model)
 
# Setup columns
def get_column_header_widget(title, icon_name=None, width=24, height=24):
def get_column_header_widget(title, icon_name=None, width=28, height=28):
hbox = Gtk.HBox()
icon = self.srvicm.get_new_image_icon(icon_name, width, height)
label = Gtk.Label()
190,12 → 288,13
self.renderer_icon = Gtk.CellRendererPixbuf()
self.renderer_icon.set_alignment(0.0, 0.5)
self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=1)
widget = get_column_header_widget('', 'basico-empty')
widget = get_column_header_widget('', 'basico-type')
self.column_icon.set_widget(widget)
self.column_icon.set_visible(True)
self.column_icon.set_expand(False)
self.column_icon.set_clickable(False)
self.column_icon.set_clickable(True)
self.column_icon.set_sort_indicator(True)
self.column_icon.set_sort_column_id(7)
self.treeview.append_column(self.column_icon)
 
# SAP Note Checkbox
202,11 → 301,14
self.renderer_checkbox = Gtk.CellRendererToggle()
self.renderer_checkbox.connect("toggled", self.toggle_checkbox)
self.column_checkbox = Gtk.TreeViewColumn('', self.renderer_checkbox, active=2)
widget = get_column_header_widget('', 'basico-check-accept')
self.column_checkbox.set_widget(widget)
self.column_checkbox.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_checkbox.set_visible(True)
self.column_checkbox.set_expand(False)
self.column_checkbox.set_clickable(True)
self.column_checkbox.set_sort_indicator(True)
# ~ self.column_checkbox.set_clickable(True)
# ~ self.column_checkbox.set_sort_indicator(True)
# ~ self.column_checkbox.set_sort_column_id(2)
self.column_checkbox.set_property('spacing', 50)
self.treeview.append_column(self.column_checkbox)
 
273,6 → 375,8
self.renderer_type = Gtk.CellRendererText()
self.renderer_type.set_property('background', '#DADAFF')
self.column_type = Gtk.TreeViewColumn('Type', self.renderer_type, markup=7)
widget = get_column_header_widget('Type', 'basico-type')
self.column_type.set_widget(widget)
self.column_type.set_visible(True)
self.column_type.set_expand(False)
self.column_type.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
285,6 → 389,8
self.renderer_priority = Gtk.CellRendererText()
self.renderer_priority.set_property('background', '#e4f1f1')
self.column_priority = Gtk.TreeViewColumn('Priority', self.renderer_priority, markup=8)
widget = get_column_header_widget('Type', 'basico-priority')
self.column_priority.set_widget(widget)
self.column_priority.set_visible(True)
self.column_priority.set_expand(False)
self.column_priority.set_clickable(True)
296,6 → 402,8
self.renderer_updated = Gtk.CellRendererText()
self.renderer_updated.set_property('background', '#FFE6D1')
self.column_updated = Gtk.TreeViewColumn('Updated', self.renderer_updated, markup=9)
widget = get_column_header_widget('Update on', 'basico-chronologic')
self.column_updated.set_widget(widget)
self.column_updated.set_visible(True)
self.column_updated.set_expand(False)
self.column_updated.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
316,40 → 424,42
self.treeview.append_column(self.column_annotation)
 
# Timestamp updated
self.renderer_timestamp = Gtk.CellRendererText()
self.column_timestamp = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp, text=11)
self.column_timestamp.set_visible(False)
self.column_timestamp.set_expand(False)
self.column_timestamp.set_clickable(False)
self.column_timestamp.set_sort_indicator(True)
self.column_timestamp.set_sort_column_id(11)
self.column_timestamp.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp)
self.renderer_timestamp_updated = Gtk.CellRendererText()
self.column_timestamp_updated = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp_updated, text=11)
self.column_timestamp_updated.set_visible(False)
self.column_timestamp_updated.set_expand(False)
self.column_timestamp_updated.set_clickable(False)
self.column_timestamp_updated.set_sort_indicator(True)
self.column_timestamp_updated.set_sort_column_id(11)
self.column_timestamp_updated.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_updated)
 
# Annotation Created On
self.renderer_updated = Gtk.CellRendererText()
self.renderer_updated.set_property('background', '#FFE6D1')
self.column_updated = Gtk.TreeViewColumn('Created', self.renderer_updated, markup=12)
self.column_updated.set_visible(True)
self.column_updated.set_expand(False)
self.column_updated.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_updated.set_clickable(True)
self.column_updated.set_sort_indicator(True)
self.column_updated.set_sort_column_id(13)
self.column_updated.set_sort_order(Gtk.SortType.DESCENDING)
self.renderer_created = Gtk.CellRendererText()
self.renderer_created.set_property('background', '#FFE6D1')
self.column_created = Gtk.TreeViewColumn('Created', self.renderer_created, markup=12)
widget = get_column_header_widget('Created on', 'basico-chronologic')
self.column_created.set_widget(widget)
self.column_created.set_visible(True)
self.column_created.set_expand(False)
self.column_created.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_created.set_clickable(True)
self.column_created.set_sort_indicator(True)
self.column_created.set_sort_column_id(13)
self.column_created.set_sort_order(Gtk.SortType.DESCENDING)
self.model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
self.treeview.append_column(self.column_updated)
self.treeview.append_column(self.column_created)
 
# Timestamp
self.renderer_timestamp = Gtk.CellRendererText()
self.column_timestamp = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp, text=13)
self.column_timestamp.set_visible(False)
self.column_timestamp.set_expand(False)
self.column_timestamp.set_clickable(False)
self.column_timestamp.set_sort_indicator(True)
self.column_timestamp.set_sort_column_id(11)
self.column_timestamp.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp)
self.renderer_timestamp_created = Gtk.CellRendererText()
self.column_timestamp_created = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp_created, text=13)
self.column_timestamp_created.set_visible(False)
self.column_timestamp_created.set_expand(False)
self.column_timestamp_created.set_clickable(False)
self.column_timestamp_created.set_sort_indicator(True)
self.column_timestamp_created.set_sort_column_id(11)
self.column_timestamp_created.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_created)
 
# Treeview properties
self.treeview.set_can_focus(False)
487,7 → 597,7
widget_annotation.preview()
else:
aid = None
self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
except Exception as error:
pass
# ~ head = "Error reading annotation's contents"
667,17 → 777,19
# ~ fullscreen_annotation.set_active(True)
self.srvclb.action_annotation_preview(aid)
else:
pass
# ~ aid = None
self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', True)
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', True)
except Exception as error:
head = "Error reading annotation's contents"
body = "<i>%s</i>\n\n" % error
body += "As a workaround, a new file will be created"
dialog = self.srvuif.message_dialog_error(head, body)
self.log.debug(error)
self.log.debug(self.get_traceback())
dialog.run()
dialog.destroy()
self.log.error(error)
# ~ head = "Error reading annotation's contents"
# ~ body = "<i>%s</i>\n\n" % error
# ~ body += "As a workaround, a new file will be created"
# ~ dialog = self.srvuif.message_dialog_error(head, body)
# ~ self.log.debug(error)
# ~ self.log.debug(self.get_traceback())
# ~ dialog.run()
# ~ dialog.destroy()
# ~ #FIXME: create an empty file for contents
 
def row_right_click(self, treeview, event, data=None):
692,7 → 804,7
treeiter = model.get_iter(path)
component = model[treeiter][5]
aid = model[treeiter][10]
toolbar = self.srvgui.get_widget('visortoolbar')
# ~ toolbar = self.srvgui.get_widget('visortoolbar')
popover = self.srvgui.add_widget('gtk_popover_visor_row', Gtk.Popover.new(treeview))
# ~ popover.set_position(Gtk.PositionType.TOP)
popover.set_pointing_to(rect)
/branches/BR-0.4/basico/widgets/wdg_visor_attachments.py
462,7 → 462,7
model = treeview.get_model()
treeiter = model.get_iter(path)
tid = model[treeiter][0]
toolbar = self.srvgui.get_widget('visortoolbar')
# ~ toolbar = self.srvgui.get_widget('visortoolbar')
popover = self.srvgui.add_widget('gtk_popover_visor_row', Gtk.Popover.new(treeview))
popover.set_position(Gtk.PositionType.TOP)
popover.set_pointing_to(rect)
/branches/BR-0.4/basico/widgets/wdg_visor_sapnotes.py
29,6 → 29,7
from basico.widgets.wdg_cols import CollectionsMgtView
from basico.widgets.wdg_import import ImportWidget
from basico.core.mod_log import get_logger
from basico.widgets.wdg_menuview import MenuView
 
 
class SAPNotesVisor(BasicoWidget, Gtk.Box):
39,7 → 40,14
self.bag = []
self.icons = {}
self.icons['type'] = {}
self.setup()
panel = self.setup_panel()
visor = self.setup_visor()
paned = Gtk.HPaned()
paned.add1(panel)
paned.add2(visor)
paned.set_position(400)
paned.show_all()
self.add(paned)
self.log.debug("SAP Notes Visor initialized")
 
 
64,13 → 72,124
self.sorted_model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
 
 
def setup(self):
def setup_panel(self):
## Left view - SAP Notes Menu view
box = self.srvgui.add_widget('gtk_vbox_container_menu_view', Gtk.VBox())
# ~ self.pack_start(box, False, True, 3)
# ~ separator = Gtk.Separator(orientation = Gtk.Orientation.VERTICAL)
# ~ self.pack_start(separator, False, False, 3)
box.set_property('margin-left', 0)
box.set_property('margin-right', 0)
box.set_property('margin-bottom', 0)
 
# View combobox button/popover
lhbox = Gtk.HBox()
menuviews = self.srvgui.add_widget('gtk_button_menu_views', Gtk.Button())
menuviews.set_relief(Gtk.ReliefStyle.NONE)
hbox = Gtk.HBox()
label = self.srvgui.add_widget('gtk_label_current_view', Gtk.Label())
label.set_xalign(0.0)
image = self.srvgui.add_widget('gtk_image_current_view', Gtk.Image())
hbox.pack_start(image, False, False, 3)
hbox.pack_start(label, True, True, 3)
menuviews.add(hbox)
lhbox.pack_start(menuviews, True, True, 3)
lhbox.show_all()
box.pack_start(lhbox, False, False, 3)
 
### Popover menuviews
popover = self.srvgui.add_widget('gtk_popover_button_menu_views', Gtk.Popover.new(menuviews))
menuviews.connect('clicked', self.srvclb.gui_show_popover, popover)
box_views = Gtk.Box(spacing = 0, orientation="vertical")
popover.add(box_views)
 
box_views.pack_start(self.srvuif.create_menuview_button('collection'), False, False, 0)
separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
box_views.pack_start(separator, False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('component'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('description'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('bookmarks'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('category'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('chronologic'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('priority'), False, False, 0)
box_views.pack_start(self.srvuif.create_menuview_button('type'), False, False, 0)
 
### Toolbar
toolbar = Gtk.Toolbar()
toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
 
#### Filter entry tool
tool = Gtk.ToolItem.new()
 
hbox = Gtk.HBox()
viewfilter = self.srvgui.add_widget('gtk_entry_filter_view', Gtk.Entry())
completion = self.srvgui.get_widget('gtk_entrycompletion_viewmenu')
viewfilter.set_completion(completion)
viewfilter.connect('activate', self.srvclb.gui_viewmenu_filter)
 
icon = self.srvicm.get_pixbuf_icon('basico-refresh')
viewfilter.set_icon_from_pixbuf(Gtk.EntryIconPosition.PRIMARY, icon)
viewfilter.set_icon_sensitive(Gtk.EntryIconPosition.PRIMARY, True)
viewfilter.set_icon_tooltip_markup (Gtk.EntryIconPosition.PRIMARY, "Refresh and collapse")
 
icon = self.srvicm.get_pixbuf_icon('basico-filter')
viewfilter.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, icon)
viewfilter.set_icon_sensitive(Gtk.EntryIconPosition.SECONDARY, True)
viewfilter.set_icon_tooltip_markup (Gtk.EntryIconPosition.SECONDARY, "Click here to expand the tree")
viewfilter.set_placeholder_text("Filter this view...")
 
def on_icon_pressed(entry, icon_pos, event):
if icon_pos == Gtk.EntryIconPosition.PRIMARY:
viewmenu = self.srvgui.get_widget('viewmenu')
viewmenu.refresh()
elif icon_pos == Gtk.EntryIconPosition.SECONDARY:
self.srvclb.expand_menuview()
 
viewfilter.connect("icon-press", on_icon_pressed)
 
hbox.pack_start(viewfilter, True, True, 0)
tool.add(hbox)
tool.set_expand(True)
toolbar.insert(tool, -1)
 
box.pack_start(toolbar, False, False, 0)
 
### View treeview
box_trv = Gtk.VBox()
box_trv.set_property('margin-left', 3)
box_trv.set_property('margin-right', 3)
box_trv.set_property('margin-bottom', 0)
scr = Gtk.ScrolledWindow()
# ~ scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scr.set_shadow_type(Gtk.ShadowType.IN)
vwp = Gtk.Viewport()
vwp.set_hexpand(True)
viewsbox = self.srvgui.add_widget('gtk_box_container_views', Gtk.Box())
# ~ viewsbox.set_hexpand(True)
viewmenu = self.srvgui.add_widget('viewmenu', MenuView(self.app))
# ~ viewmenu.set_hexpand(True)
viewmenu.set_vexpand(True)
viewsbox.pack_start(viewmenu, True, True, 0)
vwp.add(viewsbox)
scr.add(vwp)
box_trv.pack_start(scr, True, True, 0)
box.pack_start(box_trv, True, True, 0)
# ~ box.show_all()
# ~ box.add(viewmenu)
return box
 
 
 
def setup_visor(self):
visor = Gtk.VBox()
scr = Gtk.ScrolledWindow()
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scr.set_shadow_type(Gtk.ShadowType.IN)
self.treeview = Gtk.TreeView()
scr.add(self.treeview)
self.pack_start(scr, True, True, 0)
visor.pack_start(scr, True, True, 0)
visor.show_all()
 
# Setup model
self.model = Gtk.ListStore(
89,7 → 208,7
)
 
# Setup columns
def get_column_header_widget(title, icon_name=None, width=24, height=24):
def get_column_header_widget(title, icon_name=None, width=28, height=28):
hbox = Gtk.HBox()
icon = self.srvicm.get_new_image_icon(icon_name, width, height)
label = Gtk.Label()
114,8 → 233,8
self.renderer_icon = Gtk.CellRendererPixbuf()
self.renderer_icon.set_alignment(0.0, 0.5)
self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=1)
# ~ widget = get_column_header_widget('', 'basico-bookmarks')
# ~ self.column_icon.set_widget(widget)
widget = get_column_header_widget('', 'basico-sapnote')
self.column_icon.set_widget(widget)
self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_icon.set_visible(False)
self.column_icon.set_expand(False)
141,7 → 260,7
self.renderer_sid.set_property('height', 36)
self.renderer_sid.set_property('background', '#F0E3E3')
self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=3)
widget = get_column_header_widget('SAP Note', '')
widget = get_column_header_widget('SAP Note', 'basico-sapnote')
self.column_sid.set_widget(widget)
self.column_sid.set_visible(True)
self.column_sid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
200,6 → 319,8
self.renderer_type = Gtk.CellRendererText()
self.renderer_type.set_property('background', '#e4f1f1')
self.column_type = Gtk.TreeViewColumn('Type', self.renderer_type, markup=7)
widget = get_column_header_widget('Type', 'basico-type')
self.column_type.set_widget(widget)
self.column_type.set_visible(True)
self.column_type.set_expand(False)
self.column_type.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
211,6 → 332,8
# SAP Note Priority
self.renderer_priority = Gtk.CellRendererText()
self.column_priority = Gtk.TreeViewColumn('Priority', self.renderer_priority, markup=8)
widget = get_column_header_widget('Type', 'basico-priority')
self.column_priority.set_widget(widget)
self.column_priority.set_visible(False)
self.column_priority.set_expand(True)
self.column_priority.set_clickable(True)
222,6 → 345,8
self.renderer_updated = Gtk.CellRendererText()
self.renderer_updated.set_property('background', '#FFE6D1')
self.column_updated = Gtk.TreeViewColumn('Updated On', self.renderer_updated, markup=9)
widget = get_column_header_widget('Update on', 'basico-chronologic')
self.column_updated.set_widget(widget)
self.column_updated.set_visible(True)
self.column_updated.set_expand(False)
self.column_updated.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
283,6 → 408,7
self.treeview.set_model(self.sorted_model)
 
self.show_all()
return visor
 
 
def sort_function(self, model, row1, row2, user_data):
340,7 → 466,7
self.srvclb.action_annotation_edit(aid)
else:
aid = None
self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
except Exception as error:
self.log.debug(error)
 
503,8 → 629,9
self.treeview.set_model(self.sorted_model)
self.update_total_sapnotes_count()
self.show_widgets()
stack = self.srvgui.get_widget('gtk_stack_main')
stack.set_visible_child_name('visor')
self.srvclb.gui_show_dashboard()
# ~ stack = self.srvgui.get_widget('gtk_stack_main')
# ~ stack.set_visible_child_name('dashboard')
# ~ self.log.debug("Visor updated")
 
def show_widgets(self):
526,7 → 653,7
if sid == 0:
return
sid = "0"*(10 - len(str(sid))) + str(sid)
toolbar = self.srvgui.get_widget('visortoolbar')
# ~ toolbar = self.srvgui.get_widget('visortoolbar')
popover = self.srvgui.add_widget('gtk_popover_visor_row', Gtk.Popover.new(treeview))
popover.set_position(Gtk.PositionType.TOP)
popover.set_pointing_to(rect)
/branches/BR-0.4/basico/widgets/wdg_visor_toolbar.py
27,7 → 27,6
self.tool_bar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
self.tool_bar.set_property('margin-bottom', 0)
 
 
# Import button
tool = Gtk.ToolButton()
tool.set_icon_name('basico-add')
116,6 → 115,13
tool.add(hbox)
self.tool_bar.insert(tool, -1)
 
# Visor Stack Switcher
tool = Gtk.ToolItem()
tool.set_expand(False)
hbox = self.srvgui.add_widget('gtk_hbox_toolbar_stack_switcher', Gtk.HBox())
tool.add(hbox)
self.tool_bar.insert(tool, -1)
 
# Fullscreen toggle button
# ~ tool = Gtk.ToolItem()
# ~ tool.set_expand(False)
/branches/BR-0.4/setup.py
37,7 → 37,6
('basico/data/res/selenium/drivers',
[
'basico/data/res/selenium/drivers/geckodriver',
'basico/data/res/selenium/drivers/geckodriver.exe',
'basico/data/res/selenium/drivers/geckodriver.README'
]),
('basico/data/res/css',