diff --git a/source/gui/GUI_main.py b/source/gui/GUI_main.py
index 77a2149..1e203c9 100644
--- a/source/gui/GUI_main.py
+++ b/source/gui/GUI_main.py
@@ -91,6 +91,13 @@ def __init__(self, app):
task_action.setShortcut("Ctrl+T")
task_action.triggered.connect(self.go_to_tasks)
view_menu.addAction(task_action)
+
+ # Edit task in external editor using cntl + shift + t
+ edit_task_action = QtGui.QAction("&Edit task", self)
+ edit_task_action.setShortcut("Ctrl+Shift+T")
+ edit_task_action.triggered.connect(self.edit_task)
+ view_menu.addAction(edit_task_action)
+
# View error log
error_log_action = QtGui.QAction("&Error log", self)
error_log_action.setShortcut("Ctrl+E")
@@ -135,6 +142,16 @@ def go_to_data(self):
def go_to_tasks(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(user_folder("tasks")))
+ def edit_task(self):
+ # if on the run task tab, edit the selected task
+ if self.tab_widget.currentIndex() == 0:
+ selected_task = self.run_task_tab.task_select.text()
+ if selected_task == "select task":
+ return
+ QtGui.QDesktopServices.openUrl(
+ QtCore.QUrl.fromLocalFile(str(Path(self.task_directory) / (selected_task + ".py")))
+ )
+
def view_docs(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://pycontrol.readthedocs.io/en/latest/"))
diff --git a/source/gui/dialogs.py b/source/gui/dialogs.py
index 768d107..16d3694 100644
--- a/source/gui/dialogs.py
+++ b/source/gui/dialogs.py
@@ -288,6 +288,7 @@ def __init__(self, parent):
label_strings = [
"Global:",
f'{modifier_key} + t : Open tasks folder',
+ f'Shift + {modifier_key} + t : Edit task',
f'{modifier_key} + d : Open data folder',
f'{modifier_key} + e : Open error log',
f'{modifier_key} + , : Open settings',
@@ -306,6 +307,10 @@ def __init__(self, parent):
self.setFixedSize(self.sizeHint())
+ # make dialog closable with Ctrl + w
+ self.close_shortcut = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+W"), self)
+ self.close_shortcut.activated.connect(self.close)
+
# Settings dialog. ---------------------------------------------------------