[GRASS-SVN] r45845 - in grass/branches/develbranch_6/gui/wxpython:
gui_modules icons support
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 4 07:32:36 EDT 2011
Author: martinl
Date: 2011-04-04 04:32:36 -0700 (Mon, 04 Apr 2011)
New Revision: 45845
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_dialogs.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/ogc_services.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdigit.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdriver.py
grass/branches/develbranch_6/gui/wxpython/icons/icon.py
grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py
Log:
wxGUI: don't use deprecated 'dict.has_key()'
(merge r45843 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_dialogs.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_dialogs.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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)
@@ -335,17 +334,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)
@@ -381,7 +380,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" % \
@@ -395,7 +394,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/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -361,7 +361,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/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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()
@@ -935,7 +935,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):
@@ -1001,7 +1001,7 @@
'v' : 'vector',
'wx' : 'wxGUI' }
- if name.has_key(c):
+ if c in name:
return name[c]
return c
@@ -1039,7 +1039,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:
@@ -1054,7 +1054,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/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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):
@@ -1810,11 +1810,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', ''))
@@ -2842,7 +2842,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
@@ -2858,10 +2858,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
@@ -3399,7 +3399,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/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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:
@@ -522,7 +522,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:
@@ -1073,7 +1073,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/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -317,21 +317,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):
@@ -339,26 +339,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
@@ -366,13 +366,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):
@@ -496,15 +496,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:
@@ -1226,7 +1226,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/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -874,7 +874,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/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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)
@@ -1373,9 +1373,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/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -193,8 +193,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
@@ -224,7 +223,7 @@
name = win.GetName()
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()
@@ -251,7 +250,7 @@
layer = 1
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,
@@ -595,7 +594,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:
@@ -626,7 +625,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:
@@ -1067,7 +1066,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'])
@@ -1160,7 +1159,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() ]
@@ -1174,7 +1173,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')
@@ -1268,8 +1267,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)
@@ -1533,7 +1531,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:
@@ -1620,7 +1618,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() ]
@@ -1643,7 +1641,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()
@@ -1876,7 +1874,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
@@ -1897,7 +1895,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/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -301,7 +301,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:
@@ -375,11 +375,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
@@ -430,7 +430,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)
@@ -471,7 +471,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)
@@ -766,7 +766,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']
@@ -842,21 +842,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
@@ -867,8 +867,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']
@@ -905,7 +905,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']
@@ -916,7 +916,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'],
@@ -931,7 +931,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))
@@ -940,7 +940,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']
@@ -949,11 +949,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'],
@@ -967,8 +967,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']
@@ -1017,14 +1017,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
@@ -1032,21 +1032,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)
@@ -1055,10 +1055,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)
@@ -1073,17 +1073,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/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -2532,7 +2532,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)
@@ -2648,7 +2648,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)
@@ -2693,7 +2693,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)
@@ -2772,7 +2772,7 @@
continue
# skip empty attributes
- if not data.has_key(attrb):
+ if attrb not in data:
continue
value = data[attrb]['value']
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/ogc_services.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/ogc_services.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/ogc_services.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -902,15 +902,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
@@ -1922,7 +1922,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/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -215,7 +215,7 @@
# gcmd.RunCommand('d.mon',
# stop = 'cairo')
del os.environ["GRASS_CAIROFILE"]
- elif os.environ.has_key("GRASS_PNGFILE"):
+ elif "GRASS_PNGFILE" in os.environ:
del os.environ["GRASS_PNGFILE"]
self.force_render = False
@@ -881,7 +881,7 @@
os.environ["GRASS_HEIGHT"] = str(self.height)
if UserSettings.Get(group='display', key='driver', subkey='type') == 'cairo':
os.environ["GRASS_AUTO_WRITE"] = "TRUE"
- if os.environ.has_key("GRASS_RENDER_IMMEDIATE"):
+ if "GRASS_RENDER_IMMEDIATE" in os.environ:
del os.environ["GRASS_RENDER_IMMEDIATE"]
os.environ["GRASS_RENDER_IMMEDIATE"] = "TRUE"
else:
@@ -1049,22 +1049,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():
@@ -1200,19 +1200,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/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -452,11 +452,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():
@@ -481,7 +481,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/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/wxvdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdigit.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdigit.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/wxvdriver.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdriver.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxvdriver.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -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/branches/develbranch_6/gui/wxpython/icons/icon.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/icon.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/icons/icon.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -57,7 +57,7 @@
if iconTheme != 'grass':
# use default icons if no icon is available
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/branches/develbranch_6/gui/wxpython/support/update_menudata.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py 2011-04-04 11:31:19 UTC (rev 45844)
+++ grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py 2011-04-04 11:32:36 UTC (rev 45845)
@@ -77,14 +77,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
@@ -95,7 +95,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