Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 397 → Rev 398

/branches/BR-0.4/basico/widgets/wdg_annot.py
32,6 → 32,7
self.set_homogeneous(False)
self.setup()
 
 
def setup(self):
# Toolbar
self.toolbar = Gtk.Toolbar()
131,7 → 132,25
tool = self.srvuif.get_toolbar_separator(False, False)
self.toolbar.insert(tool, -1)
 
# Is template?
hbox = Gtk.HBox()
tool = Gtk.ToolItem()
icon = self.srvicm.get_new_image_icon('basico-annotation-type-template')
switch = self.srvgui.add_widget('gtk_switch_annotation_template', Gtk.ToggleButton())
# ~ switch.connect('state-set', callback)
label = Gtk.Label()
label.set_markup('<b>Template?</b>')
 
hbox.pack_start(icon, False, False, 3)
hbox.pack_start(label, False, False, 3)
switch.add(hbox)
tool.add(switch)
self.toolbar.insert(tool, -1)
 
# Separator
tool = self.srvuif.get_toolbar_separator(False, False)
self.toolbar.insert(tool, -1)
 
# 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>')
140,6 → 159,7
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)
/branches/BR-0.4/basico/widgets/wdg_visor_annotations.py
414,7 → 414,7
# Annotation Product
self.renderer_type = Gtk.CellRendererText()
self.renderer_type.set_property('background', '#DADAFF')
self.renderer_type.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
# ~ self.renderer_type.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
self.column_type = Gtk.TreeViewColumn('Type', self.renderer_type, markup=7)
widget = get_column_header_widget('Product', 'basico-type')
self.column_type.set_widget(widget)
472,7 → 472,7
self.column_created = Gtk.TreeViewColumn('Created', self.renderer_created, markup=11)
widget = get_column_header_widget('Created', 'basico-chronologic')
self.column_created.set_widget(widget)
self.column_created.set_visible(True)
self.column_created.set_visible(False)
self.column_created.set_expand(False)
self.column_created.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.column_created.set_clickable(True)
/branches/BR-0.4/basico/widgets/wdg_visor_toolbar.py
11,6 → 11,7
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf
from basico.widgets.wdg_cols import CollectionsMgtView
from basico.widgets.wdg_import import ImportWidget
from basico.core.mod_wdg import BasicoWidget
207,17 → 208,23
boxan.set_property('margin', 3)
popoveran.add(boxan)
 
## New annotation
button = Gtk.Button()
button.set_relief(Gtk.ReliefStyle.NONE)
hbox = Gtk.HBox()
icon = self.srvicm.get_new_image_icon('basico-annotation')
label = Gtk.Label()
label.set_markup('<b>New annotation</b>')
label.set_xalign(0.0)
hbox.pack_start(icon, False, False, 3)
hbox.pack_start(label, True, True, 0)
button.add(hbox)
button.set_tooltip_markup('<b>Create a new annotation (not linked to any SAP Note)</b>')
button.connect('clicked', self.clb_create_annotation)
boxan.pack_start(button, False, False, 3)
 
### New annotation from template
combobox = self.combobox_templates()
# ~ button = Gtk.Button()
# ~ button.set_relief(Gtk.ReliefStyle.NONE)
# ~ hboxtp = Gtk.HBox()
# ~ icontpl = self.srvicm.get_new_image_icon('basico-annotation-type-template', 24, 24)
# ~ label = Gtk.Label()
# ~ label.set_markup('<b>From template</b>')
# ~ label.set_xalign(0.0)
# ~ hboxtp.pack_start(icontpl, False, False, 3)
# ~ hboxtp.pack_start(label, True, True, 0)
# ~ button.add(hboxtp)
boxan.pack_start(combobox, False, False, 3)
 
# ~ widget_import = self.srvgui.add_widget('widget_import', ImportWidget(self.app))
281,7 → 288,7
def clb_template_changed(self, combobox):
treeiter = combobox.get_active_iter()
model = combobox.get_model()
aid = model[treeiter][0]
aid = model[treeiter][1]
if len(aid) > 0:
self.srvclb.action_annotation_create_from_template(aid)
 
290,25 → 297,32
tpl_aids = self.srvant.get_annotations_by_type('Template')
self.log.debug(tpl_aids)
 
model = Gtk.ListStore(str, str)
first = model.append(['', '<b>Templates</b>'])
model = Gtk.ListStore(Pixbuf, str, str)
icon = self.srvicm.get_pixbuf_icon('basico-annotation-type-template', 32)
first = model.append([icon, '', '<b>Templates</b>'])
for aid in tpl_aids:
atype = self.srvant.get_metadata_value(aid, 'Type')
icon = self.srvicm.get_pixbuf_icon('basico-annotation-type-%s' % atype.lower(), 32)
title = self.srvant.get_title(aid)
self.log.debug("AID(%s) - Title(%s)", aid, title)
model.append([aid, title])
model.append([icon, aid, title])
 
templates = Gtk.ComboBox.new_with_model(model)
templates.set_active_iter(first)
templates.connect('changed', self.clb_template_changed)
 
renderer = Gtk.CellRendererPixbuf()
templates.pack_start(renderer, False)
templates.add_attribute(renderer, "pixbuf", 0)
 
renderer = Gtk.CellRendererText()
renderer.set_visible(False)
templates.pack_start(renderer, True)
templates.add_attribute(renderer, "text", 0)
templates.add_attribute(renderer, "text", 1)
 
renderer = Gtk.CellRendererText()
templates.pack_start(renderer, True)
templates.add_attribute(renderer, "markup", 1)
templates.add_attribute(renderer, "markup", 2)
 
templates.show_all()
return templates