-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wxGUI: Console: Export history of executed commands #2682
Conversation
…of executed commands
gui/wxpython/gui_core/goutput.py
Outdated
try: | ||
self.cmdPrompt.CopyHistory(path) | ||
except IOError as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the exception handling in the CopyHistory. Check if the error type is appropriate, it seems OSError should be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I moved it to the CopyHistory. I think that the error type is okay according to https://docs.python.org/3/library/shutil.html : Changed in version 3.3: IOError used to be raised instead of OSError. Added follow_symlinks argument. Now returns dst.
But when I looked at the examples of how to use shutil.copyfile I found out that they use handling of different error types: https://www.geeksforgeeks.org/python-shutil-copyfile-method/
So difficult to decide... I would probably keep the IOError or just put the general except Exception as e:
. What do you think?
gui/wxpython/gui_core/goutput.py
Outdated
path = dlg.GetPath() | ||
try: | ||
self.cmdPrompt.CopyHistory(path) | ||
except IOError as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except IOError as e: | |
except (IOError, OSError) as e: |
Maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. A good compromise.
Replaces log file toggle functionality by exporting the whole history of executed commands
Replaces log file toggle functionality by exporting the whole history of executed commands
This PR changes the way how the Log file button works. In this PR it is renamed to Export history because it better reflects what it newly does.
Original behavior (the button Log file is togglable):
New behavior (the button Export History is not togglable):
All executed command history related to particular mapset environment can be automatically saved by clicking on the Export history button: