[GRASS-SVN] r42604 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 20 14:31:34 EDT 2010
Author: marisn
Date: 2010-06-20 18:31:34 +0000 (Sun, 20 Jun 2010)
New Revision: 42604
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py
Log:
wxGUI: Apply correctly profile text settings. Fixes #651. (Merge from trunk r42597)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py 2010-06-20 18:06:50 UTC (rev 42603)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py 2010-06-20 18:31:34 UTC (rev 42604)
@@ -670,6 +670,26 @@
dlg.ShowModal()
dlg.Destroy()
+ def OnPText(self, dlg):
+ """
+ Use user's provided profile text settings.
+ """
+ self.ptitle = dlg.ptitle
+ self.xlabel = dlg.xlabel
+ self.ylabel = dlg.ylabel
+ dlg.UpdateSettings()
+
+ self.client.SetFont(self.properties['font']['wxfont'])
+ self.client.SetFontSizeTitle(self.properties['font']['prop']['titleSize'])
+ self.client.SetFontSizeAxis(self.properties['font']['prop']['axisSize'])
+
+ if self.profile:
+ self.profile.setTitle(dlg.ptitle)
+ self.profile.setXLabel(dlg.xlabel)
+ self.profile.setYLabel(dlg.ylabel)
+
+ self.OnRedraw(event=None)
+
def PText(self, event):
"""
Set custom text values for profile
@@ -678,24 +698,10 @@
dlg = TextDialog(parent=self, id=wx.ID_ANY, title=_('Profile text settings'))
if dlg.ShowModal() == wx.ID_OK:
- self.ptitle = dlg.ptitle
- self.xlabel = dlg.xlabel
- self.ylabel = dlg.ylabel
- dlg.UpdateSettings()
+ self.OnPText(dlg)
- self.client.SetFont(self.properties['font']['wxfont'])
- self.client.SetFontSizeTitle(self.properties['font']['prop']['titleSize'])
- self.client.SetFontSizeAxis(self.properties['font']['prop']['axisSize'])
-
- if self.profile:
- self.profile.setTitle(dlg.ptitle)
- self.profile.setXLabel(dlg.xlabel)
- self.profile.setYLabel(dlg.ylabel)
-
dlg.Destroy()
- self.OnRedraw(event=None)
-
def POptions(self, event):
"""
Set various profile options, including: line width, color, style;
@@ -706,8 +712,8 @@
btnval = dlg.ShowModal()
if btnval == wx.ID_SAVE:
- dlg.UpdateSettings()
- self.SetGraphStyle()
+ dlg.UpdateSettings()
+ self.SetGraphStyle()
dlg.Destroy()
elif btnval == wx.ID_CANCEL:
dlg.Destroy()
@@ -904,7 +910,7 @@
#
label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Profile title:"))
gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
- self.ptitleentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(200,-1))
+ self.ptitleentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
# self.ptitleentry.SetFont(self.font)
self.ptitleentry.SetValue(self.ptitle)
gridSizer.Add(item=self.ptitleentry, pos=(0, 1))
@@ -925,7 +931,7 @@
#
label = wx.StaticText(parent=self, id=wx.ID_ANY, label=("X-axis label:"))
gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
- self.xlabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(200,-1))
+ self.xlabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
# self.xlabelentry.SetFont(self.font)
self.xlabelentry.SetValue(self.xlabel)
gridSizer.Add(item=self.xlabelentry, pos=(2, 1))
@@ -935,7 +941,7 @@
#
label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Y-axis label:"))
gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
- self.ylabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(200,-1))
+ self.ylabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
# self.ylabelentry.SetFont(self.font)
self.ylabelentry.SetValue(self.ylabel)
gridSizer.Add(item=self.ylabelentry, pos=(3, 1))
@@ -968,7 +974,7 @@
#
label1 = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Font family:"))
gridSizer.Add(item=label1, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
- self.ffamilycb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(200, -1),
+ self.ffamilycb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1),
choices=self.ffamilydict.keys(), style=wx.CB_DROPDOWN)
self.ffamilycb.SetStringSelection('swiss')
for item in self.ffamilydict.items():
@@ -982,7 +988,7 @@
#
label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style:"))
gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
- self.fstylecb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(200, -1),
+ self.fstylecb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1),
choices=self.fstyledict.keys(), style=wx.CB_DROPDOWN)
self.fstylecb.SetStringSelection('normal')
for item in self.fstyledict.items():
@@ -996,7 +1002,7 @@
#
label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:"))
gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
- self.fwtcb = wx.ComboBox(parent=self, size=(200, -1),
+ self.fwtcb = wx.ComboBox(parent=self, size=(250, -1),
choices=self.fwtdict.keys(), style=wx.CB_DROPDOWN)
self.fwtcb.SetStringSelection('normal')
for item in self.fwtdict.items():
@@ -1018,26 +1024,32 @@
#
btnSave = wx.Button(self, wx.ID_SAVE)
btnApply = wx.Button(self, wx.ID_APPLY)
+ btnOk = wx.Button(self, wx.ID_OK)
btnCancel = wx.Button(self, wx.ID_CANCEL)
- btnSave.SetDefault()
+ btnOk.SetDefault()
# bindigs
btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
btnApply.SetToolTipString(_("Apply changes for the current session"))
+ btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
+ btnOk.SetToolTipString(_("Apply changes for the current session and close dialog"))
+ btnOk.SetDefault()
btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
- btnSave.SetDefault()
btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
# sizers
btnStdSizer = wx.StdDialogButtonSizer()
+ btnStdSizer.AddButton(btnOk)
+ btnStdSizer.AddButton(btnApply)
btnStdSizer.AddButton(btnCancel)
- btnStdSizer.AddButton(btnSave)
- btnStdSizer.AddButton(btnApply)
btnStdSizer.Realize()
- sizer.Add(item=btnStdSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
+ btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+ btnSizer.Add(item=btnSave, proportion=0, flag=wx.ALIGN_LEFT | wx.ALL, border=5)
+ btnSizer.Add(item=btnStdSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
+ sizer.Add(item=btnSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
#
# bindings
@@ -1077,16 +1089,21 @@
fileSettings['profile'] = UserSettings.Get(group='profile')
file = UserSettings.SaveToFile(fileSettings)
self.parent.parent.gismanager.goutput.WriteLog(_('Profile settings saved to file \'%s\'.') % file)
- self.Close()
+ self.EndModal(wx.ID_OK)
def OnApply(self, event):
"""Button 'Apply' pressed"""
self.UpdateSettings()
- self.Close()
+ self.parent.OnPText(self)
+
+ def OnOk(self, event):
+ """!Button 'OK' pressed"""
+ self.UpdateSettings()
+ self.EndModal(wx.ID_OK)
def OnCancel(self, event):
"""Button 'Cancel' pressed"""
- self.Close()
+ self.EndModal(wx.ID_CANCEL)
class OptDialog(wx.Dialog):
def __init__(self, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
More information about the grass-commit
mailing list