diff --git a/.github/workflows/on-release-master.yml b/.github/workflows/on-release-master.yml index 6e83ce8..5a5c67f 100644 --- a/.github/workflows/on-release-master.yml +++ b/.github/workflows/on-release-master.yml @@ -102,7 +102,7 @@ jobs: CMD_BUILD: > brew install create-dmg && source $VENV && - poetry run make gui-macos APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && + poetry run make gui-macos-dmg APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && cd dist && zip -r ${{needs.compute.outputs.OUT_NAME_FILE}}_${{needs.compute.outputs.ARCH_MACOS_X64}}${{needs.compute.outputs.ASSET_EXTENSION}} ${{needs.compute.outputs.OUT_NAME_FILE}}.dmg -x "*.DS_Store" && cd .. @@ -120,7 +120,7 @@ jobs: OS_ARCH: ${{needs.compute.outputs.ARCH_LINUX_X64}} CMD_BUILD: > source $VENV && - poetry run make gui APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && + poetry run make gui-linux APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && cd dist && zip -r ${{needs.compute.outputs.OUT_NAME_FILE}}_${{needs.compute.outputs.ARCH_LINUX_X64}}${{needs.compute.outputs.ASSET_EXTENSION}} ${{needs.compute.outputs.OUT_NAME_FILE}} && cd .. @@ -130,7 +130,7 @@ jobs: CMD_BUILD: > choco install zip make -y && source $VENV && - poetry run make gui APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && + poetry run make gui-windows APP_NAME=${{needs.compute.outputs.OUT_NAME_FILE}} && cd dist && zip -r ${{needs.compute.outputs.OUT_NAME_FILE}}_${{needs.compute.outputs.ARCH_WINDOWS_X64}}${{needs.compute.outputs.ASSET_EXTENSION}} ${{needs.compute.outputs.OUT_NAME_FILE}}.exe && cd .. diff --git a/Makefile b/Makefile index 52e491c..3559398 100644 --- a/Makefile +++ b/Makefile @@ -57,8 +57,17 @@ docs: ## Build and serve the documentation help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' -.PHONY: gui -gui: ## Build GUI app with PyInstaller +.PHONY: gui-windows +gui-windows: ## Build GUI app with PyInstaller + @poetry run pyinstaller --noconfirm \ + --windowed --onefile \ + --name "$(APP_NAME)" \ + --noupx \ + --icon $(path_asset)/icon.ico \ + tidal_dl_ng/gui.py + +.PHONY: gui-linux +gui-linux: ## Build GUI app with PyInstaller @poetry run pyinstaller --noconfirm \ --windowed --onefile \ --name "$(APP_NAME)" \ @@ -66,9 +75,18 @@ gui: ## Build GUI app with PyInstaller --icon $(path_asset)/icon.png \ tidal_dl_ng/gui.py -# TODO: macos Signing: https://gist.github.com/txoof/0636835d3cc65245c6288b2374799c43 .PHONY: gui-macos -gui-macos: gui ## Package GUI in a *.dmg file +gui-macos: ## Build GUI app with PyInstaller + @poetry run pyinstaller --noconfirm \ + --windowed --onefile \ + --name "$(APP_NAME)" \ + --noupx \ + --icon $(path_asset)/icon.icns \ + tidal_dl_ng/gui.py + +# TODO: macos Signing: https://gist.github.com/txoof/0636835d3cc65245c6288b2374799c43 +.PHONY: gui-macos-dmg +gui-macos-dmg: gui-macos ## Package GUI in a *.dmg file @poetry run mkdir -p $(app_path_dist)/dmg @poetry run mv "$(app_path_dist)/$(APP_NAME).app" $(app_path_dist)/dmg @poetry run create-dmg \ diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py index 5a2501a..810672a 100644 --- a/tidal_dl_ng/gui.py +++ b/tidal_dl_ng/gui.py @@ -30,7 +30,6 @@ from tidal_dl_ng.worker import Worker # TODO: Make more use of Exceptions -# TODO: Add File -> Version class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): settings: Settings = None tidal: Tidal = None @@ -56,7 +55,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.setupUi(self) # self.setGeometry(50, 50, 500, 300) self.setWindowTitle("TIDAL Downloader Next Gen!") - self._init_tray() # Logging redirect. XStream.stdout().messageWritten.connect(self._log_output) @@ -473,24 +471,20 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): def on_version(self) -> None: DialogVersion(self) - def _init_tray(self): - # TODO: Fix icons (make them visible). - # my_pixmap = QtGui.QPixmap("tidal_dl_ng/ui/icon.png") - my_icon = QtGui.QIcon("tidal_dl_ng/ui/icon.png") - # self.setWindowIcon(my_icon) - self.tray = QtWidgets.QSystemTrayIcon() - self.tray.setIcon(my_icon) - self.tray.setVisible(True) - self.tray.setContextMenu(self.m_file) - # TODO: Comment with Google Docstrings. def gui_activate(tidal: Tidal | None = None): + # Set dark theme and create QT app. qdarktheme.enable_hi_dpi() app = QtWidgets.QApplication(sys.argv) qdarktheme.setup_theme() - window = MainWindow(tidal) + # Create icon object and apply it to app window. + pixmap: QtGui.QPixmap = QtGui.QPixmap("tidal_dl_ng/ui/icon.png") + icon: QtGui.QIcon = QtGui.QIcon(pixmap) + app.setWindowIcon(icon) + + window = MainWindow(tidal=tidal) window.show() sys.exit(app.exec()) diff --git a/tidal_dl_ng/ui/icon.ico b/tidal_dl_ng/ui/icon.ico new file mode 100644 index 0000000..177f3dc Binary files /dev/null and b/tidal_dl_ng/ui/icon.ico differ