Переглянути джерело

started first work on creating packages for different OSs

Thomas Buck 3 роки тому
джерело
коміт
6e46fc7ad9
8 змінених файлів з 77 додано та 14 видалено
  1. 1
    3
      .gitignore
  2. 15
    0
      build_arch.sh
  3. 15
    0
      build_mac.sh
  4. 0
    0
      data/de.xythobuz.octotray.desktop
  5. 0
    0
      data/octotray_icon.png
  6. 3
    3
      dist/PKGBUILD
  7. 35
    0
      dist/setup_mac.py
  8. 8
    8
      src/octotray.py

+ 1
- 3
.gitignore Переглянути файл

@@ -1,3 +1 @@
1
-OctoTray-*-any.pkg.tar
2
-pkg
3
-src
1
+build

+ 15
- 0
build_arch.sh Переглянути файл

@@ -0,0 +1,15 @@
1
+#!/bin/sh
2
+
3
+rm -rf build/archlinux
4
+mkdir -p build/archlinux
5
+
6
+cp -r src/* build/archlinux/
7
+cp -r data/* build/archlinux/
8
+cp dist/PKGBUILD build/archlinux/
9
+
10
+cd build/archlinux
11
+makepkg
12
+
13
+cd ../..
14
+mkdir -p build/dist
15
+cp build/archlinux/OctoTray-*.pkg.* build/dist

+ 15
- 0
build_mac.sh Переглянути файл

@@ -0,0 +1,15 @@
1
+#!/bin/sh
2
+
3
+rm -rf build/mac
4
+mkdir -p build/mac
5
+
6
+cp -r src/* build/mac/
7
+cp -r data/* build/mac/
8
+cp dist/setup_mac.py build/mac/
9
+
10
+cd build/mac
11
+python setup_mac.py py2app
12
+
13
+cd ../..
14
+mkdir -p build/dist
15
+cp -r build/mac/dist/OctoTray.app build/dist/

de.xythobuz.octotray.desktop → data/de.xythobuz.octotray.desktop Переглянути файл


octotray_icon.png → data/octotray_icon.png Переглянути файл


PKGBUILD → dist/PKGBUILD Переглянути файл

@@ -1,12 +1,12 @@
1 1
 # Maintainer: Thomas Buck <thomas@xythobuz.de>
2 2
 pkgname=OctoTray
3
-pkgver=0.2
3
+pkgver=0.3
4 4
 pkgrel=1
5 5
 pkgdesc="Control OctoPrint instances from system tray"
6 6
 arch=('any')
7 7
 license=('unknown')
8 8
 depends=('python-pyqt5')
9
-source=("octotray"
9
+source=("octotray.py"
10 10
         "octotray_icon.png"
11 11
         "de.xythobuz.octotray.desktop")
12 12
 md5sums=(SKIP
@@ -15,7 +15,7 @@ md5sums=(SKIP
15 15
 
16 16
 package() {
17 17
 	mkdir -p "$pkgdir/usr/bin"
18
-	cp octotray "$pkgdir/usr/bin/octotray"
18
+	cp octotray.py "$pkgdir/usr/bin/octotray"
19 19
 	mkdir -p "$pkgdir/usr/share/pixmaps"
20 20
 	cp octotray_icon.png "$pkgdir/usr/share/pixmaps/octotray_icon.png"
21 21
 	mkdir -p "$pkgdir/usr/share/applications"

+ 35
- 0
dist/setup_mac.py Переглянути файл

@@ -0,0 +1,35 @@
1
+#!/usr/bin/env python
2
+# -*- coding: utf-8 -*-
3
+
4
+"""
5
+This is a setup.py script generated by py2applet
6
+
7
+Usage:
8
+    python setup.py py2app
9
+"""
10
+
11
+from setuptools import setup
12
+
13
+APP = ['octotray.py']
14
+APP_NAME = "OctoTray"
15
+DATA_FILES = ['octotray_icon.png']
16
+OPTIONS = {
17
+    'argv_emulation': True,
18
+    'iconfile': 'octotray_icon.png',
19
+    'plist': {
20
+        'CFBundleName': APP_NAME,
21
+        'CFBundleDisplayName': APP_NAME,
22
+        'CFBundleGetInfoString': "Control OctoPrint instances from system tray",
23
+        'CFBundleIdentifier': "de.xythobuz.octotray",
24
+        'CFBundleVersion': "0.3.0",
25
+        'CFBundleShortVersionString': "0.3.0",
26
+        'NSHumanReadableCopyright': u"Copyright © 2021, Thomas Buck, All Rights Reserved"
27
+    }
28
+}
29
+
30
+setup(
31
+    app=APP,
32
+    data_files=DATA_FILES,
33
+    options={'py2app': OPTIONS},
34
+    setup_requires=['py2app'],
35
+)

octotray → src/octotray.py Переглянути файл

@@ -233,9 +233,9 @@ class CamWindow(QWidget):
233 233
 class OctoTray():
234 234
     name = "OctoTray"
235 235
     vendor = "xythobuz"
236
-    version = "0.2"
236
+    version = "0.3"
237 237
 
238
-    iconPath = "/usr/share/pixmaps/"
238
+    iconPaths = [ "./", "../", "data/", "../data/", "/usr/share/pixmaps/" ]
239 239
     iconName = "octotray_icon.png"
240 240
 
241 241
     networkTimeout = 2.0 # in s
@@ -318,12 +318,12 @@ class OctoTray():
318 318
         self.quitAction.triggered.connect(self.exit)
319 319
         self.menu.addAction(self.quitAction)
320 320
 
321
-        self.iconPathName = ""
322
-        if os.path.isfile(self.iconName):
323
-            self.iconPathName = self.iconName
324
-        elif os.path.isfile(self.iconPath + self.iconName):
325
-            self.iconPathName = self.iconPath + self.iconName
326
-        else:
321
+        self.iconPathName = None
322
+        for p in self.iconPaths:
323
+            if os.path.isfile(p + self.iconName):
324
+                self.iconPathName = p + self.iconName
325
+                break
326
+        if self.iconPathName == None:
327 327
             self.showDialog("OctoTray Error", "Icon file has not been found! found", "", False, False, True)
328 328
             sys.exit(0)
329 329
 

Завантаження…
Відмінити
Зберегти