Python gtk.RESPONSE_OK Examples

The following are 30 code examples of gtk.RESPONSE_OK(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gtk , or try the search function .
Example #1
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: xdot.py    From POC-EXP with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #3
Source File: tintwizard.py    From malfs-milis with MIT License 6 votes vote down vote up
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() 
Example #4
Source File: xdot.py    From openxenmanager with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #5
Source File: xdot.py    From EasY_HaCk with Apache License 2.0 6 votes vote down vote up
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() 
Example #6
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #8
Source File: xdot.py    From NoobSec-Toolkit with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #9
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
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 { 
Example #10
Source File: xdot.py    From NoobSec-Toolkit with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #11
Source File: xdot.py    From NoobSec-Toolkit with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #12
Source File: xdot.py    From NoobSec-Toolkit with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #13
Source File: operations.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _create_pdb_procedure_browser_dialog(self):
    dialog = gimpui.ProcBrowserDialog(
      _("Procedure Browser"),
      role=pg.config.PLUGIN_NAME,
      buttons=(gtk.STOCK_ADD, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
    
    dialog.set_default_response(gtk.RESPONSE_OK)
    dialog.set_alternative_button_order((gtk.RESPONSE_OK, gtk.RESPONSE_CANCEL))
    
    dialog.connect("response", self._on_pdb_procedure_browser_dialog_response)
    
    dialog.show_all()
    
    return dialog 
Example #14
Source File: menu.py    From hardening-script-el6-kickstart with Apache License 2.0 5 votes vote down vote up
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 
Example #15
Source File: core.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def _get_export_file_name(self):
        sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
                                    gtk.FILE_CHOOSER_ACTION_SAVE,
                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                     gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        sel.set_default_response(gtk.RESPONSE_OK)
        sel.set_local_only(True)
        sel.set_do_overwrite_confirmation(True)
        sel.set_current_name("Unnamed.pdf")

        filter = gtk.FileFilter()
        filter.set_name("Embedded PostScript")
        filter.add_mime_type("image/x-eps")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Portable Document Graphics")
        filter.add_mime_type("application/pdf")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Scalable Vector Graphics")
        filter.add_mime_type("image/svg+xml")
        sel.add_filter(filter)

        resp = sel.run()
        if resp != gtk.RESPONSE_OK:
            sel.destroy()
            return None
        
        file_name = sel.get_filename()
        sel.destroy()
        return file_name 
Example #16
Source File: gtk2util.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def _on_loginDialog_response(self, widget, response):
        handlers = {gtk.RESPONSE_NONE: self._windowClosed,
                   gtk.RESPONSE_DELETE_EVENT: self._windowClosed,
                   gtk.RESPONSE_OK: self._doLogin,
                   gtk.RESPONSE_CANCEL: self._cancelled}
        handler = handlers.get(response)
        if handler is not None:
            handler()
        else:
            log.msg("Unexpected dialog response %r from %s" % (response,
                                                               widget)) 
Example #17
Source File: gtk2util.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def _on_loginDialog_response(self, widget, response):
        handlers = {gtk.RESPONSE_NONE: self._windowClosed,
                   gtk.RESPONSE_DELETE_EVENT: self._windowClosed,
                   gtk.RESPONSE_OK: self._doLogin,
                   gtk.RESPONSE_CANCEL: self._cancelled}
        handler = handlers.get(response)
        if handler is not None:
            handler()
        else:
            log.msg("Unexpected dialog response %r from %s" % (response,
                                                               widget)) 
Example #18
Source File: mcplatform.py    From GDMC with ISC License 5 votes vote down vote up
def askOpenFileGtk(title, suffixes, initialDir):
    fls = []
    def run_dlg():
        chooser = gtk.FileChooserDialog(title,
                                        None, gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OPEN, gtk.RESPONSE_OK))
    
        chooser.set_default_response(gtk.RESPONSE_OK)
        chooser.set_current_folder(initialDir)
        chooser.set_current_name("world")  # For some reason the Windows isn't closing if this line ins missing or the parameter is ""

        # Add custom Filter
        file_filter = gtk.FileFilter()
        file_filter.set_name(_("Levels and Schematics"))
        for suffix in suffixes:
            file_filter.add_pattern("*." + suffix)
        chooser.add_filter(file_filter)

        # Add "All files" Filter
        file_filter = gtk.FileFilter()
        file_filter.set_name("All files")
        file_filter.add_pattern("*")
        chooser.add_filter(file_filter)

        response = chooser.run()
        if response == gtk.RESPONSE_OK:
            fls.append(chooser.get_filename())
        else:
            fls.append(None)
        chooser.destroy()
        gtk.main_quit()

    gtk.idle_add(run_dlg)
    gtk.main()

    return fls[0] 
Example #19
Source File: core.py    From ns3-ecn-sharp with GNU General Public License v2.0 5 votes vote down vote up
def _get_export_file_name(self):
        sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
                                    gtk.FILE_CHOOSER_ACTION_SAVE,
                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                     gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        sel.set_default_response(gtk.RESPONSE_OK)
        sel.set_local_only(True)
        sel.set_do_overwrite_confirmation(True)
        sel.set_current_name("Unnamed.pdf")

        filter = gtk.FileFilter()
        filter.set_name("Embedded PostScript")
        filter.add_mime_type("image/x-eps")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Portable Document Graphics")
        filter.add_mime_type("application/pdf")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Scalable Vector Graphics")
        filter.add_mime_type("image/svg+xml")
        sel.add_filter(filter)

        resp = sel.run()
        if resp != gtk.RESPONSE_OK:
            sel.destroy()
            return None
        
        file_name = sel.get_filename()
        sel.destroy()
        return file_name 
Example #20
Source File: core.py    From ns3-802.11ad with GNU General Public License v2.0 5 votes vote down vote up
def _get_export_file_name(self):
        sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
                                    gtk.FILE_CHOOSER_ACTION_SAVE,
                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                     gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        sel.set_default_response(gtk.RESPONSE_OK)
        sel.set_local_only(True)
        sel.set_do_overwrite_confirmation(True)
        sel.set_current_name("Unnamed.pdf")

        filter = gtk.FileFilter()
        filter.set_name("Embedded PostScript")
        filter.add_mime_type("image/x-eps")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Portable Document Graphics")
        filter.add_mime_type("application/pdf")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Scalable Vector Graphics")
        filter.add_mime_type("image/svg+xml")
        sel.add_filter(filter)

        resp = sel.run()
        if resp != gtk.RESPONSE_OK:
            sel.destroy()
            return None
        
        file_name = sel.get_filename()
        sel.destroy()
        return file_name 
Example #21
Source File: core.py    From Tocino with GNU General Public License v2.0 5 votes vote down vote up
def _get_export_file_name(self):
        sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
                                    gtk.FILE_CHOOSER_ACTION_SAVE,
                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                     gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        sel.set_default_response(gtk.RESPONSE_OK)
        sel.set_local_only(True)
        sel.set_do_overwrite_confirmation(True)
        sel.set_current_name("Unnamed.pdf")

        filter = gtk.FileFilter()
        filter.set_name("Embedded PostScript")
        filter.add_mime_type("image/x-eps")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Portable Document Graphics")
        filter.add_mime_type("application/pdf")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Scalable Vector Graphics")
        filter.add_mime_type("image/svg+xml")
        sel.add_filter(filter)

        resp = sel.run()
        if resp != gtk.RESPONSE_OK:
            sel.destroy()
            return None
        
        file_name = sel.get_filename()
        sel.destroy()
        return file_name 
Example #22
Source File: core.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def _get_export_file_name(self):
        sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
                                    gtk.FILE_CHOOSER_ACTION_SAVE,
                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                     gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        sel.set_default_response(gtk.RESPONSE_OK)
        sel.set_local_only(True)
        sel.set_do_overwrite_confirmation(True)
        sel.set_current_name("Unnamed.pdf")

        filter = gtk.FileFilter()
        filter.set_name("Embedded PostScript")
        filter.add_mime_type("image/x-eps")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Portable Document Graphics")
        filter.add_mime_type("application/pdf")
        sel.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("Scalable Vector Graphics")
        filter.add_mime_type("image/svg+xml")
        sel.add_filter(filter)

        resp = sel.run()
        if resp != gtk.RESPONSE_OK:
            sel.destroy()
            return None
        
        file_name = sel.get_filename()
        sel.destroy()
        return file_name 
Example #23
Source File: operations.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _on_operation_edit_dialog_for_new_operation_response(
        self, dialog, response_id, item):
    dialog.destroy()
    
    if response_id == gtk.RESPONSE_OK:
      item.operation["enabled"].set_value(True)
    else:
      self.remove_item(item) 
Example #24
Source File: operations.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _on_operation_edit_dialog_for_existing_operation_response(
        self, dialog, response_id, item, operation_values_before_dialog):
    dialog.destroy()
    
    if response_id == gtk.RESPONSE_OK:
      item.operation["arguments"].apply_gui_values_to_settings()
    else:
      item.operation.set_values(operation_values_before_dialog)
    
    item.operation_edit_dialog = None 
Example #25
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def inputbox(title, text, default='', password=False):
    msgBox = EntryDialog(title, text, default, mask=password)
    msgBox.set_icon_from_file(ICON_PATH)
    if msgBox.run() == gtk.RESPONSE_OK:
        response = msgBox.value
    else:
        response = None
    msgBox.destroy()
    return response 
Example #26
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def on_wMain_delete_event(self, widget, *args):
        (conf.WINDOW_WIDTH, conf.WINDOW_HEIGHT) = self.get_widget("wMain").get_size()
        if conf.CONFIRM_ON_EXIT and self.count>0 and msgconfirm("%s %d %s" % (_("Hay"), self.count, _("consolas abiertas, confirma que desea salir?")) ) != gtk.RESPONSE_OK:
            return True
    #-- Wmain.on_wMain_delete_event }

    #-- Wmain.on_guardar_como1_activate { 
Example #27
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def on_close_tab(self, widget, notebook, *args):
        if conf.CONFIRM_ON_CLOSE_TAB and msgconfirm("%s [%s]?" % ( _("Cerrar consola"), self.label.get_text().strip()) ) != gtk.RESPONSE_OK:
            return True
        
        self.close_tab(widget) 
Example #28
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def click(self, button):
        self.value = self.entry.get_text()        
        self.response(gtk.RESPONSE_OK) 
Example #29
Source File: mcplatform.py    From MCEdit-Unified with ISC License 5 votes vote down vote up
def askOpenFileGtk(title, suffixes, initialDir):
    fls = []

    def run_dlg():
        chooser = gtk.FileChooserDialog(title,
                                        None, gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OPEN, gtk.RESPONSE_OK))
    
        chooser.set_default_response(gtk.RESPONSE_OK)
        chooser.set_current_folder(initialDir)
        chooser.set_current_name("world")  # For some reason the Windows isn't closing if this line ins missing or the parameter is ""

        # Add custom Filter
        file_filter = gtk.FileFilter()
        file_filter.set_name(_("Levels and Schematics"))
        for suffix in suffixes:
            file_filter.add_pattern("*." + suffix)
        chooser.add_filter(file_filter)

        # Add "All files" Filter
        file_filter = gtk.FileFilter()
        file_filter.set_name("All files")
        file_filter.add_pattern("*")
        chooser.add_filter(file_filter)

        response = chooser.run()
        if response == gtk.RESPONSE_OK:
            fls.append(chooser.get_filename())
        else:
            fls.append(None)
        chooser.destroy()
        gtk.main_quit()

    gtk.idle_add(run_dlg)
    gtk.main()

    return fls[0] 
Example #30
Source File: mcplatform.py    From MCEdit-Unified with ISC License 5 votes vote down vote up
def askOpenFolderGtk(title, initialDir):
    if hasGtk:
        fls = []

        def run_dlg():
            chooser = gtk.FileChooserDialog(title,
                                        None, gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OPEN, gtk.RESPONSE_OK))

            chooser.set_default_response(gtk.RESPONSE_OK)
            chooser.set_current_folder(initialDir)
            chooser.set_current_name("world")
            chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)

            response = chooser.run()
            if response == gtk.RESPONSE_OK:
                fls.append(chooser.get_filename())  # Returns the folder path if gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER is the action
            else:
                fls.append(None)
            chooser.destroy()
            gtk.main_quit()

        gtk.idle_add(run_dlg)
        gtk.main()
        return fls[0]
    else:
        print "You currently need gtk to use an Open Folder Dialog!"