Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 387 → Rev 388

/branches/BR-0.4/basico/core/mod_win.py
310,6 → 310,7
 
# Main Stack (up)
stack_main = self.srvgui.add_widget('gtk_stack_main', Gtk.Stack())
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)
box.pack_start(stack_main, True, True, 0)
334,14 → 335,7
## Annotation widget stack child
stack_child = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
stack_main.add_titled(stack_child, "annotations", "Annotation widget")
# ~ boxannotations = self.srvgui.add_widget('gtk_vbox_container_annotations', Gtk.VBox())
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
# ~ widget_annotation = self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
# ~ boxannotations.add(widget_annotation) # <--
 
# ~ vpaned.add1(box)
# ~ vpaned.add2(boxannotations)
 
paned.add2(box)
mainbox.pack_start(paned, True, True, 0)
 
381,6 → 375,7
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()
740,10 → 735,16
return box
 
 
# ~ def setup_stack_annotation(self):
# ~ return self.srvgui.add_widget('widget_annotation', AnnotationWidget(self.controller))
def stack_changed(self, stack, gparam):
try:
pos = self.srvgui.get_key_value('current_paned_position')
paned = self.srvgui.get_widget('gtk_hpaned')
paned.set_position(pos)
except KeyError:
pass
# ~ visible_stack_name = stack.get_visible_child_name()
# ~ self.set_visible_stack(visible_stack_name)
 
 
def run(self):
# ~ visor_annotations = self.srvgui.get_widget('visor_annotations')
viewmenu = self.srvgui.get_widget('viewmenu')
/branches/BR-0.4/basico/services/srv_callbacks.py
681,9 → 681,11
def action_annotation_cancel(self, *args):
statusbar = self.srvgui.get_widget('widget_statusbar')
self.gui_annotation_widget_clear()
# ~ self.srvuif.set_widget_visibility('gtk_vbox_container_annotations', False)
# ~ button = self.srvgui.get_widget('gtk_togglebutton_maximize_annotation_widget')
# ~ button.set_active(False)
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)
self.log.debug('Annotation canceled')
self.srvuif.statusbar_msg("Annotation canceled")
self.gui_show_dashboard()
/branches/BR-0.4/basico/services/srv_collections.py
84,6 → 84,8
names = []
for tid in self.clts:
names.append(self.clts[tid])
names.sort()
 
return names
 
 
/branches/BR-0.4/basico/widgets/wdg_annot.py
30,7 → 30,9
self.sid = sid
self.get_services()
self.set_homogeneous(False)
self.setup()
 
def setup(self):
# Toolbar
self.tool_bar = Gtk.Toolbar()
self.pack_start(self.tool_bar, False, True, 0)
51,13 → 53,13
a_category.pack_start(renderer, True)
a_category.add_attribute(renderer, "text", 1)
 
icon = self.srvicm.get_pixbuf_icon('basico-inbox', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-inbox', 18, 18)
active = self.srvgui.add_widget('annotation_category_Inbox', a_category_model.append([icon, 'Inbox']))
 
icon = self.srvicm.get_pixbuf_icon('basico-drafts', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-drafts', 18, 18)
self.srvgui.add_widget('annotation_category_Drafts', a_category_model.append([icon, 'Drafts']))
 
icon = self.srvicm.get_pixbuf_icon('basico-archived', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-archived', 18, 18)
self.srvgui.add_widget('annotation_category_Archived', a_category_model.append([icon, 'Archived']))
 
a_category.set_active_iter(active)
83,7 → 85,7
a_type.pack_start(renderer, True)
a_type.add_attribute(renderer, "text", 1)
for item in ATYPES:
icon = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % item.lower(), 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % item.lower(), 18, 18)
active = self.srvgui.add_widget('annotation_type_%s' % item.title(), a_type_model.append([icon, '%s' % item.title()]))
a_type.set_active_iter(active)
hbox = Gtk.HBox()
110,13 → 112,13
a_priority.pack_start(renderer, True)
a_priority.add_attribute(renderer, "text", 1)
 
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-high', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-high', 18, 18)
self.srvgui.add_widget('annotation_priority_High', a_priority_model.append([icon, 'High']))
 
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-normal', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-normal', 18, 18)
active = self.srvgui.add_widget('annotation_priority_Normal', a_priority_model.append([icon, 'Normal']))
 
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-low', 24, 24)
icon = self.srvicm.get_pixbuf_icon('basico-annotation-priority-low', 18, 18)
self.srvgui.add_widget('annotation_priority_Low', a_priority_model.append([icon, 'Low']))
 
