コード例 #1
0
 def update_available_setups(self, i=None):
     '''Update which setups are available for selection in dropdown menus.'''
     selected_setups = set([
         str(self.cellWidget(s, 0).currentText())
         for s in range(self.n_subjects)
     ])
     self.available_setups = sorted(list(self.all_setups - selected_setups))
     for s in range(self.n_subjects):
         cbox_update_options(self.cellWidget(s, 0), self.available_setups)
コード例 #2
0
    def refresh_variable_options(self):
        fully_asigned_variables = []
        for table in self.tables:
            # determine which variables are already being used
            for row in range(table.n_variables):
                assigned_var = table.cellWidget(row, 2).currentText()
                if assigned_var != "     select variable     ":
                    fully_asigned_variables.append(assigned_var)
            self.available_vars = sorted(list(self.variable_names -
                                              set(fully_asigned_variables)),
                                         key=str.lower)

        for table in self.tables:  # Update the available options in the variable comboboxes
            for row in range(table.n_variables):
                cbox_update_options(table.cellWidget(row, 2),
                                    self.available_vars)

        index = self.tabs.currentIndex()
        if index > -1:
            self.tab_title_edit.setText(self.tabs.tabText(index))
コード例 #3
0
 def refresh(self):
     '''Called periodically when not running to update available task, ports, experiments.'''
     if self.GUI_main.available_tasks_changed:
         self.task_select.update_menu(dirs['tasks'])
         self.hardware_test_select.update_menu(dirs['tasks'])
         self.GUI_main.available_tasks_changed = False
     if self.GUI_main.available_experiments_changed:
         cbox_update_options(self.experiment_select,
                             self.GUI_main.available_experiments)
         self.GUI_main.available_experiments_changed = False
     if self.GUI_main.setups_tab.available_setups_changed:
         self.subjects_table.all_setups = set(
             self.GUI_main.setups_tab.setup_names)
         self.subjects_table.update_available_setups()
     if self.saved_exp_dict != self.experiment_dict():
         self.save_button.setEnabled(True)
     else:
         self.save_button.setEnabled(False)
     if self.GUI_main.data_dir_changed:
         if (str(self.name_text.text()) == '') and not self.custom_dir:
             self.data_dir_text.setText(dirs['data'])
コード例 #4
0
 def update_available(self, i=None):
     # Find out what variable-subject combinations already assigned.
     self.assigned = {v_name: [] for v_name in self.variable_names}
     for v in range(self.n_variables):
         v_name = self.cellWidget(v, 0).currentText()
         s_name = self.cellWidget(v, 1).currentText()
         if s_name and s_name not in self.subjects_table.subjects + ['all']:
             cbox_set_item(self.cellWidget(v, 1), '', insert=True)
             continue
         if v_name != 'select variable' and s_name:
             self.assigned[v_name].append(s_name)
     # Update the variables available:
     fully_asigned_variables = [
         v_n for v_n in self.assigned.keys() if 'all' in self.assigned[v_n]
     ]
     if self.subjects_table.subjects:
         fully_asigned_variables += [
             v_n for v_n in self.assigned.keys()
             if set(self.assigned[v_n]) == set(self.subjects_table.subjects)
         ]
     self.available_variables = sorted(
         list(set(self.variable_names) - set(fully_asigned_variables)),
         key=str.lower)
     # Update the available options in the variable and subject comboboxes.
     for v in range(self.n_variables):
         v_name = self.cellWidget(v, 0).currentText()
         s_name = self.cellWidget(v, 1).currentText()
         cbox_update_options(self.cellWidget(v, 0),
                             self.available_variables)
         if v_name != 'select variable':
             # If variable has no subjects assigned, set subjects to 'all'.
             if not self.assigned[v_name]:
                 self.cellWidget(v, 1).addItems(['all'])
                 self.assigned[v_name] = ['all']
                 self.available_variables.remove(v_name)
             cbox_update_options(self.cellWidget(v, 1),
                                 self.available_subjects(v_name, s_name))
コード例 #5
0
 def refresh(self):
     '''Called periodically when not running to update available task, ports, experiments.'''
     if self.GUI_main.available_tasks_changed:
         cbox_update_options(self.task_select,
                             self.GUI_main.available_tasks)
         cbox_update_options(self.hardware_test_select,
                             [' no hardware test'] +
                             self.GUI_main.available_tasks)
         self.GUI_main.available_tasks_changed = False
     if self.GUI_main.available_experiments_changed:
         cbox_update_options(self.experiment_select,
                             self.GUI_main.available_experiments)
         self.GUI_main.available_experiments_changed = False
     if self.GUI_main.setups_tab.available_setups_changed:
         self.subjects_table.all_setups = set(
             self.GUI_main.setups_tab.setup_names)
         self.subjects_table.update_available_setups()