Skip to content

Comments

wxGUI: Add the ProjPicker page to the Location Wizard#1770

Closed
HuidaeCho wants to merge 29 commits intoOSGeo:mainfrom
HuidaeCho:projpicker
Closed

wxGUI: Add the ProjPicker page to the Location Wizard#1770
HuidaeCho wants to merge 29 commits intoOSGeo:mainfrom
HuidaeCho:projpicker

Conversation

@HuidaeCho
Copy link
Member

@HuidaeCho HuidaeCho commented Aug 2, 2021

This PR adds spatial querying of CRSs to the Location Wizard using the ProjPicker.

image

image

image

@HuidaeCho
Copy link
Member Author

HuidaeCho commented Aug 2, 2021

Addresses #1253.

@petrasovaa
Copy link
Contributor

Awesome, thank you! I have yet to actually test it but my initial thoughts are to split the code into gui and python library, so you would have also python/grass/projpicker/ where you would have the code unrelated to gui. If I understood the code correctly, this PR also includes a standalone version, in that case it should be named g.gui.projpicker to be consistent with other standalone gui parts.

Also, we don't need the tk code here.

@HuidaeCho
Copy link
Member Author

HuidaeCho commented Aug 2, 2021

Awesome, thank you! I have yet to actually test it but my initial thoughts are to split the code into gui and python library, so you would have also python/grass/projpicker/ where you would have the code unrelated to gui.

Split in 37a1c6f.

If I understood the code correctly, this PR also includes a standalone version, in that case it should be named g.gui.projpicker to be consistent with other standalone gui parts.

That standalone version just happens to be part of projpicker.py, but it's not meant to be run from GRASS. Actually, it's not even a GRASS module. I think I'd better move g.projpicker to g.gui.projpicker?

Also, we don't need the tk code here.

Removed in 37a1c6f.

@ninsbl
Copy link
Member

ninsbl commented Aug 2, 2021

Very nice! Just wondering if users understand that they can identify suitable CRS from a map when they read Select CRS spatially?
Maybe Select CRS in a map or Select CRS interactively in a map is more clear? Just for your consideration. This is a really userfriendly addition in any case...

@HuidaeCho
Copy link
Member Author

Select CRS interactively in a map

Like this! Thanks for the suggestion.

Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thanks. Is this meant for 8.0 or 8.2?

It is a lot of code, so it would be good if it is in best condition possible. Did you try Pylint or similar tools to critique the code?

grass.projpicker subpackage is a good idea. The getosm piece also seems like library material. Basically anything which is not using wxPython is a good candidate. More reusable code in python/grass, great. Less code in GUI, even better.

I just left some mostly minor comments as I was trying to familiarize myself with the code, but the database is something I would like to know more about.

@petrasovaa
Copy link
Contributor

Seems to work well! When I first opened the wizard it took quite a bit of time, I assume because downloading OSM. Would it be possible to download only when you actually select this option? Or better, do it in separate thread.

The help is little overwhelming with a lot of options. Perhaps we could have a toolbar above the map, similarly to r.li.setup wizard. In any case, I think drawing bbox should be default, not polygon. The search shouldn't be case sensitive.

Overall I feel this should be eventually merged with the second option (Search by EPSG), because there is already an overlap in terms of the functionality and it would make sense from user point of view. That's for a different PR though.

@HuidaeCho
Copy link
Member Author

When I first opened the wizard it took quite a bit of time

I think this is because of self.ppikpage.DoLayout()?

I think drawing bbox should be default, not polygon.

I think we just need bbox, no point, no polygon at all. Or maybe keep bbox and point only?

The search shouldn't be case sensitive.

Search is already case insensitive.

Overall I feel this should be eventually merged with the second option (Search by EPSG), because there is already an overlap in terms of the functionality and it would make sense from user point of view. That's for a different PR though.

I agreed.

@petrasovaa
Copy link
Contributor

When I first opened the wizard it took quite a bit of time

I think this is because of self.ppikpage.DoLayout()?

I guess. I was trying to look what is causing that but I got quickly confused from all the code. There is a lot of gui code, the help text is repeated there 3 times, is that all used at all? The file names could be more helpful (projpicker_gui/gui.py, gui_common.py, wxwidgets.py? ).

I think drawing bbox should be default, not polygon.

I think we just need bbox, no point, no polygon at all. Or maybe keep bbox and point only?

I agree simplicity may be best, bbox could be enough. I am still thinking about the toolbar like in r.li.setup wizard plus adding a tool to clear polygons:

