[GRASS-SVN] r45843 - in grass/trunk/gui/wxpython: gui_modules icons
support
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 4 07:21:24 EDT 2011
Author: martinl
Date: 2011-04-04 04:21:24 -0700 (Mon, 04 Apr 2011)
New Revision: 45843
Modified:
grass/trunk/gui/wxpython/gui_modules/dbm.py
grass/trunk/gui/wxpython/gui_modules/dbm_base.py
grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
grass/trunk/gui/wxpython/gui_modules/gcmd.py
grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py
grass/trunk/gui/wxpython/gui_modules/ghelp.py
grass/trunk/gui/wxpython/gui_modules/gmodeler.py
grass/trunk/gui/wxpython/gui_modules/goutput.py
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/layertree.py
grass/trunk/gui/wxpython/gui_modules/location_wizard.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/ogc_services.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/prompt.py
grass/trunk/gui/wxpython/gui_modules/render.py
grass/trunk/gui/wxpython/gui_modules/utils.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
grass/trunk/gui/wxpython/gui_modules/workspace.py
grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
grass/trunk/gui/wxpython/icons/icon.py
grass/trunk/gui/wxpython/support/update_menudata.py
Log:
wxGUI: don't use deprecated 'dict.has_key()'
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -826,7 +826,7 @@
if onlyLayer > 0 and layer != onlyLayer:
continue
- if not self.layerPage.has_key(layer):
+ if not layer in self.layerPage:
continue
panel = wx.Panel(parent=self.manageTablePage, id=wx.ID_ANY)
@@ -1887,8 +1887,7 @@
sqlFile = tempfile.NamedTemporaryFile(mode="wt")
for sql in self.listOfSQLStatements:
enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
- if not enc and \
- os.environ.has_key('GRASS_DB_ENCODING'):
+ if not enc and 'GRASS_DB_ENCODING' in os.environ:
enc = os.environ['GRASS_DB_ENCODING']
if enc:
sqlFile.file.write(sql.encode(enc) + ';')
Modified: grass/trunk/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_base.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_base.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -31,7 +31,7 @@
enc = UserSettings.Get(group = 'atm', key = 'encoding', subkey = 'value')
if enc:
value = unicode(value, enc)
- elif os.environ.has_key('GRASS_DB_ENCODING'):
+ elif 'GRASS_DB_ENCODING' in os.environ:
value = unicode(value, os.environ['GRASS_DB_ENCODING'])
else:
try:
Modified: grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -282,8 +282,7 @@
"""!Submit records"""
for sql in self.GetSQLString(updateValues=True):
enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
- if not enc and \
- os.environ.has_key('GRASS_DB_ENCODING'):
+ if not enc and 'GRASS_DB_ENCODING' in os.environ:
enc = os.environ['GRASS_DB_ENCODING']
if enc:
sql = sql.encode(enc)
@@ -336,17 +335,17 @@
data = self.mapDBInfo.SelectByPoint(query[0],
query[1])
self.cats = {}
- if data and data.has_key('Layer'):
+ if data and 'Layer' in data:
idx = 0
for layer in data['Layer']:
layer = int(layer)
- if data.has_key('Id'):
+ if 'Id' in data:
tfid = int(data['Id'][idx])
else:
tfid = 0 # Area / Volume
- if not self.cats.has_key(tfid):
+ if not tfid in self.cats:
self.cats[tfid] = {}
- if not self.cats[tfid].has_key(layer):
+ if not layer in self.cats[tfid]:
self.cats[tfid][layer] = []
cat = int(data['Category'][idx])
self.cats[tfid][layer].append(cat)
@@ -382,7 +381,7 @@
for layer in layers: # for each layer
if not query: # select by layer/cat
- if self.fid > 0 and self.cats[self.fid].has_key(layer):
+ if self.fid > 0 and layer in self.cats[self.fid]:
for cat in self.cats[self.fid][layer]:
nselected = self.mapDBInfo.SelectFromTable(layer,
where="%s=%d" % \
@@ -396,7 +395,7 @@
if self.action == "add":
if nselected <= 0:
- if self.cats[self.fid].has_key(layer):
+ if layer in self.cats[self.fid]:
table = self.mapDBInfo.layers[layer]["table"]
key = self.mapDBInfo.layers[layer]["key"]
columns = self.mapDBInfo.tables[table]
Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -362,7 +362,7 @@
if verbose_orig:
os.environ["GRASS_VERBOSE"] = verbose_orig
- elif os.environ.has_key("GRASS_VERBOSE"):
+ elif "GRASS_VERBOSE" in os.environ:
del os.environ["GRASS_VERBOSE"]
def __ReadOutput(self, stream):
Modified: grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -93,7 +93,7 @@
self.layerbook = notebook # Layer Manager layer tree notebook
self.parent = parent
- if not kwargs.has_key('name'):
+ if 'name' not in kwargs:
kwargs['name'] = 'GCPMapWindow'
wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
Modified: grass/trunk/gui/wxpython/gui_modules/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/ghelp.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/ghelp.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -171,7 +171,7 @@
except ValueError:
continue # TODO
- if not modules.has_key(group):
+ if group not in modules:
modules[group] = list()
modules[group].append(name)
@@ -305,7 +305,7 @@
return
data = self.tree.GetPyData(item)
- if not data or not data.has_key('command'):
+ if not data or 'command' not in data:
return
self.tree.itemSelected = item
@@ -319,7 +319,7 @@
return
data = self.tree.GetPyData(item)
- if not data or not data.has_key('command'):
+ if not data or 'command' not in data:
return
if data['command']:
@@ -388,7 +388,7 @@
self._processItem(subItem, element, value, listOfItems)
data = self.GetPyData(item)
- if data and data.has_key(element) and \
+ if data and element in data and \
value.lower() in data[element].lower():
listOfItems.append(item)
@@ -728,7 +728,7 @@
errLines.append(line)
continue
for language in languages.split(' '):
- if not translators.has_key(language):
+ if language not in translators:
translators[language] = list()
translators[language].append((name, email))
translatorsFile.close()
@@ -937,7 +937,7 @@
def OnItemActivated(self, event):
item = event.GetItem()
data = self.tree.GetPyData(item)
- if data and data.has_key('command'):
+ if data and 'command' in data:
self._install(data['command'])
def OnInstall(self, event):
@@ -1003,7 +1003,7 @@
'v' : 'vector',
'wx' : 'wxGUI' }
- if name.has_key(c):
+ if c in name:
return name[c]
return c
@@ -1041,7 +1041,7 @@
key, value = line.split('=', 1)
if key == 'name':
prefix, name = value.split('.', 1)
- if not mdict.has_key(prefix):
+ if prefix not in mdict:
mdict[prefix] = dict()
mdict[prefix][name] = dict()
else:
@@ -1056,7 +1056,7 @@
if self._expandPrefix(prefix) == prefix:
prefix = 'unknown'
- if not mdict.has_key(prefix):
+ if prefix not in mdict:
mdict[prefix] = dict()
mdict[prefix][name] = { 'command' : prefix + '.' + name }
Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -496,14 +496,14 @@
params = action.GetParams()
for f in params['flags']:
if f.get('parameterized', False):
- if not result.has_key(name):
+ if name not in result:
result[name] = { 'flags' : list(),
'params': list(),
'idx' : idx }
result[name]['flags'].append(f)
for p in params['params']:
if p.get('parameterized', False):
- if not result.has_key(name):
+ if name not in result:
result[name] = { 'flags' : list(),
'params': list(),
'idx' : idx }
@@ -979,7 +979,7 @@
def _runAction(self, item, params):
"""!Run given action"""
name = item.GetName()
- if params.has_key(name):
+ if name in params:
paramsOrig = item.GetParams(dcopy = True)
item.MergeParams(params[name])
@@ -987,7 +987,7 @@
self.goutput.RunCmd(command = item.GetLog(string = False),
onDone = self.OnDone)
- if params.has_key(name):
+ if name in params:
item.SetParams(paramsOrig)
def OnDone(self, cmd, returncode):
@@ -1804,11 +1804,11 @@
def MergeParams(self, params):
"""!Merge dictionary of parameters"""
- if params.has_key('flags'):
+ if 'flags' in params:
for f in params['flags']:
self.task.set_flag(f['name'],
f.get('value', False))
- if params.has_key('params'):
+ if 'params' in params:
for p in params['params']:
self.task.set_param(p['name'],
p.get('value', ''))
@@ -2836,7 +2836,7 @@
if self.properties['author']:
self.fd.write('%s<author>%s</author>\n' % (' ' * self.indent, self.properties['author']))
- if self.properties.has_key('overwrite') and \
+ if 'overwrite' in self.properties and \
self.properties['overwrite']:
self.fd.write('%s<flag name="overwrite" />\n' % (' ' * self.indent))
self.indent -= 4
@@ -2852,10 +2852,10 @@
self.fd.write('%s<variable name="%s" type="%s">\n' % \
(' ' * self.indent, name, values['type']))
self.indent += 4
- if values.has_key('value'):
+ if 'value' in values:
self.fd.write('%s<value>%s</value>\n' % \
(' ' * self.indent, values['value']))
- if values.has_key('description'):
+ if 'description' in values:
self.fd.write('%s<description>%s</description>\n' % \
(' ' * self.indent, values['description']))
self.indent -= 4
@@ -3393,7 +3393,7 @@
self.name.SetValue(prop['name'])
self.desc.SetValue(prop['description'])
self.author.SetValue(prop['author'])
- if prop.has_key('overwrite'):
+ if 'overwrite' in prop:
self.overwrite.SetValue(prop['overwrite'])
class ModelParamDialog(wx.Dialog):
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -87,7 +87,7 @@
while True:
requestId, args, kwds = self.requestQ.get()
for key in ('callable', 'onDone', 'userData'):
- if kwds.has_key(key):
+ if key in kwds:
vars()[key] = kwds[key]
del kwds[key]
else:
@@ -523,7 +523,7 @@
# for all non-display commands.
if compReg:
tmpreg = os.getenv("GRASS_REGION")
- if os.environ.has_key("GRASS_REGION"):
+ if "GRASS_REGION" in os.environ:
del os.environ["GRASS_REGION"]
if len(command) == 1:
@@ -1074,7 +1074,7 @@
enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
if enc:
txt = unicode(txt, enc)
- elif os.environ.has_key('GRASS_DB_ENCODING'):
+ elif 'GRASS_DB_ENCODING' in os.environ:
txt = unicode(txt, os.environ['GRASS_DB_ENCODING'])
else:
txt = utils.EncodeString(txt)
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -318,21 +318,21 @@
else:
filesdict = grass.list_grouped(elementdict[element])
- first_dir = None
- for dir in mapsets:
- dir_node = self.AddItem('Mapset: ' + dir)
- if not first_dir:
- first_dir = dir_node
+ first_mapset = None
+ for mapset in mapsets:
+ mapset_node = self.AddItem('Mapset: ' + mapset)
+ if not first_mapset:
+ first_mapset = mapset_node
- self.seltree.SetItemTextColour(dir_node, wx.Colour(50, 50, 200))
- if not filesdict.has_key(dir):
+ self.seltree.SetItemTextColour(mapset_node, wx.Colour(50, 50, 200))
+ if mapset not in filesdict:
continue
try:
- elem_list = filesdict[dir]
+ elem_list = filesdict[mapset]
elem_list.sort(key = unicode.lower)
for elem in elem_list:
if elem != '':
- fullqElem = elem + '@' + dir
+ fullqElem = elem + '@' + mapset
if elements:
if (exclude and fullqElem in elements) or \
(not exclude and fullqElem not in elements):
@@ -340,26 +340,26 @@
if self.filterElements:
if self.filterElements(fullqElem):
- self.AddItem(elem, parent=dir_node)
+ self.AddItem(elem, parent=mapset_node)
else:
- self.AddItem(elem, parent=dir_node)
+ self.AddItem(elem, parent=mapset_node)
except StandardError, e:
sys.stderr.write(_("GSelect: invalid item: %s") % e)
continue
- if self.seltree.ItemHasChildren(dir_node):
+ if self.seltree.ItemHasChildren(mapset_node):
sel = UserSettings.Get(group='general', key='elementListExpand',
subkey='selection')
collapse = True
if sel == 0: # collapse all except PERMANENT and current
- if dir in ('PERMANENT', curr_mapset):
+ if mapset in ('PERMANENT', curr_mapset):
collapse = False
elif sel == 1: # collapse all except PERMANENT
- if dir == 'PERMANENT':
+ if mapset == 'PERMANENT':
collapse = False
elif sel == 2: # collapse all except current
- if dir == curr_mapset:
+ if mapset == curr_mapset:
collapse = False
elif sel == 3: # collapse all
pass
@@ -367,13 +367,13 @@
collapse = False
if collapse:
- self.seltree.Collapse(dir_node)
+ self.seltree.Collapse(mapset_node)
else:
- self.seltree.Expand(dir_node)
+ self.seltree.Expand(mapset_node)
- if first_dir:
+ if first_mapset:
# select first mapset (MSW hack)
- self.seltree.SelectItem(first_dir)
+ self.seltree.SelectItem(first_mapset)
# helpers
def FindItem(self, parentItem, text, startLetters = False):
@@ -497,15 +497,15 @@
def SetData(self, **kargs):
"""!Set object properties"""
- if kargs.has_key('type'):
+ if 'type' in kargs:
self.type = kargs['type']
- if kargs.has_key('mapsets'):
+ if 'mapsets' in kargs:
self.mapsets = kargs['mapsets']
- if kargs.has_key('multiple'):
+ if 'multiple' in kargs:
self.multiple = kargs['multiple']
- if kargs.has_key('updateOnPopup'):
+ if 'updateOnPopup' in kargs:
self.updateOnPopup = kargs['updateOnPopup']
- if kargs.has_key('onPopup'):
+ if 'onPopup' in kargs:
self.onPopup = kargs['onPopup']
class VectorDBInfo:
@@ -1267,7 +1267,7 @@
def OnSettingsLoad(self, event):
"""!Load named settings"""
name = event.GetString()
- if not self._settings.has_key(name):
+ if name not in self._settings:
gcmd.GError(parent = self,
message = _("Settings named '%s' not found") % name)
return
Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -346,7 +346,7 @@
# determine format
if layer and layer.GetType() == 'vector':
- if not self.GetPyData(self.layer_selected)[0].has_key('info'):
+ if 'info' not in self.GetPyData(self.layer_selected)[0]:
info = grass.parse_command('v.info',
map = layer.GetName(),
shell = 'basic')
@@ -912,7 +912,7 @@
def PropertiesDialog (self, layer, show = True):
"""!Launch the properties dialog"""
- if self.GetPyData(layer)[0].has_key('propwin') and \
+ if 'propwin' in self.GetPyData(layer)[0] and \
self.GetPyData(layer)[0]['propwin'] is not None:
# recycle GUI dialogs
win = self.GetPyData(layer)[0]['propwin']
Modified: grass/trunk/gui/wxpython/gui_modules/location_wizard.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -709,7 +709,7 @@
id = event.GetId()
val = event.GetString()
- if not self.pparam.has_key(id):
+ if id not in self.pparam:
event.Skip()
return
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -101,7 +101,7 @@
self.layerbook = notebook # Layer Manager layer tree notebook
self.parent = parent
- if not kwargs.has_key('name'):
+ if 'name' not in kwargs:
kwargs['name'] = 'MapWindow'
wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
@@ -1375,9 +1375,9 @@
if hasattr(self, "tmpreg"):
if self.tmpreg:
os.environ["GRASS_REGION"] = self.tmpreg
- elif os.environ.has_key('GRASS_REGION'):
+ elif 'GRASS_REGION' in os.environ:
del os.environ["GRASS_REGION"]
- elif os.environ.has_key('GRASS_REGION'):
+ elif 'GRASS_REGION' in os.environ:
del os.environ["GRASS_REGION"]
if hasattr(self, "tmpreg"):
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -118,7 +118,7 @@
# translate tmp objects (pointer position)
if self.toolbar.GetAction() == 'moveLine' and \
hasattr(self, "moveInfo"):
- if self.moveInfo.has_key('beginDiff'):
+ if 'beginDiff' in self.moveInfo:
# move line
for id in self.moveInfo['id']:
self.pdcTmp.TranslateId(id,
@@ -191,8 +191,8 @@
item = self.tree.FindItemByData('maplayer', mapLayer)
vdigit = self.tree.GetPyData(item)[0]['vdigit']
if not vdigit or \
- not vdigit.has_key('geomAttr') or \
- not vdigit['geomAttr'].has_key(attrb):
+ 'geomAttr' not in vdigit or \
+ attrb not in vdigit['geomAttr']:
return
val = -1
@@ -223,7 +223,7 @@
item = self.tree.FindItemByData('maplayer', mapLayer)
vdigit = self.tree.GetPyData(item)[0]['vdigit']
- if vdigit is None or not vdigit.has_key('geomAttr'):
+ if vdigit is None or 'geomAttr' not in vdigit:
return
dbInfo = gselect.VectorDBInfo(vectorName)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -378,7 +378,7 @@
elif pdctype == 'text': # draw text on top of map
if not img['active']:
return # only draw active text
- if img.has_key('rotation'):
+ if 'rotation' in img:
rotation = float(img['rotation'])
else:
rotation = 0.0
@@ -404,7 +404,7 @@
@param textinfo text metadata (text, font, color, rotation)
@param coords reference point
"""
- if textinfo.has_key('rotation'):
+ if 'rotation' in textinfo:
rotation = float(textinfo['rotation'])
else:
rotation = 0.0
@@ -1236,9 +1236,9 @@
self.dragid >= 0):
# end drag of overlay decoration
- if self.dragid < 99 and self.overlays.has_key(self.dragid):
+ if self.dragid < 99 and self.dragid in self.overlays:
self.overlays[self.dragid]['coords'] = self.pdc.GetIdBounds(self.dragid)
- elif self.dragid > 100 and self.textdict.has_key(self.dragid):
+ elif self.dragid > 100 and self.dragid in self.textdict:
self.textdict[self.dragid]['coords'] = self.pdc.GetIdBounds(self.dragid)
else:
pass
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -194,8 +194,7 @@
return
p = self.task.get_param(self.eventId, element = 'wxId', raiseError = False)
- if not p or \
- not p.has_key('wxId-bind'):
+ if not p or 'wxId-bind' not in p:
return
# get widget prompt
@@ -273,7 +272,7 @@
table = pTable.get('value', '')
if name == 'LayerSelect':
- if cparams.has_key(map) and not cparams[map]['layers']:
+ if map in cparams and not cparams[map]['layers']:
win.InsertLayers(vector = map)
cparams[map]['layers'] = win.GetItems()
@@ -298,7 +297,7 @@
elif name == 'ColumnSelect':
if map:
- if cparams.has_key(map):
+ if map in cparams:
if not cparams[map]['dbInfo']:
cparams[map]['dbInfo'] = gselect.VectorDBInfo(map)
self.data[win.InsertColumns] = { 'vector' : map, 'layer' : layer,
@@ -640,7 +639,7 @@
required = False
if not _ignoreBlackList and \
- _blackList.has_key(self.task.name) and \
+ self.task.name in _blackList and \
p.get('name') in _blackList[self.task.name]['params']:
hidden = True
else:
@@ -672,7 +671,7 @@
global _ignoreBlackList
for p in self.root.findall('flag'):
if not _ignoreBlackList and \
- _blackList.has_key(self.task.name) and \
+ self.task.name in _blackList and \
p.get('name') in _blackList[self.task.name]['flags']:
hidden = True
else:
@@ -1126,7 +1125,7 @@
if task.get('guisection','') == '':
# Undefined guisections end up into Options
task['guisection'] = _('Optional')
- if not is_section.has_key(task['guisection']):
+ if task['guisection'] not in is_section:
# We do it like this to keep the original order, except for Main which goes first
is_section[task['guisection']] = 1
sections.append(task['guisection'])
@@ -1219,7 +1218,7 @@
label = _("Parameterized in model"))
parChk.SetName('ModelParam')
parChk.SetValue(f.get('parameterized', False))
- if f.has_key('wxId'):
+ if 'wxId' in f:
f['wxId'].append(parChk.GetId())
else:
f['wxId'] = [ parChk.GetId() ]
@@ -1233,7 +1232,7 @@
if f['name'] == vq:
chk.SetValue(True)
f['value'] = True
- elif f['name'] == 'overwrite' and not f.has_key('value'):
+ elif f['name'] == 'overwrite' and 'value' not in f:
chk.SetValue(UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'))
f['value'] = UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled')
@@ -1327,7 +1326,7 @@
chkbox = wx.CheckBox(parent = which_panel,
label = text_beautify(label))
p[ 'wxId' ].append(chkbox.GetId())
- if isEnabled.has_key(val):
+ if val in isEnabled:
chkbox.SetValue(True)
hSizer.Add(item = chkbox, proportion = 0,
flag = wx.ADJUST_MINSIZE | wx.ALL, border = 1)
@@ -1643,7 +1642,7 @@
win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
p['wxId'] = [ win.GetChildren()[1].GetId() ]
- if not p.has_key('wxId'):
+ if 'wxId' not in p:
try:
p['wxId'] = [ win.GetId(), ]
except AttributeError:
@@ -1730,7 +1729,7 @@
label = _("Parameterized in model"))
parChk.SetName('ModelParam')
parChk.SetValue(p.get('parameterized', False))
- if p.has_key('wxId'):
+ if 'wxId' in p:
p['wxId'].append(parChk.GetId())
else:
p['wxId'] = [ parChk.GetId() ]
@@ -1753,7 +1752,7 @@
title_txt.SetToolTipString(tooltip)
if p == first_param:
- if p.has_key('wxId') and len(p['wxId']) > 0:
+ if 'wxId' in p and len(p['wxId']) > 0:
win = self.FindWindowById(p['wxId'][0])
win.SetFocus()
@@ -1783,7 +1782,7 @@
for opt in options:
pOpt = self.task.get_param(opt, element = 'name', raiseError = False)
if id:
- if not p.has_key('wxId-bind'):
+ if 'wxId-bind' not in p:
p['wxId-bind'] = list()
p['wxId-bind'] += pOpt['wxId']
continue
@@ -2058,7 +2057,7 @@
# Keep the original order, so that some defaults may be recovered
currentValueList = []
for v in theParam['values']:
- if currentValues.has_key(v):
+ if v in currentValues:
currentValueList.append(v)
# Pack it back
@@ -2079,7 +2078,7 @@
found = False
for porf in self.task.params + self.task.flags:
- if not porf.has_key('wxId'):
+ if 'wxId' not in porf:
continue
if myId in porf['wxId']:
found = True
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -305,7 +305,7 @@
data['persp']['value'],
data['twist']['value'])
- if event and event.zExag and data['z-exag'].has_key('value'):
+ if event and event.zExag and 'value' in data['z-exag']:
self._display.SetZExag(data['z-exag']['value'])
if event:
@@ -379,11 +379,11 @@
return 0
if layer.type == 'raster':
- if not data['surface'].has_key('object'):
+ if 'object' not in data['surface']:
return 0
elif layer.type == 'vector':
- if not data['vlines'].has_key('object') and \
- not data['points'].has_key('object'):
+ if 'object' not in data['vlines'] and \
+ 'object' not in data['points']:
return 0
return 1
@@ -434,7 +434,7 @@
elif type == 'vector':
# data = self.tree.GetPyData(item)[0]['nviz']
# vecType = []
- # if data and data.has_key('vector'):
+ # if data and 'vector' in data:
# for v in ('lines', 'points'):
# if data['vector'][v]:
# vecType.append(v)
@@ -475,7 +475,7 @@
elif ltype == 'vector':
data = self.tree.GetPyData(layer)[0]['nviz']
vecType = []
- if data and data.has_key('vector'):
+ if data and 'vector' in data:
for v in ('lines', 'points'):
if data['vector'][v]:
vecType.append(v)
@@ -770,7 +770,7 @@
vecTypes = ('lines', )
for vecType in vecTypes:
- if not data[vecType].has_key('object'):
+ if 'object' not in data[vecType]:
continue
id = data[vecType]['object']['id']
@@ -846,21 +846,21 @@
"""!Generic method to update data layer properties"""
data = event.data
- if data.has_key('surface'):
+ if 'surface' in data:
id = data['surface']['object']['id']
self.UpdateSurfaceProperties(id, data['surface'])
# -> initialized
data['surface']['object']['init'] = True
- elif data.has_key('volume'):
+ elif 'volume' in data:
id = data['volume']['object']['id']
self.UpdateVolumeProperties(id, data['volume'])
# -> initialized
data['volume']['object']['init'] = True
- elif data.has_key('vector'):
+ elif 'vector' in data:
for type in ('lines', 'points'):
- if data['vector'][type].has_key('object'):
+ if 'object' in data['vector'][type]:
id = data['vector'][type]['object']['id']
self.UpdateVectorProperties(id, data['vector'], type)
# -> initialized
@@ -871,8 +871,8 @@
# surface attributes
for attrb in ('topo', 'color', 'mask',
'transp', 'shine', 'emit'):
- if not data['attribute'].has_key(attrb) or \
- not data['attribute'][attrb].has_key('update'):
+ if attrb not in data['attribute'] or \
+ 'update' not in data['attribute'][attrb]:
continue
map = data['attribute'][attrb]['map']
@@ -909,7 +909,7 @@
data['attribute'][attrb].pop('update')
# draw res
- if data['draw']['resolution'].has_key('update'):
+ if 'update' in data['draw']['resolution']:
coarse = data['draw']['resolution']['coarse']
fine = data['draw']['resolution']['fine']
@@ -920,7 +920,7 @@
data['draw']['resolution'].pop('update')
# draw style
- if data['draw']['mode'].has_key('update'):
+ if 'update' in data['draw']['mode']:
if data['draw']['mode']['value'] < 0: # need to calculate
data['draw']['mode']['value'] = \
self.nvizDefault.GetDrawMode(mode = data['draw']['mode']['desc']['mode'],
@@ -935,7 +935,7 @@
data['draw']['mode'].pop('update')
# wire color
- if data['draw']['wire-color'].has_key('update'):
+ if 'update' in data['draw']['wire-color']:
color = data['draw']['wire-color']['value']
if data['draw']['all']:
self._display.SetWireColor(-1, str(color))
@@ -944,7 +944,7 @@
data['draw']['wire-color'].pop('update')
# position
- if data['position'].has_key('update'):
+ if 'update' in data['position']:
x = data['position']['x']
y = data['position']['y']
z = data['position']['z']
@@ -953,11 +953,11 @@
def UpdateVolumeProperties(self, id, data, isosurfId = None):
"""!Update volume (isosurface/slice) map object properties"""
- if data['draw']['resolution'].has_key('update'):
+ if 'update' in data['draw']['resolution']:
self._display.SetIsosurfaceRes(id, data['draw']['resolution']['value'])
data['draw']['resolution'].pop('update')
- if data['draw']['shading'].has_key('update'):
+ if 'update' in data['draw']['shading']:
if data['draw']['shading']['value'] < 0: # need to calculate
data['draw']['shading']['value'] = \
self.nvizDefault.GetDrawMode(shade = data['draw']['shading'],
@@ -971,8 +971,8 @@
for isosurf in data['isosurface']:
for attrb in ('color', 'mask',
'transp', 'shine', 'emit'):
- if not isosurf.has_key(attrb) or \
- not isosurf[attrb].has_key('update'):
+ if attrb not in isosurf or \
+ 'update' not in isosurf[attrb]:
continue
map = isosurf[attrb]['map']
value = isosurf[attrb]['value']
@@ -1021,14 +1021,14 @@
def UpdateVectorLinesProperties(self, id, data):
"""!Update vector line map object properties"""
# mode
- if data['color'].has_key('update') or \
- data['width'].has_key('update') or \
- data['mode'].has_key('update'):
+ if 'update' in data['color'] or \
+ 'update' in data['width'] or \
+ 'update' in data['mode']:
width = data['width']['value']
color = data['color']['value']
if data['mode']['type'] == 'flat':
flat = True
- if data.has_key('surface'):
+ if 'surface' in data:
data.pop('surface')
else:
flat = False
@@ -1036,21 +1036,21 @@
self._display.SetVectorLineMode(id, color,
width, flat)
- if data['color'].has_key('update'):
+ if 'update' in data['color']:
data['color'].pop('update')
- if data['width'].has_key('update'):
+ if 'update' in data['width']:
data['width'].pop('update')
- if data['mode'].has_key('update'):
+ if 'update' in data['mode']:
data['mode'].pop('update')
# height
- if data['height'].has_key('update'):
+ if 'update' in data['height']:
self._display.SetVectorLineHeight(id,
data['height']['value'])
data['height'].pop('update')
# surface
- if data['mode'].has_key('update'):
+ if 'update' in data['mode']:
sid = self.GetLayerId(type = 'raster', name = data['mode']['surface'])
if sid > -1:
self._display.SetVectorLineSurface(id, sid)
@@ -1059,10 +1059,10 @@
def UpdateVectorPointsProperties(self, id, data):
"""!Update vector point map object properties"""
- if data['size'].has_key('update') or \
- data['width'].has_key('update') or \
- data['marker'].has_key('update') or \
- data['color'].has_key('update'):
+ if 'update' in data['size'] or \
+ 'update' in data['width'] or \
+ 'update' in data['marker'] or \
+ 'update' in data['color']:
ret = self._display.SetVectorPointMode(id, data['color']['value'],
data['width']['value'], float(data['size']['value']),
data['marker']['value'] + 1)
@@ -1077,17 +1077,17 @@
raise gcmd.GException(_("Setting data layer properties failed.\n\n%s") % error)
for prop in ('size', 'width', 'marker', 'color'):
- if data[prop].has_key('update'):
+ if 'update' in data[prop]:
data[prop].pop('update')
# height
- if data['height'].has_key('update'):
+ if 'update' in data['height']:
self._display.SetVectorPointHeight(id,
data['height']['value'])
data['height'].pop('update')
# surface
- if data['mode'].has_key('update'):
+ if 'update' in data['mode']:
sid = self.GetLayerId(type = 'raster', name = data['mode']['surface'])
if sid > -1:
self._display.SetVectorPointSurface(id, sid)
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -2531,7 +2531,7 @@
self.SetMapObjUseMap(nvizType = 'surface',
attrb = attr, map = True) # -> map
- if data['attribute'].has_key('color'):
+ if 'color' in data['attribute']:
value = data['attribute']['color']['value']
if data['attribute']['color']['map']:
self.FindWindowById(self.win['surface']['color']['map']).SetValue(value)
@@ -2647,7 +2647,7 @@
# lines
#
showLines = self.FindWindowById(self.win['vector']['lines']['show'])
- if data['lines'].has_key('object'):
+ if 'object' in data['lines']:
showLines.SetValue(True)
else:
showLines.SetValue(False)
@@ -2692,7 +2692,7 @@
#
showPoints = self.FindWindowById(self.win['vector']['points']['show'])
- if data['points'].has_key('object'):
+ if 'object' in data['points']:
showPoints.SetValue(True)
else:
showPoints.SetValue(False)
@@ -2771,7 +2771,7 @@
continue
# skip empty attributes
- if not data.has_key(attrb):
+ if attrb not in data:
continue
value = data[attrb]['value']
Modified: grass/trunk/gui/wxpython/gui_modules/ogc_services.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/ogc_services.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/ogc_services.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -194,7 +194,7 @@
elif key == 'title':
layers[lastLayer][key] = value
elif key == 'style':
- if not layers[lastLayer].has_key('style'):
+ if 'style' not in layers[lastLayer]:
layers[lastLayer]['style'] = {}
layers[lastLayer]['style'][value] = ''
lastStyle = value
@@ -260,7 +260,7 @@
title = data[layer]['title']
lchild = self.AppendItem(self.root, layer)
self.SetItemText(lchild, title, 1)
- if data[layer].has_key('style'):
+ if 'style' in data[layer]:
styles = data[layer]['style'].keys()
if not styles:
continue
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -883,15 +883,15 @@
@param subkey subkey (value or list)
@param value value
"""
- if not dict.has_key(group):
+ if group not in dict:
dict[group] = {}
- if not dict[group].has_key(key):
+ if key not in dict[group]:
dict[group][key] = {}
if type(subkey) == types.ListType:
# TODO: len(subkey) > 2
- if not dict[group][key].has_key(subkey[0]):
+ if subkey[0] not in dict[group][key]:
dict[group][key][subkey[0]] = {}
try:
dict[group][key][subkey[0]][subkey[1]] = value
@@ -1871,7 +1871,7 @@
except ValueError:
code = -1
win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
- if self.epsgCodeDict.has_key(code):
+ if code in self.epsgCodeDict:
win.SetValue(self.epsgCodeDict[code][1])
else:
list.SetSelection(0)
Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -56,7 +56,7 @@
"""
self.statusbar = statusbar
- if kwargs.has_key('style'):
+ if 'style' in kwargs:
kwargs['style'] = wx.TE_PROCESS_ENTER | kwargs['style']
else:
kwargs['style'] = wx.TE_PROCESS_ENTER
@@ -523,7 +523,7 @@
def GetCommandDesc(self, cmd):
"""!Get description for given command"""
- if self.moduleDesc.has_key(cmd):
+ if cmd in self.moduleDesc:
return self.moduleDesc[cmd]['desc']
return ''
@@ -561,7 +561,7 @@
except ValueError:
continue # TODO
- if not result.has_key(group):
+ if group not in result:
result[group] = list()
result[group].append(name)
@@ -570,7 +570,7 @@
for i in range(len(name.split('.'))-1):
group = '.'.join([group,name.split('.',1)[0]])
name = name.split('.',1)[1]
- if not result.has_key(group):
+ if group not in result:
result[group] = list()
result[group].append(name)
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -184,7 +184,7 @@
self.maskfile = None
# stop monitor
- if os.environ.has_key("GRASS_PNGFILE"):
+ if "GRASS_PNGFILE" in os.environ:
del os.environ["GRASS_PNGFILE"]
self.force_render = False
@@ -1019,22 +1019,22 @@
"""
Debug.msg (3, "Map.ChangeLayer(): layer=%s" % layer.name)
- if kargs.has_key('type'):
+ if 'type' in kargs:
layer.SetType(kargs['type']) # check type
- if kargs.has_key('command'):
+ if 'command' in kargs:
layer.SetCmd(kargs['command'])
- if kargs.has_key('name'):
+ if 'name' in kargs:
layer.SetName(kargs['name'])
- if kargs.has_key('active'):
+ if 'active' in kargs:
layer.SetActive(kargs['active'])
- if kargs.has_key('hidden'):
+ if 'hidden' in kargs:
layer.SetHidden(kargs['hidden'])
- if kargs.has_key('opacity'):
+ if 'opacity' in kargs:
layer.SetOpacity(kargs['opacity'])
if render and not layer.Render():
@@ -1170,19 +1170,19 @@
if overlay is None:
overlay = Overlay(id, type = None, cmd = None)
- if kargs.has_key('type'):
+ if 'type' in kargs:
overlay.SetName(kargs['type']) # type -> overlay
- if kargs.has_key('command'):
+ if 'command' in kargs:
overlay.SetCmd(kargs['command'])
- if kargs.has_key('active'):
+ if 'active' in kargs:
overlay.SetActive(kargs['active'])
- if kargs.has_key('hidden'):
+ if 'hidden' in kargs:
overlay.SetHidden(kargs['hidden'])
- if kargs.has_key('opacity'):
+ if 'opacity' in kargs:
overlay.SetOpacity(kargs['opacity'])
if render and command != [] and not overlay.Render():
Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -454,11 +454,11 @@
scmd = cmd[0]
- if cmd[1].has_key('flags'):
+ if 'flags' in cmd[1]:
for flag in cmd[1]['flags']:
scmd += ' -' + flag
for flag in ('verbose', 'quiet', 'overwrite'):
- if cmd[1].has_key(flag) and cmd[1][flag] is True:
+ if flag in cmd[1] and cmd[1][flag] is True:
scmd += ' --' + flag
for k, v in cmd[1].iteritems():
@@ -483,7 +483,7 @@
if flag in ('verbose', 'quiet', 'overwrite'):
dcmd[str(flag)] = True
else: # -> flags
- if not dcmd.has_key('flags'):
+ if 'flags' not in dcmd:
dcmd['flags'] = ''
dcmd['flags'] += item.replace('-', '')
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -481,8 +481,8 @@
# default values
check.SetValue(False)
if item and tree.GetPyData(item)[0]['vdigit'] and \
- tree.GetPyData(item)[0]['vdigit'].has_key('geomAttr') and \
- tree.GetPyData(item)[0]['vdigit']['geomAttr'].has_key(attrb):
+ 'geomAttr' in tree.GetPyData(item)[0]['vdigit'] and \
+ attrb in tree.GetPyData(item)[0]['vdigit']['geomAttr']:
check.SetValue(True)
column.SetStringSelection(tree.GetPyData(item)[0]['vdigit']['geomAttr'][attrb]['column'])
if attrb == 'area':
@@ -765,7 +765,7 @@
'units' : unitsKey }
else:
if item and tree.GetPyData(item)[0]['vdigit'] and \
- tree.GetPyData(item)[0]['vdigit']['geomAttr'].has_key(key):
+ key in tree.GetPyData(item)[0]['vdigit']['geomAttr']:
del tree.GetPyData(item)[0]['vdigit']['geomAttr'][key]
# query tool
Modified: grass/trunk/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/workspace.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/workspace.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -250,7 +250,7 @@
# init nviz layer properties
vdigit = dict()
for node in node_vdigit.findall('geometryAttribute'):
- if not vdigit.has_key('geomAttr'):
+ if 'geomAttr' not in vdigit:
vdigit['geomAttr'] = dict()
type = node.get('type')
vdigit['geomAttr'][type] = dict()
@@ -277,7 +277,7 @@
for sec in ('lines', 'points'):
nviz['vector'][sec] = {}
- if nviz.has_key('surface'):
+ if 'surface' in nviz:
node_surface = node_nviz.find('surface')
# attributes
for attrb in node_surface.findall('attribute'):
@@ -315,7 +315,7 @@
# resolution
for node_res in node_draw.findall('resolution'):
resType = str(node_res.get('type', ''))
- if not nviz['surface']['draw'].has_key('resolution'):
+ if 'resolution' not in nviz['surface']['draw']:
nviz['surface']['draw']['resolution'] = {}
value = int(self.__getNodeText(node_res, 'value'))
nviz['surface']['draw']['resolution'][resType] = value
@@ -338,7 +338,7 @@
value = int(self.__getNodeText(node, 'value'))
dc[coor] = value
- elif nviz.has_key('vector'):
+ elif 'vector' in nviz:
# vpoints
node_vpoints = node_nviz.find('vpoints')
if node_vpoints is not None:
@@ -444,9 +444,9 @@
data['draw']['all'] = False # apply only for current surface
for control, value in UserSettings.Get(group='nviz', key='surface', subkey='draw').iteritems():
if control[:3] == 'res':
- if not data['draw'].has_key('resolution'):
+ if 'resolution' not in data['draw']:
data['draw']['resolution'] = {}
- if not data['draw']['resolution'].has_key('update'):
+ if 'update' not in data['draw']['resolution']:
data['draw']['resolution']['update'] = None
data['draw']['resolution'][control[4:]] = value
continue
@@ -454,7 +454,7 @@
if control == 'wire-color':
value = str(value[0]) + ':' + str(value[1]) + ':' + str(value[2])
elif control in ('mode', 'style', 'shading'):
- if not data['draw'].has_key('mode'):
+ if 'mode' not in data['draw']:
data['draw']['mode'] = {}
continue
@@ -502,7 +502,7 @@
else:
data['draw'][control] = { 'value' : value }
- if not data['draw'][control].has_key('update'):
+ if 'update' not in data['draw'][control]:
data['draw'][control]['update'] = None
#
@@ -558,7 +558,7 @@
data['height'] = { 'value' : UserSettings.Get(group='nviz', key='vector',
subkey=['lines', 'height']) }
- if data.has_key('object'):
+ if 'object' in data:
for attrb in ('color', 'width', 'mode', 'height'):
data[attrb]['update'] = None
@@ -590,7 +590,7 @@
data['height'] = { 'value' : UserSettings.Get(group='nviz', key='vector',
subkey=['points', 'height']) }
- if data.has_key('object'):
+ if 'object' in data:
for attrb in ('size', 'width', 'marker',
'color', 'surface', 'height'):
data[attrb]['update'] = None
@@ -809,7 +809,7 @@
vdigit = mapTree.GetPyData(item)[0]['vdigit']
if vdigit:
self.file.write('%s<vdigit>\n' % (' ' * self.indent))
- if vdigit.has_key('geomAttr'):
+ if 'geomAttr' in vdigit:
self.indent += 4
for type, val in vdigit['geomAttr'].iteritems():
units = ''
@@ -838,7 +838,7 @@
@param data Nviz layer properties
"""
- if not data.has_key('object'): # skip disabled
+ if 'object' not in data: # skip disabled
return
self.indent += 4
@@ -864,12 +864,12 @@
# draw mode
if attrb == 'draw':
self.file.write('%s<%s' %(' ' * self.indent, attrb))
- if data[attrb].has_key('mode'):
+ if 'mode' in data[attrb]:
for tag, value in data[attrb]['mode']['desc'].iteritems():
self.file.write(' %s="%s"' % (tag, value))
self.file.write('>\n') # <draw ...>
- if data[attrb].has_key('resolution'):
+ if 'resolution' in data[attrb]:
self.indent += 4
for type in ('coarse', 'fine'):
self.file.write('%s<resolution type="%s">\n' % (' ' * self.indent, type))
@@ -879,7 +879,7 @@
self.indent -= 4
self.file.write('%s</resolution>\n' % (' ' * self.indent))
- if data[attrb].has_key('wire-color'):
+ if 'wire-color' in data[attrb]:
self.file.write('%s<wire_color>\n' % (' ' * self.indent))
self.indent += 4
self.file.write('%s<value>%s</value>\n' % (' ' * self.indent,
@@ -917,7 +917,7 @@
if len(data[attrb]) < 1: # skip empty attributes
continue
- if not data[attrb].has_key('object'): # skip disabled
+ if 'object' not in data[attrb]: # skip disabled
continue
if attrb == 'lines':
self.file.write('%s<v%s>\n' % (' ' * self.indent, attrb))
Modified: grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdigit.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdigit.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -394,7 +394,7 @@
offset = Vect_get_line_offset(self.poMapInfo, line)
- if not self.changesets.has_key(changeset):
+ if changeset not in self.changesets:
self.changesets[changeset] = list()
self.changesetCurrent = changeset
@@ -1277,7 +1277,7 @@
id = c_int()
Vect_cidx_get_cat_by_index(self.poMapInfo, i, j,
byref(cat), byref(type), byref(id))
- if self.cats.has_key(field):
+ if field in self.cats:
if cat > self.cats[field]:
self.cats[field] = cat.value
else:
Modified: grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -951,7 +951,7 @@
Vect_read_line(self.poMapInfo, BPoints, None, line2)
if Vect_line_check_duplicate(APoints, BPoints, WITHOUT_Z):
- if not ids.has_key(i):
+ if i not in ids:
ids[i] = list()
ids[i].append((line1, self._getCatString(line1)))
self.selected['idsDupl'].append(line1)
@@ -971,7 +971,7 @@
catsDict = dict()
for i in range(cats.n_cats):
layer = cats.field[i]
- if not catsDict.has_key(layer):
+ if layer not in catsDict:
catsDict[layer] = list()
catsDict[layer].append(cats.cat[i])
Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/icons/icon.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -48,7 +48,7 @@
raise OSError
for key, img in iconSet.iteritems():
- if not iconSet.has_key(key) or \
+ if key not in iconSet or \
iconSet[key] is None: # add key
iconSet[key] = img
Modified: grass/trunk/gui/wxpython/support/update_menudata.py
===================================================================
--- grass/trunk/gui/wxpython/support/update_menudata.py 2011-04-04 10:24:11 UTC (rev 45842)
+++ grass/trunk/gui/wxpython/support/update_menudata.py 2011-04-04 11:21:24 UTC (rev 45843)
@@ -76,14 +76,14 @@
for child in node.getchildren():
item[child.tag] = child.text
- if not item.has_key('command'):
+ if 'command' not in item:
continue
if item['command'] in ignore:
continue
module = item['command'].split(' ')[0]
- if not modules.has_key(module):
+ if module not in modules:
grass.warning("'%s' not found in modules" % item['command'])
continue
@@ -94,7 +94,7 @@
if node.find('handler').text == 'OnMenuCmd':
node.find('help').text = desc
- if not modules[module].has_key('keywords'):
+ if 'keywords' not in modules[module]:
grass.warning('%s: keywords missing' % module)
else:
if node.find('keywords') is None:
More information about the grass-commit
mailing list