Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 405 → Rev 406

/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
42,9 → 42,9
PRODUCT = 8
PRIORITY = 9
UPDATED = 10
TS_UPDATED = 11
UPDATED_TIMESTAMP = 11
CREATED = 12
TS_CREATED = 13
CREATED_TIMESTAMP = 13
 
 
class AnnotationsVisor(BasicoWidget, Gtk.HBox):
93,7 → 93,7
 
def __sort_by_timestamp(self):
sorted_model = self.srvgui.get_widget('visor_annotation_sorted_model')
sorted_model.set_sort_column_id(COLUMN.TS_UPDATED, Gtk.SortType.DESCENDING)
sorted_model.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP, Gtk.SortType.DESCENDING)
 
 
def __setup_panel(self):
479,19 → 479,19
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(COLUMN.TS_UPDATED)
self.column_updated.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP)
self.column_updated.set_sort_order(Gtk.SortType.DESCENDING)
model.set_sort_column_id(COLUMN.TS_UPDATED, Gtk.SortType.DESCENDING)
model.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP, Gtk.SortType.DESCENDING)
treeview.append_column(self.column_updated)
 
# Timestamp updated
self.renderer_timestamp_updated = Gtk.CellRendererText()
self.column_timestamp_updated = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp_updated, text=COLUMN.TS_UPDATED)
self.column_timestamp_updated = Gtk.TreeViewColumn('Timestamp updated', self.renderer_timestamp_updated, text=COLUMN.UPDATED_TIMESTAMP)
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(COLUMN.TS_UPDATED)
self.column_timestamp_updated.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP)
self.column_timestamp_updated.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(self.column_timestamp_updated)
 
506,19 → 506,19
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(COLUMN.TS_CREATED)
self.column_created.set_sort_column_id(COLUMN.CREATED_TIMESTAMP)
self.column_created.set_sort_order(Gtk.SortType.DESCENDING)
model.set_sort_column_id(COLUMN.TS_CREATED, Gtk.SortType.DESCENDING)
model.set_sort_column_id(COLUMN.CREATED_TIMESTAMP, Gtk.SortType.DESCENDING)
treeview.append_column(self.column_created)
 
# Timestamp
self.renderer_timestamp_created = Gtk.CellRendererText()
self.column_timestamp_created = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp_created, text=COLUMN.TS_CREATED)
self.column_timestamp_created = Gtk.TreeViewColumn('Timestamp created', self.renderer_timestamp_created, text=COLUMN.CREATED_TIMESTAMP)
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(COLUMN.TS_CREATED)
self.column_timestamp_created.set_sort_column_id(COLUMN.CREATED_TIMESTAMP)
self.column_timestamp_created.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(self.column_timestamp_created)
 
555,7 → 555,7
selection.connect('changed', self.__clb_row_changed)
 
# Set model (filtered and sorted)
sorted_model.set_sort_column_id(COLUMN.TS_UPDATED, Gtk.SortType.ASCENDING)
sorted_model.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP, Gtk.SortType.ASCENDING)
treeview.set_model(sorted_model)
 
# Other signals
/branches/BR-0.4/basico/widgets/wdg_visor_sapnotes.py
44,7 → 44,7
TYPE = 7
PRIORITY = 8
UPDATED = 9
TS_UPDATED = 10
UPDATED_TIMESTAMP = 10
 
 
class SAPNotesVisor(BasicoWidget, Gtk.Box):
81,7 → 81,7
 
def sort_by_timestamp(self):
sorted_model = self.srvgui.get_widget('visor_sapnotes_sorted_model')
sorted_model.set_sort_column_id(COLUMN.TS_UPDATED, Gtk.SortType.DESCENDING)
sorted_model.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP, Gtk.SortType.ASCENDING)
 
 
def setup_panel(self):
203,7 → 203,7
visor.show_all()
 