Selection_182

@HuidaeCho
Copy link
Member Author

HuidaeCho commented Aug 4, 2021

When I first opened the wizard it took quite a bit of time

I think this is because of self.ppikpage.DoLayout()?

I guess.

I think it is the DoLayout() call that starts running the projpicker even before opening the page.

I'm not sure if that's a good idea or necessary to call Layout() that early. Downloading is done in a separate thread only for zooming at the moment to avoid excessive zoom requests. If this Layout() call is absolutely necessary at the beginning of the Location Wizard, background downloading might be a solution.

I was trying to look what is causing that but I got quickly confused from all the code. There is a lot of gui code, the help text is repeated there 3 times, is that all used at all? The file names could be more helpful (projpicker_gui/gui.py, gui_common.py, wxwidgets.py? ).

Only one copy of the help message is used. We only use the "map_left" layout and these files are still mostly straight copy-paste from the original project. Needs more work. I think I need to turn this PR to a draft to make that clear.

I think drawing bbox should be default, not polygon.

I think we just need bbox, no point, no polygon at all. Or maybe keep bbox and point only?

I agree simplicity may be best, bbox could be enough. I am still thinking about the toolbar like in r.li.setup wizard plus adding a tool to clear polygons:

Selection_182

Agreed on bbox only. About the toolbar idea... I need an artist ;-). Right now

  • drag for panning
  • scroll for zooming
  • ctrl+drag for bbox zooming
  • click-move-double click for drawing bbox
  • click-move-drag-move-double click for drawing bbox with panning
  • right click to cancel drawing
  • double right click to clear everything

So.. icons, we would need

  • zoom in
  • zoom out
  • pan
  • bbox (no more start drawing -> click and pan -> complete; just single click to complete, which is not implemented)
  • clear

And remove the Help tab.

@HuidaeCho HuidaeCho marked this pull request as draft August 4, 2021 03:17
@HuidaeCho
Copy link
Member Author

HuidaeCho commented Aug 7, 2021

TODO

  • Remove ProjPicker-only code (I'll keep enough code for g.projpicker though, which will include the more full-blown wxPython GUI).
  • toolbar
  • i18nify user-visible messages
  • pylint
  • black? Other GUI code is not black-formatted yet?

@wenzeslaus
Copy link
Member

Other GUI code is not black-formatted yet?

Why do you think so? It should be.

@HuidaeCho
Copy link
Member Author

Other GUI code is not black-formatted yet?

Why do you think so? It should be.

You're right! It was my code in wizard.py.

@HuidaeCho
Copy link
Member Author

ValueError is likely still the best one here. NotImplementedError has a specific meaning when working with abstract classes/methods, at least that's how it is defined:

https://docs.python.org/3/library/exceptions.html#NotImplementedError

I think any builtin errors are defined specifically for Python internally? For example, SyntaxError may not be meant for custom syntax like ProjPicker Query. Maybe, it would be better to define my own custom errors (best practice?), but I just prefer not to do that if I can recycle builtin errors (bad idea?).

@HuidaeCho
Copy link
Member Author

Current shortcuts

Pan:               Left drag
Zoom:              Scroll
Zoom to bboxes:    Ctrl + scroll up
Zoom to the world: Ctrl + scroll down
Zoom to a bbox:    Ctrl + left drag
Draw a bbox:       Left click
Cancel drawing:    Right click
Clear:             Double right click

No more polygons and points.

@ocsmit
Copy link

ocsmit commented Sep 11, 2021

@wenzeslaus, @petrasovaa - I have spoken with @HuidaeCho about plans to take over this PR. I am unable to commit directly to the PR at the moment (tried standard git workflow of adding his remote branch, making local branch and then committing to remote branch head), and wanted to inquire what the best approach to start working directly off the PR would be.

@wenzeslaus
Copy link
Member

@ocsmit I don't think there is a easy way of getting access to someones branch except 1) getting access to their repo and 2) when you are a maintainer of the project the PR was submitted to. Conclusion: To overtake the work on this, you need to get this branch locally, push it to your fork and open a new PR.

I would say, no harm done here opening a new PR. There is plenty of comments here, but they seem to be mostly resolved (please check), so opening a new PR will clear the old stuff. Restating and updating the goals and methods in the PR description might be helpful too.

@HuidaeCho HuidaeCho closed this May 20, 2022
@HuidaeCho HuidaeCho deleted the projpicker branch May 20, 2022 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request GUI wxGUI related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants