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


Python gtk.DIALOG_MODAL屬性代碼示例

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


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

示例1: quit

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
def quit(self, widget, event=None):
		"""Asks if user would like to save file before quitting, then quits the program."""
		if self.toSave:
			if self.oneConfigFile:
				response = gtk.RESPONSE_YES
			else:
				dialog = gtk.Dialog("Save config?", self, gtk.DIALOG_MODAL, (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
				dialog.get_content_area().add(gtk.Label("Save config before quitting?"))
				dialog.get_content_area().set_size_request(300, 100)
				dialog.show_all()
				response = dialog.run()
				dialog.destroy()

			if response == gtk.RESPONSE_CANCEL:
				return True							# Return True to stop it quitting when we hit "Cancel"
			elif response == gtk.RESPONSE_NO:
				gtk.main_quit()
			elif response == gtk.RESPONSE_YES:
				self.save()
				gtk.main_quit()
		else:
			gtk.main_quit() 
開發者ID:milisarge,項目名稱:malfs-milis,代碼行數:24,代碼來源:tintwizard.py

示例2: gerr

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

示例3: key_edit_window_title

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
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 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:34,代碼來源:terminal.py

示例4: _create_command_dialog

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
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) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:35,代碼來源:custom_commands.py

示例5: _error

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

示例6: start_logger

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

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
def message(self, text, title):
        dlg = gtk.MessageDialog(self.window,
                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                                gtk.MESSAGE_INFO,
                                gtk.BUTTONS_CLOSE,
                                title)
        dlg.set_title(title)
        dlg.format_secondary_text(text)
        dlg.run()
        dlg.destroy() 
開發者ID:avocado-framework,項目名稱:avocado-vt,代碼行數:12,代碼來源:step_editor.py

示例8: question_yes_no

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
def question_yes_no(self, text, title):
        dlg = gtk.MessageDialog(self.window,
                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                                gtk.MESSAGE_QUESTION,
                                gtk.BUTTONS_YES_NO,
                                title)
        dlg.set_title(title)
        dlg.format_secondary_text(text)
        response = dlg.run()
        dlg.destroy()
        if response == gtk.RESPONSE_YES:
            return True
        return False 
開發者ID:avocado-framework,項目名稱:avocado-vt,代碼行數:15,代碼來源:step_editor.py

示例9: inputdialog

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
def inputdialog(self, text, title, default_response=""):
        # Define a little helper function
        def inputdialog_entry_activated(entry):
            dlg.response(gtk.RESPONSE_OK)

        # Create the dialog
        dlg = gtk.MessageDialog(self.window,
                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                                gtk.MESSAGE_QUESTION,
                                gtk.BUTTONS_OK_CANCEL,
                                title)
        dlg.set_title(title)
        dlg.format_secondary_text(text)

        # Create an entry widget
        entry = gtk.Entry()
        entry.set_text(default_response)
        entry.connect("activate", inputdialog_entry_activated)
        dlg.vbox.pack_start(entry)
        entry.show()

        # Run the dialog
        response = dlg.run()
        dlg.destroy()
        if response == gtk.RESPONSE_OK:
            return entry.get_text()
        return None 
開發者ID:avocado-framework,項目名稱:avocado-vt,代碼行數:29,代碼來源:step_editor.py

示例10: confirmDialog

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
def confirmDialog(parent, message):
	"""Creates a confirmation dialog and returns the response."""
	dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message)
	dialog.show()
	response = dialog.run()
	dialog.destroy()
	return response 
開發者ID:milisarge,項目名稱:malfs-milis,代碼行數:9,代碼來源:tintwizard.py

示例11: errorDialog

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

示例12: show_dialog

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
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 
開發者ID:gramps-project,項目名稱:addons-source,代碼行數:33,代碼來源:SurnameMappingGramplet.py

示例13: __init__

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
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() 
開發者ID:Laharah,項目名稱:deluge-FileBotTool,代碼行數:14,代碼來源:user_messenger.py

示例14: message

# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import DIALOG_MODAL [as 別名]
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() 
開發者ID:dslackw,項目名稱:sun,代碼行數:14,代碼來源:status_icon_gtk2.py

示例15: get_password

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


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