Added detect screen resolution function

master
Jaka Perovšek 2024-05-10 22:22:48 +02:00
parent 2e68a5eaf2
commit 2f6b1a8a33
1 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,8 @@ import os
from tape_editor_widgets import *
from PIL import ImageGrab
from pathlib import Path
import yaml
@ -41,6 +43,7 @@ class OptionsWidget(QWidget):
self.height_spinbox.setValue(1080)
self.detect_pushbutton = QPushButton("Detect screen resolution")
self.detect_pushbutton.clicked.connect(self.update_screen_res)
self.resolution_hbox = QVBoxLayout()
self.resolution_hbox.addWidget(self.width_spinbox)
@ -96,6 +99,11 @@ class OptionsWidget(QWidget):
# def update_label_description(self):
def update_screen_res(self):
img = ImageGrab.grab()
self.width_spinbox.setValue(img.size[0])
self.height_spinbox.setValue(img.size[1])
# TODO: implement random local mod name
@ -149,7 +157,7 @@ class EditorWidget(QWidget):
self.button_hbox.addWidget(self.status_label)
self.button_hbox.addStretch()
self.button_hbox.addWidget(self.transfer_to_validator_pushbutton)
#self.button_hbox.addStretch()
# self.button_hbox.addStretch()
self.editor_vbox = QVBoxLayout()
self.editor_vbox.addLayout(self.button_hbox)
@ -272,15 +280,15 @@ class ValidationWidget(QWidget):
self.transfer_to_code_pushbutton.setToolTip("Update the code")
self.transfer_to_code_pushbutton.clicked.connect(self.save_tapes)
self.jump_spinbox = QSpinBox()
#self.search_lineedit = QLineEdit()
#self.search_lineedit.setPlaceholderText("Search ...")
# self.search_lineedit = QLineEdit()
# self.search_lineedit.setPlaceholderText("Search ...")
self.buttons_hbox = QHBoxLayout()
self.buttons_hbox.addWidget(self.transfer_to_code_pushbutton)
self.buttons_hbox.addWidget(QLabel("Navigate to"))
self.buttons_hbox.addWidget(self.jump_spinbox)
self.buttons_hbox.addStretch()
#self.buttons_hbox.addWidget(self.search_lineedit)
# self.buttons_hbox.addWidget(self.search_lineedit)
self.tape_list_widget = TapeListWidget()