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/psmap: fix close vector map properties dialog after hit OK button #3085

Merged
merged 3 commits into from
Sep 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 29 additions & 21 deletions gui/wxpython/psmap/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1963,16 +1963,14 @@ def OnProperties(self, event):
id = self.vectorList[pos][2]

dlg = VPropertiesDialog(
self,
self.parent,
id=id,
settings=self.instruction,
env=self.env,
vectors=self.vectorList,
tmpSettings=self.tmpDialogDict[id],
)
dlg.ShowModal()

self.parent.FindWindowById(wx.ID_OK).SetFocus()
if dlg.ShowModal() == wx.ID_OK:
dlg.update()
dlg.Destroy()

def enableButtons(self, enable=True):
"""Enable/disable up, down, properties, delete buttons"""
Expand Down Expand Up @@ -2124,20 +2122,16 @@ def updateDialog(self):
pass


class VPropertiesDialog(PsmapDialog):
def __init__(self, parent, id, settings, vectors, tmpSettings, env):
PsmapDialog.__init__(
class VPropertiesDialog(Dialog):
def __init__(self, parent, id, vectors, tmpSettings):
Dialog.__init__(
self,
parent=parent,
id=id,
title="",
settings=settings,
env=env,
apply=False,
)

vectorList = vectors
self.vPropertiesDict = tmpSettings
self.spinCtrlSize = (65, -1)

# determine map and its type
for item in vectorList:
Expand Down Expand Up @@ -2195,6 +2189,26 @@ def __init__(self, parent, id, settings, vectors, tmpSettings, env):

self._layout(notebook)

def _layout(self, panel):
# buttons
btnCancel = Button(self, wx.ID_CANCEL)
btnOK = Button(self, wx.ID_OK)
btnOK.SetDefault()

# sizers
btnSizer = wx.StdDialogButtonSizer()
btnSizer.AddButton(btnCancel)
btnSizer.AddButton(btnOK)
btnSizer.Realize()

mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(panel, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)
mainSizer.Add(btnSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)

self.SetSizer(mainSizer)
mainSizer.Layout()
mainSizer.Fit(self)

def _DataSelectionPanel(self, notebook):
panel = Panel(
parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL
Expand Down Expand Up @@ -2924,9 +2938,7 @@ def _StyleLinePanel(self, notebook):

styleText = StaticText(panel, id=wx.ID_ANY, label=_("Choose line style:"))
penStyles = ["solid", "dashed", "dotted", "dashdotted"]
self.styleCombo = PenStyleComboBox(
panel, choices=penStyles, validator=TCValidator(flag="ZERO_AND_ONE_ONLY")
)
self.styleCombo = PenStyleComboBox(panel, choices=penStyles)
# self.styleCombo = wx.ComboBox(panel, id = wx.ID_ANY,
## choices = ["solid", "dashed", "dotted", "dashdotted"],
# validator = TCValidator(flag = 'ZERO_AND_ONE_ONLY'))
Expand Down Expand Up @@ -3287,10 +3299,6 @@ def update(self):

self.vPropertiesDict["linecap"] = self.linecapChoice.GetStringSelection()

def OnOK(self, event):
self.update()
event.Skip()


class LegendDialog(PsmapDialog):
def __init__(self, parent, id, settings, page, env):
Expand Down
Loading