示例#1
0
 def retrieve_sections(self, s_sections=None):
     if s_sections is None:
         s_sections = []
     self.directive = Message(action=32)
     self.connection = self.directive.send_directive(self.connection)
     a_sections = self.connection.message.information
     for item in self.trv_available_sections.get_children():
         self.trv_available_sections.delete(item)
     for item in self.trv_selected_sections.get_children():
         self.trv_selected_sections.delete(item)
     for item in s_sections:
         item_aux1 = item.split('¥')[2:6]
         item_aux2 = [item.split('¥')[-1]]
         item = item_aux1 + item_aux2
         item = '¥'.join(item)
         if item in a_sections:
             a_sections.remove(item)
     for index, item in enumerate(a_sections):
         elements = item.split('¥')
         self.trv_available_sections.insert(
             '',
             'end',
             text=elements[0],
             values=(index + 1, summarize_text(elements[1], 150),
                     summarize_text(elements[3], 120)))
     for index, item in enumerate(s_sections):
         elements = item.split('¥')
         self.trv_selected_sections.insert(
             '',
             'end',
             text=elements[2],
             values=(index + 1, summarize_text(elements[3], 150),
                     summarize_text(elements[5],
                                    120), elements[7], elements[8]))
示例#2
0
 def select_experiment_general(self, event=None):
     """
     This function is activated when the 'Click Experiments TreeView' event ocurrs, it indicates than an experiments
     has been selected
     """
     if len(self.trv_available_exp.selection()) == 1:
         self.clear_components(3)
         id_selected_exp = int(self.trv_available_exp.item(self.trv_available_exp.selection())[
                                   'text'])  # Retrieve id of selected item from TreeView
         self.directive = Message(action=95, information=[id_selected_exp])
         self.connection = self.directive.send_directive(self.connection)
         self.experiment = Experiment(id=id_selected_exp, name=self.connection.message.information[0],
                                      description=self.connection.message.information[1],
                                      design_type=self.connection.message.information[2],
                                      state=self.connection.message.information[3],
                                      creation_date=self.connection.message.information[5],
                                      execution_date=self.connection.message.information[6],
                                      finished_date=self.connection.message.information[7])
         self.retrieve_scenarios(self.connection.message.information[4])
         # Ask to server for dataframe of the measurements for the scenarios of selected experiment
         self.directive = Message(action=107, information=[id_selected_exp, 'experiment'])
         self.connection = self.directive.send_directive(self.connection)
         final_df = get_mean_value(self.connection.message.information[0])
         for index, row in final_df.iterrows():
             self.trv_detail_sc.insert('', 'end', text=row.id, values=(index + 1, summarize_text(row.variable, 250),
                                                                       row.m1, row.m2, row.m3, row.m4))
示例#3
0
 def retrieve_list(self):
     # Remove existing elements in the list
     for item in self.trv_available.get_children():
         self.trv_available.delete(item)
     self.directive = Message(action=67)
     self.connection = self.directive.send_directive(self.connection)
     # Adding elements into the list
     for index, item in enumerate(self.connection.message.information):
         elements = item.split('¥')
         self.trv_available.insert('',
                                   'end',
                                   text=elements[0],
                                   values=(index + 1,
                                           summarize_text(elements[1], 200),
                                           summarize_text(elements[2],
                                                          150)))
     if len(self.trv_available.get_children()) != 0:
         self.trv_available.selection_set(
             self.trv_available.get_children()[0])
