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


Python gtk.RESPONSE_OK属性代码示例

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


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

示例1: changeAllFonts

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def changeAllFonts(self, widget):
		"""Changes all fonts at once."""
		dialog = gtk.FontSelectionDialog("Select Font")

		dialog.set_font_name(self.defaults["font"])

		if dialog.run() == gtk.RESPONSE_OK:
			newFont = dialog.get_font_name()

			self.clock1FontButton.set_font_name(newFont)
			self.clock2FontButton.set_font_name(newFont)
			self.bat1FontButton.set_font_name(newFont)
			self.bat2FontButton.set_font_name(newFont)
			self.fontButton.set_font_name(newFont)

		dialog.destroy()

		self.generateConfig()
		self.changeOccurred() 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:21,代码来源:tintwizard.py

示例2: on_open

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def on_open(self, action):
        chooser = gtk.FileChooserDialog(title="Open dot File",
                                        action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                        buttons=(gtk.STOCK_CANCEL,
                                                 gtk.RESPONSE_CANCEL,
                                                 gtk.STOCK_OPEN,
                                                 gtk.RESPONSE_OK))
        chooser.set_default_response(gtk.RESPONSE_OK)
        filter = gtk.FileFilter()
        filter.set_name("Graphviz dot files")
        filter.add_pattern("*.dot")
        chooser.add_filter(filter)
        filter = gtk.FileFilter()
        filter.set_name("All files")
        filter.add_pattern("*")
        chooser.add_filter(filter)
        if chooser.run() == gtk.RESPONSE_OK:
            filename = chooser.get_filename()
            chooser.destroy()
            self.open_file(filename)
        else:
            chooser.destroy() 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:24,代码来源:xdot.py

示例3: on_open

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def on_open(self, action):
        chooser = gtk.FileChooserDialog(title="Open dot File",
                                        action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                        buttons=(gtk.STOCK_CANCEL,
                                                 gtk.RESPONSE_CANCEL,
                                                 gtk.STOCK_OPEN,
                                                 gtk.RESPONSE_OK))
        chooser.set_default_response(gtk.RESPONSE_OK)
        chooser.set_current_folder(self.last_open_dir)
        filter = gtk.FileFilter()
        filter.set_name("Graphviz dot files")
        filter.add_pattern("*.dot")
        chooser.add_filter(filter)
        filter = gtk.FileFilter()
        filter.set_name("All files")
        filter.add_pattern("*")
        chooser.add_filter(filter)
        if chooser.run() == gtk.RESPONSE_OK:
            filename = chooser.get_filename()
            self.last_open_dir = chooser.get_current_folder()
            chooser.destroy()
            self.open_file(filename)
        else:
            chooser.destroy() 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:26,代码来源:xdot.py

示例4: show_font_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def show_font_dialog(parent, title, button):
    if not hasattr(parent, 'dlgFont'):
        parent.dlgFont = None
        
    if parent.dlgFont == None:
        parent.dlgFont = gtk.FontSelectionDialog(title)
    fontsel = parent.dlgFont.fontsel
    fontsel.set_font_name(button.selected_font.to_string())    

    response = parent.dlgFont.run()

    if response == gtk.RESPONSE_OK:        
        button.selected_font = pango.FontDescription(fontsel.get_font_name())        
        button.set_label(button.selected_font.to_string())
        button.get_child().modify_font(button.selected_font)
    parent.dlgFont.hide() 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:18,代码来源:gnome_connection_manager.py

示例5: show_open_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def show_open_dialog(parent, title, action):        
    dlg = gtk.FileChooserDialog(title=title, parent=parent, action=action)
    dlg.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
    
    dlg.add_button(gtk.STOCK_SAVE if action==gtk.FILE_CHOOSER_ACTION_SAVE else gtk.STOCK_OPEN, gtk.RESPONSE_OK)        
    dlg.set_do_overwrite_confirmation(True)        
    if not hasattr(parent,'lastPath'):
        parent.lastPath = os.path.expanduser("~")
    dlg.set_current_folder( parent.lastPath )
    
    if dlg.run() == gtk.RESPONSE_OK:
        filename = dlg.get_filename()
        parent.lastPath = os.path.dirname(filename)
    else:
        filename = None
    dlg.destroy()
    return filename 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:19,代码来源:gnome_connection_manager.py

示例6: show_save_buffer

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def show_save_buffer(self, terminal):        
        dlg = gtk.FileChooserDialog(title=_("Guardar como"), parent=self.wMain, action=gtk.FILE_CHOOSER_ACTION_SAVE)
        dlg.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        dlg.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_OK)        
        dlg.set_do_overwrite_confirmation(True)
        dlg.set_current_name( os.path.basename("gcm-buffer-%s.txt" % (time.strftime("%Y%m%d%H%M%S")) ))
        if not hasattr(self,'lastPath'):
            self.lastPath = os.path.expanduser("~")
        dlg.set_current_folder( self.lastPath )
        
        if dlg.run() == gtk.RESPONSE_OK:
            filename = dlg.get_filename()
            self.lastPath = os.path.dirname(filename)            
    
            try:              
                buff = terminal.get_text_range(0, 0, terminal.get_property('scrollback-lines')-1, terminal.get_column_count()-1, lambda *args: True, None, None ).strip()                
                f = open(filename, "w")
                f.write(buff)
                f.close()
            except:                
                dlg.destroy()
                msgbox("%s: %s" % (_("No se puede abrir archivo para escritura"), filename) )
                return
            
        dlg.destroy() 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:27,代码来源:gnome_connection_manager.py

