made orientation selection work

This commit is contained in:
Roberto Alsina 2020-02-05 20:12:50 -03:00
parent 60038ae394
commit eb3f31cf15
2 changed files with 6 additions and 6 deletions

View File

@ -251,9 +251,9 @@ class Window(QObject):
# self.scale_changed() # Trigger scale labels update # self.scale_changed() # Trigger scale labels update
def orientation_changed(self): def orientation_changed(self):
mon = self.ui.screenCombo.currentText() mon_name = self.ui.screenCombo.currentText()
orientation = self.ui.orientationCombo.currentIndex() orientation = self.ui.orientationCombo.currentText().split()[0].lower()
self.xrandr_info[mon]["orientation"] = orientation self.screen.monitors[mon_name].orientation = orientation
self.mode_changed() self.mode_changed()
def mode_changed(self): def mode_changed(self):

View File

@ -22,11 +22,11 @@ class MonitorItem(QGraphicsRectItem, QObject):
self.setPos(monitor.pos_x, monitor.pos_y) self.setPos(monitor.pos_x, monitor.pos_y)
if monitor.orientation == "normal": if monitor.orientation == "normal":
self.bottom_edge.setRect(0, monitor.res_y - 50, monitor.res_x, 50) self.bottom_edge.setRect(0, monitor.res_y - 50, monitor.res_x, 50)
elif monitor.orientation == 1: elif monitor.orientation == "left":
self.bottom_edge.setRect(monitor.res_x - 50, 0, 50, monitor.res_y) self.bottom_edge.setRect(monitor.res_x - 50, 0, 50, monitor.res_y)
elif monitor.orientation == 2: elif monitor.orientation == "inverted":
self.bottom_edge.setRect(0, 0, monitor.res_x, 50) self.bottom_edge.setRect(0, 0, monitor.res_x, 50)
elif monitor.orientation == 3: elif monitor.orientation == "right":
self.bottom_edge.setRect(0, 0, 50, monitor.res_y) self.bottom_edge.setRect(0, 0, 50, monitor.res_y)
if monitor.replica_of: if monitor.replica_of:
label_text = f"{self.name} [{','.join(monitor.replica_of)}]" label_text = f"{self.name} [{','.join(monitor.replica_of)}]"