Hi,

today i hacked a little bit in tryton/gui/window/view_form/view/
form_gtk/image.py

i added a button for viewing the file in the standard viewer of the
OS
(later i will try to add this button  to the binary-field)

i think this is a little improvement to the usability of the client:


Button
.....
         self.but_open = gtk.Button()
         img_open = gtk.Image()
         img_open.set_from_stock('tryton-find',
gtk.ICON_SIZE_SMALL_TOOLBAR)
         self.but_open.set_image(img_open)
         self.but_open.set_relief(gtk.RELIEF_NONE)
         self.but_open.connect('clicked', self.sig_open)
         self.tooltips.set_tip(self.but_open, _('Save As'))
         self.hbox.pack_start(self.but_open, expand=False, fill=False)
.....

Action

def sig_open(self, widget):
         data = decodestring(self.field.get_client(self.record))
         temp = tempfile.mkstemp()
         filename = temp[1]
         temp=open(filename, "w")
         temp.write(data)
         temp.close()
         if os.name == 'nt':
             #windows
             os.startfile(filename)
         elif os.name == 'mac':
             subprocess.call(('open', filename))
         else:
            #some linux
            subprocess.call(('xdg-open', filename))
         return True

-- 
[email protected] mailing list

Reply via email to