Browse Source

add win icon, bundle pyinstaller file loading

Thomas Buck 2 years ago
parent
commit
fda4cd9358
3 changed files with 13 additions and 5 deletions
  1. 1
    1
      build_win.sh
  2. BIN
      data/octotray_icon.ico
  3. 12
    4
      src/octotray.py

+ 1
- 1
build_win.sh View File

@@ -8,7 +8,7 @@ cp data/* build/win/
8 8
 cp dist/setup_win.py build/win/
9 9
 
10 10
 cd build/win
11
-pyinstaller --noconfirm --onefile --name=OctoTray --windowed --add-data="octotray_icon.png;." octotray.py
11
+pyinstaller --noconfirm --onefile --name=OctoTray --windowed --add-data="octotray_icon.png;." --icon="octotray_icon.ico" octotray.py
12 12
 
13 13
 cd ../..
14 14
 mkdir -p build/dist/win

BIN
data/octotray_icon.ico View File


+ 12
- 4
src/octotray.py View File

@@ -15,6 +15,7 @@ import os
15 15
 import time
16 16
 import urllib.parse
17 17
 import urllib.request
18
+from os import path
18 19
 from PyQt5 import QtWidgets, QtGui, QtCore, QtNetwork
19 20
 from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, QMessageBox, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QDesktopWidget, QSizePolicy, QSlider, QLayout, QTableWidget, QTableWidgetItem, QPushButton
20 21
 from PyQt5.QtGui import QIcon, QPixmap, QImageReader, QDesktopServices
@@ -235,8 +236,15 @@ class OctoTray():
235 236
     vendor = "xythobuz"
236 237
     version = "0.3"
237 238
 
238
-    iconPaths = [ "./", "../", "data/", "../data/", "/usr/share/pixmaps/" ]
239 239
     iconName = "octotray_icon.png"
240
+    iconPaths = [
241
+        path.abspath(path.dirname(__file__)),
242
+        "data",
243
+        "/usr/share/pixmaps",
244
+        ".",
245
+        "..",
246
+        "../data"
247
+    ]
240 248
 
241 249
     networkTimeout = 2.0 # in s
242 250
 
@@ -320,11 +328,11 @@ class OctoTray():
320 328
 
321 329
         self.iconPathName = None
322 330
         for p in self.iconPaths:
323
-            if os.path.isfile(p + self.iconName):
324
-                self.iconPathName = p + self.iconName
331
+            if os.path.isfile(path.join(p, self.iconName)):
332
+                self.iconPathName = path.join(p, self.iconName)
325 333
                 break
326 334
         if self.iconPathName == None:
327
-            self.showDialog("OctoTray Error", "Icon file has not been found! found", "", False, False, True)
335
+            self.showDialog("OctoTray Error", "Icon file has not been found!", "", False, False, True)
328 336
             sys.exit(0)
329 337
 
330 338
         self.icon = QIcon()

Loading…
Cancel
Save