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