ubarsc / tuiview

TuiView is a lightweight raster GIS with powerful raster attribute table manipulation abilities
http://tuiview.org/
GNU General Public License v2.0
26 stars 13 forks source link

Allow globbing of filenames in file open dialog #11

Closed eco-nz closed 3 years ago

eco-nz commented 3 years ago

In the file open dialogue allow the user to specify multiple files form the structured filenames though normal globbing (or possibly regular expressions, or both?).

Requested by James Shepherd

gillins commented 3 years ago

Is Python's glob.glob (https://docs.python.org/3/library/glob.html) going to be sufficient? Do you also want me to expand environment variables? BTW mock up below. Is this ok? User will have to click "Expand Wildcards" (or Alt+E)

image

eco-nz commented 3 years ago

I think the glob.glob or possibly/optionally glob.iglob would be fine from James's description @gillins.

gillins commented 3 years ago

ping @shepjd

gillins commented 3 years ago

@shepjd are you happy with the mock up above?

shepjd commented 3 years ago

Yep, looks good, will be awesome to be able to expand "210619" and get all the files for a particular day

shepjd commented 3 years ago

that should have read "210619"

shepjd commented 3 years ago

bugger the * is not showing

shepjd commented 3 years ago

210619

shepjd commented 3 years ago

One more try... 210619

gillins commented 3 years ago

Yeah the * is italic (can escape with back slash). I'll put something together and get you to test it first like the other one.

gillins commented 3 years ago

OK @shepjd I have something for you to test:

cd /tmp
git clone https://github.com/gillins/tuiview.git
cd tuiview
git checkout wildcards
python setup.py install

Let me know how it goes. You can either click the button or press Alt+E.

I've only enabled this for rasters. As an aside, for vectors we only ever add the first file they selected - even if they select multiple. I'm guessing this because we have a dialog asking which layer in the vector to add and this would get confusing if there we multiple files. Dunno, maybe it's ok - no one has complained!

gillins commented 3 years ago

As an aside, with this change the Qt File Open dialog will be used on all platforms for opening rasters. Previously, the native File Open would have been used on Windows and OSX.... Any objections to this?

gillins commented 3 years ago

@shepjd did this work for you?

gillins commented 3 years ago

Hi @shepjd I'm keen to do a new release soon... Did you have any luck testing this?

shepjd commented 3 years ago

I'm working from home because of lockdown, but have linux on laptop, will give it a go this afternoon

shepjd commented 3 years ago

Just tested it, worked great, bloody cool and very useful, thanks

gillins commented 3 years ago

Good to hear it will be useful!