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


Python gtk.Dialog方法代码示例

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


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

示例1: quit

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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: key_edit_window_title

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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

示例3: _create_command_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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

示例4: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, trace):
        buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)
        gtk.Dialog.__init__(self, "Select a process...", buttons=buttons)
        self.proclist = ProcessListView(trace)
        self.vbox.pack_start(self.proclist, expand=True)
        self.proclist.treeview.connect("row_activated", self.procListActivated)
        self.proclist.treeview.connect("cursor_changed", self.procListSelected)
        self.pid = None
        self.resize(300, 600) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:11,代码来源:vwvtrace.py

示例5: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, vsbuilder, parent=None):
        buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)
        gtk.Dialog.__init__(self, "Select a structure...", buttons=buttons, parent=parent)
        self.selector = VStructBuilderView(vsbuilder)
        self.vbox.pack_start(self.selector, expand=True)
        self.selector.treeview.connect("row_activated", self.nsActivated)
        self.selector.treeview.connect("cursor_changed", self.nsSelected)
        self.modinfo = None
        self.resize(400, 600) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:11,代码来源:vwvstruct.py

示例6: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, visualizer, node_index, statistics_collector):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.connect("response", self._response_cb)
        self.win.set_title("Statistics for node %i" % node_index) 
        self.visualizer = visualizer
        self.statistics_collector = statistics_collector
        self.node_index = node_index
        self.viz_node = visualizer.get_node(node_index)

        self.table_model = gtk.ListStore(*([str]*13))

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        self.win.vbox.add(treeview)
        
        def add_column(descr, colid):
            column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
            treeview.append_column(column)
            
        add_column("Interface", self.COLUMN_INTERFACE)

        add_column("Tx Packets", self.COLUMN_TX_PACKETS)
        add_column("Tx Bytes", self.COLUMN_TX_BYTES)
        add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
        add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)

        add_column("Rx Packets", self.COLUMN_RX_PACKETS)
        add_column("Rx Bytes", self.COLUMN_RX_BYTES)
        add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
        add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)

        self.visualizer.add_information_window(self)
        self.win.show() 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:38,代码来源:interface_statistics.py

示例7: show_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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

示例8: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, items=()):
        gtk.Dialog.__init__(self)
        self.ret = None
        self._started = 0
        self.connect("destroy", self.quit)
        self.connect("delete_event", self.quit)
        self.set_geometry_hints(min_width=250, min_height=300)
        scrolled_win = gtk.ScrolledWindow()
        scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled_win.show()
        self.vbox.pack_start(scrolled_win)
        #self.vbox.show()

        button = gtk.Button("Cancel")
        button.connect("clicked", self.cancel)
        button.set_flags(gtk.CAN_DEFAULT)
        self.action_area.pack_start(button)
        button.show()

        ls = gtk.ListStore(gobject.TYPE_STRING)
        for item in items:
            iter = ls.append()
            ls.set(iter, 0, item)

        lister = gtk.TreeView(ls)
        selection = lister.get_selection()
        selection.set_mode(gtk.SELECTION_BROWSE)
        selection.unselect_all()
        lister.set_search_column(0)
        scrolled_win.add_with_viewport(lister)

        column = gtk.TreeViewColumn('Keyword', gtk.CellRendererText(), text=0)
        lister.append_column(column)
        lister.set_headers_visible(False)
        lister.connect("row-activated", self.row_activated)
        lister.show() 
开发者ID:kdart,项目名称:pycopia,代码行数:38,代码来源:gtktools.py

示例9: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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

示例10: get_password

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [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

示例11: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, title, message, default_text='', modal=True, mask=False):
        gtk.Dialog.__init__(self)
        self.set_title(title)
        self.connect("destroy", self.quit)
        self.connect("delete_event", self.quit)
        if modal:
            self.set_modal(True)
        box = gtk.VBox(spacing=10)
        box.set_border_width(10)
        self.vbox.pack_start(box)
        box.show()
        if message:
            label = gtk.Label(message)
            box.pack_start(label)
            label.show()
        self.entry = gtk.Entry()
        self.entry.set_text(default_text)
        self.entry.set_visibility(not mask)
        box.pack_start(self.entry)
        self.entry.show()
        self.entry.grab_focus()
        button = gtk.Button(stock=gtk.STOCK_OK)
        button.connect("clicked", self.click)
        self.entry.connect("activate", self.click)
        button.set_flags(gtk.CAN_DEFAULT)
        self.action_area.pack_start(button)
        button.show()
        button.grab_default()
        button = gtk.Button(stock=gtk.STOCK_CANCEL)
        button.connect("clicked", self.quit)
        button.set_flags(gtk.CAN_DEFAULT)
        self.action_area.pack_start(button)
        button.show()
        self.ret = None 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:36,代码来源:gnome_connection_manager.py

