Files
nmreval/src/gui_qt/editors/script_editor.py
Dominik Demuth 4108deb69a
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 1m46s
run scripts
run scripts

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #291
2024-09-29 17:21:40 +00:00

31 lines
962 B
Python

from __future__ import annotations
from pathlib import Path
from .usermodeleditor import QUsermodelEditor
from ..Qt import QtWidgets, QtCore, QtGui
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())