forked from IPKM/nmreval
31 lines
955 B
Python
31 lines
955 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from .usermodeleditor import QUsermodelEditor
|
|
from ..Qt import QtWidgets, QtCore
|
|
|
|
|
|
class QEditor(QUsermodelEditor):
|
|
runSignal = QtCore.pyqtSignal(str)
|
|
|
|
def __init__(self, path: str | Path = None, parent=None):
|
|
super().__init__(path, parent=parent)
|
|
|
|
self.add_run_button()
|
|
|
|
def add_run_button(self):
|
|
self.disclaimer = QtWidgets.QLabel("This is work in progress and less than perfect :(")
|
|
self.disclaimer.setStyleSheet('QLabel {color: rgb(255, 0, 0); font-weight: bold; font-size: 2.5em;};')
|
|
self.centralwidget.layout().insertWidget(0, self.disclaimer)
|
|
|
|
self.run_button = QtWidgets.QPushButton("Run")
|
|
self.centralwidget.layout().addWidget(self.run_button)
|
|
|
|
self.run_button.clicked.connect(self.start_script)
|
|
|
|
@QtCore.pyqtSlot()
|
|
def start_script(self):
|
|
self.runSignal.emit(self.edit_field.toPlainText())
|
|
|