def __init__(self, store, model=None, visual_mode=False): self._confirm_disabled = False # FIXME: # BasicEditor should inheirt from BasicDialog and instantiate # the slave inside here, but it requires some major surgery BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode) self.main_dialog = BasicDialog(title=self.get_title(self.model), header_text=self.header, help_section=self.help_section, size=self.size) # Do not close the dialog if re return False on self.confirm self.main_dialog.enable_confirm_validation = True self.main_dialog.attach_slave("main", self) self.main_dialog.connect('confirm', self._on_main_dialog__confirm) self.main_dialog.connect('cancel', self._on_main_dialog__cancel) # This helps kiwis ui test, set the name of ourselves to # the classname of the slave, which is much more helpful than # just "BasicDialog" self.main_dialog.get_toplevel().set_name(self.__class__.__name__) if self.hide_footer or self.visual_mode: self.main_dialog.hide_footer() for name in self.confirm_widgets: self.set_confirm_widget(getattr(self, name)) self.register_validate_function(self._validation_function) self.force_validation() # We need to use self.model instead of model, since BaseEditorSlave # will create one if its None EditorCreateEvent.emit(self, self.model, store, visual_mode)
def __init__(self, store, model=None, visual_mode=False): self._confirm_disabled = False # FIXME: # BasicEditor should inheirt from BasicDialog and instantiate # the slave inside here, but it requires some major surgery BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode) self.main_dialog = BasicDialog(title=self.get_title(self.model), header_text=self.header, help_section=self.help_section, size=self.size) # Do not close the dialog if re return False on self.confirm self.main_dialog.enable_confirm_validation = True self.main_dialog.attach_slave("main", self) self.main_dialog.connect('confirm', self._on_main_dialog__confirm) self.main_dialog.connect('cancel', self._on_main_dialog__cancel) dialog_toplevel = self.main_dialog.get_toplevel() dialog_toplevel.connect('response', self._on_toplevel__response) dialog_toplevel.connect('delete-event', self._on_toplevel__delete_event) # This helps kiwis ui test, set the name of ourselves to # the classname of the slave, which is much more helpful than # just "BasicDialog" self.main_dialog.get_toplevel().set_name(self.__class__.__name__) if self.hide_footer or self.visual_mode: self.main_dialog.hide_footer() for name in self.confirm_widgets: self.set_confirm_widget(getattr(self, name)) self.register_validate_function(self._validation_function) self.force_validation() # We need to use self.model instead of model, since BaseEditorSlave # will create one if its None EditorCreateEvent.emit(self, self.model, store, visual_mode) if store is not None: # This needs to be the last thing done on __init__ since we don't want # to consider things like self.create_model as a change self._store_pending_count = store.get_pending_count()