mirror of
https://github.com/fergalmoran/disco-hue.git
synced 2026-02-15 12:35:03 +00:00
Fix ui import
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -141,3 +141,4 @@ cython_debug/
|
||||
.vscode/
|
||||
working/
|
||||
/src/disco_hue/desktop/ui/main_window.py
|
||||
src/disco_hue/desktop/ui/generated/
|
||||
|
||||
@@ -4,12 +4,14 @@ from PyQt6.QtWidgets import QMainWindow, QMessageBox, QFileDialog
|
||||
|
||||
from desktop import BridgeNotRegisteredException, DiscoverBridgesThread
|
||||
from services import DiscoBall
|
||||
from .utils import resource_path
|
||||
|
||||
|
||||
class App(QMainWindow):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
uic.loadUi('./desktop/ui/main.ui', self)
|
||||
|
||||
uic.loadUi(resource_path('desktop/ui/main.ui'), self)
|
||||
self._settings = QSettings('disco_hue')
|
||||
self._manager = None
|
||||
self._selected_light = None
|
||||
|
||||
13
src/disco_hue/desktop/utils.py
Normal file
13
src/disco_hue/desktop/utils.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def resource_path(relative_path):
|
||||
""" Get absolute path to resource, works for dev and for PyInstaller """
|
||||
try:
|
||||
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
||||
base_path = sys._MEIPASS
|
||||
except Exception:
|
||||
base_path = os.path.abspath(".")
|
||||
|
||||
return os.path.join(base_path, relative_path)
|
||||
Reference in New Issue
Block a user