run scripts
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 1m46s
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 1m46s
run scripts Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de> Reviewed-on: #291
This commit is contained in:
30
src/gui_qt/editors/script_editor.py
Normal file
30
src/gui_qt/editors/script_editor.py
Normal file
@ -0,0 +1,30 @@
|
||||
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())
|
||||
|
Reference in New Issue
Block a user