def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol: ProtocolAnalyzer, view: int): """ :type parent: QTableView :type undo_stack: QUndoStack :type protocol_analyzers: list of ProtocolAnalyzer """ min_row, max_row, start, end = sel_range if min_row == -1 or max_row == -1 or start == -1 or end == -1: return None if max_row != min_row: QMessageBox.critical( parent, self.tr("Error in BlockBreak"), self.tr("You can only break one line per action.")) return None end = protocol.convert_index(end, view, 0, True, block_indx=min_row)[0] # factor = 1 if view == 0 else 4 if view == 1 else 8 self.command = BlockBreakAction(protocol, max_row, end) action = QAction(self.command.text(), parent) action.triggered.connect(self.action_triggered) self.undo_stack = undo_stack return action
def __init__(self, proto_analyzer: ProtocolAnalyzer, index: int, rows: list, view: int): super().__init__() self.proto_analyzer = proto_analyzer self.index = proto_analyzer.convert_index(index, from_view=view, to_view=0, decoded=False)[0] self.nbits = 1 if view == 0 else 4 if view == 1 else 8 self.rows = rows self.saved_messages = {} self.setText("Insert column at {0:d}".format(index))
def __init__(self, proto_analyzer: ProtocolAnalyzer, index: int, rows: list, view: int): super().__init__() self.proto_analyzer = proto_analyzer self.index = proto_analyzer.convert_index(index, from_view=view, to_view=0, decoded=False)[0] self.nbits = 1 if view == 0 else 4 if view == 1 else 8 self.rows = rows self.saved_messages = {} self.setText("Insert column at {0:d}".format(index))
def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol: ProtocolAnalyzer, view: int): """ :type parent: QTableView :type undo_stack: QUndoStack :type protocol_analyzers: list of ProtocolAnalyzer """ min_row, max_row, start, end = sel_range if min_row == -1 or max_row == -1 or start == -1 or end == -1: return None if max_row != min_row: return None end = protocol.convert_index(end, view, 0, True, message_indx=min_row)[0] # factor = 1 if view == 0 else 4 if view == 1 else 8 self.command = MessageBreakAction(protocol, max_row, end) action = QAction(self.command.text(), parent) action.triggered.connect(self.action_triggered) self.undo_stack = undo_stack return action