a_priority.set_active_iter(active)
129,6 → 131,44
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
 
# Scope combobox entry
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)
completion.set_model(completion_model)
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)
 
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')
 
vbox.pack_start(scope, True, True, 0)
tool.add(vbox)
self.tool_bar.insert(tool, -1)
 
 
# Tags entry
 
# Attachment button
tool = self.srvgui.add_widget('gtk_button_annotation_toolbar_attachment', Gtk.ToolButton())
tool.set_tooltip_markup('<b>Attach file(s) to this annotation</b>')
206,20 → 246,6
tool = self.srvuif.get_toolbar_separator(False, False)
self.tool_bar.insert(tool, -1)
 
# Maximize toggle button
# ~ tool = Gtk.ToolItem()
# ~ tool.set_expand(False)
# ~ icon = self.srvicm.get_new_image_icon('basico-fullscreen', 24, 24)
# ~ box = self.srvgui.add_widget('gtk_box_container_icon_maximize', Gtk.Box())
# ~ box.pack_start(icon, False, False, 0)
# ~ button = self.srvgui.add_widget('gtk_togglebutton_maximize_annotation_widget', Gtk.ToggleButton())
# ~ button.set_relief(Gtk.ReliefStyle.NONE)
# ~ button.connect('toggled', self.srvclb.gui_maximize_annotation_window)
# ~ button.add(box)
# ~ tool.add(button)
# ~ tool.set_tooltip_markup('<b>Fullscreen/Window mode</b>')
# ~ self.tool_bar.insert(tool, -1)
 
# Toolbar initial settings
self.set_visible(True)
self.set_no_show_all(False)
226,6 → 252,25
self.tool_bar.set_hexpand(True)
 
 
def completion_match_func(self, completion, key, iter):
model = completion.get_model()
text = model.get_value(iter, 0)
if key.upper() in text.upper():
return True
return False
 
 
def scope_activated(self, entry):
scope_text = entry.get_text()
cid = self.srvclt.get_cid_by_name(scope_text)
if cid is None:
for title in self.srvclt.get_collections_name():
if scope_text.upper() in title.upper():
entry.set_text(title)
else:
entry.set_text(scope_text)
 
 
def get_services(self):
self.srvgui = self.get_service("GUI")
self.srvclb = self.get_service('Callbacks')
234,6 → 279,7
self.srvstg = self.get_service('Settings')
self.srvdtb = self.get_service('DB')
self.srvuif = self.get_service("UIF")
self.srvclt = self.get_service('Collections')
 
 
 
248,7 → 294,6
self.sid = sid
self.get_services()
self.__setup()
# ~ self.stack_changed()
 
 
def get_services(self):
316,10 → 361,6
stack_annotation.connect('notify::visible-child', self.stack_changed)
self.container_body.add(stack_annotation)
 
# ~ hpaned = self.srvgui.get_widget('gtk_hpaned')
# ~ hpaned.set_position(0)
# ~ self.log.debug("HPaned position: %d", hpaned.get_position())
 
# Add Annotation preview stack
preview = self.annotation_preview()
stack_annotation.add_titled(preview, "preview", "Preview annotation")
335,9 → 376,7
stack_annotation.add_titled(properties, "properties", "Edit properties")
stack_annotation.child_set_property (properties, "icon-name", "basico-tags")
 
self.set_visible_stack('editor')
# ~ stack_annotation.set_visible_child_full('editor', Gtk.StackTransitionType.CROSSFADE)
# ~ stack_annotation.set_property('visible-child', editor)
# ~ self.set_visible_stack('editor')
 
 
def set_visible_stack(self, stack_name='preview'):
522,6 → 561,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_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')
545,6 → 585,8
except:
a_wdg_priority.set_active_iter(self.srvgui.get_widget('annotation_priority_Normal'))
 
 
 
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'])
568,6 → 610,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_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')
580,6 → 623,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['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)
588,12 → 632,18
 
 
def stack_changed(self, stack, gparam):
paned = self.srvgui.get_widget('gtk_hpaned')
pos = paned.get_position()
self.srvgui.set_key_value('current_paned_position', pos)
paned.set_position(0)
visible_stack_name = stack.get_visible_child_name()
self.log.debug("Annotation Stack changed to: %s", visible_stack_name)
self.set_visible_stack(visible_stack_name)
 
 
def preview(self):
aid = self.get_aid_from_widget()
self.log.debug("Previewing aid: %s", aid)
if len(aid) == 0:
return