grass
grass copied to clipboard
wxGUI: add recent_files param to print a list of wxGUI component recent files
With this new functionality https://github.com/OSGeo/grass/pull/2469 I added a wxGUI command line recent_files param to print a list of wxGUI component recent 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
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.
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.
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:
python gui/wxpython/lmgr/workspace.py get recent
python gui/wxpython/gui_core/pyedit.py --get-recent-files
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.