當前位置: 首頁>>代碼示例>>Python>>正文


Python gtk.BUTTONS_OK屬性代碼示例

本文整理匯總了Python中gtk.BUTTONS_OK屬性的典型用法代碼示例。如果您正苦於以下問題:Python gtk.BUTTONS_OK屬性的具體用法?Python gtk.BUTTONS_OK怎麽用?Python gtk.BUTTONS_OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在gtk的用法示例。


在下文中一共展示了gtk.BUTTONS_OK屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: error_message

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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: simple_message

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [as 別名]
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 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:gtktools.py

示例3: run_filter

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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 BUTTONS_OK [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: gerr

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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

示例6: start_logger

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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

示例7: errorDialog

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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

示例8: update_view_timeout

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [as 別名]
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 
開發者ID:ntu-dsi-dcn,項目名稱:ntu-dsi-dcn,代碼行數:35,代碼來源:core.py

示例9: set_dotcode

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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

示例10: open_file

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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

示例11: MessageBox

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [as 別名]
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 
開發者ID:fcaviggia,項目名稱:hardening-script-el6-kickstart,代碼行數:11,代碼來源:menu.py

示例12: open_file

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_OK [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


注:本文中的gtk.BUTTONS_OK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。