backward sync

This commit is contained in:
jopohl
2016-08-12 16:39:02 +02:00
parent 9c4bf11c61
commit 20d45833aa
2 changed files with 5 additions and 29 deletions

View File

@@ -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

View File

@@ -655,7 +655,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the desired view here.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;You can set the &lt;span style=&quot; font-weight:600;&quot;&gt;alignment&lt;/span&gt; where evaluation of Hex/ASCII starts using right-click menu in Bits-View. Use this, to correct &lt;span style=&quot; font-style:italic;&quot;&gt;slided/missing Bits&lt;/span&gt; or something like that.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the desired view here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
@@ -814,8 +814,6 @@
</widget>
</item>
</layout>
<zorder>btnAnalyze</zorder>
<zorder>btnAnalyze</zorder>
</widget>
<widget class="QWidget" name="pageProgressBar">
<layout class="QVBoxLayout" name="verticalLayout_6">