当前位置: 首页>>代码示例>>Python>>正文


Python gtk.MESSAGE_ERROR属性代码示例

本文整理汇总了Python中gtk.MESSAGE_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Python gtk.MESSAGE_ERROR属性的具体用法?Python gtk.MESSAGE_ERROR怎么用?Python gtk.MESSAGE_ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gtk的用法示例。


在下文中一共展示了gtk.MESSAGE_ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: error_message

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:gtktools.py

示例2: _ebFailedLogin

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:25,代码来源:gtk2util.py

示例3: run_filter

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:24,代码来源:xdot.py

示例4: set_dotcode

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:26,代码来源:xdot.py

示例5: _on_text_entry_changed

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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) 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:22,代码来源:main.py

示例6: gerr

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:10,代码来源:util.py

示例7: _error

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
def _error(self, msg):
      err = gtk.MessageDialog(dialog,
                              gtk.DIALOG_MODAL,
                              gtk.MESSAGE_ERROR,
                              gtk.BUTTONS_CLOSE,
                              msg
                            )
      err.run()
      err.destroy() 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:11,代码来源:custom_commands.py

示例8: on_new

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:34,代码来源:custom_commands.py

示例9: start_logger

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:34,代码来源:logger.py

示例10: errorDialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:8,代码来源:tintwizard.py

示例11: set_dotcode

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:32,代码来源:xdot.py

示例12: open_file

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:14,代码来源:xdot.py

示例13: lvm_check

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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.) 
开发者ID:fcaviggia,项目名称:hardening-script-el6-kickstart,代码行数:13,代码来源:menu.py

示例14: open_file

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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() 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:14,代码来源:xdot.py

示例15: _on_popup_more_show

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import MESSAGE_ERROR [as 别名]
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) 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:9,代码来源:message_label.py


注:本文中的gtk.MESSAGE_ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。