Pārlūkot izejas kodu

make start quicker when a host is not available

Thomas Buck 3 gadus atpakaļ
vecāks
revīzija
9ce0e17bcd
2 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. 1
    1
      README.md
  2. 8
    2
      src/octotray.py

+ 1
- 1
README.md Parādīt failu

@@ -54,7 +54,7 @@ The generated bundle will then be in 'build/mac/dist/OctoTray.app' as well as 'b
54 54
 Create and install an Arch Linux package like this:
55 55
 
56 56
     ./build_arch.sh
57
-    sudo pacman -U dist/octotray-0.3-1-any.pkg.tar.xz
57
+    sudo pacman -U build/dist/octotray-0.3-1-any.pkg.tar.xz
58 58
 
59 59
 Then run it from your desktop environment menu or even add it to the autostart there.
60 60
 

+ 8
- 2
src/octotray.py Parādīt failu

@@ -316,7 +316,7 @@ class OctoTray():
316 316
             if method == "unknown":
317 317
                 unknownCount += 1
318 318
 
319
-                action = QAction(self.getName(p[0], p[1]))
319
+                action = QAction(p[0])
320 320
                 action.setEnabled(False)
321 321
                 p.append(action)
322 322
                 self.menu.addAction(action)
@@ -469,7 +469,7 @@ class OctoTray():
469 469
             pass
470 470
         except urllib.error.HTTPError:
471 471
             pass
472
-        return ""
472
+        return "error"
473 473
 
474 474
     def sendPostRequest(self, host, key, path, content):
475 475
         headers = {
@@ -560,6 +560,9 @@ class OctoTray():
560 560
 
561 561
     def getMethod(self, host, key):
562 562
         r = self.sendGetRequest(host, key, "plugin/psucontrol")
563
+        if r == "error":
564
+            return "unknown"
565
+
563 566
         try:
564 567
             rd = json.loads(r)
565 568
             if "isPSUOn" in rd:
@@ -568,6 +571,9 @@ class OctoTray():
568 571
             pass
569 572
 
570 573
         r = self.sendGetRequest(host, key, "system/commands/custom")
574
+        if r == "error":
575
+            return "unknown"
576
+
571 577
         try:
572 578
             rd = json.loads(r)
573 579
             for c in rd:

Notiek ielāde…
Atcelt
Saglabāt