|
@@ -108,13 +108,13 @@ class ElementDialog(wx.Dialog):
|
|
|
if self.etype:
|
|
|
self.dataSizer.Add(item = wx.StaticText(parent = self.panel, id = wx.ID_ANY,
|
|
|
label = _("Type of element:")),
|
|
|
- proportion=0, flag=wx.ALL, border=1)
|
|
|
+ proportion = 0, flag = wx.ALL, border = 1)
|
|
|
self.dataSizer.Add(item = self.typeSelect,
|
|
|
- proportion=0, flag=wx.ALL, border=1)
|
|
|
+ proportion = 0, flag = wx.ALL, border = 1)
|
|
|
|
|
|
self.dataSizer.Add(item = wx.StaticText(parent = self.panel, id = wx.ID_ANY,
|
|
|
label = self.label),
|
|
|
- proportion=0, flag=wx.ALL, border=1)
|
|
|
+ proportion = 0, flag = wx.ALL, border = 1)
|
|
|
|
|
|
# buttons
|
|
|
btnSizer = wx.StdDialogButtonSizer()
|
|
@@ -122,11 +122,11 @@ class ElementDialog(wx.Dialog):
|
|
|
btnSizer.AddButton(self.btnOK)
|
|
|
btnSizer.Realize()
|
|
|
|
|
|
- self.sizer.Add(item=self.dataSizer, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5)
|
|
|
+ self.sizer.Add(item = self.dataSizer, proportion = 1,
|
|
|
+ flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
|
|
|
|
|
|
- self.sizer.Add(item=btnSizer, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5)
|
|
|
+ self.sizer.Add(item = btnSizer, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
|
|
|
|
|
|
def GetElement(self):
|
|
|
"""!Return (mapName, overwrite)"""
|
|
@@ -155,15 +155,15 @@ class LocationDialog(ElementDialog):
|
|
|
|
|
|
def __Layout(self):
|
|
|
"""!Do layout"""
|
|
|
- self.dataSizer.Add(self.element, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ self.dataSizer.Add(self.element, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL, border = 1)
|
|
|
|
|
|
self.dataSizer.Add(wx.StaticText(parent = self.panel, id = wx.ID_ANY,
|
|
|
- label = _("Name of mapset:")), proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ label = _("Name of mapset:")), proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL, border = 1)
|
|
|
|
|
|
- self.dataSizer.Add(self.element1, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ self.dataSizer.Add(self.element1, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL, border = 1)
|
|
|
|
|
|
self.panel.SetSizer(self.sizer)
|
|
|
self.sizer.Fit(self)
|
|
@@ -207,8 +207,8 @@ class MapsetDialog(ElementDialog):
|
|
|
|
|
|
def __Layout(self):
|
|
|
"""!Do layout"""
|
|
|
- self.dataSizer.Add(self.element, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ self.dataSizer.Add(self.element, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL, border = 1)
|
|
|
|
|
|
self.panel.SetSizer(self.sizer)
|
|
|
self.sizer.Fit(self)
|
|
@@ -403,7 +403,7 @@ def CreateNewVector(parent, cmd, title = _('Create new vector map'),
|
|
|
return dlg
|
|
|
|
|
|
class SavedRegion(wx.Dialog):
|
|
|
- def __init__(self, parent, id = wx.ID_ANY, title="", loadsave='load',
|
|
|
+ def __init__(self, parent, id = wx.ID_ANY, title = "", loadsave = 'load',
|
|
|
**kwargs):
|
|
|
"""!Loading and saving of display extents to saved region file
|
|
|
|
|
@@ -417,27 +417,27 @@ class SavedRegion(wx.Dialog):
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- label = wx.StaticText(parent=self, id=wx.ID_ANY)
|
|
|
- box.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
|
|
|
+ label = wx.StaticText(parent = self, id = wx.ID_ANY)
|
|
|
+ box.Add(item = label, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
|
|
|
if loadsave == 'load':
|
|
|
label.SetLabel(_("Load region:"))
|
|
|
- selection = gselect.Select(parent=self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
|
|
|
- type='windows')
|
|
|
+ selection = gselect.Select(parent = self, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
|
|
|
+ type = 'windows')
|
|
|
elif loadsave == 'save':
|
|
|
label.SetLabel(_("Save region:"))
|
|
|
- selection = gselect.Select(parent=self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
|
|
|
- type='windows', mapsets = [grass.gisenv()['MAPSET']])
|
|
|
+ selection = gselect.Select(parent = self, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
|
|
|
+ type = 'windows', mapsets = [grass.gisenv()['MAPSET']])
|
|
|
|
|
|
- box.Add(item=selection, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
|
|
|
+ box.Add(item = selection, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
|
|
|
selection.SetFocus()
|
|
|
selection.Bind(wx.EVT_TEXT, self.OnRegion)
|
|
|
|
|
|
- sizer.Add(item=box, proportion=0, flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
|
|
|
- border=5)
|
|
|
+ sizer.Add(item = box, proportion = 0, flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
|
|
|
+ border = 5)
|
|
|
|
|
|
- line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
|
|
|
- sizer.Add(item=line, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border=5)
|
|
|
+ line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
|
|
|
+ sizer.Add(item = line, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
|
|
|
|
|
|
btnsizer = wx.StdDialogButtonSizer()
|
|
|
|
|
@@ -449,7 +449,7 @@ class SavedRegion(wx.Dialog):
|
|
|
btnsizer.AddButton(btn)
|
|
|
btnsizer.Realize()
|
|
|
|
|
|
- sizer.Add(item=btnsizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
|
|
|
+ sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
|
|
|
|
|
|
self.SetSizer(sizer)
|
|
|
sizer.Fit(self)
|
|
@@ -462,9 +462,9 @@ class DecorationDialog(wx.Dialog):
|
|
|
"""
|
|
|
Controls setting options and displaying/hiding map overlay decorations
|
|
|
"""
|
|
|
- def __init__(self, parent, ovlId, title, cmd, name=None,
|
|
|
- pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE,
|
|
|
- checktxt='', ctrltxt=''):
|
|
|
+ def __init__(self, parent, ovlId, title, cmd, name = None,
|
|
|
+ pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE,
|
|
|
+ checktxt = '', ctrltxt = ''):
|
|
|
|
|
|
wx.Dialog.__init__(self, parent, wx.ID_ANY, title, pos, size, style)
|
|
|
|
|
@@ -476,64 +476,64 @@ class DecorationDialog(wx.Dialog):
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- self.chkbox = wx.CheckBox(parent=self, id=wx.ID_ANY, label=checktxt)
|
|
|
+ self.chkbox = wx.CheckBox(parent = self, id = wx.ID_ANY, label = checktxt)
|
|
|
if self.parent.Map.GetOverlay(self.ovlId) is None:
|
|
|
self.chkbox.SetValue(True)
|
|
|
else:
|
|
|
self.chkbox.SetValue(self.parent.MapWindow.overlays[self.ovlId]['layer'].IsActive())
|
|
|
- box.Add(item=self.chkbox, proportion=0,
|
|
|
- flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
|
|
|
- sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
|
|
|
+ box.Add(item = self.chkbox, proportion = 0,
|
|
|
+ flag = wx.ALIGN_CENTRE|wx.ALL, border = 5)
|
|
|
+ sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- optnbtn = wx.Button(parent=self, id=wx.ID_ANY, label=_("Set options"))
|
|
|
- box.Add(item=optnbtn, proportion=0, flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
|
|
|
- sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
|
|
|
+ optnbtn = wx.Button(parent = self, id = wx.ID_ANY, label = _("Set options"))
|
|
|
+ box.Add(item = optnbtn, proportion = 0, flag = wx.ALIGN_CENTRE|wx.ALL, border = 5)
|
|
|
+ sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
if self.name == 'legend':
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- resize = wx.ToggleButton(parent=self, id=wx.ID_ANY, label=_("Set size and position"))
|
|
|
+ resize = wx.ToggleButton(parent = self, id = wx.ID_ANY, label = _("Set size and position"))
|
|
|
resize.SetToolTipString(_("Click and drag on the map display to set legend"
|
|
|
" size and position and then press OK"))
|
|
|
resize.SetName('resize')
|
|
|
if self.parent.IsPaneShown('3d'):
|
|
|
resize.Disable()
|
|
|
- box.Add(item=resize, proportion=0, flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
|
|
|
- sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
|
|
|
+ box.Add(item = resize, proportion = 0, flag = wx.ALIGN_CENTRE|wx.ALL, border = 5)
|
|
|
+ sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- label = wx.StaticText(parent=self, id=wx.ID_ANY,
|
|
|
- label=_("Drag %s with mouse in pointer mode to position.\n"
|
|
|
+ label = wx.StaticText(parent = self, id = wx.ID_ANY,
|
|
|
+ label = _("Drag %s with mouse in pointer mode to position.\n"
|
|
|
"Double-click to change options." % ctrltxt))
|
|
|
if self.name == 'legend':
|
|
|
label.SetLabel(label.GetLabel() + _('\nDefine raster map name for legend in '
|
|
|
'properties dialog.'))
|
|
|
- box.Add(item=label, proportion=0,
|
|
|
- flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
|
|
|
- sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
|
|
|
+ box.Add(item = label, proportion = 0,
|
|
|
+ flag = wx.ALIGN_CENTRE|wx.ALL, border = 5)
|
|
|
+ sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
|
|
|
- line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20,-1), style=wx.LI_HORIZONTAL)
|
|
|
- sizer.Add(item=line, proportion=0,
|
|
|
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
|
|
|
+ line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20,-1), style = wx.LI_HORIZONTAL)
|
|
|
+ sizer.Add(item = line, proportion = 0,
|
|
|
+ flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
|
|
|
# buttons
|
|
|
btnsizer = wx.StdDialogButtonSizer()
|
|
|
|
|
|
- self.btnOK = wx.Button(parent=self, id=wx.ID_OK)
|
|
|
+ self.btnOK = wx.Button(parent = self, id = wx.ID_OK)
|
|
|
self.btnOK.SetDefault()
|
|
|
if self.name == 'legend':
|
|
|
self.btnOK.Enable(False)
|
|
|
btnsizer.AddButton(self.btnOK)
|
|
|
|
|
|
- btnCancel = wx.Button(parent=self, id=wx.ID_CANCEL)
|
|
|
+ btnCancel = wx.Button(parent = self, id = wx.ID_CANCEL)
|
|
|
btnsizer.AddButton(btnCancel)
|
|
|
btnsizer.Realize()
|
|
|
|
|
|
- sizer.Add(item=btnsizer, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
|
|
|
+ sizer.Add(item = btnsizer, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border = 5)
|
|
|
|
|
|
#
|
|
|
# bindings
|
|
@@ -563,9 +563,9 @@ class DecorationDialog(wx.Dialog):
|
|
|
|
|
|
def _CreateOverlay(self):
|
|
|
if not self.parent.Map.GetOverlay(self.ovlId):
|
|
|
- self.newOverlay = self.parent.Map.AddOverlay(id=self.ovlId, type=self.name,
|
|
|
- command=self.cmd,
|
|
|
- l_active=False, l_render=False, l_hidden=True)
|
|
|
+ self.newOverlay = self.parent.Map.AddOverlay(id = self.ovlId, type = self.name,
|
|
|
+ command = self.cmd,
|
|
|
+ l_active = False, l_render = False, l_hidden = True)
|
|
|
prop = { 'layer' : self.newOverlay,
|
|
|
'params' : None,
|
|
|
'propwin' : None,
|
|
@@ -591,8 +591,8 @@ class DecorationDialog(wx.Dialog):
|
|
|
"""
|
|
|
if self.parent.MapWindow.overlays[self.ovlId]['propwin'] is None:
|
|
|
# build properties dialog
|
|
|
- menuform.GUI(parent = self.parent).ParseCommand(cmd=self.cmd,
|
|
|
- completed=(self.GetOptData, self.name, ''))
|
|
|
+ menuform.GUI(parent = self.parent).ParseCommand(cmd = self.cmd,
|
|
|
+ completed = (self.GetOptData, self.name, ''))
|
|
|
|
|
|
else:
|
|
|
if self.parent.MapWindow.overlays[self.ovlId]['propwin'].IsShown():
|
|
@@ -652,10 +652,10 @@ class DecorationDialog(wx.Dialog):
|
|
|
except ValueError:
|
|
|
pass
|
|
|
|
|
|
- self.parent.Map.ChangeOverlay(id=self.ovlId, type=self.name,
|
|
|
- command=self.parent.MapWindow.overlays[self.ovlId]['cmd'],
|
|
|
- l_active=self.parent.MapWindow.overlays[self.ovlId]['layer'].IsActive(),
|
|
|
- l_render=False, l_hidden=True)
|
|
|
+ self.parent.Map.ChangeOverlay(id = self.ovlId, type = self.name,
|
|
|
+ command = self.parent.MapWindow.overlays[self.ovlId]['cmd'],
|
|
|
+ l_active = self.parent.MapWindow.overlays[self.ovlId]['layer'].IsActive(),
|
|
|
+ l_render = False, l_hidden = True)
|
|
|
if self.name == 'legend':
|
|
|
if params and not self.btnOK.IsEnabled():
|
|
|
self.btnOK.Enable()
|
|
@@ -665,8 +665,8 @@ class TextLayerDialog(wx.Dialog):
|
|
|
Controls setting options and displaying/hiding map overlay decorations
|
|
|
"""
|
|
|
|
|
|
- def __init__(self, parent, ovlId, title, name='text',
|
|
|
- pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE):
|
|
|
+ def __init__(self, parent, ovlId, title, name = 'text',
|
|
|
+ pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE):
|
|
|
|
|
|
wx.Dialog.__init__(self, parent, wx.ID_ANY, title, pos, size, style)
|
|
|
from wx.lib.expando import ExpandoTextCtrl, EVT_ETC_LAYOUT_NEEDED
|
|
@@ -690,84 +690,84 @@ class TextLayerDialog(wx.Dialog):
|
|
|
self.currBB = wx.Rect()
|
|
|
|
|
|
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- box = wx.GridBagSizer(vgap=5, hgap=5)
|
|
|
+ box = wx.GridBagSizer(vgap = 5, hgap = 5)
|
|
|
|
|
|
# show/hide
|
|
|
- self.chkbox = wx.CheckBox(parent=self, id=wx.ID_ANY, \
|
|
|
- label = _('Show text object'))
|
|
|
+ self.chkbox = wx.CheckBox(parent = self, id = wx.ID_ANY,
|
|
|
+ label = _('Show text object'))
|
|
|
if self.parent.Map.GetOverlay(self.ovlId) is None:
|
|
|
self.chkbox.SetValue(True)
|
|
|
else:
|
|
|
self.chkbox.SetValue(self.parent.MapWindow.overlays[self.ovlId]['layer'].IsActive())
|
|
|
- box.Add(item=self.chkbox, span=(1,2),
|
|
|
- flag=wx.ALIGN_LEFT|wx.ALL, border=5,
|
|
|
- pos=(0, 0))
|
|
|
+ box.Add(item = self.chkbox, span = (1,2),
|
|
|
+ flag = wx.ALIGN_LEFT|wx.ALL, border = 5,
|
|
|
+ pos = (0, 0))
|
|
|
|
|
|
# text entry
|
|
|
- label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Enter text:"))
|
|
|
- box.Add(item=label,
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(1, 0))
|
|
|
+ label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Enter text:"))
|
|
|
+ box.Add(item = label,
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (1, 0))
|
|
|
|
|
|
- self.textentry = ExpandoTextCtrl(parent=self, id=wx.ID_ANY, value="", size=(300,-1))
|
|
|
+ self.textentry = ExpandoTextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (300,-1))
|
|
|
self.textentry.SetFont(self.currFont)
|
|
|
self.textentry.SetForegroundColour(self.currClr)
|
|
|
self.textentry.SetValue(self.currText)
|
|
|
# get rid of unneeded scrollbar when text box first opened
|
|
|
self.textentry.SetClientSize((300,-1))
|
|
|
|
|
|
- box.Add(item=self.textentry,
|
|
|
- pos=(1, 1))
|
|
|
+ box.Add(item = self.textentry,
|
|
|
+ pos = (1, 1))
|
|
|
|
|
|
# rotation
|
|
|
- label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Rotation:"))
|
|
|
- box.Add(item=label,
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(2, 0))
|
|
|
- self.rotation = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="", pos=(30, 50),
|
|
|
- size=(75,-1), style=wx.SP_ARROW_KEYS)
|
|
|
+ label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Rotation:"))
|
|
|
+ box.Add(item = label,
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (2, 0))
|
|
|
+ self.rotation = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
|
|
|
+ size = (75,-1), style = wx.SP_ARROW_KEYS)
|
|
|
self.rotation.SetRange(-360, 360)
|
|
|
self.rotation.SetValue(int(self.currRot))
|
|
|
- box.Add(item=self.rotation,
|
|
|
- flag=wx.ALIGN_RIGHT,
|
|
|
- pos=(2, 1))
|
|
|
+ box.Add(item = self.rotation,
|
|
|
+ flag = wx.ALIGN_RIGHT,
|
|
|
+ pos = (2, 1))
|
|
|
|
|
|
# font
|
|
|
- fontbtn = wx.Button(parent=self, id=wx.ID_ANY, label=_("Set font"))
|
|
|
- box.Add(item=fontbtn,
|
|
|
- flag=wx.ALIGN_RIGHT,
|
|
|
- pos=(3, 1))
|
|
|
+ fontbtn = wx.Button(parent = self, id = wx.ID_ANY, label = _("Set font"))
|
|
|
+ box.Add(item = fontbtn,
|
|
|
+ flag = wx.ALIGN_RIGHT,
|
|
|
+ pos = (3, 1))
|
|
|
|
|
|
- self.sizer.Add(item=box, proportion=1,
|
|
|
- flag=wx.ALL, border=10)
|
|
|
+ self.sizer.Add(item = box, proportion = 1,
|
|
|
+ flag = wx.ALL, border = 10)
|
|
|
|
|
|
# note
|
|
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
- label = wx.StaticText(parent=self, id=wx.ID_ANY,
|
|
|
- label=_("Drag text with mouse in pointer mode "
|
|
|
+ label = wx.StaticText(parent = self, id = wx.ID_ANY,
|
|
|
+ label = _("Drag text with mouse in pointer mode "
|
|
|
"to position.\nDouble-click to change options"))
|
|
|
- box.Add(item=label, proportion=0,
|
|
|
- flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
|
|
|
- self.sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER | wx.ALL, border=5)
|
|
|
+ box.Add(item = label, proportion = 0,
|
|
|
+ flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
|
|
|
+ self.sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER | wx.ALL, border = 5)
|
|
|
|
|
|
- line = wx.StaticLine(parent=self, id=wx.ID_ANY,
|
|
|
- size=(20,-1), style=wx.LI_HORIZONTAL)
|
|
|
- self.sizer.Add(item=line, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border=5)
|
|
|
+ line = wx.StaticLine(parent = self, id = wx.ID_ANY,
|
|
|
+ size = (20,-1), style = wx.LI_HORIZONTAL)
|
|
|
+ self.sizer.Add(item = line, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border = 5)
|
|
|
|
|
|
btnsizer = wx.StdDialogButtonSizer()
|
|
|
|
|
|
- btn = wx.Button(parent=self, id=wx.ID_OK)
|
|
|
+ btn = wx.Button(parent = self, id = wx.ID_OK)
|
|
|
btn.SetDefault()
|
|
|
btnsizer.AddButton(btn)
|
|
|
|
|
|
- btn = wx.Button(parent=self, id=wx.ID_CANCEL)
|
|
|
+ btn = wx.Button(parent = self, id = wx.ID_CANCEL)
|
|
|
btnsizer.AddButton(btn)
|
|
|
btnsizer.Realize()
|
|
|
|
|
|
- self.sizer.Add(item=btnsizer, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5)
|
|
|
+ self.sizer.Add(item = btnsizer, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
|
|
|
|
|
|
self.SetSizer(self.sizer)
|
|
|
self.sizer.Fit(self)
|
|
@@ -824,8 +824,8 @@ class TextLayerDialog(wx.Dialog):
|
|
|
|
|
|
class AddMapLayersDialog(wx.Dialog):
|
|
|
"""!Add selected map layers (raster, vector) into layer tree"""
|
|
|
- def __init__(self, parent, title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
|
|
|
- wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title, style=style)
|
|
|
+ def __init__(self, parent, title, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
|
|
|
+ wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title, style = style)
|
|
|
|
|
|
self.parent = parent # GMFrame
|
|
|
|
|
@@ -854,10 +854,10 @@ class AddMapLayersDialog(wx.Dialog):
|
|
|
btnSizer.Realize()
|
|
|
|
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- mainSizer.Add(item=self.bodySizer, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=5)
|
|
|
- mainSizer.Add(item=btnSizer, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5)
|
|
|
+ mainSizer.Add(item = self.bodySizer, proportion = 1,
|
|
|
+ flag = wx.EXPAND | wx.ALL, border = 5)
|
|
|
+ mainSizer.Add(item = btnSizer, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
|
|
|
|
|
|
self.SetSizer(mainSizer)
|
|
|
mainSizer.Fit(self)
|
|
@@ -866,61 +866,61 @@ class AddMapLayersDialog(wx.Dialog):
|
|
|
self.SetMinSize(self.GetSize())
|
|
|
|
|
|
def __createDialogBody(self):
|
|
|
- bodySizer = wx.GridBagSizer(vgap=3, hgap=3)
|
|
|
+ bodySizer = wx.GridBagSizer(vgap = 3, hgap = 3)
|
|
|
bodySizer.AddGrowableCol(1)
|
|
|
bodySizer.AddGrowableRow(3)
|
|
|
|
|
|
# layer type
|
|
|
- bodySizer.Add(item=wx.StaticText(parent=self, label=_("Map layer type:")),
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(0,0))
|
|
|
+ bodySizer.Add(item = wx.StaticText(parent = self, label = _("Map layer type:")),
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (0,0))
|
|
|
|
|
|
- self.layerType = wx.Choice(parent=self, id=wx.ID_ANY,
|
|
|
- choices=['raster', 'vector'], size=(100,-1))
|
|
|
+ self.layerType = wx.Choice(parent = self, id = wx.ID_ANY,
|
|
|
+ choices = ['raster', 'vector'], size = (100,-1))
|
|
|
self.layerType.SetSelection(0)
|
|
|
- bodySizer.Add(item=self.layerType,
|
|
|
- pos=(0,1))
|
|
|
+ bodySizer.Add(item = self.layerType,
|
|
|
+ pos = (0,1))
|
|
|
|
|
|
# select toggle
|
|
|
- self.toggle = wx.CheckBox(parent=self, id=wx.ID_ANY,
|
|
|
- label=_("Select toggle"))
|
|
|
+ self.toggle = wx.CheckBox(parent = self, id = wx.ID_ANY,
|
|
|
+ label = _("Select toggle"))
|
|
|
self.toggle.SetValue(True)
|
|
|
- bodySizer.Add(item=self.toggle,
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(0,2))
|
|
|
+ bodySizer.Add(item = self.toggle,
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (0,2))
|
|
|
|
|
|
# mapset filter
|
|
|
- bodySizer.Add(item=wx.StaticText(parent=self, label=_("Mapset:")),
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(1,0))
|
|
|
+ bodySizer.Add(item = wx.StaticText(parent = self, label = _("Mapset:")),
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (1,0))
|
|
|
|
|
|
self.mapset = gselect.MapsetSelect(parent = self)
|
|
|
self.mapset.SetStringSelection(grass.gisenv()['MAPSET'])
|
|
|
- bodySizer.Add(item=self.mapset,
|
|
|
- pos=(1,1), span=(1, 2))
|
|
|
+ bodySizer.Add(item = self.mapset,
|
|
|
+ pos = (1,1), span = (1, 2))
|
|
|
|
|
|
# map name filter
|
|
|
- bodySizer.Add(item=wx.StaticText(parent=self, label=_("Filter:")),
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL,
|
|
|
- pos=(2,0))
|
|
|
+ bodySizer.Add(item = wx.StaticText(parent = self, label = _("Filter:")),
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL,
|
|
|
+ pos = (2,0))
|
|
|
|
|
|
- self.filter = wx.TextCtrl(parent=self, id=wx.ID_ANY,
|
|
|
- value="",
|
|
|
- size=(250,-1))
|
|
|
- bodySizer.Add(item=self.filter,
|
|
|
- flag=wx.EXPAND,
|
|
|
- pos=(2,1), span=(1, 2))
|
|
|
+ self.filter = wx.TextCtrl(parent = self, id = wx.ID_ANY,
|
|
|
+ value = "",
|
|
|
+ size = (250,-1))
|
|
|
+ bodySizer.Add(item = self.filter,
|
|
|
+ flag = wx.EXPAND,
|
|
|
+ pos = (2,1), span = (1, 2))
|
|
|
|
|
|
# layer list
|
|
|
- bodySizer.Add(item=wx.StaticText(parent=self, label=_("List of maps:")),
|
|
|
- flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_TOP,
|
|
|
- pos=(3,0))
|
|
|
- self.layers = wx.CheckListBox(parent=self, id=wx.ID_ANY,
|
|
|
- size=(250, 100),
|
|
|
- choices=[])
|
|
|
- bodySizer.Add(item=self.layers,
|
|
|
- flag=wx.EXPAND,
|
|
|
- pos=(3,1), span=(1, 2))
|
|
|
+ bodySizer.Add(item = wx.StaticText(parent = self, label = _("List of maps:")),
|
|
|
+ flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_TOP,
|
|
|
+ pos = (3,0))
|
|
|
+ self.layers = wx.CheckListBox(parent = self, id = wx.ID_ANY,
|
|
|
+ size = (250, 100),
|
|
|
+ choices = [])
|
|
|
+ bodySizer.Add(item = self.layers,
|
|
|
+ flag = wx.EXPAND,
|
|
|
+ pos = (3,1), span = (1, 2))
|
|
|
|
|
|
# bindings
|
|
|
self.layerType.Bind(wx.EVT_CHOICE, self.OnChangeParams)
|
|
@@ -958,9 +958,9 @@ class AddMapLayersDialog(wx.Dialog):
|
|
|
self.popupDataID2 = wx.NewId()
|
|
|
self.popupDataID3 = wx.NewId()
|
|
|
|
|
|
- self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
|
|
|
- self.Bind(wx.EVT_MENU, self.OnSelectInvert, id=self.popupDataID2)
|
|
|
- self.Bind(wx.EVT_MENU, self.OnDeselectAll, id=self.popupDataID3)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnSelectAll, id = self.popupDataID1)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnSelectInvert, id = self.popupDataID2)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnDeselectAll, id = self.popupDataID3)
|
|
|
|
|
|
# generate popup-menu
|
|
|
menu = wx.Menu()
|
|
@@ -1047,22 +1047,27 @@ class ImportDialog(wx.Dialog):
|
|
|
|
|
|
self.commandId = -1 # id of running command
|
|
|
|
|
|
- wx.Dialog.__init__(self, parent, id, title, style=style,
|
|
|
+ wx.Dialog.__init__(self, parent, id, title, style = style,
|
|
|
name = "MultiImportDialog")
|
|
|
|
|
|
- self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
|
|
|
+ self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
|
|
|
|
|
|
- self.layerBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
|
|
|
- label=_(" List of %s layers ") % self.importType.upper())
|
|
|
+ self.layerBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
|
|
|
+ label = _(" List of %s layers ") % self.importType.upper())
|
|
|
|
|
|
#
|
|
|
# list of layers
|
|
|
#
|
|
|
- self.list = LayersList(self.panel)
|
|
|
+ columns = [_('Layer id'),
|
|
|
+ _('Layer name'),
|
|
|
+ _('Name for GRASS map (editable)')]
|
|
|
+ if itype == 'ogr':
|
|
|
+ columns.insert(2, _('Feature type'))
|
|
|
+ self.list = LayersList(parent = self.panel, columns = columns)
|
|
|
self.list.LoadData()
|
|
|
|
|
|
- self.optionBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
|
|
|
- label="%s" % _("Options"))
|
|
|
+ self.optionBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
|
|
|
+ label = "%s" % _("Options"))
|
|
|
|
|
|
cmd = self._getCommand()
|
|
|
task = gtask.parse_interface(cmd)
|
|
@@ -1087,21 +1092,21 @@ class ImportDialog(wx.Dialog):
|
|
|
label = desc)
|
|
|
|
|
|
|
|
|
- self.overwrite = wx.CheckBox(parent=self.panel, id=wx.ID_ANY,
|
|
|
- label=_("Allow output files to overwrite existing files"))
|
|
|
- self.overwrite.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
|
|
|
+ self.overwrite = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
|
|
|
+ label = _("Allow output files to overwrite existing files"))
|
|
|
+ self.overwrite.SetValue(UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'))
|
|
|
|
|
|
- self.add = wx.CheckBox(parent=self.panel, id=wx.ID_ANY)
|
|
|
+ self.add = wx.CheckBox(parent = self.panel, id = wx.ID_ANY)
|
|
|
|
|
|
#
|
|
|
# buttons
|
|
|
#
|
|
|
# cancel
|
|
|
- self.btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
|
|
|
+ self.btn_cancel = wx.Button(parent = self.panel, id = wx.ID_CANCEL)
|
|
|
self.btn_cancel.SetToolTipString(_("Close dialog"))
|
|
|
self.btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
|
|
|
# run
|
|
|
- self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label = _("&Import"))
|
|
|
+ self.btn_run = wx.Button(parent = self.panel, id = wx.ID_OK, label = _("&Import"))
|
|
|
self.btn_run.SetToolTipString(_("Import selected layers"))
|
|
|
self.btn_run.SetDefault()
|
|
|
self.btn_run.Enable(False)
|
|
@@ -1124,45 +1129,45 @@ class ImportDialog(wx.Dialog):
|
|
|
#
|
|
|
layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL)
|
|
|
|
|
|
- layerSizer.Add(item=self.list, proportion=1,
|
|
|
- flag=wx.ALL | wx.EXPAND, border=5)
|
|
|
+ layerSizer.Add(item = self.list, proportion = 1,
|
|
|
+ flag = wx.ALL | wx.EXPAND, border = 5)
|
|
|
|
|
|
- dialogSizer.Add(item=layerSizer, proportion=1,
|
|
|
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
|
|
|
+ dialogSizer.Add(item = layerSizer, proportion = 1,
|
|
|
+ flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 5)
|
|
|
|
|
|
# options
|
|
|
optionSizer = wx.StaticBoxSizer(self.optionBox, wx.VERTICAL)
|
|
|
for key in self.options.keys():
|
|
|
- optionSizer.Add(item=self.options[key], proportion=0)
|
|
|
+ optionSizer.Add(item = self.options[key], proportion = 0)
|
|
|
|
|
|
- dialogSizer.Add(item=optionSizer, proportion=0,
|
|
|
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
|
|
|
+ dialogSizer.Add(item = optionSizer, proportion = 0,
|
|
|
+ flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 5)
|
|
|
|
|
|
- dialogSizer.Add(item=self.overwrite, proportion=0,
|
|
|
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
|
|
|
+ dialogSizer.Add(item = self.overwrite, proportion = 0,
|
|
|
+ flag = wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
|
|
|
|
|
|
- dialogSizer.Add(item=self.add, proportion=0,
|
|
|
- flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
|
|
|
+ dialogSizer.Add(item = self.add, proportion = 0,
|
|
|
+ flag = wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
|
|
|
|
|
|
#
|
|
|
# buttons
|
|
|
#
|
|
|
- btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
|
|
|
+ btnsizer = wx.BoxSizer(orient = wx.HORIZONTAL)
|
|
|
|
|
|
- btnsizer.Add(item=self.btn_cmd, proportion=0,
|
|
|
- flag=wx.ALL | wx.ALIGN_CENTER,
|
|
|
- border=10)
|
|
|
+ btnsizer.Add(item = self.btn_cmd, proportion = 0,
|
|
|
+ flag = wx.ALL | wx.ALIGN_CENTER,
|
|
|
+ border = 10)
|
|
|
|
|
|
- btnsizer.Add(item=self.btn_run, proportion=0,
|
|
|
- flag=wx.ALL | wx.ALIGN_CENTER,
|
|
|
- border=10)
|
|
|
+ btnsizer.Add(item = self.btn_run, proportion = 0,
|
|
|
+ flag = wx.ALL | wx.ALIGN_CENTER,
|
|
|
+ border = 10)
|
|
|
|
|
|
- btnsizer.Add(item=self.btn_cancel, proportion=0,
|
|
|
- flag=wx.ALL | wx.ALIGN_CENTER,
|
|
|
- border=10)
|
|
|
+ btnsizer.Add(item = self.btn_cancel, proportion = 0,
|
|
|
+ flag = wx.ALL | wx.ALIGN_CENTER,
|
|
|
+ border = 10)
|
|
|
|
|
|
- dialogSizer.Add(item=btnsizer, proportion=0,
|
|
|
- flag=wx.ALIGN_CENTER)
|
|
|
+ dialogSizer.Add(item = btnsizer, proportion = 0,
|
|
|
+ flag = wx.ALIGN_CENTER)
|
|
|
|
|
|
# dialogSizer.SetSizeHints(self.panel)
|
|
|
self.panel.SetAutoLayout(True)
|
|
@@ -1173,15 +1178,15 @@ class ImportDialog(wx.Dialog):
|
|
|
size = wx.Size(globalvar.DIALOG_GSELECT_SIZE[0] + 225, 550)
|
|
|
self.SetMinSize(size)
|
|
|
self.SetSize((size.width, size.height + 100))
|
|
|
- width = self.GetSize()[0]
|
|
|
- self.list.SetColumnWidth(col=1, width=width/2 - 50)
|
|
|
+ # width = self.GetSize()[0]
|
|
|
+ # self.list.SetColumnWidth(col = 1, width = width / 2 - 50)
|
|
|
self.Layout()
|
|
|
|
|
|
def _getCommand(self):
|
|
|
"""!Get command"""
|
|
|
return ''
|
|
|
|
|
|
- def OnCancel(self, event=None):
|
|
|
+ def OnCancel(self, event = None):
|
|
|
"""!Close dialog"""
|
|
|
self.Close()
|
|
|
|
|
@@ -1213,7 +1218,7 @@ class ImportDialog(wx.Dialog):
|
|
|
if self.importType == 'gdal':
|
|
|
cmd = ['d.rast',
|
|
|
'map=%s' % name]
|
|
|
- if UserSettings.Get(group='cmd', key='rasterOverlay', subkey='enabled'):
|
|
|
+ if UserSettings.Get(group = 'cmd', key = 'rasterOverlay', subkey = 'enabled'):
|
|
|
cmd.append('-o')
|
|
|
|
|
|
item = maptree.AddLayer(ltype = 'raster',
|
|
@@ -1260,7 +1265,7 @@ class GdalImportDialog(ImportDialog):
|
|
|
else:
|
|
|
self.add.SetLabel(_("Add imported layers into layer tree"))
|
|
|
|
|
|
- self.add.SetValue(UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled'))
|
|
|
+ self.add.SetValue(UserSettings.Get(group = 'cmd', key = 'addNewLayer', subkey = 'enabled'))
|
|
|
|
|
|
if link:
|
|
|
self.btn_run.SetLabel(_("&Link"))
|
|
@@ -1325,7 +1330,7 @@ class GdalImportDialog(ImportDialog):
|
|
|
if self.options[key].IsChecked():
|
|
|
cmd.append('-%s' % key)
|
|
|
|
|
|
- if UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'):
|
|
|
+ if UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'):
|
|
|
cmd.append('--overwrite')
|
|
|
|
|
|
# run in Layer Manager
|
|
@@ -1360,17 +1365,17 @@ class DxfImportDialog(ImportDialog):
|
|
|
ImportDialog.__init__(self, parent, itype = 'dxf',
|
|
|
title = _("Import DXF layers"))
|
|
|
|
|
|
- self.dsnInput = filebrowse.FileBrowseButton(parent=self.panel, id=wx.ID_ANY,
|
|
|
- size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
|
|
|
- dialogTitle=_('Choose DXF file to import'),
|
|
|
- buttonText=_('Browse'),
|
|
|
- startDirectory=os.getcwd(), fileMode=0,
|
|
|
- changeCallback=self.OnSetDsn,
|
|
|
- fileMask="DXF File (*.dxf)|*.dxf")
|
|
|
+ self.dsnInput = filebrowse.FileBrowseButton(parent = self.panel, id = wx.ID_ANY,
|
|
|
+ size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
|
|
|
+ dialogTitle = _('Choose DXF file to import'),
|
|
|
+ buttonText = _('Browse'),
|
|
|
+ startDirectory = os.getcwd(), fileMode = 0,
|
|
|
+ changeCallback = self.OnSetDsn,
|
|
|
+ fileMask = "DXF File (*.dxf)|*.dxf")
|
|
|
|
|
|
self.add.SetLabel(_("Add imported layers into layer tree"))
|
|
|
|
|
|
- self.add.SetValue(UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled'))
|
|
|
+ self.add.SetValue(UserSettings.Get(group = 'cmd', key = 'addNewLayer', subkey = 'enabled'))
|
|
|
|
|
|
self.doLayout()
|
|
|
|
|
@@ -1398,11 +1403,11 @@ class DxfImportDialog(ImportDialog):
|
|
|
cmd.append('-%s' % key)
|
|
|
|
|
|
if self.overwrite.IsChecked() or \
|
|
|
- UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'):
|
|
|
+ UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'):
|
|
|
cmd.append('--overwrite')
|
|
|
|
|
|
# run in Layer Manager
|
|
|
- self.parent.goutput.RunCmd(cmd, switchPage=True,
|
|
|
+ self.parent.goutput.RunCmd(cmd, switchPage = True,
|
|
|
onDone = self.AddLayers)
|
|
|
|
|
|
self.OnCancel()
|
|
@@ -1444,42 +1449,46 @@ class DxfImportDialog(ImportDialog):
|
|
|
class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
listmix.CheckListCtrlMixin, listmix.TextEditMixin):
|
|
|
"""!List of layers to be imported (dxf, shp...)"""
|
|
|
- def __init__(self, parent, pos = wx.DefaultPosition,
|
|
|
- log = None):
|
|
|
+ def __init__(self, parent, columns, log = None):
|
|
|
self.parent = parent
|
|
|
|
|
|
wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
|
|
|
- style=wx.LC_REPORT)
|
|
|
+ style = wx.LC_REPORT)
|
|
|
listmix.CheckListCtrlMixin.__init__(self)
|
|
|
self.log = log
|
|
|
-
|
|
|
+
|
|
|
# setup mixins
|
|
|
listmix.ListCtrlAutoWidthMixin.__init__(self)
|
|
|
listmix.TextEditMixin.__init__(self)
|
|
|
-
|
|
|
- self.InsertColumn(0, _('Layer id'))
|
|
|
- self.InsertColumn(1, _('Layer name'))
|
|
|
- self.InsertColumn(2, _('Name for GRASS map (editable)'))
|
|
|
+
|
|
|
+ for i in range(len(columns)):
|
|
|
+ self.InsertColumn(i, columns[i])
|
|
|
+
|
|
|
+ if len(columns) == 3:
|
|
|
+ width = (65, 200)
|
|
|
+ else:
|
|
|
+ width = (65, 200, 90)
|
|
|
+
|
|
|
+ for i in range(len(width)):
|
|
|
+ self.SetColumnWidth(col = i, width = width[i])
|
|
|
|
|
|
self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnPopupMenu) #wxMSW
|
|
|
self.Bind(wx.EVT_RIGHT_UP, self.OnPopupMenu) #wxGTK
|
|
|
|
|
|
- def LoadData(self, data=None):
|
|
|
+ def LoadData(self, data = None):
|
|
|
"""!Load data into list"""
|
|
|
if data is None:
|
|
|
return
|
|
|
-
|
|
|
+
|
|
|
self.DeleteAllItems()
|
|
|
|
|
|
- for id, name, grassName in data:
|
|
|
- index = self.InsertStringItem(sys.maxint, str(id))
|
|
|
- self.SetStringItem(index, 1, "%s" % str(name))
|
|
|
- self.SetStringItem(index, 2, "%s" % str(grassName))
|
|
|
+ for item in data:
|
|
|
+ index = self.InsertStringItem(sys.maxint, str(item[0]))
|
|
|
+ for i in range(1, len(item)):
|
|
|
+ self.SetStringItem(index, i, "%s" % str(item[i]))
|
|
|
# check by default
|
|
|
### self.CheckItem(index, True)
|
|
|
|
|
|
- self.SetColumnWidth(col = 0, width = wx.LIST_AUTOSIZE_USEHEADER)
|
|
|
-
|
|
|
def OnPopupMenu(self, event):
|
|
|
"""!Show popup menu"""
|
|
|
if self.GetItemCount() < 1:
|
|
@@ -1489,14 +1498,14 @@ class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
self.popupDataID1 = wx.NewId()
|
|
|
self.popupDataID2 = wx.NewId()
|
|
|
|
|
|
- self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
|
|
|
- self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnSelectAll, id = self.popupDataID1)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnSelectNone, id = self.popupDataID2)
|
|
|
|
|
|
# generate popup-menu
|
|
|
menu = wx.Menu()
|
|
|
menu.Append(self.popupDataID1, _("Select all"))
|
|
|
menu.Append(self.popupDataID2, _("Deselect all"))
|
|
|
-
|
|
|
+
|
|
|
self.PopupMenu(menu)
|
|
|
menu.Destroy()
|
|
|
|
|
@@ -1509,7 +1518,7 @@ class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
if item == -1:
|
|
|
break
|
|
|
self.CheckItem(item, True)
|
|
|
-
|
|
|
+
|
|
|
event.Skip()
|
|
|
|
|
|
def OnSelectNone(self, event):
|
|
@@ -1521,12 +1530,12 @@ class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
if item == -1:
|
|
|
break
|
|
|
self.CheckItem(item, False)
|
|
|
-
|
|
|
+
|
|
|
event.Skip()
|
|
|
|
|
|
def OnLeftDown(self, event):
|
|
|
"""!Allow editing only output name
|
|
|
-
|
|
|
+
|
|
|
Code taken from TextEditMixin class.
|
|
|
"""
|
|
|
x, y = event.GetPosition()
|
|
@@ -1539,7 +1548,7 @@ class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
|
|
|
col = bisect(colLocs, x + self.GetScrollPos(wx.HORIZONTAL)) - 1
|
|
|
|
|
|
- if col == 2:
|
|
|
+ if col == self.GetColumnCount() - 1:
|
|
|
listmix.TextEditMixin.OnLeftDown(self, event)
|
|
|
else:
|
|
|
event.Skip()
|
|
@@ -1552,67 +1561,68 @@ class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
|
|
|
item = self.GetNextItem(item)
|
|
|
if item == -1:
|
|
|
break
|
|
|
- if self.IsChecked(item):
|
|
|
- # layer / output name
|
|
|
- data.append((self.GetItem(item, 1).GetText(),
|
|
|
- self.GetItem(item, 2).GetText()))
|
|
|
-
|
|
|
+ if not self.IsChecked(item):
|
|
|
+ continue
|
|
|
+ # layer / output name
|
|
|
+ data.append((self.GetItem(item, 1).GetText(),
|
|
|
+ self.GetItem(item, self.GetColumnCount() - 1).GetText()))
|
|
|
+
|
|
|
return data
|
|
|
|
|
|
class SetOpacityDialog(wx.Dialog):
|
|
|
"""!Set opacity of map layers"""
|
|
|
- def __init__(self, parent, id=wx.ID_ANY, title=_("Set Map Layer Opacity"),
|
|
|
- size=wx.DefaultSize, pos=wx.DefaultPosition,
|
|
|
- style=wx.DEFAULT_DIALOG_STYLE, opacity=100):
|
|
|
+ def __init__(self, parent, id = wx.ID_ANY, title = _("Set Map Layer Opacity"),
|
|
|
+ size = wx.DefaultSize, pos = wx.DefaultPosition,
|
|
|
+ style = wx.DEFAULT_DIALOG_STYLE, opacity = 100):
|
|
|
|
|
|
self.parent = parent # GMFrame
|
|
|
self.opacity = opacity # current opacity
|
|
|
|
|
|
- super(SetOpacityDialog, self).__init__(parent, id=id, pos=pos,
|
|
|
- size=size, style=style, title=title)
|
|
|
+ super(SetOpacityDialog, self).__init__(parent, id = id, pos = pos,
|
|
|
+ size = size, style = style, title = title)
|
|
|
|
|
|
- panel = wx.Panel(parent=self, id=wx.ID_ANY)
|
|
|
+ panel = wx.Panel(parent = self, id = wx.ID_ANY)
|
|
|
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
- box = wx.GridBagSizer(vgap=5, hgap=5)
|
|
|
- self.value = wx.Slider(panel, id=wx.ID_ANY, value=self.opacity,
|
|
|
- style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | \
|
|
|
+ box = wx.GridBagSizer(vgap = 5, hgap = 5)
|
|
|
+ self.value = wx.Slider(panel, id = wx.ID_ANY, value = self.opacity,
|
|
|
+ style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | \
|
|
|
wx.SL_TOP | wx.SL_LABELS,
|
|
|
- minValue=0, maxValue=100,
|
|
|
- size=(350, -1))
|
|
|
-
|
|
|
- box.Add(item=self.value,
|
|
|
- flag=wx.ALIGN_CENTRE, pos=(0, 0), span=(1, 2))
|
|
|
- box.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
|
|
|
- label=_("transparent")),
|
|
|
- pos=(1, 0))
|
|
|
- box.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
|
|
|
- label=_("opaque")),
|
|
|
- flag=wx.ALIGN_RIGHT,
|
|
|
- pos=(1, 1))
|
|
|
-
|
|
|
- sizer.Add(item=box, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
|
|
|
-
|
|
|
- line = wx.StaticLine(parent=panel, id=wx.ID_ANY,
|
|
|
- style=wx.LI_HORIZONTAL)
|
|
|
- sizer.Add(item=line, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
|
|
|
+ minValue = 0, maxValue = 100,
|
|
|
+ size = (350, -1))
|
|
|
+
|
|
|
+ box.Add(item = self.value,
|
|
|
+ flag = wx.ALIGN_CENTRE, pos = (0, 0), span = (1, 2))
|
|
|
+ box.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
|
|
|
+ label = _("transparent")),
|
|
|
+ pos = (1, 0))
|
|
|
+ box.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
|
|
|
+ label = _("opaque")),
|
|
|
+ flag = wx.ALIGN_RIGHT,
|
|
|
+ pos = (1, 1))
|
|
|
+
|
|
|
+ sizer.Add(item = box, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border = 5)
|
|
|
+
|
|
|
+ line = wx.StaticLine(parent = panel, id = wx.ID_ANY,
|
|
|
+ style = wx.LI_HORIZONTAL)
|
|
|
+ sizer.Add(item = line, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border = 5)
|
|
|
|
|
|
# buttons
|
|
|
btnsizer = wx.StdDialogButtonSizer()
|
|
|
|
|
|
- btnOK = wx.Button(parent=panel, id=wx.ID_OK)
|
|
|
+ btnOK = wx.Button(parent = panel, id = wx.ID_OK)
|
|
|
btnOK.SetDefault()
|
|
|
btnsizer.AddButton(btnOK)
|
|
|
|
|
|
- btnCancel = wx.Button(parent=panel, id=wx.ID_CANCEL)
|
|
|
+ btnCancel = wx.Button(parent = panel, id = wx.ID_CANCEL)
|
|
|
btnsizer.AddButton(btnCancel)
|
|
|
btnsizer.Realize()
|
|
|
|
|
|
- sizer.Add(item=btnsizer, proportion=0,
|
|
|
- flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
|
|
|
+ sizer.Add(item = btnsizer, proportion = 0,
|
|
|
+ flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border = 5)
|
|
|
|
|
|
panel.SetSizer(sizer)
|
|
|
sizer.Fit(panel)
|
|
@@ -1707,11 +1717,11 @@ class StaticWrapText(wx.StaticText):
|
|
|
|
|
|
class ImageSizeDialog(wx.Dialog):
|
|
|
"""!Set size for saved graphic file"""
|
|
|
- def __init__(self, parent, id = wx.ID_ANY, title=_("Set image size"),
|
|
|
+ def __init__(self, parent, id = wx.ID_ANY, title = _("Set image size"),
|
|
|
style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
|
|
|
self.parent = parent
|
|
|
|
|
|
- wx.Dialog.__init__(self, parent, id = id, style=style, title=title, **kwargs)
|
|
|
+ wx.Dialog.__init__(self, parent, id = id, style = style, title = title, **kwargs)
|
|
|
|
|
|
self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
|
|
|
|