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
 cp dist/setup_win.py build/win/
8
 cp dist/setup_win.py build/win/
9
 
9
 
10
 cd build/win
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
 cd ../..
13
 cd ../..
14
 mkdir -p build/dist/win
14
 mkdir -p build/dist/win

BIN
data/octotray_icon.ico View File


+ 12
- 4
src/octotray.py View File

15
 import time
15
 import time
16
 import urllib.parse
16
 import urllib.parse
17
 import urllib.request
17
 import urllib.request
18
+from os import path
18
 from PyQt5 import QtWidgets, QtGui, QtCore, QtNetwork
19
 from PyQt5 import QtWidgets, QtGui, QtCore, QtNetwork
19
 from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, QMessageBox, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QDesktopWidget, QSizePolicy, QSlider, QLayout, QTableWidget, QTableWidgetItem, QPushButton
20
 from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, QMessageBox, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QDesktopWidget, QSizePolicy, QSlider, QLayout, QTableWidget, QTableWidgetItem, QPushButton
20
 from PyQt5.QtGui import QIcon, QPixmap, QImageReader, QDesktopServices
21
 from PyQt5.QtGui import QIcon, QPixmap, QImageReader, QDesktopServices
235
     vendor = "xythobuz"
236
     vendor = "xythobuz"
236
     version = "0.3"
237
     version = "0.3"
237
 
238
 
238
-    iconPaths = [ "./", "../", "data/", "../data/", "/usr/share/pixmaps/" ]
239
     iconName = "octotray_icon.png"
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
     networkTimeout = 2.0 # in s
249
     networkTimeout = 2.0 # in s
242
 
250
 
320
 
328
 
321
         self.iconPathName = None
329
         self.iconPathName = None
322
         for p in self.iconPaths:
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
                 break
333
                 break
326
         if self.iconPathName == None:
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
             sys.exit(0)
336
             sys.exit(0)
329
 
337
 
330
         self.icon = QIcon()
338
         self.icon = QIcon()

Loading…
Cancel
Save