-
-
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: add recent_files param to print a list of wxGUI component recent files #2503
base: main
Are you sure you want to change the base?
Conversation
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 don't know what the CLI for recent files is for. However, if you have a use case, then I think it is okay to include it.
It seems to me that feature like this needs more a Python API rather than CLI because that's the context where it will be needed (e.g., implementing alternative startup sequence or loading 3D view settings in the Animation Tool).
To avoid duplication and adding text output code into a class which manages GUI (wx.Menu), this PR itself requires extending the API, e.g., adding a method to RecentFilesMenu or creating a separate class or set of functions which take care of recent file separately from menus.
If needed, I would be happy to discuss this further.
My simple use case is if I want copy my recent files (script which create archive from recent files) which are stored on different paths / disk partitions / disks etc. (recent files are currently implemented for Main wxGUI component - workspace files, Python Simple Editor wxGUI component - Python scripts files) from one computer to another. Maybe in the future could be create module which pack and unpack wxGUI components recent files same as raster / vector maps for simple exchanging / backup recent files between computers. |
Now I'm thinking the CLI of wxgui.py is a better fit for this task. Adding this to the g.gui interface is a much bigger commitment. g.gui CLI is our official API, wxgui.py CLI is not. This seems to be similar to grass.benchmark. We have both API and CLI there, but it is documented as experimental and not stable. Perfectly fine for one-time use and for developers closely tracking the main branch, but we don't want to guarantee it will behave the same in the next version. Additionally, the definition of recent is somewhat problematic. If you want to get "recent file just like in GUI" that's fine (I'm thinking some GUI helper tool), but if you want "recent files I worked with", it is not reliable enough. For example, we can decide to decrease or increase the number of recent files. |
``` GRASS nc_basic_spm_grass7/PERMANENT:~ > g.gui -l /tmp/w2.gxw /tmp/w1.gxw ```
This reverts commit 7422d66.
…nt files Main wxGUI component: ``` GRASS nc_basic_spm_grass7/PERMANENT:~ > g.gui recent_files=main /tmp/w2.gxw /tmp/w1.gxw ``` Simple Python Editor wxGUI component: ``` GRASS nc_basic_spm_grass7/PERMANENT:~ > g.gui recent_files=pyedit /tmp/test.py ```
8c1484d
to
d98ade6
Compare
While I'm in favor of scripting our GUI in general (like m.printws), I still think this is too many changes and too spread out for what it brings. I'm sorry to coming back to this only now. If you still needed, I suggest to limit the interface to each file, so that the commands look something like this:
A completely different alternative is to make these available in the Python console in GUI with some function similarly to how AddLayer is done. Migrating from one computer to another or other syncs seems like a good use case, something to discuss further. |
Solved conflicts |
With this new functionality #2469 I added a wxGUI command line
recent_files
param to print a list of wxGUI component recent files.Main wxGUI component:
Simple Python Editor wxGUI component: