pre select last used setup in qt gui
authorConstantin Berhard <git.mail.enormator@xoxy.net>
Tue, 24 Nov 2015 12:23:27 +0000 (13:23 +0100)
committerConstantin Berhard <git.mail.enormator@xoxy.net>
Tue, 24 Nov 2015 12:23:27 +0000 (13:23 +0100)
qt_frontend.py

index 6e41d551be0352f2741188a4431e976bd6b5391c..05c33ae26ddf0f91241dfa73d2e67e8a931336ae 100644 (file)
@@ -42,12 +42,23 @@ try:
             syncIfMirror(self.intRes, self.extRes)
             syncIfMirror(self.extRes, self.intRes)
 
             syncIfMirror(self.intRes, self.extRes)
             syncIfMirror(self.extRes, self.intRes)
 
-            # connect the update function, and make sure we are in a correct state
+            # connect the update function
             self.intEnabled.toggled.connect(self.updateEnabledControls)
             self.extEnabled.toggled.connect(self.updateEnabledControls)
             self.relPos.currentIndexChanged.connect(self.updateEnabledControls)
             self.intEnabled.toggled.connect(self.updateEnabledControls)
             self.extEnabled.toggled.connect(self.updateEnabledControls)
             self.relPos.currentIndexChanged.connect(self.updateEnabledControls)
+
+            # if situation has a lastSetup, use its values as initial state
+            if situation.lastSetup:
+                last = situation.lastSetup
+                self.intEnabled.setChecked(last.intResolution is not None)
+                self.extEnabled.setChecked(last.extResolution is not None)
+                if last.relPosition:
+                    print("YO:",last.relPosition.value-1)
+                    self.relPos.setCurrentIndex(last.relPosition.value-1)
+
+            # make sure we are in a correct state
             self.updateEnabledControls()
             self.updateEnabledControls()
-        
+
         def getRelativeScreenPosition(self):
             idx = self.relPos.currentIndex()
             return self.relPos.itemData(idx)
         def getRelativeScreenPosition(self):
             idx = self.relPos.currentIndex()
             return self.relPos.itemData(idx)