Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 383 → Rev 384

/branches/BR-0.4/basico/services/srv_annotations.py
139,7 → 139,7
 
 
def get_by_sid(self, sid):
ANNOTATION_FILES = LPATH['ANNOTATIONS'] + '%s*.json' % sid
ANNOTATION_FILES = LPATH['ANNOTATIONS'] + '*%s@*.json' % sid
annotations = glob.glob(ANNOTATION_FILES)
annotations.sort(reverse=True)
 
/branches/BR-0.4/basico/services/srv_uif.py
128,27 → 128,28
icon.show_all()
dialog = Gtk.MessageDialog(window, 0, Gtk.MessageType.QUESTION,
Gtk.ButtonsType.YES_NO, question)
dialog.set_size_request(600, 380);
dialog.set_size_request(800, 600);
content_area = dialog.get_content_area()
vbox = Gtk.VBox()
label = Gtk.Label()
label.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
label.set_property('selectable', True)
label.set_xalign(0.0)
label.grab_focus()
msg = '\t<b>This is the list of annotations to be deleted:</b>'
vbox.pack_start(label, False, False, 0)
scr = Gtk.ScrolledWindow()
scr.set_shadow_type(Gtk.ShadowType.NONE)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
vbox = self.annotationbox(bag)
# ~ vbox = Gtk.VBox()
# ~ label = Gtk.Label()
# ~ label.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
# ~ label.set_property('selectable', True)
# ~ label.set_xalign(0.0)
# ~ label.grab_focus()
# ~ msg = '\t<b>This is the list of annotations to be deleted:</b>'
# ~ vbox.pack_start(label, False, False, 0)
# ~ scr = Gtk.ScrolledWindow()
# ~ scr.set_shadow_type(Gtk.ShadowType.NONE)
# ~ scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 
msg += '\n\n'
for aid in bag:
msg += '\t%s\t\n' % self.srvant.get_title(aid)
msg += '\n'
label.set_markup(msg)
# ~ msg += '\n\n'
# ~ for aid in bag:
# ~ msg += '\t%s\t\n' % self.srvant.get_title(aid)
# ~ msg += '\n'
# ~ label.set_markup(msg)
 
vbox.pack_start(scr, True, True, 0)
# ~ vbox.pack_start(scr, True, True, 0)
content_area.pack_start(vbox, True, True, 0)
content_area.show_all()
dialog.set_image(icon)
426,3 → 427,129
box.show_all()
 
return box
 
 
def annotationbox(self, laid):
box = Gtk.Box()
box.set_property('margin', 6)
scr = Gtk.ScrolledWindow()
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scr.set_shadow_type(Gtk.ShadowType.IN)
treeview = Gtk.TreeView()
scr.add(treeview)
box.pack_start(scr, True, True, 0)
 
model = Gtk.ListStore(
str, # aid (hidden)
str, # title
str, # Category
str, # Scope (not used yet)
)
 
# Annotation Id
renderer_aid = Gtk.CellRendererText()
renderer_aid.set_property('xalign', 1.0)
renderer_aid.set_property('height', 36)
# ~ renderer_aid.set_property('background', '#F0E3E3')
column_aid = Gtk.TreeViewColumn('SAP Note', renderer_aid, markup=0)
column_aid.set_visible(False)
column_aid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column_aid.set_expand(False)
column_aid.set_clickable(True)
column_aid.set_sort_indicator(True)
column_aid.set_sort_column_id(0)
column_aid.set_sort_order(Gtk.SortType.ASCENDING)
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
treeview.append_column(column_aid)
 
# Annotation title
renderer_title = Gtk.CellRendererText()
renderer_title.set_property('xalign', 0.0)
renderer_title.set_property('height', 36)
renderer_title.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
# ~ renderer_title.set_property('background', '#FFFEEA')
column_title = Gtk.TreeViewColumn('Title', renderer_title, markup=1)
column_title.set_visible(True)
column_title.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column_title.set_expand(True)
column_title.set_clickable(True)
column_title.set_sort_indicator(True)
column_title.set_sort_column_id(1)
column_title.set_sort_order(Gtk.SortType.ASCENDING)
model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
treeview.append_column(column_title)
 
# Annotation category
renderer_category = Gtk.CellRendererText()
renderer_category.set_property('xalign', 0.0)
renderer_category.set_property('height', 36)
# ~ renderer_category.set_property('background', '#F0E3E3')
column_category = Gtk.TreeViewColumn('Component', renderer_category, markup=2)
column_category.set_visible(True)
column_category.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column_category.set_expand(False)
column_category.set_clickable(True)
column_category.set_sort_indicator(True)
column_category.set_sort_column_id(2)
column_category.set_sort_order(Gtk.SortType.ASCENDING)
model.set_sort_column_id(2, Gtk.SortType.ASCENDING)
treeview.append_column(column_category)
 
