466
533
'value' : (0, 0, 0, 255), # constant: black
469
'mode' : 0, # isosurfaces
470
'shading' : 1, # gouraud
536
'mode' : 0, # isosurfaces
537
'shading' : 1, # gouraud
471
538
'resolution' : 3, # polygon resolution
480
'bgcolor' : (255, 255, 255, 255), # white
552
'color' : (255, 255, 255, 255), # white
557
'color' : (128, 128, 128, 255), # grey
563
'valid' : (180, 234, 154, 255), # light green
564
'invalid' : (255, 255, 255, 255), # white
565
'running' : (255, 0, 0, 255), # red
566
'disabled' : (211, 211, 211, 255), # light grey
579
'raster' : (215, 215, 248, 255), # light blue
580
'raster3d' : (215, 248, 215, 255), # light green
581
'vector' : (248, 215, 215, 255), # light red
603
# quick fix, http://trac.osgeo.org/grass/ticket/1233
605
if sys.platform == 'darwin':
606
self.defaultSettings['general']['defWindowPos']['enabled'] = False
789
913
if not dict.has_key(group):
792
916
if not dict[group].has_key(key):
793
917
dict[group][key] = {}
795
if type(subkey) == type([]):
919
if type(subkey) == types.ListType:
796
920
# TODO: len(subkey) > 2
797
921
if not dict[group][key].has_key(subkey[0]):
798
922
dict[group][key][subkey[0]] = {}
799
dict[group][key][subkey[0]][subkey[1]] = value
924
dict[group][key][subkey[0]][subkey[1]] = value
926
print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
927
' (' + group + ':' + key + ':' + subkey[0] + ':' + subkey[1] + ')'
801
dict[group][key][subkey] = value
930
dict[group][key][subkey] = value
932
print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
933
' (' + group + ':' + key + ':' + subkey + ')'
803
935
def GetDefaultSettings(self):
804
"""Get default user settings"""
936
"""!Get default user settings"""
805
937
return self.defaultSettings
807
939
globalSettings = Settings()
809
class PreferencesDialog(wx.Dialog):
810
"""User preferences dialog"""
811
def __init__(self, parent, title=_("User GUI settings"),
812
settings=globalSettings,
813
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
814
self.parent = parent # GMFrame
816
wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title,
817
style=style, size=(-1, -1))
941
class PreferencesBaseDialog(wx.Dialog):
942
"""!Base preferences dialog"""
943
def __init__(self, parent, settings, title = _("User settings"),
945
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
946
self.parent = parent # ModelerFrame
819
949
self.settings = settings
951
wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
821
notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT)
955
self.notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT)
823
957
# dict for window ids
826
960
# create notebook pages
827
self.__CreateGeneralPage(notebook)
828
self.__CreateDisplayPage(notebook)
829
self.__CreateCmdPage(notebook)
830
self.__CreateAttributeManagerPage(notebook)
831
self.__CreateWorkspacePage(notebook)
832
self.__CreateAdvancedPage(notebook)
835
btnDefault = wx.Button(self, wx.ID_ANY, _("Set to default"))
836
btnSave = wx.Button(self, wx.ID_SAVE)
837
btnApply = wx.Button(self, wx.ID_APPLY)
838
btnCancel = wx.Button(self, wx.ID_CANCEL)
963
self.btnDefault = wx.Button(self, wx.ID_ANY, _("Set to default"))
964
self.btnSave = wx.Button(self, wx.ID_SAVE)
965
self.btnApply = wx.Button(self, wx.ID_APPLY)
966
self.btnCancel = wx.Button(self, wx.ID_CANCEL)
967
self.btnSave.SetDefault()
842
btnDefault.Bind(wx.EVT_BUTTON, self.OnDefault)
843
btnDefault.SetToolTipString(_("Revert settings to default and apply changes"))
844
btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
845
btnApply.SetToolTipString(_("Apply changes for the current session"))
846
btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
847
btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
849
btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
850
btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
970
self.btnDefault.Bind(wx.EVT_BUTTON, self.OnDefault)
971
self.btnDefault.SetToolTipString(_("Revert settings to default and apply changes"))
972
self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
973
self.btnApply.SetToolTipString(_("Apply changes for the current session"))
974
self.btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
975
self.btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
976
self.btnSave.SetDefault()
977
self.btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
978
self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
980
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
853
987
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
854
btnSizer.Add(item=btnDefault, proportion=1,
988
btnSizer.Add(item=self.btnDefault, proportion=1,
855
989
flag=wx.ALL, border=5)
856
990
btnStdSizer = wx.StdDialogButtonSizer()
857
btnStdSizer.AddButton(btnCancel)
858
btnStdSizer.AddButton(btnSave)
859
btnStdSizer.AddButton(btnApply)
991
btnStdSizer.AddButton(self.btnCancel)
992
btnStdSizer.AddButton(self.btnSave)
993
btnStdSizer.AddButton(self.btnApply)
860
994
btnStdSizer.Realize()
862
996
mainSizer = wx.BoxSizer(wx.VERTICAL)
863
mainSizer.Add(item=notebook, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)
997
mainSizer.Add(item=self.notebook, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)
864
998
mainSizer.Add(item=btnSizer, proportion=0,
865
999
flag=wx.EXPAND, border=0)
866
1000
mainSizer.Add(item=btnStdSizer, proportion=0,
867
1001
flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
869
1003
self.SetSizer(mainSizer)
870
1004
mainSizer.Fit(self)
1006
def OnDefault(self, event):
1007
"""!Button 'Set to default' pressed"""
1008
self.settings.userSettings = copy.deepcopy(self.settings.defaultSettings)
1011
for gks in self.winId.keys():
1013
group, key, subkey = gks.split(':')
1014
value = self.settings.Get(group, key, subkey)
1016
group, key, subkey, subkey1 = gks.split(':')
1017
value = self.settings.Get(group, key, [subkey, subkey1])
1018
win = self.FindWindowById(self.winId[gks])
1019
if win.GetName() in ('GetValue', 'IsChecked'):
1020
value = win.SetValue(value)
1021
elif win.GetName() == 'GetSelection':
1022
value = win.SetSelection(value)
1023
elif win.GetName() == 'GetStringSelection':
1024
value = win.SetStringSelection(value)
1026
value = win.SetValue(value)
1028
def OnApply(self, event):
1029
"""!Button 'Apply' pressed"""
1030
if self._updateSettings():
1031
self.parent.goutput.WriteLog(_('Settings applied to current session but not saved'))
1034
def OnCloseWindow(self, event):
1037
def OnCancel(self, event):
1038
"""!Button 'Cancel' pressed"""
1041
def OnSave(self, event):
1042
"""!Button 'Save' pressed"""
1043
if self._updateSettings():
1044
file = self.settings.SaveToFile()
1045
self.parent.goutput.WriteLog(_('Settings saved to file \'%s\'.') % file)
1048
def _updateSettings(self):
1049
"""!Update user settings"""
1050
for item in self.winId.keys():
1052
group, key, subkey = item.split(':')
1055
group, key, subkey, subkey1 = item.split(':')
1057
id = self.winId[item]
1058
win = self.FindWindowById(id)
1059
if win.GetName() == 'GetValue':
1060
value = win.GetValue()
1061
elif win.GetName() == 'GetSelection':
1062
value = win.GetSelection()
1063
elif win.GetName() == 'IsChecked':
1064
value = win.IsChecked()
1065
elif win.GetName() == 'GetStringSelection':
1066
value = win.GetStringSelection()
1067
elif win.GetName() == 'GetColour':
1068
value = tuple(win.GetValue())
1070
value = win.GetValue()
1072
if key == 'keycolumn' and value == '':
1073
wx.MessageBox(parent=self,
1074
message=_("Key column cannot be empty string."),
1075
caption=_("Error"), style=wx.OK | wx.ICON_ERROR)
1076
win.SetValue(self.settings.Get(group='atm', key='keycolumn', subkey='value'))
1080
self.settings.Set(group, value, key, [subkey, subkey1])
1082
self.settings.Set(group, value, key, subkey)
1086
class PreferencesDialog(PreferencesBaseDialog):
1087
"""!User preferences dialog"""
1088
def __init__(self, parent, title = _("GUI settings"),
1089
settings = globalSettings):
1091
PreferencesBaseDialog.__init__(self, parent = parent, title = title,
1092
settings = settings)
1094
# create notebook pages
1095
self._CreateGeneralPage(self.notebook)
1096
self._CreateDisplayPage(self.notebook)
1097
self._CreateCmdPage(self.notebook)
1098
self._CreateAttributeManagerPage(self.notebook)
1099
self._CreateProjectionPage(self.notebook)
1100
self._CreateWorkspacePage(self.notebook)
1101
self._CreateAdvancedPage(self.notebook)
872
1103
self.SetMinSize(self.GetBestSize())
873
self.SetSize((500, 375))
875
def __CreateGeneralPage(self, notebook):
876
"""Create notebook page for general settings"""
1104
self.SetSize(self.size)
1106
def _CreateGeneralPage(self, notebook):
1107
"""!Create notebook page for general settings"""
877
1108
panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
878
1109
notebook.AddPage(page=panel, text=_("General"))
1353
def __CreateWorkspacePage(self, notebook):
1354
"""Create notebook page for workspace settings"""
1652
def _CreateProjectionPage(self, notebook):
1653
"""!Create notebook page for workspace settings"""
1654
panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
1655
notebook.AddPage(page=panel, text=_("Projection"))
1657
border = wx.BoxSizer(wx.VERTICAL)
1660
# projections statusbar settings
1662
box = wx.StaticBox (parent=panel, id=wx.ID_ANY, label=" %s " % _("Projection statusbar settings"))
1663
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
1665
gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
1666
gridSizer.AddGrowableCol(1)
1670
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
1671
label=_("EPSG code:"))
1672
epsgCode = wx.ComboBox(parent=panel, id=wx.ID_ANY,
1675
self.epsgCodeDict = dict()
1676
epsgCode.SetValue(str(self.settings.Get(group='projection', key='statusbar', subkey='epsg')))
1677
self.winId['projection:statusbar:epsg'] = epsgCode.GetId()
1679
gridSizer.Add(item=label,
1681
flag = wx.ALIGN_CENTER_VERTICAL)
1682
gridSizer.Add(item=epsgCode,
1683
pos=(row, 1), span=(1, 2))
1687
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
1688
label=_("Proj.4 string (required):"))
1689
projString = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
1690
value=self.settings.Get(group='projection', key='statusbar', subkey='proj4'),
1691
name="GetValue", size=(400, -1))
1692
self.winId['projection:statusbar:proj4'] = projString.GetId()
1694
gridSizer.Add(item=label,
1696
flag = wx.ALIGN_CENTER_VERTICAL)
1697
gridSizer.Add(item=projString,
1698
pos=(row, 1), span=(1, 2),
1699
flag = wx.ALIGN_CENTER_VERTICAL)
1703
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
1704
label=_("EPSG file:"))
1705
projFile = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
1706
value = self.settings.Get(group='projection', key='statusbar', subkey='projFile'),
1707
name="GetValue", size=(400, -1))
1708
self.winId['projection:statusbar:projFile'] = projFile.GetId()
1709
gridSizer.Add(item=label,
1711
flag = wx.ALIGN_CENTER_VERTICAL)
1712
gridSizer.Add(item=projFile,
1714
flag = wx.ALIGN_CENTER_VERTICAL)
1718
note = wx.StaticText(parent = panel, id = wx.ID_ANY,
1719
label = _("Load EPSG codes (be patient), enter EPSG code or "
1720
"insert Proj.4 string directly."))
1721
gridSizer.Add(item=note,
1726
epsgLoad = wx.Button(parent=panel, id=wx.ID_ANY,
1727
label=_("&Load EPSG codes"))
1728
gridSizer.Add(item=epsgLoad,
1729
flag = wx.ALIGN_RIGHT,
1732
sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
1733
border.Add(item=sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
1738
box = wx.StaticBox (parent=panel, id=wx.ID_ANY, label=" %s " % _("Coordinates format"))
1739
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
1741
gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
1742
gridSizer.AddGrowableCol(2)
1746
ll = wx.RadioBox(parent = panel, id = wx.ID_ANY,
1747
label = " %s " % _("LL projections"),
1748
choices = ["DMS", "DEG"],
1749
name = "GetStringSelection")
1750
self.winId['projection:format:ll'] = ll.GetId()
1751
if self.settings.Get(group = 'projection', key = 'format', subkey = 'll') == 'DMS':
1757
precision = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
1760
precision.SetValue(int(self.settings.Get(group = 'projection', key = 'format', subkey = 'precision')))
1761
self.winId['projection:format:precision'] = precision.GetId()
1763
gridSizer.Add(item=ll,
1765
gridSizer.Add(item=wx.StaticText(parent = panel, id = wx.ID_ANY,
1766
label = _("Precision:")),
1767
flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT,
1770
gridSizer.Add(item=precision,
1771
flag = wx.ALIGN_CENTER_VERTICAL,
1775
sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
1776
border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
1778
panel.SetSizer(border)
1781
epsgLoad.Bind(wx.EVT_BUTTON, self.OnLoadEpsgCodes)
1782
epsgCode.Bind(wx.EVT_COMBOBOX, self.OnSetEpsgCode)
1783
epsgCode.Bind(wx.EVT_TEXT_ENTER, self.OnSetEpsgCode)
1787
def _CreateWorkspacePage(self, notebook):
1788
"""!Create notebook page for workspace settings"""
1355
1789
panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
1356
1790
notebook.AddPage(page=panel, text=_("Workspace"))
1900
def OnCheckColorTable(self, event):
1901
"""!Set/unset default color table"""
1902
win = self.FindWindowById(self.winId['cmd:rasterColorTable:selection'])
1903
if event.IsChecked():
1908
def OnLoadEpsgCodes(self, event):
1909
"""!Load EPSG codes from the file"""
1910
win = self.FindWindowById(self.winId['projection:statusbar:projFile'])
1911
path = win.GetValue()
1913
self.epsgCodeDict = utils.ReadEpsgCodes(path)
1914
list = self.FindWindowById(self.winId['projection:statusbar:epsg'])
1915
if type(self.epsgCodeDict) == type(''):
1916
wx.MessageBox(parent=self,
1917
message=_("Unable to read EPSG codes: %s") % self.epsgCodeDict,
1918
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
1919
self.epsgCodeDict = dict()
1922
self.FindWindowById(self.winId['projection:statusbar:proj4']).SetValue('')
1925
choices = map(str, self.epsgCodeDict.keys())
1927
list.SetItems(choices)
1929
code = int(list.GetValue())
1932
win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
1933
if self.epsgCodeDict.has_key(code):
1934
win.SetValue(self.epsgCodeDict[code][1])
1936
list.SetSelection(0)
1937
code = int(list.GetStringSelection())
1938
win.SetValue(self.epsgCodeDict[code][1])
1940
def OnSetEpsgCode(self, event):
1941
"""!EPSG code selected"""
1942
winCode = self.FindWindowById(event.GetId())
1943
win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
1944
if not self.epsgCodeDict:
1945
wx.MessageBox(parent=self,
1946
message=_("EPSG code %s not found") % event.GetString(),
1947
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
1948
winCode.SetValue('')
1952
code = int(event.GetString())
1954
wx.MessageBox(parent=self,
1955
message=_("EPSG code %s not found") % str(code),
1956
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
1957
winCode.SetValue('')
1962
win.SetValue(self.epsgCodeDict[code][1].replace('<>', '').strip())
1964
wx.MessageBox(parent=self,
1965
message=_("EPSG code %s not found") % str(code),
1966
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
1967
winCode.SetValue('')
1466
1970
def OnSetFont(self, event):
1467
1971
"""'Set font' button pressed"""
1468
1972
dlg = DefaultFontDialog(parent=self, id=wx.ID_ANY,
1469
1973
title=_('Select default display font'),
1470
style=wx.DEFAULT_DIALOG_STYLE)
1974
style=wx.DEFAULT_DIALOG_STYLE,
1472
1977
if dlg.ShowModal() == wx.ID_OK:
1473
1978
# set default font and encoding environmental variables
1489
def OnSave(self, event):
1490
"""Button 'Save' pressed"""
1491
if self.__UpdateSettings():
1492
file = self.settings.SaveToFile()
1493
self.parent.goutput.WriteLog(_('Settings saved to file \'%s\'.') % file)
1496
def OnApply(self, event):
1497
"""Button 'Apply' pressed"""
1498
if self.__UpdateSettings():
1501
def OnCancel(self, event):
1502
"""Button 'Cancel' pressed"""
1505
def OnDefault(self, event):
1506
"""Button 'Set to default' pressed"""
1507
self.settings.userSettings = copy.deepcopy(self.settings.defaultSettings)
1510
for gks in self.winId.keys():
1512
group, key, subkey = gks.split(':')
1513
value = self.settings.Get(group, key, subkey)
1515
group, key, subkey, subkey1 = gks.split(':')
1516
value = self.settings.Get(group, key, [subkey, subkey1])
1517
win = self.FindWindowById(self.winId[gks])
1518
if win.GetName() in ('GetValue', 'IsChecked'):
1519
value = win.SetValue(value)
1520
elif win.GetName() == 'GetSelection':
1521
value = win.SetSelection(value)
1522
elif win.GetName() == 'GetStringSelection':
1523
value = win.SetStringSelection(value)
1525
value = win.SetValue(value)
1527
def __UpdateSettings(self):
1528
"""Update user settings"""
1529
for item in self.winId.keys():
1531
group, key, subkey = item.split(':')
1534
group, key, subkey, subkey1 = item.split(':')
1536
id = self.winId[item]
1537
win = self.FindWindowById(id)
1538
if win.GetName() == 'GetValue':
1539
value = win.GetValue()
1540
elif win.GetName() == 'GetSelection':
1541
value = win.GetSelection()
1542
elif win.GetName() == 'IsChecked':
1543
value = win.IsChecked()
1544
elif win.GetName() == 'GetStringSelection':
1545
value = win.GetStringSelection()
1546
elif win.GetName() == 'GetColour':
1547
value = tuple(win.GetValue())
1549
value = win.GetValue()
1551
if key == 'keycolumn' and value == '':
1552
wx.MessageBox(parent=self,
1553
message=_("Key column cannot be empty string."),
1554
caption=_("Error"), style=wx.OK | wx.ICON_ERROR)
1555
win.SetValue(self.settings.Get(group='atm', key='keycolumn', subkey='value'))
1559
self.settings.Set(group, value, key, [subkey, subkey1])
1561
self.settings.Set(group, value, key, subkey)
1994
def OnSetOutputFont(self, event):
1995
"""'Set output font' button pressed"""
1997
dlg = DefaultFontDialog(parent=self, id=wx.ID_ANY,
1998
title=_('Select output font'),
1999
style=wx.DEFAULT_DIALOG_STYLE,
2002
if dlg.ShowModal() == wx.ID_OK:
2003
# set output font and font size variables
2005
self.settings.Set(group='display', value=dlg.font,
2006
key='outputfont', subkey='type')
2008
self.settings.Set(group='display', value=dlg.fontsize,
2009
key='outputfont', subkey='size')
2011
# Standard font dialog broken for Mac in OS X 10.6
2012
# type = self.settings.Get(group='display', key='outputfont', subkey='type')
2014
# size = self.settings.Get(group='display', key='outputfont', subkey='size')
2015
# if size == None or size == 0: size = 10
2016
# size = float(size)
2018
# data = wx.FontData()
2019
# data.EnableEffects(True)
2020
# data.SetInitialFont(wx.Font(pointSize=size, family=wx.FONTFAMILY_MODERN, faceName=type, style=wx.NORMAL, weight=0))
2022
# dlg = wx.FontDialog(self, data)
2024
# if dlg.ShowModal() == wx.ID_OK:
2025
# data = dlg.GetFontData()
2026
# font = data.GetChosenFont()
2028
# self.settings.Set(group='display', value=font.GetFaceName(),
2029
# key='outputfont', subkey='type')
2030
# self.settings.Set(group='display', value=font.GetPointSize(),
2031
# key='outputfont', subkey='size')
2037
def _updateSettings(self):
2038
"""!Update user settings"""
2039
PreferencesBaseDialog._updateSettings(self)
1564
2042
# update default window dimension
1627
2099
style=wx.LB_SINGLE|wx.LB_SORT)
1628
2100
self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.fontlb)
1629
2101
self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.fontlb)
2103
gridSizer.Add(item=self.fontlb,
2104
flag=wx.EXPAND, pos=(1, 0))
2106
if self.type == 'font':
2107
if "GRASS_FONT" in os.environ:
2108
self.font = os.environ["GRASS_FONT"]
2110
self.font = self.settings.Get(group='display',
2111
key='font', subkey='type')
2112
self.encoding = self.settings.Get(group='display',
2113
key='font', subkey='encoding')
2115
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
2116
label=_("Character encoding:"))
2117
gridSizer.Add(item=label,
2118
flag=wx.ALIGN_CENTER_VERTICAL,
2121
self.textentry = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
2122
value=self.encoding)
2123
gridSizer.Add(item=self.textentry,
2124
flag=wx.EXPAND, pos=(3, 0))
2126
self.textentry.Bind(wx.EVT_TEXT, self.OnEncoding)
2128
elif self.type == 'outputfont':
2129
self.font = self.settings.Get(group='display',
2130
key='outputfont', subkey='type')
2131
self.fontsize = self.settings.Get(group='display',
2132
key='outputfont', subkey='size')
2133
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
2134
label=_("Font size:"))
2135
gridSizer.Add(item=label,
2136
flag=wx.ALIGN_CENTER_VERTICAL,
2139
self.spin = wx.SpinCtrl(parent=panel, id=wx.ID_ANY)
2141
self.spin.SetValue(self.fontsize)
2142
self.spin.Bind(wx.EVT_SPINCTRL, self.OnSizeSpin)
2143
self.spin.Bind(wx.EVT_TEXT, self.OnSizeSpin)
2144
gridSizer.Add(item=self.spin,
2145
flag=wx.ALIGN_CENTER_VERTICAL,
1631
2152
self.fontlb.SetStringSelection(self.font, True)
1633
gridSizer.Add(item=self.fontlb,
1634
flag=wx.EXPAND, pos=(0, 1))
1636
label = wx.StaticText(parent=panel, id=wx.ID_ANY,
1637
label=("Character encoding:"))
1638
gridSizer.Add(item=label,
1639
flag=wx.ALIGN_CENTER_VERTICAL,
1642
self.textentry = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
1643
value=self.encoding)
1644
gridSizer.Add(item=self.textentry,
1645
flag=wx.EXPAND, pos=(1, 1))
1647
self.textentry.Bind(wx.EVT_TEXT, self.OnEncoding)
1649
2154
sizer.Add(item=gridSizer, proportion=1,
1650
2155
flag=wx.EXPAND | wx.ALL,
1713
2227
return fontlist
1715
2229
class MapsetAccess(wx.Dialog):
1717
Controls setting options and displaying/hiding map overlay decorations
1719
def __init__(self, parent, id, title=_('Set/unset access to mapsets in current location'),
1720
pos=wx.DefaultPosition, size=(350, 400),
1721
style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER):
2230
"""!Controls setting options and displaying/hiding map overlay
2233
def __init__(self, parent, id = wx.ID_ANY,
2234
title=_('Manage access to mapsets'),
2236
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, **kwargs):
1723
wx.Dialog.__init__(self, parent, id, title, pos, size, style)
2238
wx.Dialog.__init__(self, parent, id, title, size = size, style = style, **kwargs)
1725
self.all_mapsets = utils.ListOfMapsets(all=True)
1726
self.accessible_mapsets = utils.ListOfMapsets(all=False)
1727
self.curr_mapset = grassenv.GetGRASSVariable('MAPSET')
2240
self.all_mapsets_ordered = utils.ListOfMapsets(get = 'ordered')
2241
self.accessible_mapsets = utils.ListOfMapsets(get = 'accessible')
2242
self.curr_mapset = grass.gisenv()['MAPSET']
1729
2244
# make a checklistbox from available mapsets and check those that are active
1730
2245
sizer = wx.BoxSizer(wx.VERTICAL)
1732
2247
label = wx.StaticText(parent=self, id=wx.ID_ANY,
1733
label=_("Check mapset to make it accessible, uncheck it to hide it.%s"
1734
"Note: PERMANENT and current mapset are always accessible.") % os.linesep)
2248
label=_("Check a mapset to make it accessible, uncheck it to hide it.\n"
2250
" - The current mapset is always accessible.\n"
2251
" - You may only write to the current mapset.\n"
2252
" - You may only write to mapsets which you own."))
1735
2254
sizer.Add(item=label, proportion=0,
1736
2255
flag=wx.ALL, border=5)
1738
2257
self.mapsetlb = CheckListMapset(parent=self)
1739
self.mapsetlb.LoadData(self.all_mapsets)
2258
self.mapsetlb.LoadData()
1741
2260
sizer.Add(item=self.mapsetlb, proportion=1,
1742
2261
flag=wx.ALL | wx.EXPAND, border=5)
1744
2263
# check all accessible mapsets
1745
2264
for mset in self.accessible_mapsets:
1746
self.mapsetlb.CheckItem(self.all_mapsets.index(mset), True)
2265
self.mapsetlb.CheckItem(self.all_mapsets_ordered.index(mset), True)
2267
# FIXME (howto?): grey-out current mapset
2268
#self.mapsetlb.Enable(0, False)
1748
2270
# dialog buttons
1749
2271
line = wx.StaticLine(parent=self, id=wx.ID_ANY,