[GRASS-SVN] r35035 - in
grass/branches/releasebranch_6_4/gui/wxpython: . gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 26 10:59:56 EST 2008
Author: martinl
Date: 2008-12-26 10:59:56 -0500 (Fri, 26 Dec 2008)
New Revision: 35035
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/nviz_tools.py
grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
wxGUI: various fixes
vdigit: fix left mouse button click when moving vertex/line
sort columns in ColumnSelect
(merge from devbr6, r35033)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2008-12-26 15:59:03 UTC (rev 35034)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2008-12-26 15:59:56 UTC (rev 35035)
@@ -553,10 +553,13 @@
try:
table = dbInfo.layers[int(layer)]['table']
columnchoices = dbInfo.tables[table]
+ columns = len(columnchoices.keys()) * ['']
+ for key, val in columnchoices.iteritems():
+ columns[val['index']] = key
except (KeyError, ValueError):
- columnchoices = {}
-
- self.SetItems(columnchoices.keys())
+ columns = []
+
+ self.SetItems(columns)
self.SetValue('')
class DbColumnSelect(wx.ComboBox):
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2008-12-26 15:59:03 UTC (rev 35034)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2008-12-26 15:59:56 UTC (rev 35035)
@@ -741,7 +741,7 @@
item = self.tree.FindItemByData('maplayer', digitToolbar.GetLayer())
except TypeError:
item = None
-
+
if item and self.tree.IsItemChecked(item):
self.parent.digit.driver.DrawMap()
@@ -1087,12 +1087,14 @@
move = (current[0] - previous[0],
current[1] - previous[1])
+ digitToolbar = self.parent.toolbars['vdigit']
+
# dragging or drawing box with left button
if self.mouse['use'] == 'pan':
self.DragMap(move)
# dragging decoration overlay item
- elif (self.mouse['use'] == 'pointer' and not self.parent.toolbars['vdigit']) and \
+ elif (self.mouse['use'] == 'pointer' and not digitToolbar) and \
self.dragid != None and \
self.dragid != 99:
self.DragItem(self.dragid, event)
@@ -1100,7 +1102,11 @@
# dragging anything else - rubber band box or line
else:
self.mouse['end'] = event.GetPositionTuple()[:]
- if event.LeftIsDown():
+ digitClass = self.parent.digit
+ if event.LeftIsDown() and not \
+ (digitToolbar and \
+ digitToolbar.GetAction() in ("moveLine",) and \
+ digitClass.driver.GetSelected() > 0):
# draw box only when left mouse button is pressed
self.MouseDraw(pdc=self.pdcTmp)
@@ -1439,11 +1445,11 @@
if hasattr(self, "vdigitMove"):
if len(digitClass.driver.GetSelected()) == 0:
self.vdigitMove['begin'] = pos1 # left down
- else:
- dx = pos2[0] - pos1[0] ### ???
- dy = pos2[1] - pos1[1]
- self.vdigitMove = (self.vdigitMove['begin'][0] + dx,
- self.vdigitMove['begin'][1] + dy)
+ ### else:
+ ### dx = pos2[0] - pos1[0] ### ???
+ ### dy = pos2[1] - pos1[1]
+ ### self.vdigitMove = (self.vdigitMove['begin'][0] + dx,
+ ### self.vdigitMove['begin'][1] + dy)
# eliminate initial mouse moving efect
self.mouse['begin'] = self.mouse['end']
@@ -1531,7 +1537,7 @@
if digitClass.driver.SelectLineByPoint(pos1,
digitClass.GetSelectType()) is not None:
nselected = 1
-
+
if nselected > 0:
if digitToolbar.GetAction() in ["moveLine", "moveVertex"]:
# get pseudoDC id of objects which should be redrawn
@@ -1569,7 +1575,10 @@
self.UpdateMap(render=False)
else: # no vector object found
- self.UpdateMap(render=False, renderVector=False)
+ if not (digitToolbar.GetAction() in ["moveLine", "moveVertex"] and \
+ len(self.vdigitMove['id']) > 0):
+ # avoid left-click when features are already selected
+ self.UpdateMap(render=False, renderVector=False)
elif digitToolbar.GetAction() in ["splitLine", "addVertex", "removeVertex"]:
pointOnLine = digitClass.driver.SelectLineByPoint(pos1,
@@ -2031,7 +2040,7 @@
x, y = self.Pixel2Cell(self.pdcTmp.GetIdBounds(self.vdigitMove['id'][2])[0:2])
self.pdcTmp.RemoveId(self.vdigitMove['id'][2]-1)
self.polycoords.append((x, y))
-
+
self.ClearLines(pdc=self.pdcTmp)
self.DrawLines(pdc=self.pdcTmp)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/nviz_tools.py 2008-12-26 15:59:03 UTC (rev 35034)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/nviz_tools.py 2008-12-26 15:59:56 UTC (rev 35035)
@@ -2415,27 +2415,24 @@
def UpdateVectorPage(self, layer, data):
vInfo = gcmd.Command(['v.info',
+ '-t',
'map=%s' % layer.name])
npoints = nprimitives = 0
for line in vInfo.ReadStdOutput():
- if 'Map is 3D' in line:
- mapIs3D = line.replace('|', '').split(':')[1].strip()
- if mapIs3D == 'Yes':
- mapIs3D = 1
- else:
- mapIs3D = 0
- elif 'Number of points' in line:
- npoints = int(line.replace('|', '').split(':')[1].strip().split(' ')[0])
+ key, value = line.split('=')
+ if key == 'map3d':
+ mapIs3D = int(value)
+
+ elif key == 'points':
+ npoints = int(value)
nprimitives = npoints
- elif 'Number of lines' in line:
- nprimitives += int(line.replace('|', '').split(':')[1].strip().split(' ')[0])
- elif 'Number of boundaries' in line:
- nprimitives += int(line.replace('|', '').split(':')[1].strip().split(' ')[0]) # boundaries
- nprimitives += int(line.replace('|', '').split(':')[2].strip()) # faces
- elif 'Number of centroids' in line:
- nprimitives += int(line.replace('|', '').split(':')[1].strip().split(' ')[0]) # centroids
- nprimitives += int(line.replace('|', '').split(':')[2].strip()) # kernels
-
+ elif key in ('lines',
+ 'boundaries',
+ 'centroids',
+ 'faces',
+ 'kernels'):
+ nprimitives += int(value)
+
if mapIs3D:
desc = _("Vector map <%s> is 3D") % layer.name
enable = False
Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py 2008-12-26 15:59:03 UTC (rev 35034)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py 2008-12-26 15:59:56 UTC (rev 35035)
@@ -291,8 +291,10 @@
#create main notebook widget
nbStyle = FN.FNB_FANCY_TABS | \
- FN.FNB_BOTTOM | \
- FN.FNB_NO_NAV_BUTTONS
+ FN.FNB_BOTTOM | \
+ FN.FNB_NO_NAV_BUTTONS | \
+ FN.FNB_NO_X_BUTTON
+
self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style=nbStyle)
#self.notebook = wx.aui.AuiNotebook(parent=self, id=wx.ID_ANY, style=wx.aui.AUI_NB_BOTTOM)
@@ -517,7 +519,7 @@
authorsFile = open(os.path.join(os.getenv("GISBASE"), "AUTHORS"), 'r')
info.SetDevelopers([unicode(''.join(authorsFile.readlines()), "utf-8")])
authorsFile.close()
-
+
wx.AboutBox(info)
def OnWorkspace(self, event):
@@ -1432,16 +1434,16 @@
name = str(self.curr_page.maptree.GetItemText(item))
idx = name.find('(opacity')
if idx > -1:
- layerName += '<' + name[:idx].strip(' ') + '>, '
+ layerName += '<' + name[:idx].strip(' ') + '>,\n'
else:
- layerName += '<' + name + '>, '
- layerName = layerName.rstrip(', ')
+ layerName += '<' + name + '>,\n'
+ layerName = layerName.rstrip(',\n')
- if layerName:
- message = _("Do you want to remove map layer %s "
+ if len(layerName) > 2: # <>
+ message = _("Do you want to remove map layer(s)\n%s\n"
"from layer tree?") % layerName
else:
- message = _("Do you want to remove selected map layer "
+ message = _("Do you want to remove selected map layer(s) "
"from layer tree?")
dlg = wx.MessageDialog (parent=self, message=message,
More information about the grass-commit
mailing list