def message(self, text, title=None): flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT dialog = gtk.MessageDialog(parent=self.toplevel, flags=flags, buttons=gtk.BUTTONS_OK, message_format=text) if title is not None: dialog.set_title(title) dialog.run() dialog.destroy()
def run_view_dialog(self, entity, action): with TemporaryCursor(self): db = action.db parent = self.toplevel dialog = form.get_view_dialog( parent, db, entity, action, self.get_value_handlers, self.set_field_handlers, ) dialog.run() dialog.destroy()
def run_tx_dialog(self, tx, action): with TemporaryCursor(self): db = action.db parent = self.toplevel dialog = form.get_tx_dialog( parent, db, tx, action, self.get_value_handlers, self.set_field_handlers, ) dialog.run() tx_result = dialog.tx_result dialog.destroy() return tx_result
def create_backup(self, filename): if os.path.isfile(filename): n = 1 backup_filename = filename + '.bk%s' % n while os.path.isfile(backup_filename): n += 1 backup_filename = filename + '.bk%s' % n os.rename(filename, backup_filename) # Popup a message telling them the file was renamed. msg = '%s already exists, so a backup copy was saved as %s.' % ( filename, backup_filename) flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT dialog = gtk.MessageDialog(parent=self.toplevel, flags=flags, buttons=gtk.BUTTONS_OK, message_format=msg) dialog.run() dialog.destroy()
def run_relationship_dialog(self, entity): from schevogtk2 import relationship with TemporaryCursor(self): db = entity._db parent = self.toplevel dialog = relationship.RelationshipWindow(db, entity) dialog.after_tx = self.after_tx dialog.before_tx = self.before_tx # Be sure to set the get_value and set_field handlers to match # this window. dialog.get_value_handlers = self.get_value_handlers dialog.set_field_handlers = self.set_field_handlers window = dialog.toplevel window.set_modal(True) window.set_transient_for(parent) window.set_position(gtk.WIN_POS_CENTER_ON_PARENT) dialog.run() dialog.destroy()