Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 398 → Rev 399

/branches/BR-0.4/basico/services/srv_asciidoctor.py
37,6 → 37,18
self.srvutl = self.get_service('Utils')
 
 
def get_target_path(self, aid):
source = self.get_source_path(aid)
target_dir = LPATH['CACHE_HTML']
target_file = os.path.basename(source).replace('.adoc', '.html')
path = os.path.join(target_dir, target_file)
return path
 
 
def get_source_path(self, aid):
return self.srvant.get_content_file(aid)
 
 
def generate_preview(self, aid):
adocprops = ''
for prop in ADOCPROPS:
/branches/BR-0.4/basico/services/srv_utils.py
182,6 → 182,14
return timestamp
 
 
def get_file_modification_date(self, filename):
"""
Get modification datetime for a given filename.
"""
t = os.path.getmtime(filename)
return datetime.fromtimestamp(t)
 
 
def get_datetime(self, timestamp):
"""
Missing method docstring (missing-docstring)
/branches/BR-0.4/basico/widgets/wdg_annot.py
7,6 → 7,7
# Description: Annotation Widget
"""
 
import os
import html
import gi
gi.require_version('Gtk', '3.0')
40,6 → 41,29
self.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
self.toolbar.set_property('margin-bottom', 0)
 
# Annotation icon
tool = self.srvgui.add_widget('gtk_tool_annotation_icon', Gtk.ToolItem())
box = self.srvgui.add_widget('gtk_box_annotation_icon', Gtk.Box())
tool.add(box)
self.toolbar.insert(tool, -1)
 
# Separator
tool = self.srvuif.get_toolbar_separator(False, False)
self.toolbar.insert(tool, -1)
 
# Title
tool = Gtk.ToolItem()
# ~ vbox = Gtk.VBox()
title = self.srvgui.add_widget('gtk_label_annotation_sid', Gtk.Label())
title.set_selectable(True)
if self.sid == '0000000000':
title.set_markup('<small><b>Annotation</b></small>')
else:
title.set_markup('<small><b>Annotation for SAP Note %s</b></small>' % str(int(self.sid)))
title.set_xalign(0.5)
tool.add(title)
self.toolbar.insert(tool, -1)
 
# Task Category button
tool = Gtk.ToolItem()
a_category_model = Gtk.ListStore(Pixbuf, str)
135,7 → 159,7
# Is template?
hbox = Gtk.HBox()
tool = Gtk.ToolItem()
icon = self.srvicm.get_new_image_icon('basico-annotation-type-template')
icon = self.srvicm.get_new_image_icon('basico-annotation-type-template', 18, 18)
switch = self.srvgui.add_widget('gtk_switch_annotation_template', Gtk.ToggleButton())
# ~ switch.connect('state-set', callback)
label = Gtk.Label()
159,23 → 183,10
tool.connect('clicked', self.srvclb.gui_attachment_add_to_annotation)
self.toolbar.insert(tool, -1)
 
 
# Separator
tool = self.srvuif.get_toolbar_separator(False, True)
self.toolbar.insert(tool, -1)
 
# Title
tool = Gtk.ToolItem()
# ~ vbox = Gtk.VBox()
title = self.srvgui.add_widget('gtk_label_annotation_sid', Gtk.Label())
title.set_selectable(True)
if self.sid == '0000000000':
title.set_markup('<small><b>Annotation</b></small>')
else:
title.set_markup('<small><b>Annotation for SAP Note %s</b></small>' % str(int(self.sid)))
title.set_xalign(0.5)
# ~ vbox.pack_start(title, False, False, 3)
 
# Timestamp created
tool = Gtk.ToolItem()
tool.set_expand(False)
200,6 → 211,9
 
# Annotation Stack Switcher
tool = Gtk.ToolItem()
tool.set_is_important(True)
tool.set_visible_vertical(True)
tool.set_visible_horizontal(True)
stack_switcher = self.srvgui.add_widget('stack_switcher_annotation', Gtk.StackSwitcher())
stack_switcher.set_property('icon-size', 3)
stack = self.srvgui.add_widget('stack_annotation', Gtk.Stack())
213,6 → 227,10
 
