Browse Source

dont allow opening multiple webcam windows for one printer, just raise existing one.

Thomas Buck 3 years ago
parent
commit
86751976bd
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      octotray

+ 10
- 1
octotray View File

@@ -58,7 +58,7 @@ class CamWindow(QWidget):
58 58
     def __init__(self, parent, name, icon, app, manager, host, *args, **kwargs):
59 59
         super(CamWindow, self).__init__(*args, **kwargs)
60 60
         self.url = "http://" + host + ":8080/?action=snapshot"
61
-
61
+        self.host = host
62 62
         self.app = app
63 63
         self.parent = parent
64 64
         self.manager = manager
@@ -101,6 +101,9 @@ class CamWindow(QWidget):
101 101
 
102 102
         self.loadImage()
103 103
 
104
+    def getHost(self):
105
+        return self.host
106
+
104 107
     def sliderChanged(self):
105 108
         self.slideLabel.setText(str(self.slider.value()) + "ms")
106 109
 
@@ -382,6 +385,12 @@ class OctoTray():
382 385
         self.showDialog("OctoTray Status", s, None, False, warning)
383 386
 
384 387
     def printerWebcamAction(self, item):
388
+        for cw in self.camWindows:
389
+            if cw.getHost() == item[0]:
390
+                cw.show()
391
+                cw.activateWindow()
392
+                return
393
+
385 394
         window = CamWindow(self, self.name, self.icon, self.app, self.manager, item[0])
386 395
         self.camWindows.append(window)
387 396
 

Loading…
Cancel
Save