bugfixes (#191)
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 2m2s

added basic syntax check; closes #148

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #191
This commit is contained in:
2023-12-28 14:30:33 +00:00
parent 2cf94af2c4
commit 694d47267d
7 changed files with 73 additions and 65 deletions

View File

@ -54,7 +54,7 @@ class QUserFitCreator(QtWidgets.QDialog, Ui_Dialog):
return self
def update_function(self):
prev_text = self.plainTextEdit.toPlainText().split('\n')
prev_text = self.editor.toPlainText().split('\n')
func_body = ''
in_body = False
for line in prev_text:
@ -89,9 +89,12 @@ class QUserFitCreator(QtWidgets.QDialog, Ui_Dialog):
else:
k += f' def func(x):\n'
k += func_body
if func_body:
k += func_body
else:
k += ' return x'
self.plainTextEdit.setPlainText(k)
self.editor.setPlainText(k)
except Exception as e:
QtWidgets.QMessageBox.warning(self, 'Failure', f'Error found: {e.args[0]}')
@ -215,7 +218,7 @@ class KwargsWidget(QtWidgets.QWidget):
for i in range(self.choices.count()):
kwargs.append(self.choices.widget(i).get_strings())
if kwargs:
return f" choices = {', '.join(kwargs)}\n"
return f" choices = [{', '.join(kwargs)}]\n"
else:
return ''
@ -475,12 +478,3 @@ class DescWidget(QtWidgets.QWidget):
f" equation = r'{self.eq_lineedit.text()}'\n"
return stringi
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication([])
win = QUserFitCreator()
win.show()
sys.exit(app.exec())