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
     def __init__(self, parent, name, icon, app, manager, host, *args, **kwargs):
58
     def __init__(self, parent, name, icon, app, manager, host, *args, **kwargs):
59
         super(CamWindow, self).__init__(*args, **kwargs)
59
         super(CamWindow, self).__init__(*args, **kwargs)
60
         self.url = "http://" + host + ":8080/?action=snapshot"
60
         self.url = "http://" + host + ":8080/?action=snapshot"
61
-
61
+        self.host = host
62
         self.app = app
62
         self.app = app
63
         self.parent = parent
63
         self.parent = parent
64
         self.manager = manager
64
         self.manager = manager
101
 
101
 
102
         self.loadImage()
102
         self.loadImage()
103
 
103
 
104
+    def getHost(self):
105
+        return self.host
106
+
104
     def sliderChanged(self):
107
     def sliderChanged(self):
105
         self.slideLabel.setText(str(self.slider.value()) + "ms")
108
         self.slideLabel.setText(str(self.slider.value()) + "ms")
106
 
109
 
382
         self.showDialog("OctoTray Status", s, None, False, warning)
385
         self.showDialog("OctoTray Status", s, None, False, warning)
383
 
386
 
384
     def printerWebcamAction(self, item):
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
         window = CamWindow(self, self.name, self.icon, self.app, self.manager, item[0])
394
         window = CamWindow(self, self.name, self.icon, self.app, self.manager, item[0])
386
         self.camWindows.append(window)
395
         self.camWindows.append(window)
387
 
396
 

Loading…
Cancel
Save