示例12: construct_confirm_close

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def construct_confirm_close(self, window, reqtype):
        """Create a confirmation dialog for closing things"""
        
        # skip this dialog if applicable
        if self.config['suppress_multiple_term_dialog']:
            return gtk.RESPONSE_ACCEPT
        
        dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL)
        dialog.set_has_separator(False)
        dialog.set_resizable(False)
    
        dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        c_all = dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
        c_all.get_children()[0].get_children()[0].get_children()[1].set_label(
                _('Close _Terminals'))
    
        primary = gtk.Label(_('<big><b>Close multiple terminals?</b></big>'))
        primary.set_use_markup(True)
        primary.set_alignment(0, 0.5)
        secondary = gtk.Label(_('This %s has several terminals open. Closing \
the %s will also close all terminals within it.') % (reqtype, reqtype))
        secondary.set_line_wrap(True)
                    
        labels = gtk.VBox()
        labels.pack_start(primary, False, False, 6)
        labels.pack_start(secondary, False, False, 6)
    
        image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING,
                                         gtk.ICON_SIZE_DIALOG)
        image.set_alignment(0.5, 0)
    
        box = gtk.HBox()
        box.pack_start(image, False, False, 6)
        box.pack_start(labels, False, False, 6)
        dialog.vbox.pack_start(box, False, False, 12)

        checkbox = gtk.CheckButton(_("Do not show this message next time"))
        dialog.vbox.pack_end(checkbox)
    
        dialog.show_all()

        result = dialog.run()
        
        # set configuration
        self.config['suppress_multiple_term_dialog'] = checkbox.get_active()
        self.config.save()

        dialog.destroy()
                
        return(result) 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:52,代码来源:container.py

示例13: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, visualizer, node_index):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2)
        self.win.connect("response", self._response_cb)
        self.win.set_title("OLSR routing table for node %i" % node_index) 
        self.visualizer = visualizer
        self.node_index = node_index

        self.table_model = gtk.ListStore(str, str, str, int)

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        sw = gtk.ScrolledWindow()
        sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                          vscrollbar_policy=gtk.POLICY_AUTOMATIC)
        sw.show()
        sw.add(treeview)
        self.win.vbox.add(sw)
        
        # Dest.
        column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
                                    text=self.COLUMN_DESTINATION)
        treeview.append_column(column)

        # Next hop
        column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(),
                                    text=self.COLUMN_NEXT_HOP)
        treeview.append_column(column)

        # Interface
        column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(),
                                    text=self.COLUMN_INTERFACE)
        treeview.append_column(column)

        # Num. Hops
        column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(),
                                    text=self.COLUMN_NUM_HOPS)
        treeview.append_column(column)

        self.visualizer.add_information_window(self)
        self.win.show() 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:46,代码来源:olsr.py

示例14: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Dialog [as 别名]
def __init__(self, visualizer, node_index):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.connect("response", self._response_cb)
        self.win.set_title("IPv4 routing table for node %i" % node_index) 
        self.visualizer = visualizer
        self.node_index = node_index

        self.table_model = gtk.ListStore(str, str, str, str, int)

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        sw = gtk.ScrolledWindow()
        sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                          vscrollbar_policy=gtk.POLICY_AUTOMATIC)
        sw.show()
        sw.add(treeview)
        self.win.vbox.add(sw)
        self.win.set_default_size(600, 300)
        
        # Dest.
        column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
                                    text=self.COLUMN_DESTINATION)
        treeview.append_column(column)

        # Next hop
        column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(),
                                    text=self.COLUMN_NEXT_HOP)
        treeview.append_column(column)

        # Interface
        column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(),
                                    text=self.COLUMN_INTERFACE)
        treeview.append_column(column)

        # Type
        column = gtk.TreeViewColumn('Type', gtk.CellRendererText(),
                                    text=self.COLUMN_TYPE)
        treeview.append_column(column)

        # Prio
        column = gtk.TreeViewColumn('Prio', gtk.CellRendererText(),
                                    text=self.COLUMN_PRIO)
        treeview.append_column(column)

        self.visualizer.add_information_window(self)
        self.win.show() 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:51,代码来源:ipv4_routing_table.py


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