示例7: on_btnDel_clicked

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def on_btnDel_clicked(self, widget, *args):
        if self.treeServers.get_selection().get_selected()[1]!=None:
            if not self.treeModel.iter_has_child(self.treeServers.get_selection().get_selected()[1]):
                #Eliminar solo el nodo
                name = self.treeModel.get_value(self.treeServers.get_selection().get_selected()[1],0)
                if msgconfirm("%s [%s]?" % (_("Confirma que desea eliminar el host"), name) ) == gtk.RESPONSE_OK:
                    host = self.treeModel.get_value(self.treeServers.get_selection().get_selected()[1],1)
                    groups[host.group].remove(host)
                    self.updateTree()
            else:                
                #Eliminar todo el grupo                
                group = self.get_group(self.treeModel.iter_children(self.treeServers.get_selection().get_selected()[1]))
                if msgconfirm("%s [%s]?" % (_("Confirma que desea eliminar todos los hosts del grupo"), group) ) == gtk.RESPONSE_OK:                                
                    try:
                        del groups[group]
                    except:
                        pass
                    for h in dict(groups):
                        if h.startswith(group+'/'):
                            del groups[h]
                    self.updateTree()
        self.writeConfig()                    
    #-- Wmain.on_btnDel_clicked }

    #-- Wmain.on_btnHSplit_clicked { 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:27,代码来源:gnome_connection_manager.py

示例8: start_logger

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

示例9: terminalshot

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def terminalshot(self, _widget, terminal):
        """Handle the taking, prompting and saving of a terminalshot"""
        # Grab a pixbuf of the terminal
        orig_pixbuf = widget_pixbuf(terminal)

        savedialog = gtk.FileChooserDialog(title="Save image",
                                           action=self.dialog_action,
                                           buttons=self.dialog_buttons)
        savedialog.set_do_overwrite_confirmation(True)
        savedialog.set_local_only(True)

        pixbuf = orig_pixbuf.scale_simple(orig_pixbuf.get_width() / 2, 
                                     orig_pixbuf.get_height() / 2,
                                     gtk.gdk.INTERP_BILINEAR)
        image = gtk.image_new_from_pixbuf(pixbuf)
        savedialog.set_preview_widget(image)

        savedialog.show_all()
        response = savedialog.run()
        path = None
        if response == gtk.RESPONSE_OK:
            path = os.path.join(savedialog.get_current_folder(),
                                savedialog.get_filename())
            orig_pixbuf.save(path, 'png')

        savedialog.destroy() 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:28,代码来源:terminalshot.py

示例10: chooseFile

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def chooseFile(self, default_dir=None,
                   filter_patterns=None):
        dialog = gtk.FileChooserDialog(
            title="Open File",
            parent=self._win,
            action=gtk.FILE_CHOOSER_ACTION_OPEN,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                     gtk.STOCK_OPEN, gtk.RESPONSE_OK))

        dialog.set_default_response(gtk.RESPONSE_OK)

        patterns = self._str_to_obj(filter_patterns) or {"xml": "XML Files"}
        for pattern in patterns:
            file_filter = gtk.FileFilter()
            file_filter.set_name(patterns[pattern])
            file_filter.add_pattern('*.{}'.format(pattern))
            dialog.add_filter(file_filter)

        if default_dir is not None:
            dialog.set_current_folder(os.path.expanduser(default_dir))

        path = ""

        response = dialog.run()
        if response == gtk.RESPONSE_OK:
            path = dialog.get_filename()
        elif response == gtk.RESPONSE_CANCEL:
            self.error("No files selected.")

        dialog.destroy()

        return path 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:34,代码来源:webapp.py

示例11: inputdialog

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

示例12: filedialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def filedialog(self, title=None, default_filename=None):
        chooser = gtk.FileChooserDialog(title=title, parent=self.window,
                                        action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                        buttons=(
                                            gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
                                            gtk.RESPONSE_OK))
        chooser.resize(700, 500)
        if default_filename:
            chooser.set_filename(os.path.abspath(default_filename))
        filename = None
        response = chooser.run()
        if response == gtk.RESPONSE_OK:
            filename = chooser.get_filename()
        chooser.destroy()
        return filename 
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:17,代码来源:step_editor.py

示例13: __init__

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

示例14: procListActivated

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def procListActivated(self, *args):
        self.response(gtk.RESPONSE_OK) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:4,代码来源:vwvtrace.py

示例15: selectProcess

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import RESPONSE_OK [as 别名]
def selectProcess(self):
        self.show_all()
        resp = self.run()
        self.hide()
        if resp == gtk.RESPONSE_OK:
            return self.pid
        return None 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:9,代码来源:vwvtrace.py


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