Python gtk.MessageDialog() Examples
The following are 30
code examples of gtk.MessageDialog().
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: 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 #2
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 #3
Source File: gtktools.py From matplotlib-4-abaqus with MIT License | 6 votes |
def simple_message(msg, parent=None, title=None): """ create a simple message dialog with string msg. Optionally set the parent widget and dialog title """ dialog = gtk.MessageDialog( parent = None, type = gtk.MESSAGE_INFO, 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) dialog.show() dialog.run() dialog.destroy() return None
Example #4
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 #5
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 #6
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 #7
Source File: gtktools.py From Computable with MIT License | 6 votes |
def simple_message(msg, parent=None, title=None): """ create a simple message dialog with string msg. Optionally set the parent widget and dialog title """ dialog = gtk.MessageDialog( parent = None, type = gtk.MESSAGE_INFO, 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) dialog.show() dialog.run() dialog.destroy() return None
Example #8
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 #9
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 #10
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 #11
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 #12
Source File: core.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def update_view_timeout(self): #print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): while gtk.events_pending(): gtk.main_iteration() pause_messages = self.simulation.pause_messages self.simulation.pause_messages = [] try: self.update_view() self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period #print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: #print pause_messages dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format='\n'.join(pause_messages)) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) # if we're paused, stop the update timer if not self.play_button.get_active(): self._update_timeout_id = None return False #print "view: self.simulation.go.set()" self.simulation.go.set() #print "view: done." return True
Example #13
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 #14
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 #15
Source File: menu.py From hardening-script-el6-kickstart with Apache License 2.0 | 5 votes |
def MessageBox(self,parent,text,type=gtk.MESSAGE_INFO): message = gtk.MessageDialog(parent,0,type,gtk.BUTTONS_OK) message.set_markup(text) response = message.run() if response == gtk.RESPONSE_OK: message.destroy() # Get Password
Example #16
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 #17
Source File: core.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
def update_view_timeout(self): #print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): while gtk.events_pending(): gtk.main_iteration() pause_messages = self.simulation.pause_messages self.simulation.pause_messages = [] try: self.update_view() self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period #print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: #print pause_messages dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format='\n'.join(pause_messages)) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) # if we're paused, stop the update timer if not self.play_button.get_active(): self._update_timeout_id = None return False #print "view: self.simulation.go.set()" self.simulation.go.set() #print "view: done." return True
Example #18
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 #19
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 #20
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 #21
Source File: bluezchat.py From python-for-android with Apache License 2.0 | 5 votes |
def alert(text, buttons=gtk.BUTTONS_NONE, type=gtk.MESSAGE_INFO): md = gtk.MessageDialog(buttons=buttons, type=type) md.label.set_text(text) md.run() md.destroy()
Example #22
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 #23
Source File: core.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def update_view_timeout(self): #print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): while gtk.events_pending(): gtk.main_iteration() pause_messages = self.simulation.pause_messages self.simulation.pause_messages = [] try: self.update_view() self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period #print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: #print pause_messages dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format='\n'.join(pause_messages)) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) # if we're paused, stop the update timer if not self.play_button.get_active(): self._update_timeout_id = None return False #print "view: self.simulation.go.set()" self.simulation.go.set() #print "view: done." return True
Example #24
Source File: core.py From ns3-802.11ad with GNU General Public License v2.0 | 5 votes |
def update_view_timeout(self): #print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): while gtk.events_pending(): gtk.main_iteration() pause_messages = self.simulation.pause_messages self.simulation.pause_messages = [] try: self.update_view() self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period #print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: #print pause_messages dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format='\n'.join(pause_messages)) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) # if we're paused, stop the update timer if not self.play_button.get_active(): self._update_timeout_id = None return False #print "view: self.simulation.go.set()" self.simulation.go.set() #print "view: done." return True
Example #25
Source File: core.py From Tocino with GNU General Public License v2.0 | 5 votes |
def update_view_timeout(self): #print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): while gtk.events_pending(): gtk.main_iteration() pause_messages = self.simulation.pause_messages self.simulation.pause_messages = [] try: self.update_view() self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period #print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: #print pause_messages dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format='\n'.join(pause_messages)) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) # if we're paused, stop the update timer if not self.play_button.get_active(): self._update_timeout_id = None return False #print "view: self.simulation.go.set()" self.simulation.go.set() #print "view: done." return True
Example #26
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 #27
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 #28
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 #29
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 #30
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