Improve building methods

This commit is contained in:
Wiktor Zykubek 2023-07-08 20:20:56 +02:00
parent 30952ad2fb
commit eb86628f6e
No known key found for this signature in database
GPG Key ID: 0DAA9DC01449FCA2
7 changed files with 19 additions and 12 deletions

View File

@ -1,7 +0,0 @@
# This Python file uses the following encoding: utf-8
import PyInstaller.__main__
import os
os.system("pyside6-uic form.ui -o ui_form.py")
PyInstaller.__main__.run(['Open-FM.spec'])

View File

@ -1,3 +1,3 @@
{ {
"files": ["build.py","openfm_qt/__init__.py","form.ui","main.py","Open-FM.spec","pyproject.toml","openfm_qt/mainwindow.py","icon.ico","README.md","screenshot_linux.png"] "files": ["build.py","openfm_qt/__init__.py","form.ui","openfm_qt/__main__.py","pyproject.toml","openfm_qt/mainwindow.py","icon.ico","README.md","screenshot_linux.png","build.py"]
} }

View File

@ -3,4 +3,5 @@
API_URL = "https://open.fm/radio/api/v2/ofm/stations_slug.json" API_URL = "https://open.fm/radio/api/v2/ofm/stations_slug.json"
DEFAULT_VOLUME = 70 DEFAULT_VOLUME = 70
from .ui_form import Ui_MainWindow
from .mainwindow import MainWindow from .mainwindow import MainWindow

View File

@ -1,11 +1,14 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QApplication
from openfm_qt import MainWindow from . import MainWindow
import sys import sys
if __name__ == "__main__": def main():
app = QApplication(sys.argv) app = QApplication(sys.argv)
widget = MainWindow() widget = MainWindow()
widget.show() widget.show()
sys.exit(app.exec()) sys.exit(app.exec())
if __name__ == "__main__":
main()

View File

@ -8,10 +8,9 @@ from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
# You need to run the following command to generate the ui_form.py file # You need to run the following command to generate the ui_form.py file
# pyside6-uic form.ui -o ui_form.py, or # pyside6-uic form.ui -o ui_form.py, or
# pyside2-uic form.ui -o ui_form.py # pyside2-uic form.ui -o ui_form.py
from ui_form import Ui_MainWindow
import json import json
import requests import requests
from . import API_URL, DEFAULT_VOLUME from . import API_URL, DEFAULT_VOLUME, Ui_MainWindow
class MainWindow(QMainWindow): class MainWindow(QMainWindow):

5
prebuild.py Normal file
View File

@ -0,0 +1,5 @@
# This Python file uses the following encoding: utf-8
import os
os.system("pyside6-uic form.ui -o openfm_qt/ui_form.py")

View File

@ -15,6 +15,12 @@ PySide6 = "^6.5.1.1"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pyinstaller = "^5.12.0" pyinstaller = "^5.12.0"
[tool.poetry.scripts]
openfm-qt = "openfm_qt.__main__:main"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry.build]
script = "build.py"