# Setup model
model = Gtk.ListStore(
model = Gtk.TreeStore(
int, # key
Pixbuf, # Icon
int, # checkbox
231,153 → 231,155
return hbox
 
# SAP Note key
self.renderer_key = Gtk.CellRendererText()
self.renderer_key.set_property('height', 32)
self.column_key = Gtk.TreeViewColumn('Key', self.renderer_key, text=COLUMN.KEY)
self.column_key.set_visible(False)
self.column_key.set_expand(False)
self.column_key.set_clickable(False)
self.column_key.set_sort_indicator(False)
treeview.append_column(self.column_key)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_key', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_key', Gtk.TreeViewColumn('Key', renderer, text=COLUMN.KEY))
renderer.set_property('height', 32)
column.set_visible(False)
column.set_expand(False)
column.set_clickable(False)
column.set_sort_indicator(False)
treeview.append_column(column)
 
# Icon
self.renderer_icon = Gtk.CellRendererPixbuf()
self.renderer_icon.set_alignment(0.0, 0.5)
self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=COLUMN.ICON)
# ~ widget = get_column_header_widget('', '')
# ~ self.column_icon.set_widget(widget)
self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_icon.set_visible(True)
self.column_icon.set_expand(False)
self.column_icon.set_clickable(True)
self.column_icon.set_sort_indicator(True)
self.column_icon.set_sort_column_id(COLUMN.TYPE)
self.column_icon.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(self.column_icon)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_icon', Gtk.CellRendererPixbuf())
column = self.srvgui.add_widget('visor_sapnotes_column_icon', Gtk.TreeViewColumn('', renderer, pixbuf=COLUMN.ICON))
renderer.set_alignment(0.0, 0.5)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_visible(True)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.TYPE)
column.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(column)
 
# SAP Note Checkbox
self.renderer_checkbox = Gtk.CellRendererToggle()
self.renderer_checkbox.connect("toggled", self.__clb_row_toggled)
self.column_checkbox = Gtk.TreeViewColumn('', self.renderer_checkbox, active=COLUMN.CHECKBOX)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_checkbox', Gtk.CellRendererToggle())
column = self.srvgui.add_widget('visor_sapnotes_column_checkbox', Gtk.TreeViewColumn('', renderer, active=COLUMN.CHECKBOX))
renderer.connect("toggled", self.__clb_row_toggled)
column = Gtk.TreeViewColumn('', renderer, active=COLUMN.CHECKBOX)
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(False)
self.column_checkbox.set_property('spacing', 50)
treeview.append_column(self.column_checkbox)
column.set_widget(widget)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_visible(True)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(False)
column.set_property('spacing', 50)
treeview.append_column(column)
 
# SAP Note Id
self.renderer_sid = Gtk.CellRendererText()
self.renderer_sid.set_property('xalign', 1.0)
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=COLUMN.SID)
# ~ 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)
self.column_sid.set_expand(False)
self.column_sid.set_clickable(True)
self.column_sid.set_sort_indicator(True)
self.column_sid.set_sort_column_id(COLUMN.SID)
self.column_sid.set_sort_order(Gtk.SortType.ASCENDING)
# ~ model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
treeview.append_column(self.column_sid)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_sid', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_sid', Gtk.TreeViewColumn('SAP Note', renderer, markup=COLUMN.SID))
renderer.set_property('xalign', 1.0)
renderer.set_property('height', 36)
renderer.set_property('background', '#F0E3E3')
column.set_visible(True)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.KEY)
column.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(column)
 
# SAP Note title
self.renderer_title = Gtk.CellRendererText()
self.renderer_title.set_property('background', '#FFFEEA')
self.renderer_title.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
self.column_title = Gtk.TreeViewColumn('Title', self.renderer_title, markup=COLUMN.TITLE)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_title', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_title', Gtk.TreeViewColumn('Title', renderer, markup=COLUMN.TITLE))
renderer.set_property('background', '#FFFEEA')
renderer.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
column = Gtk.TreeViewColumn('Title', renderer, markup=COLUMN.TITLE)
widget = get_column_header_widget('Title', 'basico-tag')
self.column_title.set_widget(widget)
self.column_title.set_visible(True)
self.column_title.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_title.set_expand(True)
self.column_title.set_clickable(True)
self.column_title.set_sort_indicator(True)
self.column_title.set_sort_column_id(COLUMN.TITLE)
treeview.append_column(self.column_title)
column.set_widget(widget)
column.set_visible(True)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_expand(True)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.TITLE)
treeview.append_column(column)
 
