diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2017-03-16 22:27:04 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-03-16 22:27:04 -0700 |
commit | ffa0822abf7a30f9b44b3fb046cb6d723c4d8c37 (patch) | |
tree | 0e2d7be7824e91cf037f275098e1f90561fdafec /grc/gui/Application.py | |
parent | 00e775ff3e78f9e0fd216e683c958ed820363fac (diff) | |
parent | b675ccc2fd08574c3169659003290327b63aa16b (diff) |
Merge branch 'next' into python3
Conflicts:
gr-blocks/swig/blocks_swig.py.in
gr-uhd/apps/uhd_app.py
Diffstat (limited to 'grc/gui/Application.py')
-rw-r--r-- | grc/gui/Application.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/grc/gui/Application.py b/grc/gui/Application.py index e2290b3401..9e89009dc9 100644 --- a/grc/gui/Application.py +++ b/grc/gui/Application.py @@ -145,6 +145,7 @@ class Application(Gtk.Application): for action in ( Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW, Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS, + Actions.FLOW_GRAPH_DUPLICATE, Actions.FLOW_GRAPH_SAVE_A_COPY, Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY, Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY, Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW, @@ -558,6 +559,32 @@ class Application(Gtk.Application): self.config.add_recent_file(file_path) main.tool_bar.refresh_submenus() main.menu_bar.refresh_submenus() + elif action == Actions.FLOW_GRAPH_SAVE_A_COPY: + try: + if not page.get_file_path(): + Actions.FLOW_GRAPH_SAVE_AS() + else: + dup_file_path = page.get_file_path() + dup_file_name = '.'.join(dup_file_path.split('.')[:-1]) + "_copy" # Assuming .grc extension at the end of file_path + dup_file_path_temp = dup_file_name+'.grc' + count = 1 + while os.path.exists(dup_file_path_temp): + dup_file_path_temp = dup_file_name+'('+str(count)+').grc' + count += 1 + dup_file_path_user = SaveFlowGraphFileDialog(dup_file_path_temp).run() + if dup_file_path_user is not None: + ParseXML.to_file(flow_graph.export_data(), dup_file_path_user) + Messages.send('Saved Copy to: "' + dup_file_path_user + '"\n') + except IOError: + Messages.send_fail_save("Can not create a copy of the flowgraph\n") + elif action == Actions.FLOW_GRAPH_DUPLICATE: + flow_graph = main.get_flow_graph() + main.new_page() + curr_page = main.get_page() + new_flow_graph = main.get_flow_graph() + new_flow_graph.import_data(flow_graph.export_data()) + flow_graph_update(new_flow_graph) + curr_page.set_saved(False) elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE: file_path, background_transparent = FileDialogs.SaveScreenShot(main, page.file_path).run() if file_path is not None: |