当前位置: 首页>>代码示例>>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;未经允许,请勿转载。