diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index ed6d84cb5c8..0a05b4562ed 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -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""" @@ -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: @@ -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 @@ -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')) @@ -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):