Added console widget, removed the debug dialog, some refactoring
parent
c31e2f2b88
commit
24279524c7
|
@ -40,13 +40,11 @@ class OptionsWidget(QWidget):
|
||||||
self.width_spinbox.setRange(100, 100000)
|
self.width_spinbox.setRange(100, 100000)
|
||||||
self.width_spinbox.setPrefix("Width: ")
|
self.width_spinbox.setPrefix("Width: ")
|
||||||
self.width_spinbox.setSuffix(" px")
|
self.width_spinbox.setSuffix(" px")
|
||||||
self.width_spinbox.setValue(1920)
|
|
||||||
|
|
||||||
self.height_spinbox = QSpinBox()
|
self.height_spinbox = QSpinBox()
|
||||||
self.height_spinbox.setRange(100, 100000)
|
self.height_spinbox.setRange(100, 100000)
|
||||||
self.height_spinbox.setPrefix("Height: ")
|
self.height_spinbox.setPrefix("Height: ")
|
||||||
self.height_spinbox.setSuffix(" px")
|
self.height_spinbox.setSuffix(" px")
|
||||||
self.height_spinbox.setValue(1080)
|
|
||||||
|
|
||||||
self.detect_pushbutton = QPushButton("Detect screen resolution")
|
self.detect_pushbutton = QPushButton("Detect screen resolution")
|
||||||
self.detect_pushbutton.clicked.connect(self.update_screen_res)
|
self.detect_pushbutton.clicked.connect(self.update_screen_res)
|
||||||
|
@ -92,18 +90,20 @@ class OptionsWidget(QWidget):
|
||||||
self.options_gbox.setLayout(self.options_hbox)
|
self.options_gbox.setLayout(self.options_hbox)
|
||||||
|
|
||||||
# Update widget
|
# Update widget
|
||||||
self.update_widget = UpdateWidget()
|
self.update_widget = UpdateWidget(self)
|
||||||
# Install widget
|
# Install widget
|
||||||
self.install_widget = InstallWidget(self)
|
self.install_widget = InstallWidget(self)
|
||||||
|
# Console widget
|
||||||
|
self.console_widget = ConsoleWidget(self)
|
||||||
|
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout(self)
|
||||||
layout.addWidget(self.name_gbox)
|
layout.addWidget(self.name_gbox)
|
||||||
layout.addWidget(self.tape_covers_gbox)
|
layout.addWidget(self.tape_covers_gbox)
|
||||||
layout.addWidget(self.options_gbox)
|
layout.addWidget(self.options_gbox)
|
||||||
layout.addWidget(self.update_widget)
|
layout.addWidget(self.update_widget)
|
||||||
layout.addWidget(self.install_widget)
|
layout.addWidget(self.install_widget)
|
||||||
|
layout.addWidget(self.console_widget)
|
||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
self.setLayout(layout)
|
|
||||||
|
|
||||||
self.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Minimum)
|
self.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Minimum)
|
||||||
|
|
||||||
|
@ -233,8 +233,7 @@ class CodeEditorWidget(QWidget):
|
||||||
self.parent.validation_widget.load_tapes(tapes)
|
self.parent.validation_widget.load_tapes(tapes)
|
||||||
|
|
||||||
except yaml.scanner.ScannerError as e:
|
except yaml.scanner.ScannerError as e:
|
||||||
dlg = DebugDialog(f"Error applying yaml code:\n\n{str(e)}")
|
logging.error(f"Error applying yaml code:\n\n{str(e)}")
|
||||||
dlg.exec()
|
|
||||||
|
|
||||||
|
|
||||||
class TapeEditWidget(QWidget):
|
class TapeEditWidget(QWidget):
|
||||||
|
@ -354,8 +353,7 @@ class ValidationWidget(QWidget):
|
||||||
self.load_tapes(tapes)
|
self.load_tapes(tapes)
|
||||||
|
|
||||||
except yaml.scanner.ScannerError as e:
|
except yaml.scanner.ScannerError as e:
|
||||||
dlg = DebugDialog(f"Error applying yaml code:\n\n{str(e)}")
|
logging.error(f"Error applying yaml code:\n\n{str(e)}")
|
||||||
dlg.exec()
|
|
||||||
|
|
||||||
|
|
||||||
def load_tapes(self, tapes):
|
def load_tapes(self, tapes):
|
||||||
|
@ -383,12 +381,14 @@ class ValidationWidget(QWidget):
|
||||||
scrollbar.setValue(tape_number * step)
|
scrollbar.setValue(tape_number * step)
|
||||||
|
|
||||||
|
|
||||||
class UpdateWidget(QWidget):
|
class UpdateWidget(QGroupBox):
|
||||||
def __init__(self):
|
def __init__(self, parent: QWidget):
|
||||||
super().__init__()
|
super().__init__("Update")
|
||||||
|
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
hr_html_string = "<hr style=\"background-color:gray;\">"
|
hr_html_string = "<hr style=\"background-color:gray;\">"
|
||||||
self.grid = QGridLayout()
|
self.grid = QGridLayout(self)
|
||||||
|
|
||||||
self.git_checkbox = QCheckBox()
|
self.git_checkbox = QCheckBox()
|
||||||
self.git_checkbox.setDisabled(True)
|
self.git_checkbox.setDisabled(True)
|
||||||
|
@ -416,13 +416,6 @@ class UpdateWidget(QWidget):
|
||||||
self.grid.addWidget(self.git_update_pushbutton, 10, 2)
|
self.grid.addWidget(self.git_update_pushbutton, 10, 2)
|
||||||
self.grid.addWidget(QLabel(hr_html_string), 12, 0, 1, 3)
|
self.grid.addWidget(QLabel(hr_html_string), 12, 0, 1, 3)
|
||||||
|
|
||||||
self.gbox = QGroupBox("Update")
|
|
||||||
self.gbox.setLayout(self.grid)
|
|
||||||
|
|
||||||
layout = QHBoxLayout(self)
|
|
||||||
layout.addWidget(self.gbox)
|
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
|
|
||||||
self.does_git_exist()
|
self.does_git_exist()
|
||||||
|
|
||||||
def download_git_action(self):
|
def download_git_action(self):
|
||||||
|
@ -439,13 +432,24 @@ class UpdateWidget(QWidget):
|
||||||
self.git_checkbox.setChecked(exists)
|
self.git_checkbox.setChecked(exists)
|
||||||
return exists
|
return exists
|
||||||
|
|
||||||
|
class ConsoleWidget(QGroupBox):
|
||||||
class InstallWidget(QWidget):
|
|
||||||
def __init__(self, parent: QWidget):
|
def __init__(self, parent: QWidget):
|
||||||
super().__init__()
|
super().__init__("Info")
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
|
self.console = QPlainTextEdit()
|
||||||
|
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
layout.addWidget(self.console)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class InstallWidget(QGroupBox):
|
||||||
|
def __init__(self, parent: QWidget):
|
||||||
|
super().__init__("Install steps")
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.grid = QGridLayout()
|
self.grid = QGridLayout(self)
|
||||||
|
|
||||||
hr_html_string = "<hr style=\"background-color:gray;\">"
|
hr_html_string = "<hr style=\"background-color:gray;\">"
|
||||||
|
|
||||||
|
@ -499,13 +503,6 @@ class InstallWidget(QWidget):
|
||||||
|
|
||||||
self.grid.setRowStretch(50, 20)
|
self.grid.setRowStretch(50, 20)
|
||||||
|
|
||||||
self.gbox = QGroupBox("Install steps")
|
|
||||||
self.gbox.setLayout(self.grid)
|
|
||||||
|
|
||||||
layout = QHBoxLayout(self)
|
|
||||||
layout.addWidget(self.gbox)
|
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
|
|
||||||
self.does_ffmpeg_exist()
|
self.does_ffmpeg_exist()
|
||||||
|
|
||||||
def does_ffmpeg_exist(self):
|
def does_ffmpeg_exist(self):
|
||||||
|
@ -539,35 +536,19 @@ class InstallWidget(QWidget):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class DebugDialog(QDialog):
|
|
||||||
def __init__(self, text):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
self.setWindowTitle("Error and debug info")
|
|
||||||
|
|
||||||
self.description = QPlainTextEdit(text)
|
|
||||||
self.description.setEnabled(False)
|
|
||||||
|
|
||||||
layout = QVBoxLayout(self)
|
|
||||||
layout.addWidget(self.description)
|
|
||||||
|
|
||||||
|
|
||||||
class MainWidget(QWidget):
|
class MainWidget(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
layout = QHBoxLayout()
|
layout = QHBoxLayout(self)
|
||||||
|
|
||||||
self.options_widget = OptionsWidget(self)
|
self.options_widget = OptionsWidget(self)
|
||||||
self.editor_widget = CodeEditorWidget(self)
|
self.editor_widget = CodeEditorWidget(self)
|
||||||
self.validation_widget = ValidationWidget(self)
|
self.validation_widget = ValidationWidget(self)
|
||||||
# install = InstallWidget()
|
|
||||||
layout.addWidget(self.options_widget)
|
layout.addWidget(self.options_widget)
|
||||||
layout.addWidget(self.editor_widget)
|
layout.addWidget(self.editor_widget)
|
||||||
layout.addWidget(self.validation_widget)
|
layout.addWidget(self.validation_widget)
|
||||||
# layout.addWidget(install)
|
|
||||||
|
|
||||||
self.setLayout(layout)
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
|
|
Loading…
Reference in New Issue