Changed folder structure to match the python package standards more and created setup.py for an easy installation.

This commit is contained in:
The Wobbler 2024-12-14 18:41:42 +01:00
parent b1b442b23a
commit b7a6ba567a
17 changed files with 48 additions and 12 deletions

3
bread_editor/__init__.py Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/python3
from bread_editor.main import start_from_command_line

View file

@ -2,8 +2,8 @@
from PyQt6.QtWidgets import QWidget, QVBoxLayout from PyQt6.QtWidgets import QWidget, QVBoxLayout
from PyQt6.QtGui import QFont, QTextCharFormat, QColor from PyQt6.QtGui import QFont, QTextCharFormat, QColor
from binary_text_edit import BinaryTextEdit from bread_editor.binary_text_edit import BinaryTextEdit
from highlighting import Higlighter from bread_editor.highlighting import Higlighter
class BitEditor: class BitEditor:

View file

@ -2,7 +2,7 @@
import os.path import os.path
from PyQt6.QtWidgets import QFileDialog from PyQt6.QtWidgets import QFileDialog
from editor import BitEditor from bread_editor.editor import BitEditor
MAX_FILE_SIZE = 262144 # 2^18 MAX_FILE_SIZE = 262144 # 2^18

View file

@ -0,0 +1 @@
#!/usr/bin/python3

View file

@ -0,0 +1 @@
#!/usr/bin/python3

View file

@ -3,11 +3,11 @@
import sys import sys
from PyQt6.QtCore import QTimer from PyQt6.QtCore import QTimer
from wobbl_tools.data_file import load_dataclass_json from wobbl_tools.data_file import load_dataclass_json
from utils import Utils from bread_editor.utils import Utils
from file import File, FileActions from bread_editor.file import File, FileActions
from ui import GUI from bread_editor.ui import GUI
from settings import Settings from bread_editor.settings import Settings
from ipc import IPC from bread_editor.ipc import IPC
class BreadEditor: class BreadEditor:
@ -46,6 +46,11 @@ class BreadEditor:
sys.exit(self.gui.qt_app.exec()) sys.exit(self.gui.qt_app.exec())
def start_from_command_line():
editor = BreadEditor()
editor.run()
if __name__ == "__main__": if __name__ == "__main__":
editor = BreadEditor() editor = BreadEditor()
editor.run() editor.run()

View file

@ -2,7 +2,7 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import List from typing import List
from utils import Utils from bread_editor.utils import Utils
@dataclass @dataclass

View file

@ -1,8 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
from PyQt6.QtWidgets import QApplication, QMainWindow from PyQt6.QtWidgets import QApplication, QMainWindow
from gui.main_window import Ui_MainWindow from bread_editor.gui.main_window import Ui_MainWindow
from connect_gui import connect_gui from bread_editor.connect_gui import connect_gui
class GUI: class GUI:

View file

@ -4,7 +4,6 @@ import os
import sys import sys
from pathlib import Path from pathlib import Path
from PyQt6.QtWidgets import QMessageBox from PyQt6.QtWidgets import QMessageBox
from file import File
class Utils: class Utils:

27
setup.py Normal file
View file

@ -0,0 +1,27 @@
#!/usr/bin/python3
import setuptools
from pathlib import Path
this_directory = Path(__file__).parent # use readme file as long description
long_description = (this_directory / "README.md").read_text()
setuptools.setup(
name="Bread Editor",
version="0.0",
description="A binary editor with that you can edit single bits.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://teapot.informationsanarchistik.de/Wobbl/Bread_Editor",
author="The Wobbler",
author_email="emil@i21k.de",
packages=["bread_editor"],
package_data={"": ["*.ui", "*.txt"]},
install_requires=[
"PyQt6",
"wobbl_tools @ git+https://teapot.informationsanarchistik.de/Wobbl/wobbl_tools@main#egg=wobbl_tools"
],
entry_points={
"console_scripts": ["bread_editor=bread_editor:start_from_command_line"],
}
)