1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-03-09 15:40:18 +00:00

UI: removed position dialogs

This commit is contained in:
Bumsik Kim 2018-04-25 18:35:54 -04:00
parent 726e71c126
commit b71fc7414e
No known key found for this signature in database
GPG key ID: E31041C8EC5B01C6

View file

@ -101,11 +101,10 @@ class XRandR:
self.virt.height = 2 * self.virt.height self.virt.height = 2 * self.virt.height
self.mode_name = str(self.virt.width) + "x" + str(self.virt.height) + self.scrren_suffix self.mode_name = str(self.virt.width) + "x" + str(self.virt.height) + self.scrren_suffix
def create_virtual_screen(self, position) -> None: def create_virtual_screen(self) -> None:
self._add_screen_mode() self._add_screen_mode()
self._check_call(f"xrandr --output {self.virt.name} --mode {self.mode_name}") self._check_call(f"xrandr --output {self.virt.name} --mode {self.mode_name}")
self._check_call("sleep 5") self._check_call("sleep 5")
# self._check_call(f"xrandr --output {self.virt.name} {position} {self.primary.name}")
self._check_call(f"xrandr --output {self.virt.name} --auto") self._check_call(f"xrandr --output {self.virt.name} --auto")
self._update_primary_screen() self._update_primary_screen()
self._update_virtual_screen() self._update_virtual_screen()
@ -247,9 +246,8 @@ class Window(QDialog):
height = self.displayHeightSpinBox.value() height = self.displayHeightSpinBox.value()
portrait = self.displayPortraitCheckBox.isChecked() portrait = self.displayPortraitCheckBox.isChecked()
hidpi = self.displayHIDPICheckBox.isChecked() hidpi = self.displayHIDPICheckBox.isChecked()
position = self.displayPositionComboBox.currentData()
self.xrandr.set_virtual_screen(width, height, portrait, hidpi) self.xrandr.set_virtual_screen(width, height, portrait, hidpi)
self.xrandr.create_virtual_screen(position) self.xrandr.create_virtual_screen()
self.createDisplayButton.setText("Disable the virtual display") self.createDisplayButton.setText("Disable the virtual display")
self.isDisplayCreated = True self.isDisplayCreated = True
self.createDisplayButton.setEnabled(True) self.createDisplayButton.setEnabled(True)
@ -294,34 +292,25 @@ class Window(QDialog):
def createDisplayGroupBox(self): def createDisplayGroupBox(self):
self.displayGroupBox = QGroupBox("Virtual Display Settings") self.displayGroupBox = QGroupBox("Virtual Display Settings")
# Position Row
positionLabel = QLabel("Position:")
self.displayPositionComboBox = QComboBox()
self.displayPositionComboBox.addItem("Right", "--right-of")
self.displayPositionComboBox.addItem("Left", "--left-of")
self.displayPositionComboBox.addItem("Above", "--above")
self.displayPositionComboBox.addItem("Below", "--below")
self.displayPositionComboBox.setCurrentIndex(0)
self.displayPortraitCheckBox = QCheckBox("Portrait Mode")
self.displayPortraitCheckBox.setChecked(False)
# Resolution Row # Resolution Row
resolutionLabel = QLabel("Resolution:") resolutionLabel = QLabel("Resolution:")
self.displayWidthSpinBox = QSpinBox() self.displayWidthSpinBox = QSpinBox()
self.displayWidthSpinBox.setRange(640, 1920) self.displayWidthSpinBox.setRange(640, 1920)
self.displayWidthSpinBox.setSuffix(" px") self.displayWidthSpinBox.setSuffix("px")
self.displayWidthSpinBox.setValue(1368) self.displayWidthSpinBox.setValue(1368)
xLabel = QLabel("x") xLabel = QLabel("x")
self.displayHeightSpinBox = QSpinBox() self.displayHeightSpinBox = QSpinBox()
self.displayHeightSpinBox.setRange(360, 1080) self.displayHeightSpinBox.setRange(360, 1080)
self.displayHeightSpinBox.setSuffix(" px") self.displayHeightSpinBox.setSuffix("px")
self.displayHeightSpinBox.setValue(1024) self.displayHeightSpinBox.setValue(1024)
# Portrait and HiDPI
self.displayPortraitCheckBox = QCheckBox("Portrait Mode")
self.displayPortraitCheckBox.setChecked(False)
self.displayHIDPICheckBox = QCheckBox("HiDPI (2x resolution)") self.displayHIDPICheckBox = QCheckBox("HiDPI (2x resolution)")
self.displayHIDPICheckBox.setChecked(False) self.displayHIDPICheckBox.setChecked(False)
@ -329,28 +318,38 @@ class Window(QDialog):
self.createDisplayButton = QPushButton("Create a Virtual Display") self.createDisplayButton = QPushButton("Create a Virtual Display")
self.createDisplayButton.setDefault(True) self.createDisplayButton.setDefault(True)
# Notice Label
self.displayNoticeLabel = QLabel("After creating, you can adjust the display's " +
"position in the Desktop Environment's settings " +
"or ARandR.")
self.displayNoticeLabel.setWordWrap(True)
font = self.displayNoticeLabel.font()
font.setPointSize(9)
self.displayNoticeLabel.setFont(font)
# Putting them together # Putting them together
layout = QVBoxLayout() layout = QVBoxLayout()
# Grid layout for screen settings # Grid layout for screen settings
gridLayout = QGridLayout() gridLayout = QGridLayout()
# Display Position row
gridLayout.addWidget(positionLabel, 0, 0)
gridLayout.addWidget(self.displayPositionComboBox, 0, 1, 1, 2)
gridLayout.addWidget(self.displayPortraitCheckBox, 0, 6, 1, 2, Qt.AlignLeft)
# Resolution row # Resolution row
gridLayout.addWidget(resolutionLabel, 1, 0) rowLayout = QHBoxLayout()
gridLayout.addWidget(self.displayWidthSpinBox, 1, 1, 1, 2) rowLayout.addWidget(resolutionLabel)
gridLayout.addWidget(xLabel, 1, 3, Qt.AlignHCenter) rowLayout.addWidget(self.displayWidthSpinBox)
gridLayout.addWidget(self.displayHeightSpinBox, 1, 4, 1, 2) rowLayout.addWidget(xLabel)
gridLayout.addWidget(self.displayHIDPICheckBox, 1, 6, 1, 2, Qt.AlignLeft) rowLayout.addWidget(self.displayHeightSpinBox)
# Set strectch rowLayout.addStretch()
gridLayout.setColumnStretch(1, 0) layout.addLayout(rowLayout)
gridLayout.setColumnStretch(3, 0) # Portrait & HiDPI
# layout.setRowStretch(4, 1) rowLayout = QHBoxLayout()
rowLayout.addWidget(self.displayPortraitCheckBox)
layout.addLayout(gridLayout) rowLayout.addWidget(self.displayHIDPICheckBox)
rowLayout.addStretch()
layout.addLayout(rowLayout)
# Display create button and Notice label
layout.addWidget(self.createDisplayButton) layout.addWidget(self.createDisplayButton)
layout.addWidget(self.displayNoticeLabel)
self.displayGroupBox.setLayout(layout) self.displayGroupBox.setLayout(layout)
def createVNCGroupBox(self): def createVNCGroupBox(self):