# SAP Note Component
self.renderer_component = Gtk.CellRendererText()
self.renderer_component.set_property('background', '#E3E3F0')
self.column_component = Gtk.TreeViewColumn('Component', self.renderer_component, markup=COLUMN.COMPONENT)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_component', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_component', Gtk.TreeViewColumn('Component', renderer, markup=COLUMN.COMPONENT))
renderer.set_property('background', '#E3E3F0')
widget = get_column_header_widget('Component', 'basico-component')
self.column_component.set_widget(widget)
self.column_component.set_visible(True)
self.column_component.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_component.set_expand(False)
self.column_component.set_clickable(True)
self.column_component.set_sort_indicator(True)
self.column_component.set_sort_column_id(COLUMN.COMPONENT)
treeview.append_column(self.column_component)
column.set_widget(widget)
column.set_visible(True)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.COMPONENT)
treeview.append_column(column)
 
# SAP Note Category
self.renderer_category = Gtk.CellRendererText()
self.renderer_category.set_property('background', '#E3F1E3')
self.column_category = Gtk.TreeViewColumn('Category', self.renderer_category, markup=COLUMN.CATEGORY)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_category', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_category', Gtk.TreeViewColumn('Category', renderer, markup=COLUMN.CATEGORY))
renderer.set_property('background', '#E3F1E3')
widget = get_column_header_widget('Category', 'basico-category')
self.column_category.set_widget(widget)
self.column_category.set_visible(False)
self.column_category.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_category.set_expand(False)
self.column_category.set_clickable(True)
self.column_category.set_sort_indicator(True)
self.column_category.set_sort_column_id(COLUMN.CATEGORY)
treeview.append_column(self.column_category)
column.set_widget(widget)
column.set_visible(False)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.CATEGORY)
treeview.append_column(column)
 
# SAP Note Type
self.renderer_type = Gtk.CellRendererText()
self.renderer_type.set_property('background', '#e4f1f1')
self.column_type = Gtk.TreeViewColumn('Type', self.renderer_type, markup=COLUMN.TYPE)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_type', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_type', Gtk.TreeViewColumn('Type', renderer, markup=COLUMN.TYPE))
renderer.set_property('background', '#e4f1f1')
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)
self.column_type.set_clickable(True)
self.column_type.set_sort_indicator(True)
self.column_type.set_sort_column_id(COLUMN.TYPE)
treeview.append_column(self.column_type)
column.set_widget(widget)
column.set_visible(True)
column.set_expand(False)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.TYPE)
treeview.append_column(column)
 
# SAP Note Priority
self.renderer_priority = Gtk.CellRendererText()
self.column_priority = Gtk.TreeViewColumn('Priority', self.renderer_priority, markup=COLUMN.PRIORITY)
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)
self.column_priority.set_sort_indicator(True)
self.column_priority.set_sort_column_id(COLUMN.PRIORITY)
treeview.append_column(self.column_priority)
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_priority', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_priority', Gtk.TreeViewColumn('Priority', renderer, markup=COLUMN.PRIORITY))
renderer.set_property('background', '#f1e4f1')
widget = get_column_header_widget('Priority', 'basico-priority')
column.set_widget(widget)
column.set_visible(True)
column.set_expand(False)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.PRIORITY)
treeview.append_column(column)
 
# SAP Note UpdatedOn
self.renderer_updated = Gtk.CellRendererText()
self.renderer_updated.set_property('background', '#FFE6D1')
self.column_updated = Gtk.TreeViewColumn('Updated', self.renderer_updated, markup=COLUMN.UPDATED)
# SAP Note Updated
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_updated', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_updated', Gtk.TreeViewColumn('Updated', renderer, markup=COLUMN.UPDATED))
renderer.set_property('background', '#FFE6D1')
widget = get_column_header_widget('Updated', '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)
self.column_updated.set_clickable(True)
self.column_updated.set_sort_indicator(True)
self.column_updated.set_sort_column_id(COLUMN.TS_UPDATED)
treeview.append_column(self.column_updated)
column.set_widget(widget)
column.set_visible(True)
column.set_expand(False)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_clickable(True)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP)
column.set_sort_order(Gtk.SortType.DESCENDING)
model.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP, Gtk.SortType.DESCENDING)
treeview.append_column(column)
 
