def on_import_dmf_device(self, widget, data=None): self.save_check() dialog = gtk.FileChooserDialog(title="Import device", 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) add_filters(dialog, [{'name': 'DMF device version 0.3.0 (device)', 'pattern': 'device'}]) response = dialog.run() filename = dialog.get_filename() dialog.destroy() if response == gtk.RESPONSE_OK: try: self.import_device(filename) except Exception, e: _L().error('Error importing device. %s', e, exc_info=True)
def on_import_dmf_device(self, widget, data=None): self.save_check() dialog = gtk.FileChooserDialog(title="Import device", 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) add_filters(dialog, [{'name': 'DMF device version 0.3.0 (device)', 'pattern': 'device'}]) response = dialog.run() filename = dialog.get_filename() dialog.destroy() if response == gtk.RESPONSE_OK: try: self.import_device(filename) except Exception, e: _L().error('Error importing device. %s', e, exc_info=True)
def on_load_dmf_device(self, widget, data=None): self.save_check() app = get_app() directory = app.get_device_directory() dialog = gtk.FileChooserDialog(title="Load device", 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) if directory: dialog.set_current_folder(directory) add_filters(dialog, [{'name': 'DMF device (*.svg)', 'pattern': '*.svg'}]) response = dialog.run() if response == gtk.RESPONSE_OK: filename = dialog.get_filename() self.load_device(filename) dialog.destroy()
def on_load_dmf_device(self, widget, data=None): self.save_check() app = get_app() directory = app.get_device_directory() dialog = gtk.FileChooserDialog(title="Load device", 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) if directory: dialog.set_current_folder(directory) add_filters(dialog, [{'name': 'DMF device (*.svg)', 'pattern': '*.svg'}]) response = dialog.run() if response == gtk.RESPONSE_OK: filename = dialog.get_filename() self.load_device(filename) dialog.destroy()