2024-11-17 18:54:51 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
from PyQt6.QtWidgets import QFileDialog
|
2024-11-18 18:28:26 +01:00
|
|
|
from file import File
|
2024-11-17 18:54:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Utils:
|
|
|
|
def __init__(self, app):
|
|
|
|
self.app = app
|
|
|
|
|
|
|
|
self.home_path = str(Path.home())
|
2024-11-19 17:52:08 +01:00
|
|
|
|
|
|
|
def bstring_to_oz(self, data): # convert binary data to a string of ones and zeros (oz)
|
2024-11-19 18:04:01 +01:00
|
|
|
oz_bytes = []
|
|
|
|
|
|
|
|
for byte in data:
|
|
|
|
oz_bytes.append(format(byte, "08b"))
|
|
|
|
|
|
|
|
oz_string = " ".join(oz_bytes)
|
2024-11-19 17:52:08 +01:00
|
|
|
|
|
|
|
return oz_string
|