Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions source/gui/GUI_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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/"))

Expand Down
5 changes: 5 additions & 0 deletions source/gui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def __init__(self, parent):
label_strings = [
"<b><u>Global:</u></b>",
f'<b style="color:#0220e0;">{modifier_key} + t</b> : Open tasks folder',
f'<b style="color:#0220e0;">Shift + {modifier_key} + t</b> : Edit task',
f'<b style="color:#0220e0;">{modifier_key} + d</b> : Open data folder',
f'<b style="color:#0220e0;">{modifier_key} + e</b> : Open error log',
f'<b style="color:#0220e0;">{modifier_key} + ,</b> : Open settings',
Expand All @@ -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. ---------------------------------------------------------

Expand Down