Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 382 → Rev 383

/branches/BR-0.4/basico/widgets/wdg_visor_sapnotes.py
73,7 → 73,7
self.pack_start(scr, True, True, 0)
 
# Setup model
self.model = Gtk.TreeStore(
self.model = Gtk.ListStore(
int, # key
Pixbuf, # Icon
int, # checkbox
140,8 → 140,8
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 Id', self.renderer_sid, markup=3)
widget = get_column_header_widget('SAP Note Id', 'basico-sid')
self.column_sid = Gtk.TreeViewColumn('SAP Note', self.renderer_sid, markup=3)
widget = get_column_header_widget('SAP Note', 'basico-sid')
self.column_sid.set_widget(widget)
self.column_sid.set_visible(True)
self.column_sid.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
440,53 → 440,53
'',
timestamp
)
pid = self.model.append(None, node)
pid = self.model.append(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']),
annotation['AID'],
annotation['Timestamp']
)
self.model.append(pid, node)
# ~ 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']
# ~ )
# ~ self.model.append(pid, node)
 
# Load attachments
files = self.srvatc.get_by_sid(metadata['id'])
for fname in files:
with open(fname, 'r') as ft:
attachment = json.load(ft)
icon = self.srvicm.get_pixbuf_icon('basico-attachment')
node = self.get_node( 0,
icon,
False,
'',
attachment['Title'],
'Attachment',
'',
attachment['Description'],
'',
self.srvutl.fuzzy_date_from_timestamp(attachment['Created']),
attachment['TID'],
attachment['Created']
)
self.model.append(pid, node)
# ~ files = self.srvatc.get_by_sid(metadata['id'])
# ~ for fname in files:
# ~ with open(fname, 'r') as ft:
# ~ attachment = json.load(ft)
# ~ icon = self.srvicm.get_pixbuf_icon('basico-attachment')
# ~ node = self.get_node( 0,
# ~ icon,
# ~ False,
# ~ '',
# ~ attachment['Title'],
# ~ 'Attachment',
# ~ '',
# ~ attachment['Description'],
# ~ '',
# ~ self.srvutl.fuzzy_date_from_timestamp(attachment['Created']),
# ~ attachment['TID'],
# ~ attachment['Created']
# ~ )
# ~ self.model.append(pid, node)
 
self.treeview.set_model(self.sorted_model)
self.update_total_sapnotes_count()
493,7 → 493,7
self.show_widgets()
stack = self.srvgui.get_widget('gtk_stack_main')
stack.set_visible_child_name('visor')
self.log.debug("Visor updated")
# ~ self.log.debug("Visor updated")
 
def show_widgets(self):
self.srvuif.set_widget_visibility('gtk_label_total_notes', True)
564,14 → 564,31
button.connect('clicked', self.clb_create_annotation, sid)
box.pack_start(button, False, False, 0)
 
fbox = Gtk.VBox()
frame = Gtk.Frame()
frame.set_border_width(3)
label = Gtk.Label()
label.set_markup(' <b>Attachments</b> ')
frame.set_label_widget(label)
# Popover button "Add attachments"
button = get_popover_button("<b>Add attachments</b> to SAP Note %d" % isid, 'basico-attachment')
button = get_popover_button("<b>Add</b> new to SAP Note %d" % isid, 'basico-attachment')
button.set_property('margin', 3)
button.show_all()
button.connect('clicked', self.srvclb.gui_attachment_add_to_sapnote, sid)
box.pack_start(button, False, False, 0)
fbox.pack_start(button, False, False, 0)
 
# Popover button "Show attachments"
if len(self.srvatc.get_by_sid(sid)) > 0:
button = get_popover_button("<b>Show</b> linked to SAP Note %d" % isid, 'basico-attachment')
button.set_property('margin', 3)
button.show_all()
# ~ button.connect('clicked', self.srvclb.gui_attachment_show_, sid)
fbox.pack_start(button, False, False, 0)
frame.add(fbox)
box.pack_start(frame, False, False, 0)
 
# Popover button "Open SAP Note"
button = get_popover_button("<b>Browse</b> SAP Note %d" % isid, 'basico-browse')
button = get_popover_button("<b>Browse</b> SAP Note %d" % isid, 'basico-preview')
button.connect('clicked', self.srvclb.sapnote_browse, sid)
box.pack_start(button, False, False, 0)