Changeset 0033a40 in ammosreader


Ignore:
Timestamp:
07/04/22 13:08:22 (3 years ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
AmmosSource, guix
Children:
a19529a
Parents:
d2f9280
Message:

allow offsets other than multiples of 8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sample_scripts/ammos_viewer.py

    rd2f9280 r0033a40  
    8181                                                                                          self.cycle.get())])
    8282        bits = bitstring.BitArray(self.bytes)
    83         return (bits << self.offset.get()).tobytes()
     83        new_bytes = bits[self.offset.get()*8:].tobytes()
     84        return b"".join([new_bytes[each: each+self.canvas_size[0]] for each in range(0,
     85                                                                                     len(new_bytes),
     86                                                                                     self.cycle.get())])
    8487
    8588    def update_canvas(self):
Note: See TracChangeset for help on using the changeset viewer.