Python gtk.MESSAGE_ERROR Examples
The following are 30
code examples of gtk.MESSAGE_ERROR().
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: xdot.py From EasY_HaCk with Apache License 2.0 | 6 votes |
def set_dotcode(self, dotcode, filename=None): self.openfilename = None if isinstance(dotcode, unicode): dotcode = dotcode.encode('utf8') xdotcode = self.run_filter(dotcode) if xdotcode is None: return False try: self.set_xdotcode(xdotcode) except ParseError as ex: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False else: if filename is None: self.last_mtime = None else: self.last_mtime = os.stat(filename).st_mtime self.openfilename = filename return True
Example #2
Source File: xdot.py From EasY_HaCk with Apache License 2.0 | 6 votes |
def run_filter(self, dotcode): if not self.filter: return dotcode p = subprocess.Popen( [self.filter, '-Txdot'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, universal_newlines=True ) xdotcode, error = p.communicate(dotcode) sys.stderr.write(error) if p.returncode != 0: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=error, buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return None return xdotcode
Example #3
Source File: gtk2util.py From python-for-android with Apache License 2.0 | 6 votes |
def _ebFailedLogin(self, reason): if isinstance(reason, failure.Failure): reason = reason.value self.statusMsg(reason) if isinstance(reason, (unicode, str)): text = reason else: text = unicode(reason) msg = gtk.MessageDialog(self._loginDialog, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, text) msg.show_all() msg.connect("response", lambda *a: msg.destroy()) # hostname not found # host unreachable # connection refused # authentication failed # no such service # no such perspective # internal server error
Example #4
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 6 votes |
def _on_text_entry_changed(self, entry, setting, name_preview_lock_update_key=None): try: setting.gui.update_setting_value() except pg.setting.SettingValueError as e: pg.invocation.timeout_add_strict( self._DELAY_NAME_PREVIEW_UPDATE_TEXT_ENTRIES_MILLISECONDS, self._name_preview.set_sensitive, False) self._display_inline_message(str(e), gtk.MESSAGE_ERROR, setting) self._name_preview.lock_update(True, name_preview_lock_update_key) else: self._name_preview.lock_update(False, name_preview_lock_update_key) if self._message_setting == setting: self._display_inline_message(None) self._name_preview.add_function_at_update( self._name_preview.set_sensitive, True) pg.invocation.timeout_add_strict( self._DELAY_NAME_PREVIEW_UPDATE_TEXT_ENTRIES_MILLISECONDS, self._name_preview.update)
Example #5
Source File: gtktools.py From Computable with MIT License | 6 votes |
def error_message(msg, parent=None, title=None): """ create an error message dialog with string msg. Optionally set the parent widget and dialog title """ dialog = gtk.MessageDialog( parent = None, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = msg) if parent is not None: dialog.set_transient_for(parent) if title is not None: dialog.set_title(title) else: dialog.set_title('Error!') dialog.show() dialog.run() dialog.destroy() return None
Example #6
Source File: gtktools.py From matplotlib-4-abaqus with MIT License | 6 votes |
def error_message(msg, parent=None, title=None): """ create an error message dialog with string msg. Optionally set the parent widget and dialog title """ dialog = gtk.MessageDialog( parent = None, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = msg) if parent is not None: dialog.set_transient_for(parent) if title is not None: dialog.set_title(title) else: dialog.set_title('Error!') dialog.show() dialog.run() dialog.destroy() return None
Example #7
Source File: gtk2util.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def _ebFailedLogin(self, reason): if isinstance(reason, failure.Failure): reason = reason.value self.statusMsg(reason) if isinstance(reason, (unicode, str)): text = reason else: text = unicode(reason) msg = gtk.MessageDialog(self._loginDialog, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, text) msg.show_all() msg.connect("response", lambda *a: msg.destroy()) # hostname not found # host unreachable # connection refused # authentication failed # no such service # no such perspective # internal server error
Example #8
Source File: xdot.py From POC-EXP with GNU General Public License v3.0 | 6 votes |
def run_filter(self, dotcode): if not self.filter: return dotcode p = subprocess.Popen( [self.filter, '-Txdot'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, universal_newlines=True ) xdotcode, error = p.communicate(dotcode) sys.stderr.write(error) if p.returncode != 0: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=error, buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return None return xdotcode
Example #9
Source File: xdot.py From POC-EXP with GNU General Public License v3.0 | 6 votes |
def set_dotcode(self, dotcode, filename=None): self.openfilename = None if isinstance(dotcode, unicode): dotcode = dotcode.encode('utf8') xdotcode = self.run_filter(dotcode) if xdotcode is None: return False try: self.set_xdotcode(xdotcode) except ParseError as ex: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False else: if filename is None: self.last_mtime = None else: self.last_mtime = os.stat(filename).st_mtime self.openfilename = filename return True
Example #10
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _set_settings(func): """ This is a decorator for `Group.apply_gui_values_to_settings()` that prevents the decorated function from being executed if there are invalid setting values. For the invalid values, an error message is displayed. This decorator is meant to be used in the `ExportLayersDialog` class. """ @functools.wraps(func) def func_wrapper(self, *args, **kwargs): try: self._settings["main"].apply_gui_values_to_settings() self._settings["gui"].apply_gui_values_to_settings() self._settings["gui_session/current_directory"].gui.update_setting_value() self._settings["main/output_directory"].set_value( self._settings["gui_session/current_directory"].value) self._settings["gui_session/name_preview_layers_collapsed_state"].value[ self._image.ID] = self._name_preview.collapsed_items self._settings["main/selected_layers"].value[ self._image.ID] = self._name_preview.selected_items self._settings["gui_session/image_preview_displayed_layers"].value[ self._image.ID] = ( self._image_preview.layer_elem.item.ID if self._image_preview.layer_elem is not None else None) except pg.setting.SettingValueError as e: self._display_inline_message(str(e), gtk.MESSAGE_ERROR, e.setting) return func(self, *args, **kwargs) return func_wrapper
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: xdot.py From openxenmanager with GNU General Public License v2.0 | 5 votes |
def set_dotcode(self, dotcode, filename='<stdin>'): if isinstance(dotcode, unicode): dotcode = dotcode.encode('utf8') p = subprocess.Popen( [self.filter, '-Txdot'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, universal_newlines=True ) xdotcode, error = p.communicate(dotcode) if p.returncode != 0: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=error, buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False try: self.set_xdotcode(xdotcode) except ParseError, ex: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False
Example #13
Source File: xdot.py From openxenmanager with GNU General Public License v2.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError, ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title('Dot Viewer') dlg.run() dlg.destroy()
Example #14
Source File: xdot.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError as ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title(self.base_title) dlg.run() dlg.destroy()
Example #15
Source File: message_label.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _on_popup_more_show(self, popup): self._popup_hide_context.connect_button_press_events_for_hiding() self._popup_more.set_screen(self._button_more.get_screen()) if self._message_type != gtk.MESSAGE_ERROR: self._timeout_remove_strict(self._clear_delay, self.set_text)
Example #16
Source File: message_label.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _on_popup_more_hide(self, popup): self._popup_hide_context.disconnect_button_press_events_for_hiding() if self._message_type != gtk.MESSAGE_ERROR: self._timeout_add_strict(self._clear_delay, self.set_text, None)
Example #17
Source File: menu.py From hardening-script-el6-kickstart with Apache License 2.0 | 5 votes |
def lvm_check(self,args): self.lvm = self.root_partition.get_value_as_int()+self.home_partition.get_value_as_int()+self.tmp_partition.get_value_as_int()+self.var_partition.get_value_as_int()+self.log_partition.get_value_as_int()+self.audit_partition.get_value_as_int()+self.swap_partition.get_value_as_int()+self.www_partition.get_value_as_int()+self.opt_partition.get_value_as_int() self.partition_used.set_label(str(self.lvm)+'%') if int(self.lvm) > 100: self.MessageBox(self.window,"<b>Verify that LVM configuration is not over 100%!</b>",gtk.MESSAGE_ERROR) return False else: return True # Display Message Box (e.g. Help Screen, Warning Screen, etc.)
Example #18
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _display_inline_message_on_setting_value_error( self, exc_type, exc_value, exc_traceback): if issubclass(exc_type, pg.setting.SettingValueError): self._display_inline_message(str(exc_value), gtk.MESSAGE_ERROR) return True else: return False
Example #19
Source File: xdot.py From EasY_HaCk with Apache License 2.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError as ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title(self.base_title) dlg.run() dlg.destroy()
Example #20
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 #21
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 #22
Source File: xdot.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError, ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title('Dot Viewer') dlg.run() dlg.destroy()
Example #23
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 #24
Source File: custom_commands.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def on_new(self, button, data): (dialog,enabled,name,command) = self._create_command_dialog() 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: # we have a new command store = data['treeview'].get_model() iter = store.get_iter_first() name_exist = False while iter != None: if store.get_value(iter,CC_COL_NAME) == item['name']: name_exist = True break iter = store.iter_next(iter) if not name_exist: store.append((item['enabled'], item['name'], item['command'])) else: self._err(_("Name *%s* already exist") % item['name']) dialog.destroy()
Example #25
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 #26
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 #27
Source File: xdot.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def set_dotcode(self, dotcode, filename='<stdin>'): if isinstance(dotcode, unicode): dotcode = dotcode.encode('utf8') p = subprocess.Popen( [self.filter, '-Txdot'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, universal_newlines=True ) xdotcode, error = p.communicate(dotcode) if p.returncode != 0: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=error, buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False try: self.set_xdotcode(xdotcode) except ParseError, ex: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False
Example #28
Source File: xdot.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError, ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title('Dot Viewer') dlg.run() dlg.destroy()
Example #29
Source File: xdot.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def open_file(self, filename): try: fp = file(filename, 'rt') self.set_dotcode(fp.read(), filename) fp.close() except IOError, ex: dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dlg.set_title('Dot Viewer') dlg.run() dlg.destroy()
Example #30
Source File: xdot.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def set_dotcode(self, dotcode, filename='<stdin>'): if isinstance(dotcode, unicode): dotcode = dotcode.encode('utf8') p = subprocess.Popen( [self.filter, '-Txdot'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, universal_newlines=True ) xdotcode, error = p.communicate(dotcode) if p.returncode != 0: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=error, buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False try: self.set_xdotcode(xdotcode) except ParseError, ex: dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, message_format=str(ex), buttons=gtk.BUTTONS_OK) dialog.set_title('Dot Viewer') dialog.run() dialog.destroy() return False