Use package structure

This commit is contained in:
Wiktor Zykubek 2023-06-15 13:14:40 +02:00
parent d707588926
commit a841bb4293
No known key found for this signature in database
GPG Key ID: 0DAA9DC01449FCA2
4 changed files with 20 additions and 13 deletions

11
main.py Normal file
View File

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

View File

@ -1,3 +1,3 @@
{
"files": ["mainwindow.py","form.ui"]
"files": ["form.ui","openfm_qt/mainwindow.py","openfm_qt/__init__.py","main.py"]
}

6
openfm_qt/__init__.py Normal file
View File

@ -0,0 +1,6 @@
# This Python file uses the following encoding: utf-8
API_URL = "https://open.fm/radio/api/v2/ofm/stations_slug.json"
DEFAULT_VOLUME = 70
from .mainwindow import MainWindow

View File

@ -1,8 +1,7 @@
# This Python file uses the following encoding: utf-8
import sys
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox, QStyle
from PySide6.QtWidgets import QMainWindow, QMessageBox, QStyle
from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
# Important:
@ -12,9 +11,7 @@ from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
from ui_form import Ui_MainWindow
import json
import requests
API_URL = "https://open.fm/radio/api/v2/ofm/stations_slug.json"
DEFAULT_VOLUME = 70
from . import API_URL, DEFAULT_VOLUME
class MainWindow(QMainWindow):
@ -128,10 +125,3 @@ class MainWindow(QMainWindow):
pass
self.ui.playbackToolButton.setIcon(icon)
if __name__ == "__main__":
app = QApplication(sys.argv)
widget = MainWindow()
widget.show()
sys.exit(app.exec())