Skip to content

Commit

Permalink
Fix code duplication issue in mu/logic.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SurajSanap committed Dec 20, 2023
1 parent c38a539 commit 14b7a24
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mu/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,8 @@ def save(self, *args, default=None):
if tab is None:
# There is no active text editor so abort.
return
if not tab.path:
# Unsaved file.

def handle_unsaved_file():
folder = self.get_dialog_directory(default)
path = self._view.get_save_path(folder)
if path and self.check_for_shadow_module(path):
Expand All @@ -1299,6 +1299,12 @@ def save(self, *args, default=None):
"different filename."
)
self._view.show_message(message, info)
return None
return path
if not tab.path:
# Unsaved file.
path = handle_unsaved_file()
if path is None:
return
tab.path = path
if tab.path:
Expand Down

0 comments on commit 14b7a24

Please sign in to comment.