Beispiel #1
0
    def setup_task(self):
        task = self.task_select.text()
        if task == "select task":
            return
        try:
            if self.uploaded:
                self.status_text.setText("Resetting task..")
            else:
                self.status_text.setText("Uploading..")
                self.task_hash = _djb2_file(
                    os.path.join(dirs["tasks"], task + ".py"))
            self.start_button.setEnabled(False)
            self.variables_button.setEnabled(False)
            self.repaint()
            self.board.setup_state_machine(task, uploaded=self.uploaded)
            if self.variables_dialog:
                self.variables_button.clicked.disconnect()
                self.variables_dialog.deleteLater()
            self.task = task
            if "custom_variables_dialog" in self.board.sm_info["variables"]:
                custom_variables_name = eval(
                    self.board.sm_info["variables"]["custom_variables_dialog"])
                potential_dialog = Custom_variables_dialog(
                    self, custom_variables_name)
                if potential_dialog.using_custom_gui:
                    self.variables_dialog = potential_dialog
                    self.using_custom_gui = True
                else:
                    self.variables_dialog = Variables_dialog(self, self.board)
                    self.using_custom_gui = False
            else:
                self.variables_dialog = Variables_dialog(self, self.board)
                self.using_custom_gui = False
            self.variables_button.clicked.connect(self.variables_dialog.exec_)
            self.variables_button.setEnabled(True)
            self.task_plot.set_state_machine(self.board.sm_info)
            self.task_info.set_state_machine(self.board.sm_info)
            self.file_groupbox.setEnabled(True)
            self.session_groupbox.setEnabled(True)
            self.start_button.setEnabled(True)
            self.stop_button.setEnabled(False)
            self.status_text.setText("Uploaded : " + task)
            self.fresh_task = True
            self.uploaded = True
            self.upload_button.setText("Reset")
            self.upload_button.setIcon(QtGui.QIcon("gui/icons/refresh.svg"))

        except PyboardError:
            self.status_text.setText("Error setting up state machine.")
Beispiel #2
0
    def assign_board(self, board):
        self.board = board
        if 'custom_variables_dialog' in self.board.sm_info['variables']:
            custom_variables_name = eval(self.board.sm_info['variables']['custom_variables_dialog'])
            potential_dialog = Custom_variables_dialog(self,custom_variables_name,is_experiment=True)
            if potential_dialog.using_custom_gui is True:
                self.variables_dialog = potential_dialog
            else:
                self.variables_dialog = Variables_dialog(self, self.board)
        else:
            self.variables_dialog = Variables_dialog(self, self.board)

        self.variables_button.clicked.connect(self.variables_dialog.exec_)
        self.variables_button.setEnabled(True)
        self.start_stop_button.clicked.connect(self.start_stop_task)
 def setup_task(self):
     try:
         task = self.task_select.currentText()
         if self.uploaded:
             self.status_text.setText('Resetting task..')
         else:
             self.status_text.setText('Uploading..')
             self.task_hash = _djb2_file(
                 os.path.join(tasks_dir, task + '.py'))
         self.start_button.setEnabled(False)
         self.variables_button.setEnabled(False)
         self.repaint()
         self.board.setup_state_machine(task, uploaded=self.uploaded)
         if self.variables_dialog:
             self.variables_button.clicked.disconnect()
             self.variables_dialog.deleteLater()
         self.variables_dialog = Variables_dialog(self, self.board)
         self.variables_button.clicked.connect(self.variables_dialog.exec_)
         self.variables_button.setEnabled(True)
         self.task_plot.set_state_machine(self.board.sm_info)
         self.file_groupbox.setEnabled(True)
         self.session_groupbox.setEnabled(True)
         self.start_button.setEnabled(True)
         self.stop_button.setEnabled(False)
         self.status_text.setText('Uploaded : ' + task)
         self.task = task
         self.fresh_task = True
         self.uploaded = True
         self.upload_button.setText('Reset')
     except PyboardError:
         self.status_text.setText('Error setting up state machine.')
 def assign_board(self, board):
     self.board = board
     self.variables_dialog = Variables_dialog(self, board)
     self.variables_button.clicked.connect(self.variables_dialog.exec_)
     self.variables_button.setEnabled(True)