Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 359 → Rev 360

/branches/BR-0.4/basico/services/srv_callbacks.py
866,24 → 866,124
vpaned.set_position(600)
 
 
def gui_attachment_add(self, *args):
visor = self.srvgui.get_widget('visor_attachments')
# Get Annotation ID (AID) from widget, if any
widget_annotation = self.srvgui.get_widget('widget_annotation')
def gui_attachment_add_to_sapnote(self, button, sid):
visor_attachemnts = self.srvgui.get_widget('visor_attachments')
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
# Create annotation
aid = self.srvant.gen_aid(sid)
annotation = {}
annotation["AID"] = aid
annotation["Title"] = "Attachments added for SAP Note %s" % str(int(sid))
annotation["Component"] = "Annotation"
annotation["Type"] = "Note"
annotation["Category"] = "Inbox"
annotation["Priority"] = "Low"
annotation["Link"] = ""
annotation["LinkType"] = "Website"
annotation["Origin"] = "Service-Attachment"
# Get attachments from filechooser dialog
attachments = self.gui_attachment_show_filechooser()
# Add them to Basico database
if attachments is not None:
content = '== Attachments\n\n'
for attachment in attachments:
# only allow files (avoid directories)
if os.path.isfile(attachment):
content += "* %s\n" % attachment
tid = self.srvatc.create(attachment, aid)
annotation["TID"] = tid
# ~ self.log.debug(annotation)
annotation["Content"] = content
self.srvant.create(annotation)
visor_attachemnts.populate_attachments()
visor_annotations.populate_annotations()
visor_sapnotes.populate_sapnotes()
else:
self.log.warning("No files selected to attach")
 
 
def gui_attachment_add_to_annotation(self, button):
visor_attachemnts = self.srvgui.get_widget('visor_attachments')
visor_annotations = self.srvgui.get_widget('visor_annotations')
aid = widget_annotation.get_aid_from_widget()
 
# Get attachments fro filechooser dialog
# Create annotation
sid = self.srvant.get_sid(aid)
new_aid = self.srvant.gen_aid(sid)
annotation = {}
annotation["AID"] = new_aid
annotation["Title"] = "Attachments added for annotation: %s" % self.srvant.get_title(aid)
annotation["Component"] = "Annotation"
annotation["Type"] = "Note"
annotation["Category"] = "Inbox"
annotation["Priority"] = "Low"
annotation["Link"] = ""
annotation["LinkType"] = "Website"
annotation["Origin"] = "Service-Attachment"
# Get attachments from filechooser dialog
attachments = self.gui_attachment_show_filechooser()
 
# Add them to Basico database
if attachments is not None:
content = '== Attachments\n\n'
for attachment in attachments:
# only allow files (avoid directories)
if os.path.isfile(attachment):
self.srvatc.create(attachment, aid)
visor.populate_attachments()
content += "* %s\n" % attachment
tid = self.srvatc.create(attachment, aid)
annotation["TID"] = tid
# ~ self.log.debug(annotation)
annotation["Content"] = content
self.srvant.create(annotation)
self.srvant.update_timestamp(aid)
visor_attachemnts.populate_attachments()
visor_annotations.populate_annotations()
else:
self.log.warning("No files selected to attach")
def gui_attachment_add(self, button):
visor_attachemnts = self.srvgui.get_widget('visor_attachments')
visor_annotations = self.srvgui.get_widget('visor_annotations')
visor_sapnotes = self.srvgui.get_widget('visor_sapnotes')
# Create annotation
aid = self.srvant.gen_aid('0000000000')
annotation = {}
annotation["AID"] = aid
annotation["Title"] = "Attachments added"
annotation["Component"] = "Annotation"
annotation["Type"] = "Note"
annotation["Category"] = "Inbox"
annotation["Priority"] = "Low"
annotation["Link"] = ""
annotation["LinkType"] = "Website"
annotation["Origin"] = "Service-Attachment"
# Get attachments from filechooser dialog
attachments = self.gui_attachment_show_filechooser()
# Add them to Basico database
if attachments is not None:
content = '== Attachments\n\n'
for attachment in attachments:
# only allow files (avoid directories)
if os.path.isfile(attachment):
content += "* %s\n" % attachment
tid = self.srvatc.create(attachment, aid)
annotation["TID"] = tid
# ~ self.log.debug(annotation)
annotation["Content"] = content
self.srvant.create(annotation)
visor_attachemnts.populate_attachments()
visor_annotations.populate_annotations()
else:
self.log.warning("No files selected to attach")
 
def gui_attachment_show_filechooser(self):
filenames = None