Преглед изворни кода

make start quicker when a host is not available

Thomas Buck пре 3 година
родитељ
комит
9ce0e17bcd
2 измењених фајлова са 9 додато и 3 уклоњено
  1. 1
    1
      README.md
  2. 8
    2
      src/octotray.py

+ 1
- 1
README.md Прегледај датотеку

54
 Create and install an Arch Linux package like this:
54
 Create and install an Arch Linux package like this:
55
 
55
 
56
     ./build_arch.sh
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
 Then run it from your desktop environment menu or even add it to the autostart there.
59
 Then run it from your desktop environment menu or even add it to the autostart there.
60
 
60
 

+ 8
- 2
src/octotray.py Прегледај датотеку

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

Loading…
Откажи
Сачувај