# Arrow UP
tool = self.srvgui.add_widget('gtk_button_annotation_toolbar_previous_item', Gtk.ToolButton())
tool.set_expand(False)
tool.set_visible_horizontal(True)
tool.set_visible_vertical(True)
tool.set_is_important(True)
tool.set_tooltip_markup('<b>Previous annotation</b>')
tool.set_icon_name('basico-arrow-up')
tool.connect('clicked', self.srvclb.gui_annotation_previous_row)
220,6 → 238,10
 
# Arrow DOWN
tool = self.srvgui.add_widget('gtk_button_annotation_toolbar_next_item', Gtk.ToolButton())
tool.set_visible_vertical(True)
tool.set_visible_horizontal(True)
tool.set_is_important(True)
tool.set_expand(False)
tool.set_tooltip_markup('<b>Next annotation</b>')
tool.set_icon_name('basico-arrow-down')
tool.connect('clicked', self.srvclb.gui_annotation_next_row)
353,6 → 375,8
self.srvuif.set_widget_visibility('gtk_combobox_annotation_priority', False)
self.srvuif.set_widget_visibility('gtk_button_annotation_toolbar_attachment', False)
self.srvuif.set_widget_visibility('gtk_entry_annotation_scope', False)
self.srvuif.set_widget_visibility('gtk_switch_annotation_template', False)
self.srvuif.set_widget_visibility('gtk_label_annotation_sid', True)
elif stack_name == 'properties':
self.srvuif.set_widget_visibility('gtk_combobox_annotation_category', False)
self.srvuif.set_widget_visibility('gtk_combobox_annotation_type', False)
359,6 → 383,8
self.srvuif.set_widget_visibility('gtk_combobox_annotation_priority', False)
self.srvuif.set_widget_visibility('gtk_button_annotation_toolbar_attachment', False)
self.srvuif.set_widget_visibility('gtk_entry_annotation_scope', False)
self.srvuif.set_widget_visibility('gtk_switch_annotation_template', False)
self.srvuif.set_widget_visibility('gtk_label_annotation_sid', False)
elif stack_name == 'editor':
self.srvuif.set_widget_visibility('gtk_combobox_annotation_category', True)
self.srvuif.set_widget_visibility('gtk_combobox_annotation_type', True)
365,6 → 391,8
self.srvuif.set_widget_visibility('gtk_combobox_annotation_priority', True)
self.srvuif.set_widget_visibility('gtk_button_annotation_toolbar_attachment', True)
self.srvuif.set_widget_visibility('gtk_entry_annotation_scope', True)
self.srvuif.set_widget_visibility('gtk_switch_annotation_template', True)
self.srvuif.set_widget_visibility('gtk_label_annotation_sid', False)
 
 
def widget_annotation_preview(self):
577,19 → 605,21
self.set_aid_to_widget(aid)
sid = self.srvant.get_sid(aid)
title = self.srvgui.get_widget('gtk_label_annotation_sid')
if sid == '0000000000':
title.set_markup('<big><b>Annotation</b></big>')
# ~ if sid == '0000000000':
# ~ title.set_markup('<big><b>Annotation</b></big>')
 
# ~ else:
# ~ title.set_markup('<big><b>Annotation for SAP Note %s</b></big>' % str(int(sid)))
 
 
if action == 'create':
self.srvuif.statusbar_msg("Creating new annotation")
else:
title.set_markup('<big><b>Annotation for SAP Note %s</b></big>' % str(int(sid)))
elif action == 'edit' or action == 'preview':
self.srvuif.statusbar_msg("Creating/Editing new annotation for SAP Note %s" % str(int(sid)))
 
if action == 'create':
pass
elif action == 'edit':
annotation = self.srvant.get_metadata_from_aid(aid)
if annotation is not None:
ANNOTATION_FILE_CONTENT = LPATH['ANNOTATIONS'] + aid + '.adoc'
a_wdg_icon = self.srvgui.get_widget('gtk_box_annotation_icon')
a_wdg_aid = self.srvgui.get_widget('gtk_label_aid')
a_wdg_timestamp = self.srvgui.get_widget('gtk_label_timestamp')
a_wdg_title = self.srvgui.get_widget('gtk_entry_annotation_title')
605,7 → 635,10
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')
 
