class StockIconDialog(BaseDialog): def __init__(self, parent=None): BaseDialog.__init__(self, parent, title=_('Stock Icons'), buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) self.set_size_request(260, 330) self._stockicons = ObjectList([Column('stock_id', use_stock=True), Column('name')]) self._stockicons.set_headers_visible(False) self._stockicons.connect('row-activated', self._on_stockicons__row_activated) self._icons = {} for stock_label, stock_id in get_stock_icons(): icon = Settable(stock_id=stock_id, name=stock_label) self._stockicons.append(icon) self._icons[stock_id] = icon self.vbox.pack_start(self._stockicons) self._stockicons.show() def select(self, value): icon = self._icons.get(value) if icon: self._stockicons.select(icon) def get_selected(self): icon = self._stockicons.get_selected() if icon: return icon.stock_id def _on_stockicons__row_activated(self, objectlist, icon): self.emit('response', gtk.RESPONSE_OK)
def create_objectlist(self, icon_name, text): l = ObjectList([Column('title', use_markup=True)]) l.connect('row-activated', self._on_item_activated) l.connect('selection-changed', self._on_item_selected) l.set_headers_visible(False) l.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._books.append_page(l, tab_label=self.create_tab_label(icon_name, text)) return l
def create_objectlist(self, icon_name, text): l = ObjectList([Column('title', use_markup=True)]) l.connect('row-activated', self._on_item_activated) l.connect('selection-changed', self._on_item_selected) l.set_headers_visible(False) l.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._books.append_page(l, tab_label=self.create_tab_label( icon_name, text)) return l
class PyflakeView(PidaView): icon_name = 'python-icon' label_text = _('Python Errors') def create_ui(self): self.errors_ol = ObjectList( Column('markup', use_markup=True) ) self.errors_ol.set_headers_visible(False) self.errors_ol.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.add_main_widget(self.errors_ol) self.errors_ol.connect('double-click', self._on_errors_double_clicked) self.errors_ol.show_all() self.sort_combo = AttrSortCombo( self.errors_ol, [ ('lineno', _('Line Number')), ('message_string', _('Message')), ('name', _('Type')), ], 'lineno', ) self.sort_combo.show() self.add_main_widget(self.sort_combo, expand=False) def clear_items(self): self.errors_ol.clear() def set_items(self, items): self.clear_items() for item in items: self.errors_ol.append(self.decorate_pyflake_message(item)) def decorate_pyflake_message(self, msg): args = [('<b>%s</b>' % arg) for arg in msg.message_args] msg.message_string = msg.message % tuple(args) msg.name = msg.__class__.__name__ msg.markup = ('<tt>%s </tt><i>%s</i>\n%s' % (msg.lineno, msg.name, msg.message_string)) return msg def _on_errors_double_clicked(self, ol, item): self.svc.boss.editor.cmd('goto_line', line=item.lineno) def can_be_closed(self): self.svc.get_action('show_python_errors').set_active(False)
class BookmarkView(PidaView): icon_name = 'gtk-library' label_text = _('Bookmarks') def create_ui(self): self._vbox = gtk.VBox() self.create_toolbar() self.create_ui_list() self.add_main_widget(self._vbox) self._vbox.show_all() def create_tab_label(self, icon_name, text): if None in [icon_name, text]: return None label = gtk.Label(text) b_factory = gtk.HBox b = b_factory(spacing=2) icon = gtk.image_new_from_stock(icon_name, gtk.ICON_SIZE_MENU) b.pack_start(icon) b.pack_start(label) b.show_all() return b def create_ui_list(self): self._books = gtk.Notebook() self._books.set_border_width(6) self._list_dirs = ObjectList([Column('markup', data_type=str, use_markup=True)]) self._list_dirs.connect('row-activated', self._on_item_activated) self._list_dirs.connect('selection-changed', self._on_item_selected) self._list_dirs.set_headers_visible(False) self._list_dirs.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._books.append_page(self._list_dirs, tab_label=self.create_tab_label('stock_folder', _('Dirs'))) self._list_files = ObjectList([Column('markup', data_type=str, use_markup=True)]) self._list_files.connect('row-activated', self._on_item_activated) self._list_files.connect('selection-changed', self._on_item_selected) self._list_files.set_headers_visible(False) self._list_files.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._books.append_page(self._list_files, tab_label=self.create_tab_label('text-x-generic', _('Files'))) """ self._list_url = ObjectList([Column('markup', data_type=str, use_markup=True)]) self._list_url.set_headers_visible(False) self._books.add(self._list_url) """ self._vbox.add(self._books) self._books.show_all() def create_toolbar(self): self._uim = gtk.UIManager() self._uim.insert_action_group(self.svc.get_action_group(), 0) self._uim.add_ui_from_file(get_uidef_path('bookmark-toolbar.xml')) self._uim.ensure_update() self._toolbar = self._uim.get_toplevels('toolbar')[0] self._toolbar.set_style(gtk.TOOLBAR_ICONS) self._toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR) self._vbox.pack_start(self._toolbar, expand=False) self._toolbar.show_all() def add_item(self, item): if item.group == 'file': self._list_files.append(item) elif item.group == 'path': self._list_dirs.append(item) elif item.group == 'url': self._list_urls.append(item) def remove_item(self, item): if item.group == 'file': self._list_files.remove(item) elif item.group == 'path': self._list_dirs.remove(item) elif item.group == 'url': self._list_urls.remove(item) def clear_all(self): self._list_files.clear() self._list_dirs.clear() #self._list_urls.clear() def can_be_closed(self): self.svc.get_action('show_bookmark').set_active(False) def _on_item_selected(self, olist, item): self.svc.set_current(item) def _on_item_activated(self, olist, item): item.run(self.svc)
class FormFieldEditor(BasicDialog): size = (700, 400) title = _("Form fields") def __init__(self, store): self.store = store BasicDialog.__init__(self, size=FormFieldEditor.size, title=FormFieldEditor.title) self._create_ui() def _create_ui(self): hbox = gtk.HBox() self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.forms = ObjectList( [Column('description', title=_('Description'), sorted=True, expand=True, format_func=stoqlib_gettext)], self.store.find(UIForm), gtk.SELECTION_BROWSE) self.forms.connect('selection-changed', self._on_forms__selection_changed) self.forms.set_headers_visible(False) self.forms.set_size_request(200, -1) hbox.pack_start(self.forms, False, False) self.forms.show() box = gtk.VBox() hbox.pack_start(box) box.show() self.fields = ObjectList(self._get_columns(), [], gtk.SELECTION_BROWSE) box.pack_start(self.fields) self.fields.show() box.show() def _on_forms__selection_changed(self, forms, form): if not form: return self.fields.add_list(self.store.find(UIField, ui_form=form), clear=True) def _get_columns(self): return [Column('description', title=_('Description'), data_type=str, expand=True, sorted=True, format_func=stoqlib_gettext), Column('visible', title=_('Visible'), data_type=bool, width=120, editable=True), Column('mandatory', title=_('Mandatory'), data_type=bool, width=120, editable=True)] def confirm(self, *args): self.store.confirm(True) BasicDialog.confirm(self, *args) info(_("Changes will be applied after all instances of Stoq are restarted.")) def cancel(self, *args): self.store.rollback(close=False) BasicDialog.confirm(self, *args)
class ShortcutsEditor(BasicDialog): size = (700, 400) title = _("Keyboard shortcuts") def __init__(self): BasicDialog.__init__(self, size=ShortcutsEditor.size, title=ShortcutsEditor.title) self._create_ui() def _create_ui(self): self.cancel_button.hide() hbox = gtk.HBox(spacing=6) self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.categories = ObjectList( [Column('label', sorted=True, expand=True)], get_binding_categories(), gtk.SELECTION_BROWSE) self.categories.connect('selection-changed', self._on_categories__selection_changed) self.categories.set_headers_visible(False) self.categories.set_size_request(200, -1) hbox.pack_start(self.categories, False, False) self.categories.show() box = gtk.VBox(spacing=6) hbox.pack_start(box) box.show() self.shortcuts = ObjectList(self._get_columns(), [], gtk.SELECTION_BROWSE) box.pack_start(self.shortcuts) self.shortcuts.show() self._label = gtk.Label( _("You need to restart Stoq for the changes to take effect")) box.pack_start(self._label, False, False, 6) box.show() defaults_button = gtk.Button(_("Reset defaults")) defaults_button.connect('clicked', self._on_defaults_button__clicked) self.action_area.pack_start(defaults_button, False, False, 6) self.action_area.reorder_child(defaults_button, 0) defaults_button.show() def _on_categories__selection_changed(self, categories, category): if not category: return self.shortcuts.add_list(get_bindings(category.name), clear=True) def _on_defaults_button__clicked(self, button): old = self.categories.get_selected() api.user_settings.remove('shortcuts') remove_user_bindings() self._label.show() self.categories.refresh() self.categories.select(old) def _get_columns(self): return [Column('description', _("Description"), data_type=str, expand=True, sorted=True), ShortcutColumn('shortcut', _("Shortcut"), self)] def set_binding(self, binding): set_user_binding(binding.name, binding.shortcut) d = api.user_settings.get('shortcuts', {}) d[binding.name] = binding.shortcut self._label.show() def remove_binding(self, binding): remove_user_binding(binding.name) d = api.user_settings.get('shortcuts', {}) try: del d[binding.name] except KeyError: pass self._label.show()
class PluginManagerDialog(BasicDialog): size = (500, 350) title = _(u'Plugin Manager') help_section = 'plugin' def __init__(self, store): header = _(u'Select the plugin you want to activate and click in ' 'the apply button.') BasicDialog.__init__(self, hide_footer=False, size=PluginManagerDialog.size, title=PluginManagerDialog.title, header_text=header) self.store = store self._manager = get_plugin_manager() self._setup_widgets() def _update_widgets(self): selected = self.klist.get_selected() self.ok_button.set_sensitive(selected and selected.can_activate()) def _setup_widgets(self): self.set_ok_label(_(u'Activate'), Gtk.STOCK_APPLY) self.ok_button.set_sensitive(False) plugins = [] for name in sorted(self._manager.available_plugins_names): desc = self._manager.get_description_by_name(name) plugins.append( _PluginModel(name, name in self._manager.installed_plugins_names, desc)) self.klist = ObjectList(self._get_columns(), plugins, Gtk.SelectionMode.BROWSE) self.klist.set_headers_visible(False) self.klist.connect("selection-changed", self._on_klist__selection_changed) self.main.remove(self.main.get_child()) self.main.add(self.klist) self.klist.show() def _get_columns(self): return [ Column('is_active', title=_('Active'), width=20, data_type=bool), Column('icon', data_type=str, width=24, use_stock=True, icon_size=Gtk.IconSize.BUTTON), Column('description', data_type=str, expand=True, use_markup=True) ] def _enable_plugin(self, plugin_model): plugin_name = plugin_model.name # This should not really be necessary, but there may be deadlocks when # activating the plugin. See bug 5272 default_store = get_default_store() default_store.commit() with new_store() as store: self._manager.install_plugin(store, plugin_name) self._manager.activate_plugin(plugin_name) info( _("The plugin %s was successfully activated. Please, restart all " "Stoq instances connected to this installation.") % (plugin_name, )) # # BasicDialog # def confirm(self): msg = _("Are you sure you want activate this plugin?\n" "Please note that, once activated you will not " "be able to disable it.") response = yesno(msg, Gtk.ResponseType.NO, _("Activate plugin"), _("Not now")) if response: self._enable_plugin(self.klist.get_selected()) self.close() # # Callbacks # def _on_klist__selection_changed(self, list, data): self._update_widgets()
class FormFieldEditor(BasicDialog): size = (700, 400) title = _("Form fields") def __init__(self, store): self.store = store BasicDialog.__init__(self, size=FormFieldEditor.size, title=FormFieldEditor.title) self._create_ui() def _create_ui(self): hbox = Gtk.HBox() self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.forms = ObjectList( [Column('description', title=_('Description'), sorted=True, expand=True, format_func=stoqlib_gettext)], self.store.find(UIForm), Gtk.SelectionMode.BROWSE) self.forms.connect('selection-changed', self._on_forms__selection_changed) self.forms.set_headers_visible(False) self.forms.set_size_request(200, -1) hbox.pack_start(self.forms, False, False, 0) self.forms.show() box = Gtk.VBox() hbox.pack_start(box, True, True, 0) box.show() self.fields = ObjectList(self._get_columns(), [], Gtk.SelectionMode.BROWSE) box.pack_start(self.fields, True, True, 0) self.fields.show() box.show() def _on_forms__selection_changed(self, forms, form): if not form: return self.fields.add_list(self.store.find(UIField, ui_form=form), clear=True) self.fields.set_cell_data_func(self._uifield__cell_data_func) def _uifield__cell_data_func(self, column, renderer, obj, text): if isinstance(renderer, Gtk.CellRendererText): return text manager = get_plugin_manager() if manager.is_any_active(['nfe', 'nfce']): is_editable = obj.field_name not in [u'street', u'district', u'city', u'state', u'country', u'street_number'] renderer.set_property('sensitive', is_editable) renderer.set_property('activatable', is_editable) return text def _get_columns(self): return [Column('description', title=_('Description'), data_type=str, expand=True, sorted=True, format_func=stoqlib_gettext), Column('visible', title=_('Visible'), data_type=bool, width=120, editable=True), Column('mandatory', title=_('Mandatory'), data_type=bool, width=120, editable=True)] def confirm(self, *args): self.store.confirm(True) BasicDialog.confirm(self, *args) info(_("Changes will be applied after all instances of Stoq are restarted.")) def cancel(self, *args): self.store.rollback(close=False) BasicDialog.confirm(self, *args)
class PluginManagerDialog(BasicDialog): size = (500, 350) title = _(u'Plugin Manager') help_section = 'plugin' def __init__(self, store): header = _(u'Select the plugin you want to activate and click in ' 'the apply button.') BasicDialog.__init__(self, hide_footer=False, size=PluginManagerDialog.size, title=PluginManagerDialog.title, header_text=header) self.store = store self._manager = get_plugin_manager() self._setup_widgets() def _update_widgets(self): selected = self.klist.get_selected() assert selected self.ok_button.set_sensitive(selected.can_activate()) def _setup_widgets(self): self.set_ok_label(_(u'Activate'), gtk.STOCK_APPLY) self.ok_button.set_sensitive(False) plugins = [] for name in sorted(self._manager.available_plugins_names): # FIXME: Remove when magento plugin is functional for end users if not is_developer_mode() and name == 'magento': continue if platform.system() == 'Windows': if name in ['ecf', 'tef']: continue desc = self._manager.get_description_by_name(name) plugins.append(_PluginModel(name, name in self._manager.installed_plugins_names, desc)) self.klist = ObjectList(self._get_columns(), plugins, gtk.SELECTION_BROWSE) self.klist.set_headers_visible(False) self.klist.connect("selection-changed", self._on_klist__selection_changed) self.main.remove(self.main.get_child()) self.main.add(self.klist) self.klist.show() def _get_columns(self): return [Column('is_active', title=_('Active'), width=20, data_type=bool), Column('icon', data_type=str, width=24, use_stock=True, icon_size=gtk.ICON_SIZE_BUTTON), Column('description', data_type=str, expand=True, use_markup=True)] def _enable_plugin(self, plugin_model): plugin_name = plugin_model.name # This should not really be necessary, but there may be deadlocks when # activating the plugin. See bug 5272 default_store = get_default_store() default_store.commit() self._manager.install_plugin(plugin_name) self._manager.activate_plugin(plugin_name) # # BasicDialog # def confirm(self): msg = _("Are you sure you want activate this plugin?\n" "Please note that, once activated you will not " "be able to disable it.") response = yesno(msg, gtk.RESPONSE_NO, _("Activate plugin"), _("Not now")) if response: self._enable_plugin(self.klist.get_selected()) self.close() # # Callbacks # def _on_klist__selection_changed(self, list, data): self._update_widgets()
class ShortcutsEditor(BasicDialog): size = (700, 400) title = _("Keyboard shortcuts") def __init__(self): BasicDialog.__init__(self, size=ShortcutsEditor.size, title=ShortcutsEditor.title) self._create_ui() def _create_ui(self): self.cancel_button.hide() hbox = gtk.HBox(spacing=6) self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.categories = ObjectList( [Column('label', sorted=True, expand=True)], get_binding_categories(), gtk.SELECTION_BROWSE) self.categories.connect('selection-changed', self._on_categories__selection_changed) self.categories.set_headers_visible(False) self.categories.set_size_request(200, -1) hbox.pack_start(self.categories, False, False) self.categories.show() box = gtk.VBox(spacing=6) hbox.pack_start(box) box.show() self.shortcuts = ObjectList(self._get_columns(), [], gtk.SELECTION_BROWSE) box.pack_start(self.shortcuts) self.shortcuts.show() self._label = gtk.Label( _("You need to restart Stoq for the changes to take effect")) box.pack_start(self._label, False, False, 6) box.show() defaults_button = gtk.Button(_("Reset defaults")) defaults_button.connect('clicked', self._on_defaults_button__clicked) self.action_area.pack_start(defaults_button, False, False, 6) self.action_area.reorder_child(defaults_button, 0) defaults_button.show() def _on_categories__selection_changed(self, categories, category): if not category: return self.shortcuts.add_list(get_bindings(category.name), clear=True) def _on_defaults_button__clicked(self, button): old = self.categories.get_selected() api.user_settings.remove('shortcuts') remove_user_bindings() self._label.show() self.categories.refresh() self.categories.select(old) def _get_columns(self): return [ Column('description', _("Description"), data_type=str, expand=True, sorted=True), ShortcutColumn('shortcut', _("Shortcut"), self) ] def set_binding(self, binding): set_user_binding(binding.name, binding.shortcut) d = api.user_settings.get('shortcuts', {}) d[binding.name] = binding.shortcut self._label.show() def remove_binding(self, binding): remove_user_binding(binding.name) d = api.user_settings.get('shortcuts', {}) try: del d[binding.name] except KeyError: pass self._label.show()
class PluginManagerDialog(BasicDialog): size = (500, 350) title = _(u'Plugin Manager') help_section = 'plugin' def __init__(self, store): header = _(u'Select the plugin you want to activate and click in ' 'the apply button.') BasicDialog.__init__(self, hide_footer=False, size=PluginManagerDialog.size, title=PluginManagerDialog.title, header_text=header) self.store = store self._manager = get_plugin_manager() self._setup_widgets() def _update_widgets(self): selected = self.klist.get_selected() assert selected self.ok_button.set_sensitive(selected.can_activate()) def _setup_widgets(self): self.set_ok_label(_(u'Activate'), Gtk.STOCK_APPLY) self.ok_button.set_sensitive(False) plugins = [] for name in sorted(self._manager.available_plugins_names): desc = self._manager.get_description_by_name(name) plugins.append(_PluginModel(name, name in self._manager.installed_plugins_names, desc)) self.klist = ObjectList(self._get_columns(), plugins, Gtk.SelectionMode.BROWSE) self.klist.set_headers_visible(False) self.klist.connect("selection-changed", self._on_klist__selection_changed) self.main.remove(self.main.get_child()) self.main.add(self.klist) self.klist.show() def _get_columns(self): return [Column('is_active', title=_('Active'), width=20, data_type=bool), Column('icon', data_type=str, width=24, use_stock=True, icon_size=Gtk.IconSize.BUTTON), Column('description', data_type=str, expand=True, use_markup=True)] def _enable_plugin(self, plugin_model): plugin_name = plugin_model.name # This should not really be necessary, but there may be deadlocks when # activating the plugin. See bug 5272 default_store = get_default_store() default_store.commit() with new_store() as store: self._manager.install_plugin(store, plugin_name) self._manager.activate_plugin(plugin_name) info(_("The plugin %s was successfully activated. Please, restart all " "Stoq instances connected to this installation.") % (plugin_name, )) # # BasicDialog # def confirm(self): msg = _("Are you sure you want activate this plugin?\n" "Please note that, once activated you will not " "be able to disable it.") response = yesno(msg, Gtk.ResponseType.NO, _("Activate plugin"), _("Not now")) if response: self._enable_plugin(self.klist.get_selected()) self.close() # # Callbacks # def _on_klist__selection_changed(self, list, data): self._update_widgets()
class PluginManagerDialog(BasicDialog): size = (500, 350) title = _(u'Plugin Manager') help_section = 'plugin' def __init__(self, store): header = _(u'Select the plugin you want to activate and click in ' 'the apply button.') BasicDialog.__init__(self, hide_footer=False, size=PluginManagerDialog.size, title=PluginManagerDialog.title, header_text=header) self.store = store self._manager = get_plugin_manager() self._setup_widgets() def _update_widgets(self): selected = self.klist.get_selected() assert selected self.ok_button.set_sensitive(selected.can_activate()) def _setup_widgets(self): self.set_ok_label(_(u'Activate'), gtk.STOCK_APPLY) self.ok_button.set_sensitive(False) plugins = [] for name in sorted(self._manager.available_plugins_names): # FIXME: Remove when magento plugin is functional for end users if not is_developer_mode() and name == 'magento': continue if platform.system() == 'Windows': if name in ['ecf', 'tef']: continue desc = self._manager.get_description_by_name(name) plugins.append( _PluginModel(name, name in self._manager.installed_plugins_names, desc)) self.klist = ObjectList(self._get_columns(), plugins, gtk.SELECTION_BROWSE) self.klist.set_headers_visible(False) self.klist.connect("selection-changed", self._on_klist__selection_changed) self.main.remove(self.main.get_child()) self.main.add(self.klist) self.klist.show() def _get_columns(self): return [ Column('is_active', title=_('Active'), width=20, data_type=bool), Column('icon', data_type=str, width=24, use_stock=True, icon_size=gtk.ICON_SIZE_BUTTON), Column('description', data_type=str, expand=True, use_markup=True) ] def _enable_plugin(self, plugin_model): plugin_name = plugin_model.name # This should not really be necessary, but there may be deadlocks when # activating the plugin. See bug 5272 default_store = get_default_store() default_store.commit() self._manager.install_plugin(plugin_name) self._manager.activate_plugin(plugin_name) # # BasicDialog # def confirm(self): msg = _("Are you sure you want activate this plugin?\n" "Please note that, once activated you will not " "be able to disable it.") response = yesno(msg, gtk.RESPONSE_NO, _("Activate plugin"), _("Not now")) if response: self._enable_plugin(self.klist.get_selected()) self.close() # # Callbacks # def _on_klist__selection_changed(self, list, data): self._update_widgets()
class FormFieldEditor(BasicDialog): size = (700, 400) title = _("Form fields") def __init__(self, store): self.store = store BasicDialog.__init__(self, size=FormFieldEditor.size, title=FormFieldEditor.title) self._create_ui() def _create_ui(self): hbox = gtk.HBox() self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.forms = ObjectList( [Column('description', title=_('Description'), sorted=True, expand=True, format_func=stoqlib_gettext)], self.store.find(UIForm), gtk.SELECTION_BROWSE) self.forms.connect('selection-changed', self._on_forms__selection_changed) self.forms.set_headers_visible(False) self.forms.set_size_request(200, -1) hbox.pack_start(self.forms, False, False) self.forms.show() box = gtk.VBox() hbox.pack_start(box) box.show() self.fields = ObjectList(self._get_columns(), [], gtk.SELECTION_BROWSE) box.pack_start(self.fields) self.fields.show() box.show() def _on_forms__selection_changed(self, forms, form): if not form: return self.fields.add_list(self.store.find(UIField, ui_form=form), clear=True) def _get_columns(self): return [Column('description', title=_('Description'), data_type=str, expand=True, sorted=True, format_func=stoqlib_gettext), Column('visible', title=_('Visible'), data_type=bool, width=120, editable=True), Column('mandatory', title=_('Mandatory'), data_type=bool, width=120, editable=True)] def confirm(self, *args): self.store.confirm(True) BasicDialog.confirm(self, *args) def cancel(self, *args): self.store.rollback(close=False) BasicDialog.confirm(self, *args)