Handle setting primary status via UI

This commit is contained in:
Roberto Alsina 2020-02-01 16:58:34 -03:00
parent 90fe2990bc
commit 4373045db9

View File

@ -103,11 +103,25 @@ class Window(QObject):
self.ui.resetButton.clicked.connect(self.do_reset)
self.ui.cancelButton.clicked.connect(self.ui.reject)
self.ui.scaleModeCombo.currentTextChanged.connect(self.scale_mode_changed)
self.ui.primary.stateChanged.connect(self.primary_changed)
self.pos_label = QLabel(self.ui.sceneView)
self.pos_label.setText("FOOOOO")
self.pos_label.move(5, 5)
def primary_changed(self):
mon = self.ui.screenCombo.currentText()
primary = self.ui.primary.isChecked()
# Update visuals on all monitos
for name, monitor in self.xrandr_info.items():
if name == mon:
monitor["primary"] = primary
else:
if primary: # There can only be one primary
monitor["primary"] = False
monitor["item"].update_visuals(monitor)
def scale_mode_changed(self):
mon = self.ui.screenCombo.currentText()
scale_mode = self.ui.scaleModeCombo.currentText()
@ -374,6 +388,7 @@ class Window(QObject):
self.ui.verticalScaleLabel.setText(f"{int(self.ui.verticalScale.value()/10)}%")
self.mode_changed() # Not really, but it's the same thing
def main():
app = QApplication(sys.argv)
@ -387,4 +402,4 @@ def main():
if __name__ == "__main__":
main()
main()