# Timestamp
self.renderer_timestamp = Gtk.CellRendererText()
self.column_timestamp = Gtk.TreeViewColumn('Annotation Id', self.renderer_timestamp, text=COLUMN.TS_UPDATED)
self.column_timestamp.set_visible(False)
self.column_timestamp.set_expand(False)
self.column_timestamp.set_clickable(False)
self.column_timestamp.set_sort_indicator(False)
treeview.append_column(self.column_timestamp)
# Timestamp updated
renderer = self.srvgui.add_widget('visor_sapnotes_renderer_updated_timestamp', Gtk.CellRendererText())
column = self.srvgui.add_widget('visor_sapnotes_column_updated_timestamp', Gtk.TreeViewColumn('Updated', renderer, markup=COLUMN.UPDATED_TIMESTAMP))
column.set_visible(False)
column.set_expand(False)
column.set_clickable(False)
column.set_sort_indicator(True)
column.set_sort_column_id(COLUMN.UPDATED_TIMESTAMP)
column.set_sort_order(Gtk.SortType.ASCENDING)
treeview.append_column(column)
 
# Treeview properties
treeview.set_can_focus(False)
396,20 → 398,20
# new model to create the sorted model. Then, attach the sorted
# model to the treeview...
 
# Treeview filtering:
self.visible_filter = model.filter_new()
self.visible_filter.set_visible_func(self.visible_function)
# Treeview filtering
visible_filter = self.srvgui.add_widget('visor_sapnotes_visible_filter', model.filter_new())
visible_filter.set_visible_func(self.__clb_visible_function)
# https://stackoverflow.com/questions/23355866/user-search-collapsed-rows-in-a-gtk-treeview
 
# TreeView sorting
sorted_model = Gtk.TreeModelSort(model=self.visible_filter)
sorted_model = Gtk.TreeModelSort(model=visible_filter)
self.srvgui.add_widget('visor_sapnotes_sorted_model', sorted_model)
sorted_model.set_sort_func(0, self.sort_function, None)
 
