From 20d45833aa37ab6d887cebf42e71b92a2a82fbec Mon Sep 17 00:00:00 2001 From: jopohl Date: Fri, 12 Aug 2016 16:39:02 +0200 Subject: [PATCH] backward sync --- src/urh/signalprocessing/ProtocolBlock.py | 30 +++-------------------- ui/analysis_frame.ui | 4 +-- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/urh/signalprocessing/ProtocolBlock.py b/src/urh/signalprocessing/ProtocolBlock.py index 94636f29..2b4b6d08 100644 --- a/src/urh/signalprocessing/ProtocolBlock.py +++ b/src/urh/signalprocessing/ProtocolBlock.py @@ -350,33 +350,11 @@ class ProtocolBlock(object): def __get_bit_range_from_hex_or_ascii_index(self, from_index: int, decoded: bool, is_hex: bool) -> tuple: bits = self.decoded_bits if decoded else self.plain_bits factor = 4 if is_hex else 8 - pos = 0 - cur_index = 0 - # TODO Consider Bit alignment for labels (if label align is enabled) + for i in range(len(bits)): + if self.__get_hex_ascii_index_from_bit_index(i, decoded, to_hex=is_hex)[0] == from_index: + return i, i + factor - 1 - result = factor * (from_index - 1) - # for ba in self.__bit_alignments: - # - # - # - # for si in (i for i, b in enumerate(bits) if type(b) == Symbol): - # if from_index > cur_index + math.ceil((si - pos) / factor): - # result += (si - pos) + 1 - # cur_index += math.ceil((si - pos) / factor) + 1 - # pos = si + 1 - # elif from_index == cur_index + math.ceil((si - pos) / factor): - # result += (si - pos) - # return result, result - # else: - # break - # - # if from_index > cur_index: - # result += factor * (from_index - cur_index) - - end = result + factor - 1 - #end = end if end < len(bits) else len(bits) - 1 - - return result, end + return None, None def __get_hex_ascii_index_from_bit_index(self, bit_index: int, decoded: bool, to_hex: bool) -> tuple: bits = self.decoded_bits if decoded else self.plain_bits diff --git a/ui/analysis_frame.ui b/ui/analysis_frame.ui index ff8aa21d..3d283562 100644 --- a/ui/analysis_frame.ui +++ b/ui/analysis_frame.ui @@ -655,7 +655,7 @@ - <html><head/><body><p>Set the desired view here.</p><p><br/></p><p>You can set the <span style=" font-weight:600;">alignment</span> where evaluation of Hex/ASCII starts using right-click menu in Bits-View. Use this, to correct <span style=" font-style:italic;">slided/missing Bits</span> or something like that.</p></body></html> + <html><head/><body><p>Set the desired view here.</p></body></html> @@ -814,8 +814,6 @@ - btnAnalyze - btnAnalyze