feat: package to be runnable as a script
This commit is contained in:
@@ -16,6 +16,9 @@ dependencies = [
|
||||
"star-resonance-tracer>=0.1.0",
|
||||
]
|
||||
|
||||
[project.gui-scripts]
|
||||
inventory-wars = "inventory_wars:gui"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://git.dizzynight.moe/DizzyNight/inventory-wars"
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from inventory_wars.gui.app import main as gui
|
||||
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import os.path
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
@@ -23,6 +24,7 @@ engine = create_engine("sqlite:///app.db")
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
session = Session(engine)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FirstGuessGui(FirstGuess):
|
||||
@@ -159,9 +161,7 @@ class SqlLeaderboardModel(QSqlTableModel):
|
||||
self.select()
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main():
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
app = QGuiApplication(sys.argv)
|
||||
@@ -177,7 +177,7 @@ if __name__ == "__main__":
|
||||
sys.exit(1)
|
||||
|
||||
engine = QQmlApplicationEngine()
|
||||
engine.addImportPath(sys.path[1])
|
||||
engine.addImportPath(os.path.dirname(os.path.abspath(__file__)))
|
||||
engine.loadFromModule("InventoryWars", "Main")
|
||||
|
||||
if not engine.rootObjects():
|
||||
@@ -186,3 +186,7 @@ if __name__ == "__main__":
|
||||
exit_code = app.exec()
|
||||
del engine
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user