Add initial GUI program
This commit is contained in:
parent
22a9c68611
commit
8d531b3304
3 changed files with 77 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ dependencies = []
|
|||
|
||||
[project.scripts]
|
||||
trove = "trovedb.cli:cli_main"
|
||||
qtrove = "trovedb.qgui.qtrove:main"
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
|
|
|
|||
53
trovedb/qgui/main_window.py
Normal file
53
trovedb/qgui/main_window.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtGui import QAction, QKeySequence
|
||||
from PySide6.QtWidgets import (
|
||||
QLabel,
|
||||
QMainWindow,
|
||||
QSplitter,
|
||||
QStatusBar,
|
||||
QToolBar,
|
||||
QVBoxLayout,
|
||||
QWidget
|
||||
)
|
||||
|
||||
class TroveMainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setWindowTitle("Trove")
|
||||
|
||||
# ── Toolbar ──
|
||||
toolbar = QToolBar("Main")
|
||||
toolbar.setMovable(False)
|
||||
self.addToolBar(toolbar)
|
||||
|
||||
new_action = QAction("New", self)
|
||||
new_action.setShortcut(QKeySequence.StandardKey.New)
|
||||
toolbar.addAction(new_action)
|
||||
|
||||
save_action = QAction("Save", self)
|
||||
save_action.setShortcut(QKeySequence.StandardKey.Save)
|
||||
toolbar.addAction(save_action)
|
||||
|
||||
toolbar.addSeparator()
|
||||
|
||||
# ── Central layout ──
|
||||
central = QWidget()
|
||||
self.setCentralWidget(central)
|
||||
layout = QVBoxLayout(central)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(0)
|
||||
|
||||
# Horizontal splitter: tree | editor
|
||||
splitter = QSplitter(Qt.Orientation.Horizontal)
|
||||
|
||||
self._note_browser = QLabel("Note Browser")
|
||||
splitter.addWidget(self._note_browser)
|
||||
|
||||
self._tool = QLabel("View/Edit Tool")
|
||||
splitter.addWidget(self._tool)
|
||||
|
||||
layout.addWidget(splitter, stretch=1)
|
||||
|
||||
# ── Status bar ──
|
||||
self.setStatusBar(QStatusBar())
|
||||
self.statusBar().showMessage("Ready")
|
||||
23
trovedb/qgui/qtrove.py
Normal file
23
trovedb/qgui/qtrove.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
"""PySide6 GUI for Trove"""
|
||||
|
||||
import sys
|
||||
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
)
|
||||
|
||||
from .main_window import TroveMainWindow
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
# Respect system theme on KDE
|
||||
app.setStyle("Fusion")
|
||||
|
||||
window = TroveMainWindow()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue