55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
import sys
|
|
from typing import Dict, List, Optional, Sequence, Tuple, TypeAlias
|
|
|
|
from PySide6.QtWidgets import QApplication, QDialog, QHBoxLayout, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget
|
|
from PySide6.QtCore import Slot
|
|
from PySide6.QtPdf import QPdfDocument
|
|
from PySide6.QtPdfWidgets import QPdfView
|
|
import fitz
|
|
|
|
TEST_FILENAME = "/home/luna/Documents/Resources/Praca Licencjacka/sources/2018_Torres-Benitez_Metabolomic analysis Parmotrema.pdf"
|
|
|
|
Coords: TypeAlias = Tuple[float, float]
|
|
|
|
class Selection:
|
|
def __init__(self, bounds: Tuple[Coords, Coords], columns: Optional[Sequence[float]] = None):
|
|
self.bounds = bounds
|
|
self.columns = columns
|
|
|
|
class Document:
|
|
def __init__(self, filename: str):
|
|
self.filename = filename
|
|
self.document = fitz.Document(filename)
|
|
self.selections: Dict[int, List[Selection]] = {}
|
|
|
|
class SelectablePdfView(QPdfView):
|
|
pass
|
|
|
|
class State():
|
|
pass
|
|
|
|
class Frontend():
|
|
def __init__(self, argv: Sequence[str]):
|
|
self.app = QApplication(argv)
|
|
self.window = QMainWindow()
|
|
self.state = State()
|
|
|
|
self.thumbnails = QWidget()
|
|
self.pdfDocument = QPdfDocument()
|
|
self.optionsPanel = QWidget()
|
|
|
|
central_widget = QWidget()
|
|
cw_layout = QHBoxLayout(central_widget)
|
|
cw_layout.addWidget(self.thumbnails)
|
|
cw_layout.addWidget(self.optionsPanel)
|
|
self.window.setCentralWidget(central_widget)
|
|
|
|
|
|
def exec(self):
|
|
self.window.show()
|
|
self.app.exec()
|
|
|
|
if __name__ == "__main__":
|
|
app = Frontend(sys.argv)
|
|
app.exec()
|