-
-
Notifications
You must be signed in to change notification settings - Fork 320
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/dbmgr: fix removing map table layer and layer related Browse data and Manage tables page (tab) #2422
Conversation
gui/wxpython/dbmgr/base.py
Outdated
@@ -1018,7 +1018,7 @@ def DeletePage(self, layer): | |||
if layer not in self.layers: | |||
return False | |||
|
|||
GNotebook.DeleteNBPage(self, self.layers.index(layer)) | |||
GNotebook.DeletePage(self, self.layers.index(layer)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please comment on this more? The new code uses directly the method of the FlatNotebook, but why? Is something wrong about GNotebook's implementation? Wouldn't it be possibly better to adjust the code of this function to work with the GNotebook's version of DeletNBPage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotebookController
base class, InsertPage
method has 2 way how to insert page:
grass/gui/wxpython/gui_core/widgets.py
Lines 143 to 154 in 120f198
def InsertPage(self, *args, **kwargs): | |
"""Insert a new page""" | |
if "name" in kwargs: | |
self.notebookPages[kwargs["name"]] = kwargs["page"] | |
del kwargs["name"] | |
try: | |
self.classObject.InsertPage(self.widget, *args, **kwargs) | |
except TypeError as e: # documentation says 'index', but certain versions of wx require 'n' | |
kwargs["n"] = kwargs["index"] | |
del kwargs["index"] | |
self.classObject.InsertPage(self.widget, *args, **kwargs) |
- Insert page with name param
- Insert page without name param (this is preferred way in Attribute Table Manager code)
grass/gui/wxpython/dbmgr/base.py
Lines 1173 to 1178 in 120f198
self.InsertNBPage( index=pos, page=panel, text=" %d / %s %s" % (layer, label, self.dbMgrData["mapDBInfo"].layers[layer]["table"]), )
NotebookController
base class, inside DeletePage
method is called method GetPageIndexByName
which is not return page index (return -1) if page was inserted without name param.
grass/gui/wxpython/gui_core/widgets.py
Lines 156 to 169 in 120f198
def DeletePage(self, page): | |
"""Delete page | |
:param page: name | |
:return: True if page was deleted, False if not exists | |
""" | |
delPageIndex = self.GetPageIndexByName(page) | |
if delPageIndex != -1: | |
ret = self.classObject.DeletePage(self.widget, delPageIndex) | |
if ret: | |
del self.notebookPages[page] | |
return ret | |
else: | |
return False |
FlatNotebookController
class, GetPageIndexByName
method
grass/gui/wxpython/gui_core/widgets.py
Lines 258 to 264 in 120f198
def GetPageIndexByName(self, page): | |
"""Get notebook page index | |
:param page: name | |
""" | |
if page not in self.notebookPages: | |
return -1 |
GNotebook
class, method DeleteNBPage
implementation allow delete page which was inserted with name param only.
a4419dd
to
327d334
Compare
Rebase 327d334. |
@petrasovaa I refactored the use of |
With 086b5b2 I refactor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I think this is better!
…ta and Manage tables page (tab) (OSGeo#2422)
…ta and Manage tables page (tab) (OSGeo#2422)
…ta and Manage tables page (tab) (OSGeo#2422)
…ta and Manage tables page (tab) (OSGeo#2422)
…ta and Manage tables page (tab) (OSGeo#2422)
Describe the bug
Removing map table layer don't work and related layer page (tab) on the Browse data and Manage tables page (tab) aren't deleted too.
To Reproduce
Steps to reproduce the behavior:
g.gui.dbmgr geology
Expected behavior
Removing map table layer should be work without error message, and related layer page (tab) on the Browse data and Manage tables page (tab) be deleted too.
System description (please complete the following information):