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

TopoViewer: all layers are added as visible while code asks them NOT to be #19669

Closed
qgib opened this issue Oct 10, 2014 · 12 comments
Closed

TopoViewer: all layers are added as visible while code asks them NOT to be #19669

qgib opened this issue Oct 10, 2014 · 12 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Oct 10, 2014

Author Name: Sandro Santilli (@strk)
Original Redmine Issue: 11382
Affected QGIS version: 2.4.0
Redmine category:db_manager
Assignee: Martin Dobias


I guess something changed in the TOC api as the TopoViewer plugin of the DBManager now adds all layers as visible even if it makes its best to request then NOT to be.

Code snippet:

1. NODES
group = legend.addGroup(u'Nodes', False, supergroup)
1. should not be needed: #16051
legend.setGroupVisible(group, False)
layer = QgsVectorLayer(uri.uri(), u'%s.node' % toponame, provider)
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2014

Author Name: Sandro Santilli (@strk)


Link to more code: https://github.com/qgis/QGIS/blob/final-2_4_0/python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py#L104-L118

It looks like 2.4 was also affected :(


  • version was changed from master to 2.4.0

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2014

Author Name: Sandro Santilli (@strk)


2.2.0 was fine

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2014

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from Normal to Severe/Regression

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2014

Author Name: Jürgen Fischer (@jef-n)


  • subject was changed from DBManager TopoViewer: all layers are added as visible while code asks them NOT to be to TopoViewer: all layers are added as visible while code asks them NOT to be
  • category_id was changed from Python plugins to DB Manager

@qgib
Copy link
Contributor Author

qgib commented Oct 14, 2014

Author Name: gillian milani (gillian milani)


The moveLayer(layer, group) make your layer visible.
So it's normal behavior.
Just change the order of commands, it sould work fine.

@qgib
Copy link
Contributor Author

qgib commented Oct 14, 2014

Author Name: Sandro Santilli (@strk)


Thank you Gillian, the change fixes the problem. But as of version 2.2 the behaviour was different.
Also, the API documentation doesn't say anything about moveLayer making the layer visible:
http://qgis.org/api/classQgsLegendInterface.html#a23183b102f51dfecb81b26ea570ff224

@qgib
Copy link
Contributor Author

qgib commented Oct 14, 2014

Author Name: Sandro Santilli (@strk)


Fixed in changeset "1ff2ad3cc3fa4bdca691f83497f96e83a6cc898b".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Oct 15, 2014

Author Name: Salvatore Larosa (@slarosa)


I would reopen this issue as the @moveLayer@ should not make the layer visible if it was not.
IMO, the normal behavior when moving a layer into a group is keeping the initial state of the layer.

here my proposal patch: #1629

I also think you can drop all the stuff like "should not be needed: #16051" from topoviewer plugin :)

Thoughts?

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2014

Author Name: Sandro Santilli (@strk)


Agreed, reopened.


  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Oct 20, 2014

Author Name: Martin Dobias (@wonder-sk)


Fixed in changeset "3546b325a5c335ac960494259bb006514111c08d".


  • status_id was changed from Reopened to Closed

@qgib
Copy link
Contributor Author

qgib commented Oct 21, 2014

Author Name: Sandro Santilli (@strk)


Thanks, Martin. Could you also look at #16051 since you're at it ? Would be nice to drop other hacks from the plugin, like
https://github.com/qgis/QGIS/blob/final-2_4_0/python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py#L154-L155

@qgib
Copy link
Contributor Author

qgib commented Oct 21, 2014

Author Name: Martin Dobias (@wonder-sk)


I think #16051 should not be an issue since 2.4 because the logic for visibility has been rewritten. Would you mind to check if your code works without that workaround in 2.4 / master - and eventually close that ticket?

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin labels May 25, 2019
@qgib qgib added this to the Version 2.6 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin
Projects
None yet
Development

No branches or pull requests

1 participant