Esempio n. 1
0
    def OnCreate(self, form):
        """
        Called when the view is created
        """
        self.bp_tree_widget = QtWidgets.QTreeWidget()
        self.bp_handler = BpHandler.get_bp_handler()
        self.die_icons = DIE.UI.Die_Icons.get_die_icons()

        # Get parent widget
        self.parent = form_to_widget(form)

        self._add_parser_data()

        toolbar = QtWidgets.QToolBar()
        action_refresh = QtWidgets.QAction(self.die_icons.icon_refresh,
                                           "Refresh", toolbar)
        action_refresh.triggered.connect(self.refresh)
        toolbar.addAction(action_refresh)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(toolbar)
        layout.addWidget(self.bp_tree_widget)

        self.parent.setLayout(layout)
Esempio n. 2
0
    def OnCreate(self, form):
        """
        Called when the plugin form is created
        """
        self.value_view = DIE.UI.ValueViewEx.get_view()
        self.bp_handler = DIE.Lib.BpHandler.get_bp_handler()
        self.die_icons = DIE.UI.Die_Icons.get_die_icons()
        self.die_db = DIE.Lib.DIEDb.get_db()

        # Get parent widget
        self.parent = form_to_widget(form)

        self.functionModel = QtGui.QStandardItemModel()
        self.functionTreeView = QtWidgets.QTreeView()
        self.functionTreeView.setExpandsOnDoubleClick(False)
        #self.functionTreeView.setSortingEnabled(True)

        delegate = TreeViewDelegate(self.functionTreeView)
        self.functionTreeView.setItemDelegate(delegate)

        self.functionTreeView.doubleClicked.connect(self.itemDoubleClickSlot)

        self._model_builder(self.functionModel)
        self.functionTreeView.setModel(self.functionModel)

        self.functionTreeView.setColumnWidth(0, 200)
        self.functionTreeView.setColumnWidth(1, 20)
        self.functionTreeView.setColumnWidth(2, 20)
        self.functionTreeView.setColumnWidth(3, 20)
        self.functionTreeView.setColumnWidth(4, 250)
        self.functionTreeView.setColumnWidth(5, 100)
        self.functionTreeView.setColumnWidth(6, 20)
        self.functionTreeView.setColumnWidth(7, 450)
        self.functionTreeView.setColumnWidth(8, 20)
        self.functionTreeView.setColumnWidth(9, 450)

        # Context menus
        self.functionTreeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.functionTreeView.customContextMenuRequested.connect(
            self.onCustomContextMenu)

        # Actions
        self.context_menu_param = None  # Parameter to be passed to context menu slots

        action_exclude_func = QtWidgets.QAction(
            "Exclude Function",
            self.functionTreeView,
            triggered=lambda: self.on_exclude_func(self.context_menu_param))
        action_exclude_func_adrs = QtWidgets.QAction(
            "Exclude All Function Calls",
            self.functionTreeView,
            triggered=lambda: self.on_exclude_func_adrs(self.context_menu_param
                                                        ))
        action_exclude_ea = QtWidgets.QAction(
            "Exclude Address",
            self.functionTreeView,
            triggered=lambda: self.on_exclude_ea(self.context_menu_param))
        action_exclude_library = QtWidgets.QAction(
            "Exclude Library",
            self.functionTreeView,
            triggered=lambda: self.on_exclude_library(self.context_menu_param))
        action_value_detail = QtWidgets.QAction(
            "Inspect Value Details",
            self.functionTreeView,
            triggered=lambda: self.on_value_detail(self.context_menu_param))

        action_show_callgraph = QtWidgets.QAction(
            "Show Call-Graph",
            self.functionTreeView,
            triggered=lambda: self.on_show_callgraph(self.context_menu_param))

        # Function ContextMenu
        self.function_context_menu = QtWidgets.QMenu(self.functionTreeView)
        self.function_context_menu.addAction(action_exclude_func)
        self.function_context_menu.addAction(action_exclude_library)
        self.function_context_menu.addAction(action_exclude_func_adrs)

        # Function ea ContextMenu
        self.ea_context_menu = QtWidgets.QMenu(self.functionTreeView)
        self.ea_context_menu.addAction(action_exclude_ea)
        self.ea_context_menu.addAction(action_show_callgraph)

        # Argument value ContextMenu
        self.value_context_menu = QtWidgets.QMenu(self.functionTreeView)
        self.value_context_menu.addAction(action_value_detail)

        # Therad ComboBox
        threads = []
        if self.die_db is not None:
            threads = self.die_db.get_thread_list()

        thread_id_list = []
        thread_id_list.append("All Threads")
        for thread in threads:
            thread_id_list.append(str(thread.thread_num))

        self.thread_id_combo = QtWidgets.QComboBox()
        self.thread_id_combo.addItems(thread_id_list)
        self.thread_id_combo.activated[str].connect(
            self.on_thread_combobox_change)

        self.thread_id_label = QtWidgets.QLabel("Thread:  ")

        # Toolbar
        self.function_toolbar = QtWidgets.QToolBar()
        self.function_toolbar.addWidget(self.thread_id_label)
        self.function_toolbar.addWidget(self.thread_id_combo)

        # Grid
        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.function_toolbar)
        layout.addWidget(self.functionTreeView)

        self.parent.setLayout(layout)