示例#4
0
 def retrieve_problems(self, problems=None):
     """
     This function shows the existing Problems in an 'Experimental scenario'
     """
     # Remove existing elements in the list
     for item in self.trv_available_prob.get_children():
         self.trv_available_prob.delete(item)
     for index, item in enumerate(problems):
         elements = item.split('¥')
         self.trv_available_prob.insert('', 'end', text=elements[0], values=(index + 1,
                                                                             summarize_text(elements[1], 250)))
     '''if len(self.trv_available_prob.get_children()) != 0:
示例#5
0
 def retrieve_experiments(self):
     """
     This function shows the existing 'Experiments' in the home TreeView
     """
     # Remove existing elements in the list
     for item in self.trv_available_exp.get_children():
         self.trv_available_exp.delete(item)
     self.directive = Message(action=92, information=['finished'])
     self.connection = self.directive.send_directive(self.connection)
     if len(self.connection.message.information) != 0:
         for index, item in enumerate(self.connection.message.information):
             elements = item.split('¥')
             self.trv_available_exp.insert('', 'end', text=elements[0], values=(index + 1,
                                                                                summarize_text(elements[1], 250)))
         self.available_patterns = Pattern.get_available_patterns(self.connection)
         '''if len(self.trv_available_exp.get_children()) != 0:
             self.trv_available_exp.selection_set(self.trv_available_exp.get_children()[0])
             self.select_experiment_general()'''
     else:
         messagebox.showwarning(parent=self.frm_child_report, title='No experiments',
                                message='No experiments in finished state')
示例#6
0
 def select_problem_general(self, event=None):
     """
     Function activated when a scenario is selected
     """
     if len(self.trv_available_prob.selection()) == 1:
         self.clear_components(1)
         id_selected_prob = int(self.trv_available_prob.item(self.trv_available_prob.selection())[
                                    'text'])  # Retrieve id of selected item from TreeView
         self.directive = Message(action=55, information=[id_selected_prob])
         self.connection = self.directive.send_directive(self.connection)
         self.problem = Problem(id=id_selected_prob, brief_description=self.connection.message.information[0],
                                description=self.connection.message.information[1],
                                id_solution=self.connection.message.information[2],
                                av_patterns=self.available_patterns, connection=self.connection)
         # Ask to server for dataframe of the measurements for the designers of selected problem
         self.directive = Message(action=107, information=[id_selected_prob, 'problem'])
         self.connection = self.directive.send_directive(self.connection)
         final_df = get_mean_value(self.connection.message.information[0])
         for index, row in final_df.iterrows():
             self.trv_detail_designer.insert('', 'end', text=row.id, values=(index + 1,
                                                                             summarize_text(row.variable, 250),
                                                                             row.m1, row.m2, row.m3, row.m4))
示例#7
0
 def retrieve_list(self):
     """
     This function shows the existing 'Experimental scenarios for the specified designer' in the home TreeView, if
     not 'Experimental scenario' then an information box is showed
     """
     # Remove existing elements in the list
     for item in self.trv_available.get_children():
         self.trv_available.delete(item)
     # Retrieve scenario for current designer
     self.directive = Message(action=82, information=['my scenarios', self.current_designer.id])
     self.connection = self.directive.send_directive(self.connection)
     # Set visual components with retrieved scenarios
     for item in self.connection.message.information:
         elements = item.split('¥')
         self.trv_available.insert('', 'end', text=elements[0], values=(summarize_text(elements[1], 400),))
     if len(self.trv_available.get_children()) != 0:
         self.trv_available.selection_set(self.trv_available.get_children()[0])
         self.select_experimental_scenario()
     else:
         self.txt_scenario_desc['state'] = NORMAL
         self.txt_scenario_desc.delete('1.0', 'end-1c')
         self.txt_scenario_desc.insert('1.0', 'No experiments available for you')
         self.txt_scenario_desc['state'] = DISABLED
示例#8
0
 def select_scenario_general(self, event=None):
     """
     Function activated when a scenario is selecteded
     """
     if len(self.trv_available_sc.selection()) == 1:
         self.clear_components(2)
         id_selected_sc = int(self.trv_available_sc.item(self.trv_available_sc.selection())[
                                  'text'])  # Retrieve id of selected item from TreeView
         self.directive = Message(action=85, information=[id_selected_sc, 'report', 1])
         self.connection = self.directive.send_directive(self.connection)
         self.scenario = ExperimentalSC(id=id_selected_sc, title=self.connection.message.information[0],
                                        description=self.connection.message.information[1],
                                        id_description_diagram=self.connection.message.information[2],
                                        info_designers=self.connection.message.information[4])
         self.retrieve_problems(self.connection.message.information[3])
         # Ask to server for dataframe of the measurements for the problems of selected scenario
         self.directive = Message(action=107, information=[id_selected_sc, 'scenario'])
         self.connection = self.directive.send_directive(self.connection)
         final_df = get_mean_value(self.connection.message.information[0])
         for index, row in final_df.iterrows():
             self.trv_detail_prob.insert('', 'end', text=row.id, values=(index + 1,
                                                                         summarize_text(row.variable, 250), row.m1,
                                                                         row.m2, row.m3, row.m4))