def on_buttonOpenInfo_clicked(button=None): dialog = FileManager() print shared.get_last_dir() dialog.set_lastdir(shared.get_last_dir()) fname = dialog.get_filename('Choose info file') #using gtkutils to modernize file dlg -eli #dialog.set_transient_for(widgets['dlgReader']) #dialog.set_filename(widgets['entryInfoFile'].get_text() or #shared.get_last_dir()) #response = dialog.run() #fname = dialog.get_filename() #dialog.destroy() #if response == gtk.RESPONSE_OK: if widgets.load_params_from_file(fname): GladeHandlers.__dict__['on_buttonPreview_clicked']() shared.set_file_selection(fname)
def load_from(self, button): dialog = FileManager() #modernizing the dialog box dialog.set_lastdir(shared.get_last_dir()) fname = dialog.get_filename('Choose filename for marker info') #dialog = gtk.FileSelection() #dialog.show() #response = dialog.run() #if response==gtk.RESPONSE_OK: # fname = dialog.get_filename() # dialog.destroy() try: EventHandler().load_markers_from(fname) except IOError: error_msg('Could not load markers from %s' % fname, ) else: shared.set_file_selection(fname) self.fileName = fname
try: fh = file(self.filename, 'w') for attr in self.attrs: func = self.convertToFile.get(attr, str) val = func(self.__dict__[attr]) fh.write('%s : %s\n' % (attr, val)) print 'Updated RC file', self.filename except IOError: print >> sys.stderr, 'Failed to write to', self.filename def __del__(self): self.save() eegviewrc = RC() fmanager = FileManager() fmanager.bni = eegviewrc.bni fmanager.csv = eegviewrc.csv fmanager.amp = eegviewrc.amp fmanager.dat = eegviewrc.dat fmanager.col = eegviewrc.col fmanager.set_lastdir(eegviewrc.lastdir) fmanager.set_lastdirs([ eegviewrc.lastdir, eegviewrc.lastdir1, eegviewrc.lastdir2, eegviewrc.lastdir3, eegviewrc.lastdir4, eegviewrc.lastdir5, eegviewrc.lastdir6, eegviewrc.lastdir7, eegviewrc.lastdir8, eegviewrc.lastdir9 ])