예제 #1
0
파일: mainwnd.py 프로젝트: ponty/nanpy-gui
    def _connect_fired(self):
            try:
                connection = SerialManager(device=self.serial_device,
                                           baudrate=self.baudrate,
                                           sleep_after_connect=self.sleep_after_connect,
                                           timeout=self.timeout)
                connection.open()
                print ArduinoApi(connection=connection).millis()
            except Exception as e:
                traceback.print_exc()
                message(traceback.format_exc(), buttons=['OK'])
                return

            a = self.tree = ArduinoTree(connection=connection)

            d = a.define.as_dict
            s = [GuiDefine(name=k, value=str(v)) for k, v in d.items()]
            s.sort(key=lambda x: x.name)
            self.defines = s
            self.digital_pins = [PinWrapper(pin=a.pin.get(x))
                                 for x in a.pin.names_digital]
            self.analog_pins = [PinWrapper(pin=a.pin.get(x))
                                for x in a.pin.names_analog]
            self.pins = self.digital_pins + self.analog_pins

            fw = a.firmware_info
            self.arduino_version = fw.get('arduino_version')
            self.firmware_build_time = str(fw.get('compile_datetime'))
            self.avr_name = fw.get('avr_name')
            self.gcc_version = fw.get('gcc_version')
            self.libc_version = fw.get('libc_version')
            self.libc_date = str(fw.get('libc_date'))
            self.connected = True
예제 #2
0
 def _info_button_fired(self):
     """Open dialog with description of statistics."""
     if self.statistics_name in GLOBAL_STATS:
         stat_func = GLOBAL_STATS[self.statistics_name]
     else:
         stat_func = PAIRWISE_STATS[self.statistics_name]
     message(message = stat_func.__doc__, title='Statistics info')
예제 #3
0
 def _info_button_fired(self):
     """Open dialog with description of statistics."""
     if self.statistics_name in GLOBAL_STATS:
         stat_func = GLOBAL_STATS[self.statistics_name]
     else:
         stat_func = PAIRWISE_STATS[self.statistics_name]
     message(message=stat_func.__doc__, title='Statistics info')
예제 #4
0
파일: ibis_file.py 프로젝트: jdpatt/PyAMI
 def log(self, msg, alert=False):
     """Log a message to the console and, optionally, to terminal and/or pop-up dialog."""
     _msg = msg.strip()
     txt = "\n[{}]: {}\n".format(datetime.now(), _msg)
     self._log += txt
     if self.debug:
         print(txt)
     if alert:
         message(_msg, "PyAMI Alert")
예제 #5
0
 def _gcuts_fired(self):
     sp = os.path.join(self.project_surface_directory,self.subject_id)
     if os.path.exists(os.path.join(sp,'mri','brainmask.braincuts.mgz')):
         message(message='gcuts has already been run for subject %s'%self.subject_id)
     else:
         if not os.path.isfile(os.path.join(sp,'mri','brainmask_backup_%s.mgz'%self.date)):
             copy(os.path.join(sp,'mri','brainmask.mgz'),os.path.join(sp,'mri','brainmask_backup_%s.mgz'%self.date))
         os.system('recon-all -skullstrip -clean-bm -gcut -subjid %s'%self.subject_id)
         os.system('echo "gcuts was run on %s" >> %s' %(time.strftime("%Y_%b_%d_%H%M",time.localtime()),os.path.join(sp,'edit.log')))
예제 #6
0
 def _check_for_subjects_surfaces_fired(self):
     project_surface_directory=self.project_surface_directory
     subject_id=self.subject_id
     os.environ['SUBJECTS_DIR']=self.project_surface_directory
     if os.path.isfile(os.path.join(project_surface_directory,subject_id,
                                    'mri','aparc+aseg.mgz')):
         self.subjects_existence=True
         message(message='Subject %s was successfully found at %s.'%(subject_id,os.path.join(project_surface_directory,subject_id)),title='Subject successfully found', buttons=['OK'])
     else:
         self.subjects_existence=False 
         error(message='Subject %s was not found at %s. Please check your subject directory and subject id'%(subject_id,os.path.join(project_surface_directory,subject_id)), title='Subject not found', buttons=['OK'])
예제 #7
0
    def _delete_fired(self):
        assert self.measurement
        res = message(
            'Delete "%s" ?' % self.measurement, buttons=['OK', 'Cancel'])
        if res:
#            path
            (self.project.result_dir / self.measurement).remove()
            self.update_available_measurements()
예제 #8
0
 def _delete_fired(self):
     assert self.measurement
     res = message('Delete "%s" ?' % self.measurement,
                   buttons=['OK', 'Cancel'])
     if res:
         #            path
         (self.project.result_dir / self.measurement).remove()
         self.update_available_measurements()
예제 #9
0
    def _delete_action(self):
        # open dialog asking are you sure
        msg = 'Remove selected result from database?'
        result = message(message=msg,
                         title='Delete result from database',
                         buttons=['OK', 'Cancel'])

        if result:
            # remove from results_table
            self.results_table.remove(self.current_selection)
            self.current_selection = None
예제 #10
0
    def _delete_action(self):
        # open dialog asking are you sure
        msg = 'Remove selected result from database?'
        result = message(message=msg,
                         title='Delete result from database',
                         buttons = ['OK', 'Cancel'])

        if result:
            # remove from results_table
            self.results_table.remove(self.current_selection)
            self.current_selection = None
예제 #11
0
 def _get_info_on_model_fired(self):
     """Open dialog with model description."""
     model_class = self._model_name_to_class[self.model_name]
     message(message = model_class.__doc__, title='Model info')
예제 #12
0
 def _check_on_jobs_fired(self):
     user=getuser()
     recon_jobs=subprocess.check_output("qstat -u %s | grep 'recon'"%user,shell = True)
     message(message='%s'%recon_jobs)
예제 #13
0
 def _get_info_on_model_fired(self):
     """Open dialog with model description."""
     model_class = self._model_name_to_class[self.model_name]
     message(message=model_class.__doc__, title='Model info')
예제 #14
0
 def _fire_event_fired():
     message("Button clicked!")
예제 #15
0
 def _fire_event_fired():
     message("Button clicked!")