def dialog_args(self): ''' Create a dialog ''' d = HIGDialog(_('Arguments')) description_label = HIGEntryLabel( _('Insert the description to argument:')) description_label.show() description_entry = HIGTextEntry() text = self.arguments_entry.get_text() description_entry.set_text(text) description_entry.show() combo_box = gtk.combo_box_new_text() combo_box.set_wrap_width(1) index = -1 j = 0 for i in ARG_TYPES: combo_box.append_text(ARG_TYPES[i]) if i == self.arg_type: index = j j = j + 1 if index > -1: combo_box.set_active(index) combo_box.show() d.vbox.pack_start(description_label, False, False) d.vbox.pack_start(description_entry, False, False) d.vbox.pack_start(combo_box, False, False) d.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) d.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) resp = d.run() result = None, None if resp == gtk.RESPONSE_OK: model = combo_box.get_model() active = combo_box.get_active() if active < 0: return None, None combo_selected = model[active][0] for i in ARG_TYPES: if combo_selected == ARG_TYPES[i]: combo_selected = i result = description_entry.get_text(), combo_selected #self.insert_arg_button.set_label('Edit args') #self.insert_arg_button. d.destroy() return result
def dialog_args(self): ''' Create a dialog ''' d = HIGDialog(_('Arguments')) description_label = HIGEntryLabel( _('Insert the description to argument:')) description_label.show() description_entry = HIGTextEntry() text = self.arguments_entry.get_text() description_entry.set_text(text) description_entry.show() combo_box = gtk.combo_box_new_text() combo_box.set_wrap_width(1) index = -1 j = 0 for i in ARG_TYPES: combo_box.append_text(ARG_TYPES[i]) if i == self.arg_type: index = j j = j + 1 if index > -1 : combo_box.set_active(index) combo_box.show() d.vbox.pack_start(description_label, False, False) d.vbox.pack_start(description_entry, False, False) d.vbox.pack_start(combo_box, False, False) d.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) d.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) resp = d.run() result = None, None if resp == gtk.RESPONSE_OK: model = combo_box.get_model() active = combo_box.get_active() if active < 0: return None, None combo_selected = model[active][0] for i in ARG_TYPES: if combo_selected == ARG_TYPES[i]: combo_selected = i result = description_entry.get_text(), combo_selected #self.insert_arg_button.set_label('Edit args') #self.insert_arg_button. d.destroy() return result
def quit(self, widget=None, extra=None): if self.deleted: dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) alert = HIGEntryLabel('<b>' + _("Deleting Profile") + '</b>') text = HIGEntryLabel( _('Your profile is going to be deleted! Click\ Ok to continue, or Cancel to go back to Profile Editor.' )) hbox = HIGHBox() hbox.set_border_width(5) hbox.set_spacing(12) vbox = HIGVBox() vbox.set_border_width(5) vbox.set_spacing(12) image = gtk.Image() image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) vbox.pack_start(alert) vbox.pack_start(text) hbox.pack_start(image) hbox.pack_start(vbox) dialog.vbox.pack_start(hbox) dialog.vbox.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_CANCEL: return None self.destroy() if self.scan_notebook != None: for i in xrange(self.scan_notebook.get_n_pages()): page = self.scan_notebook.get_nth_page(i) page.toolbar.profile_entry.update()
def on_delete(self, widget=None): if not self.profile_name: return self.on_cancel() dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) alert = HIGEntryLabel('<b>' + _("Deleting Profile") + '</b>') text = HIGEntryLabel( _('Your profile is going to be deleted! Click \ Ok to continue, or Cancel to go back to Profile Editor.')) hbox = HIGHBox() hbox.set_border_width(5) hbox.set_spacing(12) vbox = HIGVBox() vbox.set_border_width(5) vbox.set_spacing(12) image = gtk.Image() image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) vbox.pack_start(alert) vbox.pack_start(text) hbox.pack_start(image) hbox.pack_start(vbox) dialog.vbox.pack_start(hbox) dialog.vbox.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_CANCEL: return None self.deleted = True self.profile.remove_profile(self.profile_name) self.on_cancel()
def on_delete(self, widget=None): if not self.profile_name: return self.on_cancel() dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) alert = HIGEntryLabel('<b>'+_("Deleting Profile")+'</b>') text = HIGEntryLabel(_('Your profile is going to be deleted! Click \ Ok to continue, or Cancel to go back to Profile Editor.')) hbox = HIGHBox() hbox.set_border_width(5) hbox.set_spacing(12) vbox = HIGVBox() vbox.set_border_width(5) vbox.set_spacing(12) image = gtk.Image() image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) vbox.pack_start(alert) vbox.pack_start(text) hbox.pack_start(image) hbox.pack_start(vbox) dialog.vbox.pack_start(hbox) dialog.vbox.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_CANCEL: return None self.deleted = True self.profile.remove_profile(self.profile_name) self.on_cancel()
def quit(self, widget=None, extra=None): if self.deleted: dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) alert = HIGEntryLabel('<b>'+_("Deleting Profile")+'</b>') text = HIGEntryLabel(_('Your profile is going to be deleted! Click\ Ok to continue, or Cancel to go back to Profile Editor.')) hbox = HIGHBox() hbox.set_border_width(5) hbox.set_spacing(12) vbox = HIGVBox() vbox.set_border_width(5) vbox.set_spacing(12) image = gtk.Image() image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) vbox.pack_start(alert) vbox.pack_start(text) hbox.pack_start(image) hbox.pack_start(vbox) dialog.vbox.pack_start(hbox) dialog.vbox.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_CANCEL: return None self.destroy() if self.scan_notebook != None: for i in xrange(self.scan_notebook.get_n_pages()): page = self.scan_notebook.get_nth_page(i) page.toolbar.profile_entry.update()