Пример #1
0
 def on_finished_importing(self, attr, result):
     parent_table = ArtifactTable(self.tab,
                                  result,
                                  is_parent=True,
                                  selected_sw=attr[2])
     parent_table.setToolTip("{} - {}".format(attr[0], attr[1]))
     idx = self.tab.addTab(parent_table, self.get_tab_text("XML"))
     self.adding_tab_number = idx
     self.tab.setCurrentIndex(idx)
     if attr[2]:
         self.filtering_widget.change_status_for_color_parent_table()
     else:
         self.filtering_widget.change_status_for_no_color_parent_table()
     self.adding_tab_number = -1
Пример #2
0
    def on_finished_searching(self, artifacts_list, parent_table):
        new_tab_text = self.get_tab_text("Search")
        child_table = ArtifactTable(self.tab,
                                    artifacts_list,
                                    selected_sw=parent_table.selected_sw)

        self.adding_tab_number = self.tab.addTab(child_table, new_tab_text)
        child_table.setToolTip("From \"{}\" Tab".format(
            self.tab.tabText(self.tab.indexOf(parent_table))))
        child_table.navigated.connect(self.navigate)
        self.tab.setCurrentIndex(self.adding_tab_number)
        if parent_table.selected_sw:
            self.filtering_widget.change_status_for_color_table()
        else:
            self.filtering_widget.change_status_for_no_color_table()
        self.table_dict[child_table] = parent_table
        self.adding_tab_number = -1
Пример #3
0
 def import_csv(self):
     import os, csv
     dir_path = os.getcwd() + "\\" if len(self.env) == 2 else self.env[6]
     file_name, _ = QFileDialog.getOpenFileName(self,
                                                "Import CSV",
                                                dir_path,
                                                filter="*.csv")
     if not file_name and not _: return
     try:
         with open(file_name, newline='', encoding='utf-8') as f:
             reader = csv.reader(f)
             first_row = next(reader)
             selected_sw = first_row[-1].split("=")[1]
             selected_sw = None if selected_sw == 'None' else list(
                 map(int, selected_sw.split("/")))
             result = []
             for row in reader:
                 head = row[0].split("/")
                 head[1] = True if head[1] == "True" else False
                 head[2:] = map(int, head[2:])
                 if head[0] == CONSTANT.HISTORY_KEYWORD:
                     result.append([head] + row[1:4])
                 elif head[0] == CONSTANT.PREFETCH_KEYWORD:
                     result.append([head] + row[1:5])
                 else:
                     result.append([head] + row[1:6])
     except Exception as e:
         QMessageBox.warning(self, "Error", "{}".format(e), QMessageBox.Ok)
         return
     parent_table = ArtifactTable(self.tab,
                                  result,
                                  is_parent=True,
                                  selected_sw=selected_sw)
     idx = self.tab.addTab(parent_table, self.get_tab_text("CSV"))
     self.adding_tab_number = idx
     parent_table.is_detail_allowed = False
     parent_table.setToolTip(file_name)
     self.tab.setCurrentIndex(idx)
     if selected_sw:
         self.filtering_widget.change_status_for_color_parent_table()
     else:
         self.filtering_widget.change_status_for_no_color_parent_table()
     self.adding_tab_number = -1