title.set_markup("<big><b>%s - %s</b></big>" % (annotation['Type'], annotation['Title']))
a_wdg_aid.set_text(annotation['AID'])
icon = self.srvicm.get_new_image_icon('basico-annotation-type-%s' % annotation['Type'].lower())
self.srvgui.swap_widget(a_wdg_icon, icon)
a_wdg_timestamp.set_text(annotation['Timestamp'])
a_wdg_title.set_text(html.escape(annotation['Title']))
 
638,8 → 671,6
human_timestamp = self.srvutl.get_human_date_from_timestamp(annotation['Timestamp'])
a_wdg_human_timestamp.set_markup('<b>%s</b>' % human_timestamp)
a_wdg_timestamp_created.set_text(annotation['Created'])
# ~ self.stack_changed()
# ~ self.preview()
 
 
def get_metadata_from_widget(self):
731,9 → 762,24
if len(alink) > 0:
browser.load_url(alink)
else:
target = self.srvacd.generate_preview(aid)
tpath = self.srvacd.get_target_path(aid)
if not os.path.exists(tpath):
target = self.srvacd.generate_preview(aid)
else:
spath = self.srvacd.get_source_path(aid)
smtime = self.srvutl.get_file_modification_date(spath)
tmtime = self.srvutl.get_file_modification_date(tpath)
# ~ self.log.debug("%s; %s", spath, smtime)
# ~ self.log.debug("%s; %s", tpath, tmtime)
if tmtime < smtime:
target = self.srvacd.generate_preview(aid)
self.log.debug("Preview generated")
else:
target = "file://" + tpath
self.log.debug("Using cache for preview")
browser.load_url(html.escape(target))
except:
except Exception as error:
self.log.error(error)
self.log.debug("Showing editor instead preview")
stack_annotation = self.srvgui.get_widget('stack_annotation')
self.set_visible_stack('editor')
758,5 → 804,6
else:
entry.set_text(scope_text)
 
 
def product_activated(self, entry):
pass
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
74,12 → 74,9
self.srvgui.set_key_value('ANNOTATIONS_PRIORITY_%s_VISIBLE' % priority.upper(), True)
 
 
def get_treeview(self):
return self.treeview
 
 
def sort_by_timestamp(self):
self.sorted_model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
sorted_model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
 
 
def setup_panel(self):
280,13 → 277,13
scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scr.set_shadow_type(Gtk.ShadowType.IN)
self.treeview = Gtk.TreeView()
scr.add(self.treeview)
treeview = self.srvgui.add_widget('visor_annotation_treeview', Gtk.TreeView())
scr.add(treeview)
scr.set_hexpand(True)
self.pack_start(scr, True, True, 0)
 
# Setup model
self.model = Gtk.ListStore(
model = Gtk.TreeStore(
str, # Annotation Id
Pixbuf, # Icon
int, # checkbox
301,7 → 298,7
str, # Annotation created
str, # Timestamp created
)
self.srvgui.add_widget('gtk_model_annotation', self.model)
self.srvgui.add_widget('gtk_model_annotation', model)
 
# Setup columns
def get_column_header_widget(title, icon_name=None, width=28, height=28):
322,7 → 319,7
self.column_key.set_expand(False)
self.column_key.set_clickable(False)
self.column_key.set_sort_indicator(True)
self.treeview.append_column(self.column_key)
treeview.append_column(self.column_key)
 
# Annotation Icon
self.renderer_icon = Gtk.CellRendererPixbuf()
335,7 → 332,7
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)
treeview.append_column(self.column_icon)
 
# Annotation Checkbox
self.renderer_checkbox = Gtk.CellRendererToggle()
350,7 → 347,7
# ~ 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)
treeview.append_column(self.column_checkbox)
 
# Annotation Id
self.renderer_sid = Gtk.CellRendererText()
366,7 → 363,7
self.column_sid.set_clickable(True)
self.column_sid.set_sort_indicator(True)
self.column_sid.set_sort_column_id(0)
self.treeview.append_column(self.column_sid)
treeview.append_column(self.column_sid)
 
