def OnCustomContextMenu(self, point): menu = QtWidgets.QMenu() # Actions action_undo = QtWidgets.QAction('Undo', self.treeView) action_undo.triggered.connect(self.Undo) action_restore = QtWidgets.QAction('Restore original trace', self.treeView) action_restore.triggered.connect(self.Restore) action_forward_to_clustering = QtWidgets.QAction( "Open in Clustering Analysis", self.treeView) action_forward_to_clustering.triggered.connect(self.ClusterForward) action_export_trace = QtWidgets.QAction('Export this trace...', self.treeView) action_export_trace.triggered.connect(self.SaveTrace) action_close_viewer = QtWidgets.QAction('Close Viewer', self.treeView) action_close_viewer.triggered.connect(lambda: self.Close(4)) # add actions to menu menu.addAction(action_undo) menu.addAction(action_restore) menu.addAction(action_forward_to_clustering) menu.addAction(action_export_trace) menu.addSeparator() menu.addAction(action_close_viewer) menu.exec_(self.treeView.viewport().mapToGlobal(point))
def OnCustomContextMenu(self, point): menu = QtWidgets.QMenu() # Actions action_set_t = QtWidgets.QAction('Set grade threshold...', self.treeView) action_set_t.triggered.connect(self.SetThreshold) action_restore = QtWidgets.QAction('Show All', self.treeView) action_restore.triggered.connect(self.Restore) action_export_trace = QtWidgets.QAction('Export this trace...', self.treeView) action_export_trace.triggered.connect(self.SaveTrace) action_close_viewer = QtWidgets.QAction('Close Viewer', self.treeView) action_close_viewer.triggered.connect(lambda: self.Close(4)) # add actions to menu menu.addAction(action_set_t) menu.addAction(action_restore) menu.addAction(action_export_trace) menu.addSeparator() menu.addAction(action_close_viewer) menu.exec_(self.treeView.viewport().mapToGlobal(point))
def OnCustomContextMenu(self, point): menu = QtWidgets.QMenu() init_index = self.treeView.indexAt(point) index = self.treeView.indexAt(point) level = 0 while index.parent().isValid(): index = index.parent() level += 1 text = 'Remove Line' if level == 0: text = "Remove Cluster / Line" elif level == 1 and get_vmr().bb: text = "Remove Basic Block" elif level == 2: text = "Remove Line" try: action_remove = QtWidgets.QAction(text, self.treeView) action_remove.triggered.connect( lambda: self.ItemDoubleClickSlot(init_index)) menu.addAction(action_remove) menu.addSeparator() except: print '[*] An Exception occured, remove action could not be added to the menu!' # Actions action_remove_threshold = QtWidgets.QAction( 'Remove several clusters...', self.treeView) action_remove_threshold.triggered.connect(self.ClusterRemoval) action_undo = QtWidgets.QAction('Undo', self.treeView) action_undo.triggered.connect(self.Undo) action_restore = QtWidgets.QAction('Restore original trace', self.treeView) action_restore.triggered.connect(self.Restore) action_export_trace = QtWidgets.QAction('Export this trace ...', self.treeView) action_export_trace.triggered.connect(self.SaveTrace) action_close_viewer = QtWidgets.QAction('Close Viewer', self.treeView) action_close_viewer.triggered.connect(lambda: self.Close(4)) # add actions to menu menu.addAction(action_remove_threshold) menu.addAction(action_undo) menu.addAction(action_restore) menu.addAction(action_export_trace) menu.addSeparator() menu.addAction(action_close_viewer) menu.exec_(self.treeView.viewport().mapToGlobal(point))