Skip to content
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/Data catalog: distinguish label and name of nodes #783

Conversation

lindakarlovska
Copy link
Contributor

wxGUI/datacatalog: node.label changed to node.data['name'] in tree.py.

@lindakarlovska lindakarlovska changed the title Data catalog: distinguish label and name of nodes wxGUI/Data catalog: distinguish label and name of nodes Jul 13, 2020
@petrasovaa petrasovaa added gsoc Reserved for Google Summer of Code student(s) GUI wxGUI related labels Jul 13, 2020
@petrasovaa petrasovaa linked an issue Jul 13, 2020 that may be closed by this pull request
@petrasovaa petrasovaa added this to In progress in New GUI Startup via automation Jul 13, 2020
@petrasovaa
Copy link
Contributor

You need to rebase and solve conflict with master. When you are in this PR branch do something like (always read git status to check):

git fetch upstream
git rebase upstream/master
# resolve conflicts in tree.py
git add tree.py
git rebase --continue
git push -f

@lindakarlovska lindakarlovska force-pushed the wxGUI-Distinquish-label-and-names-of-nodes branch from 64aafcc to 23012a1 Compare July 14, 2020 11:36
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

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

Renaming map doesn't work.

@petrasovaa
Copy link
Contributor

You don't need to reload the entire tree to refresh the one layer.

if new_name:
self.Rename(old_name, new_name)
self.ReloadTreeItems()
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

Which exception are you trying to catch here? Raised in _getNewMapName or Rename?

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove it or explain why it needs to be there.

@lindakarlovska
Copy link
Contributor Author

You don't need to reload the entire tree to refresh the one layer.

I have tried to use self.RefreshNode(self.selected_layer[0]) instead of self.ReloadTreeItems but it does not work.
So, I should probably make the function self.ReloadSelectedLayer similar to self.ReloadCurrentMapset which would reload only selected layer. And similarly I could make other functions like self.ReloadSelectedMapset etc.. which might be used in other rename/delete functions further on.
But I am not sure how to make self.ReloadSelectedLayer since there is some process:
p = Process(
target=getLocationTree,
args=(
self.current_grassdb_node.data['name'],
self.current_location_node.data['name'],
q,
self.current_mapset_node.data['name']))...
in which a layer does not appear.

@lindakarlovska
Copy link
Contributor Author

You don't need to reload the entire tree to refresh the one layer.

I have tried to use self.RefreshNode(self.selected_layer[0]) instead of self.ReloadTreeItems but it does not work.
So, I should probably make the function self.ReloadSelectedLayer similar to self.ReloadCurrentMapset which would reload only selected layer. And similarly I could make other functions like self.ReloadSelectedMapset etc.. which might be used in other rename/delete functions further on.
But I am not sure how to make self.ReloadSelectedLayer since there is some process:
p = Process(
target=getLocationTree,
args=(
self.current_grassdb_node.data['name'],
self.current_location_node.data['name'],
q,
self.current_mapset_node.data['name']))...
in which a layer does not appear.

Would be probably nice to have one general function for reloading which will reload everything recursively according to type of a node parameter?...

@petrasovaa
Copy link
Contributor

You don't need to reload the entire tree to refresh the one layer.

I have tried to use self.RefreshNode(self.selected_layer[0]) instead of self.ReloadTreeItems but it does not work.
So, I should probably make the function self.ReloadSelectedLayer similar to self.ReloadCurrentMapset which would reload only selected layer. And similarly I could make other functions like self.ReloadSelectedMapset etc.. which might be used in other rename/delete functions further on.
But I am not sure how to make self.ReloadSelectedLayer since there is some process:
p = Process(
target=getLocationTree,
args=(
self.current_grassdb_node.data['name'],
self.current_location_node.data['name'],
q,
self.current_mapset_node.data['name']))...
in which a layer does not appear.

Reloading single layer is different than mapset/location/db. For this PR just change the node.label. We will address this in future differently.

@lindakarlovska
Copy link
Contributor Author

lindakarlovska commented Jul 16, 2020

I had an idea to changed ReloadTreeItems() in create/rename/delete functions to self.Refresh(self.selected_"node"[0], recursive=True) but it does not work. Seems to me that refreshing is different from reloading and for reload, the function _initTreeItems is needed.

@petrasovaa
Copy link
Contributor

I had an idea to changed ReloadTreeItems() in create/rename/delete functions to self.Refresh(self.selected_"node"[0], recursive=True) but it does not work. Seems to me that refreshing is different from reloading and for reload, the function _initTreeItems is needed.

Yes, that's different. I suggest to review in depth the implementation of TreeModel and TreeView and AbstractTreeViewMixin. Basically, refreshing just influences rendering of the nodes, reloading changes the actual underlying data model.

@petrasovaa petrasovaa merged commit d4337c5 into OSGeo:master Jul 17, 2020
New GUI Startup automation moved this from In progress to Done Jul 17, 2020
@neteler neteler added this to the 8.0.0 milestone Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc Reserved for Google Summer of Code student(s) GUI wxGUI related
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[Feat] Data catalog: distinguish label and name of nodes
3 participants