# Annotation scope
renderer_scope = Gtk.CellRendererText()
renderer_scope.set_property('xalign', 0.0)
renderer_scope.set_property('height', 36)
# ~ renderer_scope.set_property('background', '#F0E3E3')
column_scope = Gtk.TreeViewColumn('Component', renderer_scope, markup=3)
column_scope.set_visible(False)
column_scope.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column_scope.set_expand(False)
column_scope.set_clickable(True)
column_scope.set_sort_indicator(True)
column_scope.set_sort_column_id(1)
column_scope.set_sort_order(Gtk.SortType.ASCENDING)
model.set_sort_column_id(3, Gtk.SortType.ASCENDING)
treeview.append_column(column_scope)
 
# Treeview properties
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.NONE)
treeview.set_enable_tree_lines(True)
treeview.set_level_indentation(10)
 
# TreeView sorting
def sort_function(model, row1, row2, user_data):
sort_column = 0
 
value1 = model.get_value(row1, sort_column)
value2 = model.get_value(row2, sort_column)
 
if value1 < value2:
return -1
elif value1 == value2:
return 0
else:
return 1
 
self.sorted_model = Gtk.TreeModelSort(model=model)
self.sorted_model.set_sort_func(0, sort_function, None)
 
# Selection
selection = treeview.get_selection()
selection.set_mode(Gtk.SelectionMode.NONE)
 
# Set model (filtered and sorted)
treeview.set_model(self.sorted_model)
 
for aid in laid:
title = self.srvant.get_title(aid)
category = self.srvant.get_metadata_value(aid, 'Category')
model.append([aid, escape(title), category, ''])
 
box.show_all()
 
return box
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
42,7 → 42,7
self.icons = {}
self.icons['type'] = {}
for atype in ATYPES:
self.icons['type'][atype.lower()] = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % atype.lower())
self.icons['type'][atype.lower()] = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % atype.lower(), 32)
self.log.debug("Annotation Visor initialized")
 
 
357,7 → 357,7
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.NONE)
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)
/branches/BR-0.4/basico/widgets/wdg_visor_attachments.py
256,7 → 256,7
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.NONE)
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)
/branches/BR-0.4/basico/widgets/wdg_visor_sapnotes.py
113,11 → 113,11
# Icon
self.renderer_icon = Gtk.CellRendererPixbuf()
self.renderer_icon.set_alignment(0.0, 0.5)
self.column_icon = Gtk.TreeViewColumn('Bookmark', self.renderer_icon, pixbuf=1)
widget = get_column_header_widget('', 'basico-bookmarks')
self.column_icon.set_widget(widget)
self.column_icon = Gtk.TreeViewColumn('', self.renderer_icon, pixbuf=1)
# ~ widget = get_column_header_widget('', 'basico-bookmarks')
# ~ self.column_icon.set_widget(widget)
self.column_icon.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_icon.set_visible(True)
self.column_icon.set_visible(False)
self.column_icon.set_expand(False)
self.column_icon.set_clickable(False)
self.column_icon.set_sort_indicator(False)
141,7 → 141,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', 'basico-sid')
widget = get_column_header_widget('SAP Note', '')
self.column_sid.set_widget(widget)
self.column_sid.set_visible(True)
self.column_sid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
254,7 → 254,7
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.NONE)
self.treeview.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
self.treeview.set_enable_tree_lines(True)
self.treeview.set_level_indentation(10)
# ~ self.treeview.modify_font(Pango.FontDescription('Monospace 10'))
412,15 → 412,27
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']))
 
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
sid = "<b>%s</b>" % sid
else:
icon = icon_sapnote
if len(has_annotations) > 0 and len(has_attachments) > 0:
icon = self.srvicm.get_pixbuf_icon('basico-annotation-attachment', 32, 32)
elif len(has_annotations) > 0 and len(has_attachments) == 0:
icon = self.srvicm.get_pixbuf_icon('basico-annotation', 32, 32)
elif len(has_annotations) == 0 and len(has_attachments) > 0:
icon = self.srvicm.get_pixbuf_icon('basico-attachment', 32, 32)
else:
icon = icon_sapnote
 
timestamp = metadata['releasedon']
timestamp = timestamp.replace('-', '')
/branches/BR-0.4/setup.py
56,6 → 56,7
'basico/data/icons/basico-about.svg',
'basico/data/icons/basico-add.svg',
'basico/data/icons/basico-annotation.svg',
'basico/data/icons/basico-annotation-attachment.svg',
'basico/data/icons/basico-annotation-type-bookmark.svg',
'basico/data/icons/basico-edit.svg',
'basico/data/icons/basico-annotation-type-note.svg',