# Annotation title
self.renderer_title = Gtk.CellRendererText()
374,6 → 371,7
self.renderer_title.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
self.column_title = Gtk.TreeViewColumn('Title', self.renderer_title, markup=4)
widget = get_column_header_widget('Title', 'basico-tag')
# ~ widget.connect('button_press_event', self.header_right_click)
self.column_title.set_widget(widget)
self.column_title.set_visible(True)
self.column_title.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
381,7 → 379,7
self.column_title.set_clickable(True)
self.column_title.set_sort_indicator(True)
self.column_title.set_sort_column_id(4)
self.treeview.append_column(self.column_title)
treeview.append_column(self.column_title)
 
# Annotation Component
self.renderer_component = Gtk.CellRendererText()
395,7 → 393,7
self.column_component.set_clickable(True)
self.column_component.set_sort_indicator(True)
self.column_component.set_sort_column_id(5)
self.treeview.append_column(self.column_component)
treeview.append_column(self.column_component)
 
# Annotation Scope
self.renderer_scope = Gtk.CellRendererText()
409,7 → 407,7
self.column_scope.set_clickable(True)
self.column_scope.set_sort_indicator(True)
self.column_scope.set_sort_column_id(6)
self.treeview.append_column(self.column_scope)
treeview.append_column(self.column_scope)
 
# Annotation Product
self.renderer_type = Gtk.CellRendererText()
424,7 → 422,7
self.column_type.set_clickable(True)
self.column_type.set_sort_indicator(True)
self.column_type.set_sort_column_id(7)
self.treeview.append_column(self.column_type)
treeview.append_column(self.column_type)
 
# Annotation Priority
self.renderer_priority = Gtk.CellRendererText()
437,7 → 435,7
self.column_priority.set_clickable(True)
self.column_priority.set_sort_indicator(True)
self.column_priority.set_sort_column_id(8)
self.treeview.append_column(self.column_priority)
treeview.append_column(self.column_priority)
 
# Annotation Updated On
self.renderer_updated = Gtk.CellRendererText()
452,8 → 450,8
self.column_updated.set_sort_indicator(True)
self.column_updated.set_sort_column_id(10)
self.column_updated.set_sort_order(Gtk.SortType.DESCENDING)
self.model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
self.treeview.append_column(self.column_updated)
model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
treeview.append_column(self.column_updated)
 
# Timestamp updated
self.renderer_timestamp_updated = Gtk.CellRendererText()
464,7 → 462,7
self.column_timestamp_updated.set_sort_indicator(True)
self.column_timestamp_updated.set_sort_column_id(10)
self.column_timestamp_updated.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_updated)
treeview.append_column(self.column_timestamp_updated)
 
# Annotation Created On
self.renderer_created = Gtk.CellRendererText()
479,8 → 477,8
self.column_created.set_sort_indicator(True)
self.column_created.set_sort_column_id(12)
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_created)
model.set_sort_column_id(11, Gtk.SortType.DESCENDING)
treeview.append_column(self.column_created)
 
# Timestamp
self.renderer_timestamp_created = Gtk.CellRendererText()
491,20 → 489,20
self.column_timestamp_created.set_sort_indicator(True)
self.column_timestamp_created.set_sort_column_id(12)
self.column_timestamp_created.set_sort_order(Gtk.SortType.ASCENDING)
self.treeview.append_column(self.column_timestamp_created)
treeview.append_column(self.column_timestamp_created)
 
# Treeview properties
self.treeview.set_can_focus(False)
self.treeview.set_enable_tree_lines(True)
self.treeview.set_headers_visible(True)
self.treeview.set_enable_search(True)
self.treeview.set_hover_selection(False)
self.treeview.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
self.treeview.set_enable_tree_lines(True)
self.treeview.set_level_indentation(10)
self.treeview.connect('button_press_event', self.row_right_click)
treeview.set_can_focus(False)
treeview.set_enable_tree_lines(True)
treeview.set_headers_visible(True)
treeview.set_enable_search(True)
treeview.set_hover_selection(False)
treeview.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
treeview.set_enable_tree_lines(True)
treeview.set_level_indentation(10)
treeview.connect('button_press_event', self.row_right_click)
 
