Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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
    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
Exemplo n.º 4
0
    def __init__(self):
        # create a new window
        self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.win.connect("delete_event", self.delete_event)
        self.win.connect("destroy", self.destroy)
        self.win.set_border_width(10)

        self.button = gtk.Button("Hello World")
        self.button.connect("clicked", self.hello, None)
        self.win.add(self.button)
        self.button.show()
        self.win.show()
        
        self.fmanager = FileManager()

        dlg = Dialog_FileChooser(defaultDir=self.fmanager.get_lastdir(),
                                 okCallback=self.ok_callback,
                                 title='Select Neuroscanascii file',
                                 parent=self.win,
                                 previous_dirnames=self.fmanager.get_lastdirs())
Exemplo n.º 5
0
            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,
Exemplo n.º 6
0
class Pbrain2:

    self.extmap = { '.w18' : load_w18,
           '.bni' : load_bmsi,
           '.params' : load_params,
           '.epoch' : load_epoch,
           '.axonascii' : load_axonascii,
           '.neuroscanascii' : load_neuroscanascii,
           '.alphaomegaascii' : load_alphaomegaascii
           }



    # This is a callback function. The data arguments are ignored
    # in this example. More on callbacks below.
    def hello(self, widget, data=None):
        print "Hello World"

    def delete_event(self, widget, event, data=None):
        print "delete event occurred"
        return False

    def destroy(self, widget, data=None):
        print "destroy signal occurred"
        gtk.main_quit()

    def __init__(self):
        # create a new window
        self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.win.connect("delete_event", self.delete_event)
        self.win.connect("destroy", self.destroy)
        self.win.set_border_width(10)

        self.button = gtk.Button("Hello World")
        self.button.connect("clicked", self.hello, None)
        self.win.add(self.button)
        self.button.show()
        self.win.show()
        
        self.fmanager = FileManager()

        dlg = Dialog_FileChooser(defaultDir=self.fmanager.get_lastdir(),
                                 okCallback=self.ok_callback,
                                 title='Select Neuroscanascii file',
                                 parent=self.win,
                                 previous_dirnames=self.fmanager.get_lastdirs())


    def ok_callback(self, dlg):
        fname = dlg.get_filename()
        
        fullpath =  dlg.get_filename()
        self.fmanager.set_lastdir(fullpath)
        dlg.destroy()
        
        if not os.path.exists(fullpath):
            error_msg(
                'Cannot find %s' % fullpath,
                title='Error',
                parent=self.win)
            
        basename, ext = os.path.splitext(fullpath)
        if not self.extmap.has_key(ext.lower()):
            error_msg(
                'Do not know how to handle extension %s in %s' % (ext, fullpath),
                title='Error',
                parent=self.win)
            
            return
        else:
            loader = self.extmap[ext.lower()]
            try: eeg = loader(fullpath)
            except ValueError, msg:
                msg = exception_to_str('Error loading EEG' )
                error_msg(msg, title='Error loading EEG',
                          parent=self.win)
                return
            else:
Exemplo n.º 7
0
        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
])