Esempio n. 1
0
 def select_operation_type(self):
     """
     prepare dictionary [building, simulating, plotting] for self.select_from_options() and call it
     :return: ((one-character) tring) selected operation type
     """
     if not self.__operation_type:
         operation_type_dict = OrderedDict([('b', '(b)uilding'), ('s', '(s)imulating'), ('p', '(p)lotting')])
         self.__operation_type = select_from_options(operation_type_dict, 'Select operation type')
     return self.__operation_type
Esempio n. 2
0
 def reselect(self, subject):
     """
     prepare dictionary [operation type, computer, ...] for self.select_from_options() and call it
     call self.neutralize_previous_selections() to set previous settings to None
     this condition (value is None) lets user reselect values in functions select_*
     :param subject: (class Subject) stores variables computer, user, code, branch
     :return:
     """
     option_dict = OrderedDict([('p', 'o(p)eration type'), ('c', '(c)omputer'), ('o', 'c(o)de'),
                                ('b', '(b)ranch'), ('n', 'co(n)figuration')])
     if self.__operation_type == 's' or self.__operation_type == 'p':
         option_dict_amendments = {'e': '(e)xample', 't': '(t)ype', 'a': 'c(a)se'}
         option_dict.update(option_dict_amendments)
     option_selected = select_from_options(option_dict, 'Select')
     self.neutralize_previous_selections(subject, option_selected)
Esempio n. 3
0
    def select_operation(self, selected_operation):
        """
        set self._selected_operation
        from user input if not already selected via previous loop or constructor of Environment
        else from setting.operation (which is passed to here as function argument)
        Required:
            self._operation_dict (dict)
        :param selected_operation: (string, None if operation not already selected)
        :return:
        """
        print('\n-----------------------------------------------------------------\n') 
        print('Test subject {} {}\n             on {}'.format(
            self._subject.code, self._subject.branch, self._subject.computer))

        if selected_operation:
            self._selected_operation = selected_operation
        else:
            self._selected_operation = select_from_options(self._operation_dict, 'Select operation')