self.treeview.modify_font(Pango.FontDescription('Monospace 9'))
treeview.modify_font(Pango.FontDescription('Monospace 9'))
 
# DOC: In order to have a Gtk.Widged with sorting and filtering
# capabilities, you have to filter the model first, and use this
512,24 → 510,25
# model to the treeview...
 
# Treeview filtering:
self.visible_filter = self.model.filter_new()
self.visible_filter.set_visible_func(self.visible_function)
visible_filter = self.srvgui.add_widget('visor_annotation_filter', model.filter_new())
visible_filter.set_visible_func(self.visible_function)
 
# TreeView sorting
self.sorted_model = Gtk.TreeModelSort(model=self.visible_filter)
self.sorted_model.set_sort_func(0, self.sort_function, None)
sorted_model = Gtk.TreeModelSort(model=visible_filter)
self.srvgui.add_widget('visor_annotation_sorted_model', sorted_model)
# ~ self.sorted_model.set_sort_func(0, self.sort_function, None)
 
# Selection
self.selection = self.treeview.get_selection()
self.selection.set_mode(Gtk.SelectionMode.SINGLE)
self.selection.connect('changed', self.row_changed)
selection = treeview.get_selection()
selection.set_mode(Gtk.SelectionMode.SINGLE)
selection.connect('changed', self.row_changed)
 
# Set model (filtered and sorted)
self.sorted_model.set_sort_column_id(9, Gtk.SortType.ASCENDING)
self.treeview.set_model(self.sorted_model)
sorted_model.set_sort_column_id(9, Gtk.SortType.ASCENDING)
treeview.set_model(sorted_model)
 
# Other signals
self.treeview.connect('row-activated', self.row_double_click)
treeview.connect('row-activated', self.row_double_click)
 
self.show_all()
 
584,10 → 583,11
 
 
def update_total_annotations_count(self):
visible_filter = self.srvgui.get_widget('visor_annotation_filter')
statusbar = self.srvgui.get_widget('widget_statusbar')
lblnotescount = self.srvgui.get_widget('gtk_label_total_notes')
total = self.srvant.get_total()
count = len(self.visible_filter)
count = len(visible_filter)
lblnotescount.set_markup("<b>%d/<big>%d annotations</big></b>" % (count, total))
msg = 'View populated with %d annotations' % count
self.srvuif.statusbar_msg(msg)
598,13 → 598,15
 
 
def row_current(self, *args):
selection = self.treeview.get_selection()
treeview = self.srvgui.get_widget('visor_annotation_treeview')
selection = treeview.get_selection()
model, treeiter = selection.get_selected()
return treeiter
 
 
def row_previous(self, *args):
selection = self.treeview.get_selection()
treeview = self.srvgui.get_widget('visor_annotation_treeview')
selection = treeview.get_selection()
model, iter_current = selection.get_selected()
if iter_current is not None:
iter_previous = model.iter_previous(iter_current)
615,28 → 617,30
 
 
def row_next(self, *args):
selection = self.treeview.get_selection()
treeview = self.srvgui.get_widget('visor_annotation_treeview')
selection = treeview.get_selection()
model, iter_current = selection.get_selected()
if iter_current is not None:
iter_next = model.iter_next(iter_current)
if iter_next:
selection.select_iter(iter_next)
path, col = self.treeview.get_cursor()
path, col = treeview.get_cursor()
row = self.srvuif.tree_path_to_row(path)
self.treeview.scroll_to_cell(row, column=None, use_align=False, row_align=0.5, col_align=0)
treeview.scroll_to_cell(row, column=None, use_align=False, row_align=0.5, col_align=0)
widget_annotation = self.srvgui.get_widget('widget_annotation')
widget_annotation.preview()
 
 
def rows_toggled(self):
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
selected = []
 
def get_selected_sapnotes(model, path, itr):
aid = self.sorted_model.get(itr, 0)[0]
checked = self.sorted_model.get(itr, 2)[0]
aid = sorted_model.get(itr, 0)[0]
checked = sorted_model.get(itr, 2)[0]
if checked:
selected.append(str(aid))
self.sorted_model.foreach(get_selected_sapnotes)
sorted_model.foreach(get_selected_sapnotes)
 
return selected
 
