Fix NotebookCell status, add quit button, BUGS
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..ed78482
--- /dev/null
+++ b/BUGS
@@ -0,0 +1 @@
+Evaluator::quit(): throwing exceptions from event handlers is not supported in Qt. Need to manually keep track of some sort of evaluator state and quit when necessary.
diff --git a/PPrint.h b/PPrint.h
index 4020752..2134b57 100644
--- a/PPrint.h
+++ b/PPrint.h
@@ -21,8 +21,6 @@
QString out;
int lastType = -1;
- qInfo() << "pprint specialized";
-
for (const T &v : val)
{
if ((lastType != v.type() || v.type() != T::SYM) && lastType != -1)
diff --git a/StdLib.h b/StdLib.h
index 0cc98a5..75d415d 100644
--- a/StdLib.h
+++ b/StdLib.h
@@ -10,7 +10,7 @@
void load(Evaluator &eval);
private:
- Function _print{"Print"},
+ Function _print{"Print"},
_prout{"Prout"},
_sleep{"Sleep"};
};
diff --git a/ide/Notebook.cpp b/ide/Notebook.cpp
index a5baa0c..72261cf 100644
--- a/ide/Notebook.cpp
+++ b/ide/Notebook.cpp
@@ -55,6 +55,7 @@
void Notebook::quitCell(QUuid uuid)
{
+ qDebug() << "Quitting cell" << uuid;
_rt->unqueueCell(Cell::cellFromUuid(uuid));
_runningAll = false;
}
diff --git a/ide/qml/NbWindow.qml b/ide/qml/NbWindow.qml
index 858fb5e..8b51793 100644
--- a/ide/qml/NbWindow.qml
+++ b/ide/qml/NbWindow.qml
@@ -190,6 +190,10 @@
notebook.runCell(uuid)
}
+ onQuitClicked: {
+ notebook.quitCell(uuid)
+ }
+
onCellFocused: {
codeEditor.currentIndex = index
}
diff --git a/ide/qml/NotebookCell.qml b/ide/qml/NotebookCell.qml
index 7653dd7..d1c285b 100644
--- a/ide/qml/NotebookCell.qml
+++ b/ide/qml/NotebookCell.qml
@@ -19,6 +19,7 @@
signal cellFocused()
signal cellUnfocused()
signal runClicked()
+ signal quitClicked()
signal deleteClicked()
height: column.height
@@ -61,13 +62,20 @@
RoundButton {
Layout.alignment: Qt.AlignTop
- icon.source: iconForState(root.state)
+ icon.source: iconForState(root.status)
icon.color: Material.color(Material.Grey, Material.Shade600)
flat: true
- onClicked: root.runClicked()
+ onClicked: {
+ if (root.status == Cell.IDLE)
+ root.runClicked()
+ else if (root.status == Cell.RUNNING)
+ root.quitClicked()
+ }
function iconForState(state) {
+ console.log("iconForState", state);
+
if (state === Cell.RUNNING)
return "qrc:///icons/square.svg"