Skip to content
Snippets Groups Projects
Commit 20fc15d0 authored by Allen, Bruce (CIV)'s avatar Allen, Bruce (CIV)
Browse files

add ability to open original examples and snippet examples

parent 5e6f4a76
No related branches found
No related tags found
No related merge requests found
...@@ -342,6 +342,26 @@ class GUIManager(QObject): ...@@ -342,6 +342,26 @@ class GUIManager(QObject):
else: else:
print("Examples path is not configured.") print("Examples path is not configured.")
def _fill_original_examples_menu(self):
original_examples_paths = os.path.join(examples_paths["examples_root"],
"original_examples")
if os.path.exists(original_examples_paths):
fill_examples_menu(self.open_original_examples_menu,
original_examples_paths,
self.open_mp_code)
else:
print("Original examples path is not configured.")
def _fill_snippet_examples_menu(self):
snippet_example_paths = os.path.join(examples_paths["examples_root"],
"snippets")
if os.path.exists(snippet_example_paths):
fill_examples_menu(self.open_snippet_examples_menu,
snippet_example_paths,
self.open_mp_code)
else:
print("Examples path is not configured.")
def _enable_manage_snapshots(self): def _enable_manage_snapshots(self):
has_snapshots = bool(len(snapshot_files())) has_snapshots = bool(len(snapshot_files()))
self.session_snapshots.action_manage_snapshots.setDisabled( self.session_snapshots.action_manage_snapshots.setDisabled(
...@@ -367,6 +387,19 @@ class GUIManager(QObject): ...@@ -367,6 +387,19 @@ class GUIManager(QObject):
self.open_examples_menu.aboutToShow.connect( self.open_examples_menu.aboutToShow.connect(
self._fill_examples_menu) self._fill_examples_menu)
# menu | file | open original examples
self.open_original_examples_menu = QMenu("Open Original Example (old)")
self.open_original_examples_menu.setToolTip(
"Open original old MP code example")
self.open_original_examples_menu.aboutToShow.connect(
self._fill_original_examples_menu)
# menu | file | open snippet
self.open_snippet_examples_menu = QMenu("Open Snippet Example")
self.open_snippet_examples_menu.setToolTip("Open Snippet Example")
self.open_snippet_examples_menu.aboutToShow.connect(
self._fill_snippet_examples_menu)
# menu | file | save MP Code # menu | file | save MP Code
self.file_menu.addAction(self.action_save_mp_code_file) self.file_menu.addAction(self.action_save_mp_code_file)
...@@ -378,6 +411,8 @@ class GUIManager(QObject): ...@@ -378,6 +411,8 @@ class GUIManager(QObject):
# menu | file | open examples # menu | file | open examples
self.file_menu.addMenu(self.open_examples_menu) self.file_menu.addMenu(self.open_examples_menu)
self.file_menu.addMenu(self.open_original_examples_menu)
self.file_menu.addMenu(self.open_snippet_examples_menu)
# menu | file | search .mp files # menu | file | search .mp files
self.file_menu.addAction( self.file_menu.addAction(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment