Python gtk.DIALOG_MODAL Examples
The following are 24
code examples of gtk.DIALOG_MODAL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gtk
, or try the search function
.
Example #1
Source File: tintwizard.py From malfs-milis with MIT License | 5 votes |
def errorDialog(parent=None, message="An error has occured!"): """Creates an error dialog.""" dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message) dialog.show() dialog.run() dialog.destroy()
Example #2
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 5 votes |
def msg(self, text, parent): self.msgBox = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text) self.msgBox.set_icon_from_file(ICON_PATH) self.msgBox.connect('response', self.on_clicked) self.msgBox.show_all() return False
Example #3
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 5 votes |
def msgconfirm(text): msgBox = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, text) msgBox.set_icon_from_file(ICON_PATH) response = msgBox.run() msgBox.destroy() return response
Example #4
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 5 votes |
def msgbox(text, parent=None): msgBox = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text) msgBox.set_icon_from_file(ICON_PATH) msgBox.run() msgBox.destroy()
Example #5
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def display_reset_prompt(parent=None, more_settings_shown=False): dialog = gtk.MessageDialog( parent=parent, type=gtk.MESSAGE_WARNING, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=gtk.BUTTONS_YES_NO) dialog.set_transient_for(parent) dialog.set_title(pg.config.PLUGIN_TITLE) dialog.set_markup( gobject.markup_escape_text(_("Are you sure you want to reset settings?"))) if more_settings_shown: checkbutton_reset_operations = gtk.CheckButton( label=_("Remove procedures and constraints"), use_underline=False) dialog.vbox.pack_start(checkbutton_reset_operations, expand=False, fill=False) dialog.set_focus(dialog.get_widget_for_response(gtk.RESPONSE_NO)) dialog.show_all() response_id = dialog.run() dialog.destroy() clear_operations = ( checkbutton_reset_operations.get_active() if more_settings_shown else False) return response_id, clear_operations
Example #6
Source File: menu.py From hardening-script-el6-kickstart with Apache License 2.0 | 5 votes |
def get_password(self,parent): dialog = gtk.Dialog("Configure System Password",parent,gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,(gtk.STOCK_CANCEL,gtk.RESPONSE_REJECT,gtk.STOCK_OK,gtk.RESPONSE_ACCEPT)) self.pass1 = gtk.HBox() self.label1 = gtk.Label(" Passsword: ") self.pass1.pack_start(self.label1,False,True,0) self.password1 = gtk.Entry() self.password1.set_visibility(False) self.pass1.pack_start(self.password1,False,True,0) dialog.vbox.add(self.pass1) self.pass2 = gtk.HBox() self.label2 = gtk.Label(" Verify Password: ") self.pass2.pack_start(self.label2,False,True,0) self.password2 = gtk.Entry() self.password2.set_visibility(False) self.pass2.pack_start(self.password2,False,True,0) dialog.vbox.add(self.pass2) dialog.show_all() response = dialog.run() if response == gtk.RESPONSE_ACCEPT: self.a = self.password1.get_text() self.b = self.password2.get_text() dialog.destroy() else: self.a = '' self.b = '' dialog.destroy() # Appply Configurations to Kickstart File
Example #7
Source File: status_icon_gtk2.py From sun with GNU General Public License v3.0 | 5 votes |
def message(self, data): """Function to display messages to the user """ msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, data) msg.set_resizable(1) msg.set_title(self.dialog_title) self.img.set_from_file(self.sun_icon) msg.set_image(self.img) msg.show_all() msg.run() msg.destroy()
Example #8
Source File: user_messenger.py From deluge-FileBotTool with GNU General Public License v3.0 | 5 votes |
def __init__(self, title, message, parent=None, modal=True, buttons=None): if not buttons: buttons = (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) modal = gtk.DIALOG_MODAL if modal else 0 super(self.__class__, self).__init__(title, parent, modal, buttons) self.message = message label = gtk.Label(message) self.get_content_area().add(label) self.set_gravity(gtk.gdk.GRAVITY_CENTER) self.set_position(gtk.WIN_POS_CENTER) self.show_all()
Example #9
Source File: user_messenger.py From deluge-FileBotTool with GNU General Public License v3.0 | 5 votes |
def __init__(self, title, message, parent=None, modal=False): if modal: modal = gtk.DIALOG_MODAL else: modal = 0 gtk.Dialog.__init__(self, title, parent, modal, (gtk.STOCK_OK, gtk.RESPONSE_OK)) self.message = message label = gtk.Label(message) self.get_content_area().add(label) self.set_position(gtk.WIN_POS_CENTER) self.set_gravity(gtk.gdk.GRAVITY_CENTER) self.show_all()
Example #10
Source File: SurnameMappingGramplet.py From addons-source with GNU General Public License v2.0 | 5 votes |
def show_dialog(self, title, surname, group): labelSurname = gtk.Label(_("Surname")) entrySurname = gtk.Entry() if surname: entrySurname.set_text(surname) labelGroup = gtk.Label(_("Group")) entryGroup = gtk.Entry() if group: entryGroup.set_text(group) dialog = gtk.Dialog(title, None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) table = gtk.Table(2, 2) table.attach(labelSurname, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(labelGroup, 0, 1, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(entrySurname, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(entryGroup, 1, 2, 1, 2, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) dialog.vbox.pack_start(table, fill=True, expand=True) dialog.show_all() response = dialog.run() if response == gtk.RESPONSE_ACCEPT: result = (entrySurname.get_text(), entryGroup.get_text()) else: result = None dialog.destroy() return result
Example #11
Source File: util.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def gerr(message = None): """Display a graphical error. This should only be used for serious errors as it will halt execution""" dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message) dialog.run() dialog.destroy()
Example #12
Source File: tintwizard.py From malfs-milis with MIT License | 5 votes |
def confirmDialog(parent, message): """Creates a confirmation dialog and returns the response.""" dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message) dialog.show() response = dialog.run() dialog.destroy() return response
Example #13
Source File: tintwizard.py From malfs-milis with MIT License | 5 votes |
def quit(self, widget, event=None): """Asks if user would like to save file before quitting, then quits the program.""" if self.toSave: if self.oneConfigFile: response = gtk.RESPONSE_YES else: dialog = gtk.Dialog("Save config?", self, gtk.DIALOG_MODAL, (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) dialog.get_content_area().add(gtk.Label("Save config before quitting?")) dialog.get_content_area().set_size_request(300, 100) dialog.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_CANCEL: return True # Return True to stop it quitting when we hit "Cancel" elif response == gtk.RESPONSE_NO: gtk.main_quit() elif response == gtk.RESPONSE_YES: self.save() gtk.main_quit() else: gtk.main_quit()
Example #14
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def inputdialog(self, text, title, default_response=""): # Define a little helper function def inputdialog_entry_activated(entry): dlg.response(gtk.RESPONSE_OK) # Create the dialog dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, title) dlg.set_title(title) dlg.format_secondary_text(text) # Create an entry widget entry = gtk.Entry() entry.set_text(default_response) entry.connect("activate", inputdialog_entry_activated) dlg.vbox.pack_start(entry) entry.show() # Run the dialog response = dlg.run() dlg.destroy() if response == gtk.RESPONSE_OK: return entry.get_text() return None
Example #15
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def question_yes_no(self, text, title): dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, title) dlg.set_title(title) dlg.format_secondary_text(text) response = dlg.run() dlg.destroy() if response == gtk.RESPONSE_YES: return True return False
Example #16
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def message(self, text, title): dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, title) dlg.set_title(title) dlg.format_secondary_text(text) dlg.run() dlg.destroy()
Example #17
Source File: logger.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def start_logger(self, _widget, Terminal): """ Handle menu item callback by saving text to a file""" savedialog = gtk.FileChooserDialog(title="Save Log File As", action=self.dialog_action, buttons=self.dialog_buttons) savedialog.set_do_overwrite_confirmation(True) savedialog.set_local_only(True) savedialog.show_all() response = savedialog.run() if response == gtk.RESPONSE_OK: try: logfile = os.path.join(savedialog.get_current_folder(), savedialog.get_filename()) fd = open(logfile, 'w+') # Save log file path, # associated file descriptor, signal handler id # and last saved col,row positions respectively. vte_terminal = Terminal.get_vte() (col, row) = vte_terminal.get_cursor_position() self.loggers[vte_terminal] = {"filepath":logfile, "handler_id":0, "fd":fd, "col":col, "row":row} # Add contents-changed callback self.loggers[vte_terminal]["handler_id"] = vte_terminal.connect('contents-changed', self.save) except: e = sys.exc_info()[1] error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, e.strerror) error.run() error.destroy() savedialog.destroy()
Example #18
Source File: custom_commands.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def _error(self, msg): err = gtk.MessageDialog(dialog, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, msg ) err.run() err.destroy()
Example #19
Source File: custom_commands.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def _create_command_dialog(self, enabled_var = False, name_var = "", command_var = ""): dialog = gtk.Dialog( _("New Command"), None, gtk.DIALOG_MODAL, ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT ) ) table = gtk.Table(3, 2) label = gtk.Label(_("Enabled:")) table.attach(label, 0, 1, 0, 1) enabled = gtk.CheckButton() enabled.set_active(enabled_var) table.attach(enabled, 1, 2, 0, 1) label = gtk.Label(_("Name:")) table.attach(label, 0, 1, 1, 2) name = gtk.Entry() name.set_text(name_var) table.attach(name, 1, 2, 1, 2) label = gtk.Label(_("Command:")) table.attach(label, 0, 1, 2, 3) command = gtk.Entry() command.set_text(command_var) table.attach(command, 1, 2, 2, 3) dialog.vbox.pack_start(table) dialog.show_all() return (dialog,enabled,name,command)
Example #20
Source File: terminal.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def key_edit_window_title(self): window = self.get_toplevel() dialog = gtk.Dialog(_('Rename Window'), window, gtk.DIALOG_MODAL, ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT )) dialog.set_default_response(gtk.RESPONSE_ACCEPT) dialog.set_has_separator(False) dialog.set_resizable(False) dialog.set_border_width(8) label = gtk.Label(_('Enter a new title for the Terminator window...')) name = gtk.Entry() name.set_activates_default(True) if window.title.text != self.vte.get_window_title(): name.set_text(self.get_toplevel().title.text) dialog.vbox.pack_start(label, False, False, 6) dialog.vbox.pack_start(name, False, False, 6) dialog.show_all() res = dialog.run() if res == gtk.RESPONSE_ACCEPT: if name.get_text(): window.title.force_title(None) window.title.force_title(name.get_text()) else: window.title.force_title(None) dialog.destroy() return # End key events
Example #21
Source File: custom_commands.py From NINJA-PingU with GNU General Public License v3.0 | 4 votes |
def on_edit(self, button, data): treeview = data['treeview'] selection = treeview.get_selection() (store, iter) = selection.get_selected() if not iter: return (dialog,enabled,name,command) = self._create_command_dialog( enabled_var = store.get_value(iter, CC_COL_ENABLED), name_var = store.get_value(iter, CC_COL_NAME), command_var = store.get_value(iter, CC_COL_COMMAND) ) res = dialog.run() item = {} if res == gtk.RESPONSE_ACCEPT: item['enabled'] = enabled.get_active() item['name'] = name.get_text() item['command'] = command.get_text() if item['name'] == '' or item['command'] == '': err = gtk.MessageDialog(dialog, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, _("You need to define a name and command") ) err.run() err.destroy() else: tmpiter = store.get_iter_first() name_exist = False while tmpiter != None: if store.get_path(tmpiter) != store.get_path(iter) and store.get_value(tmpiter,CC_COL_NAME) == item['name']: name_exist = True break tmpiter = store.iter_next(tmpiter) if not name_exist: store.set(iter, CC_COL_ENABLED,item['enabled'], CC_COL_NAME, item['name'], CC_COL_COMMAND, item['command'] ) else: self._err(_("Name *%s* already exist") % item['name']) dialog.destroy()
Example #22
Source File: data_model_tree.py From cellblender with GNU General Public License v2.0 | 4 votes |
def row_selected ( self, tv, path, col ): selected = tv.get_selection().get_selected() print ( "Row selected type: " + str(type(selected)) ) if type(selected) == type((1,2)): sel_val = selected[0].get_value(selected[1],0) if '=' in sel_val: dm_key = sel_val.split("=")[0].strip() dm_val = sel_val.split("=")[1].strip() sel_path = selected[0].get_path(selected[1]) print ( "selected = " + str(selected)) print ( "get_value(): " + str(sel_val) ) print ( "type(get_value()): " + str(type(sel_val)) ) print ( "get_path(): " + str(selected[0].get_path(selected[1])) ) #__import__('code').interact(local={k: v for ns in (globals(), locals()) for k, v in ns.items()}) #dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) #dialog.set_markup ( "Enter the <b>new value</b>" ) #response = dialog.run() #print ( "Dialog options = " + str(dir(dialog)) ) #print ( "Dialog action = " + str(dialog.get_action()) ) #print ( "Dialog response = " + str(response) ) #dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) dialog.set_markup ( "Enter the new value for <b>" + dm_key + "</b>" ) #create the text input field #dm_key_field = gtk.Entry() dm_val_field = gtk.Entry() #dm_key_field.set_text ( dm_key ) dm_val_field.set_text ( dm_val ) #allow the user to press enter to do ok dm_val_field.connect("activate", responseToOKDialog, dialog, gtk.RESPONSE_OK) #create a horizontal box to pack the dm_key_field and a label hbox = gtk.HBox() hbox.pack_start(gtk.Label(dm_key + " = "), False, 5, 5) #hbox.pack_start(dm_key_field) #hbox.pack_start(gtk.Label(" = "), False, 5, 5) hbox.pack_end(dm_val_field) #some secondary text dialog.format_secondary_markup("Current value = <i>" + dm_val + "</i>") #add it and show it dialog.vbox.pack_end(hbox, True, True, 0) dialog.show_all() #go go go dialog.run() new_assignment = dm_key + " = " + dm_val_field.get_text() print ( "Got: " + new_assignment ) dialog.destroy() #selected[0].set_value( selected[1], 0, "(" + sel_val + ")" ) selected[0].set_value( selected[1], 0, new_assignment )
Example #23
Source File: overwritechooser.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
def _init_gui(self): self._dialog = gimpui.Dialog( title="", role=None, parent=self._parent, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) self._dialog.set_transient_for(self._parent) self._dialog.set_title(self._title) self._dialog.set_border_width(self._DIALOG_BORDER_WIDTH) self._dialog.set_resizable(False) self._dialog_icon = gtk.Image() self._dialog_icon.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG) self._dialog_text = gtk.Label("") self._dialog_text.set_line_wrap(True) self._dialog_text.set_use_markup(True) self._dialog_text_event_box = gtk.EventBox() self._dialog_text_event_box.add(self._dialog_text) self._hbox_dialog_contents = gtk.HBox(homogeneous=False) self._hbox_dialog_contents.set_spacing(self._DIALOG_HBOX_CONTENTS_SPACING) self._hbox_dialog_contents.pack_start(self._dialog_icon, expand=False, fill=False) self._hbox_dialog_contents.pack_start( self._dialog_text_event_box, expand=False, fill=False) self._checkbutton_apply_to_all = gtk.CheckButton( label=_("_Apply action to all files")) self._checkbutton_apply_to_all.set_use_underline(True) self._dialog.vbox.set_spacing(self._DIALOG_VBOX_SPACING) self._dialog.vbox.pack_start(self._hbox_dialog_contents, expand=False, fill=False) self._dialog.vbox.pack_start(self._checkbutton_apply_to_all, expand=False, fill=False) self._buttons = {} for value, display_name in self.values_and_display_names: self._buttons[value] = self._dialog.add_button(display_name, value) self._dialog.action_area.set_spacing(self._DIALOG_ACTION_AREA_SPACING) self._checkbutton_apply_to_all.connect( "toggled", self._on_checkbutton_apply_to_all_toggled) self._is_dialog_text_allocated_size = False self._dialog_text_event_box.connect( "size-allocate", self._on_dialog_text_event_box_size_allocate) self._dialog.set_focus(self._buttons[self.default_value])
Example #24
Source File: container.py From NINJA-PingU with GNU General Public License v3.0 | 4 votes |
def construct_confirm_close(self, window, reqtype): """Create a confirmation dialog for closing things""" # skip this dialog if applicable if self.config['suppress_multiple_term_dialog']: return gtk.RESPONSE_ACCEPT dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL) dialog.set_has_separator(False) dialog.set_resizable(False) dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT) c_all = dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT) c_all.get_children()[0].get_children()[0].get_children()[1].set_label( _('Close _Terminals')) primary = gtk.Label(_('<big><b>Close multiple terminals?</b></big>')) primary.set_use_markup(True) primary.set_alignment(0, 0.5) secondary = gtk.Label(_('This %s has several terminals open. Closing \ the %s will also close all terminals within it.') % (reqtype, reqtype)) secondary.set_line_wrap(True) labels = gtk.VBox() labels.pack_start(primary, False, False, 6) labels.pack_start(secondary, False, False, 6) image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) image.set_alignment(0.5, 0) box = gtk.HBox() box.pack_start(image, False, False, 6) box.pack_start(labels, False, False, 6) dialog.vbox.pack_start(box, False, False, 12) checkbox = gtk.CheckButton(_("Do not show this message next time")) dialog.vbox.pack_end(checkbox) dialog.show_all() result = dialog.run() # set configuration self.config['suppress_multiple_term_dialog'] = checkbox.get_active() self.config.save() dialog.destroy() return(result)