Python gtk.STOCK_OK Examples
The following are 9
code examples of gtk.STOCK_OK().
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: 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 #2
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 #3
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 #4
Source File: handler_editor.py From deluge-FileBotTool with GNU General Public License v3.0 | 5 votes |
def on_save_changes_clicked(self, *args): """send updated handlers dictionary to server, call the callback if supplied""" settings = self.collect_dialog_settings() handler_id = self.handler_name_combo_entry.child.get_text().strip() if not handler_id: dialog = InfoDialog("Identifier Required", "The Handler requires a Name.", modal=True) dialog.run() dialog.destroy() return if handler_id in self.handlers: buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK,) dialog = ResponseDialog("Overwrite?", "Overwrite the profile named {0}? " "Auto-sort rules that use this handler will " "be affected.".format(handler_id), buttons=buttons) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_OK: return self.handlers[handler_id] = settings self.window.destroy() if self.cb: self.cb(handler_id, self.handlers)
Example #5
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 #6
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 #7
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 #8
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 5 votes |
def __init__(self, title, message, default_text='', modal=True, mask=False): gtk.Dialog.__init__(self) self.set_title(title) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) if modal: self.set_modal(True) box = gtk.VBox(spacing=10) box.set_border_width(10) self.vbox.pack_start(box) box.show() if message: label = gtk.Label(message) box.pack_start(label) label.show() self.entry = gtk.Entry() self.entry.set_text(default_text) self.entry.set_visibility(not mask) box.pack_start(self.entry) self.entry.show() self.entry.grab_focus() button = gtk.Button(stock=gtk.STOCK_OK) button.connect("clicked", self.click) self.entry.connect("activate", self.click) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() button.grab_default() button = gtk.Button(stock=gtk.STOCK_CANCEL) button.connect("clicked", self.quit) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() self.ret = None
Example #9
Source File: operations.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
def __init__(self, operation, pdb_procedure, *args, **kwargs): super().__init__(*args, **kwargs) self.set_transient() self.set_resizable(False) self._button_ok = self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) self._button_cancel = self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) self.set_alternative_button_order([gtk.RESPONSE_OK, gtk.RESPONSE_CANCEL]) self._button_reset = gtk.Button() self._button_reset.set_label(_("_Reset")) self.action_area.pack_start(self._button_reset, expand=False, fill=False) self.action_area.set_child_secondary(self._button_reset, True) self._label_procedure_name = pg.gui.EditableLabel() self._label_procedure_name.label.set_use_markup(True) self._label_procedure_name.label.set_ellipsize(pango.ELLIPSIZE_END) self._label_procedure_name.label.set_markup( "<b>{}</b>".format(gobject.markup_escape_text(operation["display_name"].value))) self._label_procedure_name.connect( "changed", self._on_label_procedure_name_changed, operation) if pdb_procedure is not None: self._label_procedure_short_description = gtk.Label() self._label_procedure_short_description.set_line_wrap(True) self._label_procedure_short_description.set_alignment(0.0, 0.5) self._label_procedure_short_description.set_label(pdb_procedure.proc_blurb) self._label_procedure_short_description.set_tooltip_text(pdb_procedure.proc_help) self._table_operation_arguments = gtk.Table(homogeneous=False) self._table_operation_arguments.set_row_spacings(self._TABLE_ROW_SPACING) self._table_operation_arguments.set_col_spacings(self._TABLE_COLUMN_SPACING) # Put widgets in a custom `VBox` because the action area would otherwise # have excessively thick borders for some reason. self._vbox = gtk.VBox() self._vbox.set_border_width(self._DIALOG_BORDER_WIDTH) self._vbox.set_spacing(self._DIALOG_VBOX_SPACING) self._vbox.pack_start(self._label_procedure_name, expand=False, fill=False) if pdb_procedure is not None: self._vbox.pack_start( self._label_procedure_short_description, expand=False, fill=False) self._vbox.pack_start(self._table_operation_arguments, expand=True, fill=True) self.vbox.pack_start(self._vbox, expand=False, fill=False) self._set_arguments(operation, pdb_procedure) self.set_focus(self._button_ok) self._button_reset.connect("clicked", self._on_button_reset_clicked, operation) self.connect("response", self._on_operation_edit_dialog_response)