# Selection
self.selection = 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)
treeview.set_model(sorted_model)
436,7 → 438,7
return False
 
 
def visible_function(self, model, itr, data):
def __clb_visible_function(self, model, itr, data):
entry = self.srvgui.get_widget('gtk_entry_filter_visor')
text = self.srvutl.clean_html(entry.get_text())
title = model.get(itr, COLUMN.TITLE)[0]
448,19 → 450,16
 
 
def update_total_sapnotes_count(self):
visible_filter = self.srvgui.get_widget('visor_sapnotes_visible_filter')
statusbar = self.srvgui.get_widget('widget_statusbar')
lblnotescount = self.srvgui.get_widget('gtk_label_total_notes')
total = self.srvdtb.get_total()
count = len(self.visible_filter)
count = len(visible_filter)
lblnotescount.set_markup("<b>%d/<big>%d</big></b>" % (count, total))
msg = 'View populated with %d SAP Notes' % count
self.srvuif.statusbar_msg(msg)
 
 
def get_visible_filter(self):
return self.visible_filter
 
 
def row_changed(self, selection):
pass
# ~ try:
485,7 → 484,7
model[rpath][COLUMN.CHECKBOX] = not model[rpath][COLUMN.CHECKBOX]
 
 
def get_node(self, key, icon, checkbox, sid, title, component, category='', sntype='', priority='', updated='', aid='', timestamp=''):
def get_node(self, key, icon, checkbox, sid, title, component, category='', sntype='', priority='', updated='', timestamp=''):
# Add completion entries
completion = self.srvgui.get_widget('gtk_entrycompletion_visor')
completion_model = completion.get_model()
516,19 → 515,12
 
 
def populate(self, bag=None, cid=None):
self.log.debug("Hello")
model = self.srvgui.get_widget('gtk_model_sapnotes')
sorted_model = self.srvgui.get_widget('visor_sapnotes_sorted_model')
icon_sapnote = self.srvicm.get_pixbuf_icon('basico-sapnote', 32, 32)
# ~ icon_sap_note = self.srvicm.get_pixbuf_icon('basico-sap-note', 32, 32)
# ~ icon_sap_note_standard = self.srvicm.get_pixbuf_icon('basico-sap-note', 32, 32)
icon_bookmark = self.srvicm.get_pixbuf_icon('basico-bookmarks', 32, 32)
for atype in ATYPES:
self.icons['type'][atype.lower()] = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % atype.lower())
self.column_sid.set_visible(True)
# ~ self.column_checkbox.set_visible(False)
# ~ self.column_category.set_visible(False)
# ~ self.column_component.set_visible(True)
completion = self.srvgui.get_widget('gtk_entrycompletion_visor')
completion_model = completion.get_model()
completion_model.clear()
541,7 → 533,6
for sid in self.bag:
metadata = self.srvdtb.get_sapnote_metadata(sid)
if metadata is not None:
# ~ self.log.debug("%s:\n%s", sid, metadata)
bookmark = metadata['bookmark']
title = escape(metadata['title'])
sid = str(int(metadata['id']))
548,7 → 539,6
 
has_annotations = self.srvant.get_by_sid(sid)
has_attachments = self.srvatc.get_by_sid(sid)
# ~ self.log.debug("Annotations: %d, Attachments: %d", len(has_annotations), len(has_attachments))
if bookmark:
icon = icon_bookmark
title = "<b>%s</b>" % title
569,11 → 559,7
timestamp = timestamp.replace('T', '_')
stype = escape(metadata['type'].lower())
icon_name = 'basico-%s' % stype.replace(' ', '-')
# ~ self.log.debug(icon_name)
icon = self.srvicm.get_pixbuf_icon(icon_name, 36, 36)
# ~ self.log.debug(icon)
# ~ self.log.debug(icon_name)
icon_name = None
node = self.get_node( int(metadata['id']),
icon,
False,
586,32 → 572,32
self.srvutl.fuzzy_date_from_timestamp(timestamp),
timestamp
)
pid = model.append(node)
pid = model.append(None, node)
 
# Load annotations
# ~ files = self.srvant.get_by_sid(metadata['id'])
# ~ for fname in files:
# ~ with open(fname, 'r') as fa:
# ~ annotation = json.load(fa)
# ~ atype = annotation['Type']
# ~ try:
# ~ icon = self.icons['type']['%s' % atype.lower()]
# ~ except:
# ~ icon = None
# ~ node = self.get_node( 0,
# ~ icon,
# ~ False,
# ~ '',
# ~ annotation['Title'],
# ~ annotation['Component'],
# ~ '',
# ~ annotation['Type'],
# ~ '',
# ~ self.srvutl.fuzzy_date_from_timestamp(annotation['Timestamp']),
files = self.srvant.get_by_sid(metadata['id'])
for fname in files:
with open(fname, 'r') as fa:
annotation = json.load(fa)
atype = annotation['Type']
try:
icon = self.icons['type']['%s' % atype.lower()]
except:
icon = None
node = self.get_node( 0,
icon,
False,
'',
annotation['Title'],
annotation['Component'],
'',
annotation['Type'],
'',
self.srvutl.fuzzy_date_from_timestamp(annotation['Timestamp']),
# ~ annotation['AID'],
# ~ annotation['Timestamp']
# ~ )
# ~ model.append(pid, node)
annotation['Timestamp']
)
model.append(pid, node)
 
# Load attachments
# ~ files = self.srvatc.get_by_sid(metadata['id'])
638,10 → 624,8
self.update_total_sapnotes_count()
self.show_widgets()
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):
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)