Reviewers: ,
Please review this at http://codereview.tryton.org/620003/ Affected files: M tryton/gui/window/form.py M tryton/gui/window/tabcontent.py Index: tryton/gui/window/form.py =================================================================== --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -611,3 +611,34 @@ def set_cursor(self): if self.screen: self.screen.set_cursor(reset_view=False) + + def show_url(self, button): + try: + res_id = (self.screen.current_record.id + if self.screen.current_record else None) + url = RPCExecute('model', self.model, 'get_url', res_id) + except RPCException: + return + + clipboard = gtk.Clipboard() + clipboard.set_text(url) + + win = gtk.Dialog() + win.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) + win.set_transient_for(button.get_toplevel()) + win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP_MENU) + win.set_destroy_with_parent(True) + win.set_title('Tryton') + win.set_icon(TRYTON_ICON) + win.set_default_response(gtk.RESPONSE_OK) + url_entry = gtk.Entry() + url_entry.set_text(url) + url_entry.set_activates_default(True) + url_entry.set_editable(False) + url_entry.select_region(0, -1) + url_entry.set_width_chars(len(url)) + url_entry.show_all() + win.vbox.add(url_entry) + win.run() + win.destroy() + Index: tryton/gui/window/tabcontent.py =================================================================== --- a/tryton/gui/window/tabcontent.py +++ b/tryton/gui/window/tabcontent.py @@ -80,10 +80,19 @@ self.status_label.set_alignment(0.0, 0.5) self.status_label.show() + url_button = gtk.Button() + url_button.connect('clicked', self.show_url) + url_image = gtk.Image() + url_image.set_from_stock('tryton-web-browser', + gtk.ICON_SIZE_SMALL_TOOLBAR) + url_button.add(url_image) + url_button.show_all() + hbox = gtk.HBox() hbox.pack_start(title, expand=True, fill=True) hbox.pack_start(vbox, expand=False, fill=True, padding=20) hbox.pack_start(self.status_label, expand=False, fill=True) + hbox.pack_start(url_button, expand=False, fill=True) hbox.show() frame = gtk.Frame() -- -- tryton-dev@googlegroups.com mailing list