670,9 → 674,10
 
 
def toggle_checkbox(self, cell, path):
model = self.sorted_model.get_model()
# ~ path = model.convert_path_to_child_path(Gtk.TreePath(path))
model[path][2] = not model[path][2]
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
model = sorted_model.get_model()
rpath = sorted_model.convert_path_to_child_path(Gtk.TreePath(path))
model[rpath][2] = not model[rpath][2]
 
 
def get_node(self, key, icon, checkbox, sid, title, component, scope='', sntype='', priority='', updated='', ts_updated='', created='', ts_created=''):
713,6 → 718,10
 
 
def populate(self, annotations=None):
treeview = self.srvgui.get_widget('visor_annotation_treeview')
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
model = self.srvgui.get_widget('gtk_model_annotation')
# ~ model = sorted_model.get_model()
self.column_sid.set_visible(False)
# ~ self.column_checkbox.set_visible(True)
# ~ self.column_category.set_visible(True)
721,8 → 730,8
completion_model = completion.get_model()
completion_model.clear()
 
self.treeview.set_model(None)
self.model.clear()
treeview.set_model(None)
model.clear()
 
if annotations is None:
annotations = self.get_bag()
818,13 → 827,14
except Exception as error:
# Whenever an annotation is deleted, after reloading
# the view, it fails. Then, skip it
self.log.error("Annotation: %s", fname)
self.log.error(error)
# ~ self.log.error("Annotation: %s", fname)
# ~ self.log.error(error)
pass
 
for node in nodes:
self.model.append(node)
model.append(None, node)
 
self.treeview.set_model(self.sorted_model)
treeview.set_model(sorted_model)
self.sort_by_timestamp()
# ~ self.set_bag(bag)
self.update_panel_values()
872,12 → 882,16
# ~ dialog.destroy()
# ~ #FIXME: create an empty file for contents
 
def header_right_click(self, *args):
self.log.debug(args)
 
def row_right_click(self, treeview, event, data=None):
treeview = self.srvgui.get_widget('visor_annotation_treeview')
if event.button == 3:
rect = Gdk.Rectangle()
rect.x = x = int(event.x)
rect.y = y = int(event.y)
pthinfo = self.treeview.get_path_at_pos(x,y)
pthinfo = treeview.get_path_at_pos(x,y)
if pthinfo is not None:
path,col,cellx,celly = pthinfo
model = treeview.get_model()
983,6 → 997,7
 
 
def select_all(self, button, checked):
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
def check_row(model, path, itr):
# ~ model[path][2] = not model[path][2]
if checked is not None:
991,7 → 1006,7
state = model[path][2]
model[path][2] = not state
 
model = self.sorted_model.get_model()
model = sorted_model.get_model()
model.foreach(check_row)
self.srvuif.grab_focus()
 
1070,12 → 1085,13
self.update_products()
 
def update_scopes(self):
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
scopes = set()
 
def get_values(model, path, itr):
scope = self.sorted_model.get(itr, 6)[0]
scope = sorted_model.get(itr, 6)[0]
scopes.add(scope)
self.sorted_model.foreach(get_values)
sorted_model.foreach(get_values)
 
# Update scope combo
cmb_scope = self.srvgui.get_widget('gtk_combobox_filter_scope')
1096,12 → 1112,13
 
 
def update_products(self):
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
products = set()
 
def get_values(model, path, itr):
product = self.sorted_model.get(itr, 7)[0]
product = sorted_model.get(itr, 7)[0]
products.add(product)
self.sorted_model.foreach(get_values)
sorted_model.foreach(get_values)
 
# Update product combo
cmb_product = self.srvgui.get_widget('gtk_combobox_filter_product')
1122,7 → 1139,7
 
 
def clb_scope_changed(self, *args):
visible_filter = self.get_visible_filter()
visible_filter = self.srvgui.get_widget('visor_annotation_filter')
visible_filter.refilter()
self.update_total_annotations_count()
self.update_products()
1129,7 → 1146,7
 
 
def product_changed(self, *args):
visible_filter = self.get_visible_filter()
visible_filter = self.srvgui.get_widget('visor_annotation_filter')
visible_filter.refilter()
self.update_total_annotations_count()
self.update_scopes()