-
-
Notifications
You must be signed in to change notification settings - Fork 322
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: New History pane for launching commands from history log #3234
wxGUI: New History pane for launching commands from history log #3234
Conversation
3375976
to
13917c0
Compare
@petrasovaa why did you unassign me? |
@lindakladivova Nothing changes for you, but during PSC meeting today, we agreed on an initial policy for handling PRs and this was a one of the PRs we tested the policy on. Each PR should have a assignee who is responsible for moving the PR towards being closed. We will work on making this official. While for issues, nothing changes, assignee for a PR will be someone with write access, i.e., someone who can do the actual merge when the code is ready. You can comment on that in #3235. |
Maybe it can open a dialog just like in the successful case, but say "...but here it is and you can copy it and modify as needed: ...". |
Yes, It could open the module dialog based on the module called, but the issue is that in a history file, there can be lots of mistakes (calling of nonexisting modules etc.) so probably when the module is decoded, we can launch the relevant empty module dialog but otherwise, just show the message "History record cound not be parsed into command" in the statusbar? I was also thinking about history file itself. I would suggest changing it to JSON format and to also save dates within it or other information such as "task failed", "task succeeded". It could possibly be the tree of dates with subitems as commands. What do you think @petrasovaa ? These improvements could be implemented in following PRs. 🙂 |
Just a quick testing, it looks like the content is not being updated when you run a tool? |
I am getting:
It looks like this happens in a new mapset. |
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 think putting the code in menu.py and menudata.py is not a good choice, it's unrelated. Either put it all in one file history.py, which could go into lmgr/ or create a history folder (similar to datacatalog) and put the files there.
…from empty history mapset, creating a new updateHistory signal
…ng history file moved to new grassdb/history.py
You are right, I created the folder history_catalog and inside there are new python files "catalog" and "tree". |
Now fixed. I created a new signal giface.updateHistory and connected several methods to it. |
Fixed. |
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.
Currently wxGUI fails when wxgui_history file is missing (open GUI first time in a new mapset):
File "/usr/lib/python3/dist-packages/wx/core.py", line 3427, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/wxgui.py", line 93, in show_main_gui
mainframe = GMFrame(
^^^^^^^^
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/main_window/frame.py", line 184, in __init__
self.BuildPanes()
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/main_window/frame.py", line 571, in BuildPanes
self._createConsole(parent=self)
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/main_window/frame.py", line 370, in _createConsole
self.goutput = GConsoleWindow(
^^^^^^^^^^^^^^^
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/goutput.py", line 146, in __init__
self._loadHistory()
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/goutput.py", line 263, in _loadHistory
self.cmdPrompt.cmdbuffer = read_history(history_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/martin/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/grassdb/history.py", line 38, in read_history
fileHistory = codecs.open(
^^^^^^^^^^^^
File "<frozen codecs>", line 918, in open
TypeError: expected str, bytes or os.PathLike object, not NoneType
Ah ok, thanks for catching Martin. I had fixed it but probably through several iterations, it has occured again… I will look at it. |
…is not created yet
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
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.
Almost there!
This PR creates a new History pane which allows us to launch commands contained in .wxgui_history file.
The history pane is visible on the right side:
It tries to parse the command. If the parsing is not successful, it writes the message: "History record cound not be parsed into command" into the Main window statusbar. In the case when parsing successes, it opens the dialog with filled command parameters.
History panel is also linked to mapset switching, so when mapset is switched the tree is regenerated based on the relevant wxgui_history file.