diff --git a/Ccs/ccs_function_lib.py b/Ccs/ccs_function_lib.py index a2020f9b3872fd654dbefe9990d3f6e36f9870b1..b022f46a8fe9b5b90694db4b37f3b075f7fa0284 100644 --- a/Ccs/ccs_function_lib.py +++ b/Ccs/ccs_function_lib.py @@ -2690,12 +2690,34 @@ def get_tc_calibration_and_parameters(ccf_descr=None): def get_tm_id(ccf_descr=None): if ccf_descr is None: - tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr ' - 'FROM pid ').fetchall() + tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr, pid_tpsd, ' + 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby ' + 'FROM pid ' + 'LEFT JOIN plf ' + 'ON pid_spid = plf_spid AND pid_tpsd = -1 ' + 'LEFT JOIN vpd ' + 'ON pid_tpsd = vpd_tpsd AND pid_tpsd <> -1 ' + 'LEFT JOIN pcf ' + 'ON pcf_name = COALESCE(plf_name, vpd_name) ' + 'LEFT JOIN txf ' + 'ON pcf_curtx = txf_numbr ' + 'LEFT JOIN txp ' + 'ON txf_numbr = txp.txp_numbr').fetchall() else: - tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr ' + tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr , pid_tpsd, ' + 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby ' 'FROM pid ' + 'LEFT JOIN plf ' + 'ON pid_spid = plf_spid AND pid_tpsd = -1 ' + 'LEFT JOIN vpd ' + 'ON pid_tpsd = vpd_tpsd AND pid_tpsd <> -1 ' + 'LEFT JOIN pcf ' + 'ON pcf_name = COALESCE(plf_name, vpd_name) ' + 'LEFT JOIN txf ' + 'ON pcf_curtx = txf_numbr ' + 'LEFT JOIN txp ' + 'ON txf_numbr = txp.txp_numbr ' 'WHERE ccf_descr="{}"'.format(ccf_descr)).fetchall() scoped_session_idb.close() @@ -2703,7 +2725,7 @@ def get_tm_id(ccf_descr=None): tms_dict = {} for row in tms: - tms_dict.setdefault(row[0:6]) + tms_dict.setdefault(row[0:5], []).append(row[5:]) return tms_dict diff --git a/Tst/tst/tc_management.py b/Tst/tst/tc_management.py index 2dd7a542bf849806fa9abc9bd4d8f2b0586e826a..2dee664b25f22863819c5c4699d44708ac5957db 100644 --- a/Tst/tst/tc_management.py +++ b/Tst/tst/tc_management.py @@ -293,7 +293,7 @@ class CommandDescriptionBox(Gtk.Box): # setting the filter function self.cal_filter.set_visible_func(self.cal_filter_func) - self.cal_treeview = Gtk.TreeView(model=self.descr_filter) + self.cal_treeview = Gtk.TreeView(model=self.cal_filter) for i, column_title in enumerate( ["prv_minval", "prv_maxval", "pas_altxt", "pas_alval", "data-type"] diff --git a/Tst/tst/tm_management.py b/Tst/tst/tm_management.py index 0ab3f865406ad057a9655aa5315e96e341cc0678..36648287c91bf1527069d10ea5d6cb919c8dc656 100644 --- a/Tst/tst/tm_management.py +++ b/Tst/tst/tm_management.py @@ -15,57 +15,37 @@ dictionary_of_tms = cfl.get_tm_id() tm_list = list(dictionary_of_tms.keys()) +tm_type_list = [] +tm_type_sub_list = [] +for counter in tm_list: + if counter[0] not in tm_type_list: + tm_type_list.append(counter[0]) + else: + pass +def get_tm_type_sublist(tm_descr): + tm_type_sub_list.clear() + for key in dictionary_of_tms: + if tm_descr in key: + for counter in dictionary_of_tms[key]: + pid_tpsc = str(counter[0]) + pid_spid = str(counter[1]) + pcf_name = str(counter[2]) + pcf_descr = str(counter[3]) + pcf_curtx = str(counter[4]) + txp_from = str(counter[5]) + txp_altxt = str(counter[6]) + plf_offpy = str(counter[7]) + tm_type_sub_list.append([pid_tpsc, pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt]) - - - - - - - - - -tc_type = None - - -dictionary_of_commands = cfl.get_tc_list() -read_in_list_of_commands = list(dictionary_of_commands.keys()) -list_of_commands = [] -type_list = [] -subtype_list = [] - -descr_list = [] -calibrations_list = [] -minval_list = [] -maxval_list = [] -altxt_list = [] -alval_list = [] - - -for command in read_in_list_of_commands: - command = list(command) - del command[0] - myorder = [2, 3, 0, 1] - command = [command[i] for i in myorder] - command[0] = int(command[0]) - command[1] = int(command[1]) - list_of_commands.append(command) - if command[0] not in type_list: - type_list.append(command[0]) - - -type_list.sort() -subtype_list.sort() - - + return tm_type_sub_list @@ -88,7 +68,7 @@ class TmTable(Gtk.Grid): # Create ListStores for the ComboBoxes self.type_liststore = Gtk.ListStore(int) - for type_ref in type_list: + for type_ref in tm_type_list: self.type_liststore.append([type_ref, ]) # self.current_filter_type = None @@ -127,9 +107,14 @@ class TmTable(Gtk.Grid): self.scrollable_treelist.add(self.treeview) - self.command_entry = Gtk.Entry() - self.command_entry.set_placeholder_text("<Command Variables>") - self.attach_next_to(self.command_entry, self.scrollable_treelist, Gtk.PositionType.BOTTOM, 8, 1) + self.telemetry_entry = Gtk.Entry() + self.telemetry_entry.set_placeholder_text("<Telemetry Variables>") + self.attach_next_to(self.telemetry_entry, self.scrollable_treelist, Gtk.PositionType.BOTTOM, 8, 1) + + self.secondary_box = TmSecondaryTable() + self.attach_next_to(self.secondary_box, self.telemetry_entry, Gtk.PositionType.BOTTOM, 8, 5) + + # Set up Drag and Drop @@ -147,18 +132,32 @@ class TmTable(Gtk.Grid): if combo_iter is not None: model = combo.get_model() number = model[combo_iter][0] - # print(number) - self.current_filter_telecommand = int(number) + self.current_filter_telemetry = int(number) - self.telecommand_filter.refilter() + self.telemetry_filter.refilter() def on_clear_button_clicked(self, widget): - self.current_filter_telecommand = None - self.telecommand_filter.refilter() + self.current_filter_telemetry = None + self.telemetry_filter.refilter() def item_selected(self, selection): - pass + model, row = selection.get_selected() + if row is not None: + tm_descr = model[row][4] + global tm_type_sub_list + tm_type_sub_list = get_tm_type_sublist(tm_descr) + self.secondary_box.refresh_secondary_treelist() + + + + + + + + + + @@ -180,3 +179,68 @@ class TmTable(Gtk.Grid): def on_drag_begin(self, *args): pass + + + + + + +class TmSecondaryTable(Gtk.Box): + def __init__(self): + + Gtk.Box.__init__(self) + self.set_orientation(Gtk.Orientation.HORIZONTAL) + self.set_vexpand(True) + # self.set_hexpand(False) + + + self.secondary_liststore = Gtk.ListStore(str, str, str, str, str, str, str) + for tm_type_sub_ref in tm_type_sub_list: + self.secondary_liststore.append(list(tm_type_sub_ref)) + self.current_filter_secondary = None + + # Creating filter, feeding it with liststore model + self.secondary_filter = self.secondary_liststore.filter_new() + # setting the filter function + self.secondary_filter.set_visible_func(self.secondary_filter_func) + + self.secondary_treeview = Gtk.TreeView(model=self.secondary_filter) + + for i, column_title in enumerate( + ["pid_tpsc", "pid_spic", "pcf_name", "pcf_descr", "pcf_curtx", "txp_from", "txp_altxt"] + ): + renderer = Gtk.CellRendererText() + column = Gtk.TreeViewColumn(column_title, renderer, text=i) + self.secondary_treeview.append_column(column) + + + self.scrollable_secondary_tm_treelist = Gtk.ScrolledWindow() + self.pack_start(self.scrollable_secondary_tm_treelist, True, True, 0) + + self.scrollable_secondary_tm_treelist.add(self.secondary_treeview) + + + + + + def secondary_filter_func(self, model, iter, data): + if ( + self.current_filter_secondary is None + or self.current_filter_secondary == "None" + ): + return True + else: + return model[iter][2] == self.current_filter_descr + + def refresh_secondary_treelist(self): + self.secondary_liststore.clear() + self.secondary_liststore = Gtk.ListStore(str, str, str, str, str, str, str) + for tm_type_sub_ref in tm_type_sub_list: + self.secondary_liststore.append(list(tm_type_sub_ref)) + self.secondary_treeview.set_model(self.secondary_liststore) + + + + + +