[GRASS-SVN] r71852 - in grass/trunk/gui/wxpython: . animation core dbmgr gcp gui_core iclass image2target iscatt lmgr mapdisp mapwin nviz photo2image tools vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 26 15:17:33 PST 2017
Author: wenzeslaus
Date: 2017-11-26 15:17:33 -0800 (Sun, 26 Nov 2017)
New Revision: 71852
Modified:
grass/trunk/gui/wxpython/animation/dialogs.py
grass/trunk/gui/wxpython/animation/nviztask.py
grass/trunk/gui/wxpython/animation/temporal_manager.py
grass/trunk/gui/wxpython/core/gcmd.py
grass/trunk/gui/wxpython/core/gconsole.py
grass/trunk/gui/wxpython/core/menutree.py
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/core/toolboxes.py
grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
grass/trunk/gui/wxpython/gcp/manager.py
grass/trunk/gui/wxpython/gui_core/gselect.py
grass/trunk/gui/wxpython/gui_core/treeview.py
grass/trunk/gui/wxpython/iclass/toolbars.py
grass/trunk/gui/wxpython/image2target/ii2t_manager.py
grass/trunk/gui/wxpython/iscatt/frame.py
grass/trunk/gui/wxpython/lmgr/giface.py
grass/trunk/gui/wxpython/lmgr/pyshell.py
grass/trunk/gui/wxpython/mapdisp/main.py
grass/trunk/gui/wxpython/mapwin/buffered.py
grass/trunk/gui/wxpython/nviz/wxnviz.py
grass/trunk/gui/wxpython/photo2image/ip2i_manager.py
grass/trunk/gui/wxpython/tools/build_modules_xml.py
grass/trunk/gui/wxpython/tools/update_menudata.py
grass/trunk/gui/wxpython/vdigit/wxdisplay.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: replace print statement by print function for Python 3 support, remove mixed tabs (PEP8 E101, W191, see #2708)
Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/animation/dialogs.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -19,6 +19,9 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+
+from __future__ import print_function
+
import os
import wx
import copy
@@ -2098,8 +2101,8 @@
dlg = ExportDialog(parent=None, temporal=TemporalMode.TEMPORAL,
timeTick=200)
if dlg.ShowModal() == wx.ID_OK:
- print dlg.GetDecorations()
- print dlg.GetExportInformation()
+ print(dlg.GetDecorations())
+ print(dlg.GetExportInformation())
dlg.Destroy()
else:
dlg.Destroy()
@@ -2112,7 +2115,7 @@
dlg = AddTemporalLayerDialog(parent=frame, layer=layer)
if dlg.ShowModal() == wx.ID_OK:
layer = dlg.GetLayer()
- print layer.name, layer.cmd, layer.mapType
+ print(layer.name, layer.cmd, layer.mapType)
dlg.Destroy()
else:
dlg.Destroy()
Modified: grass/trunk/gui/wxpython/animation/nviztask.py
===================================================================
--- grass/trunk/gui/wxpython/animation/nviztask.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/animation/nviztask.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -14,6 +14,8 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import os
try:
import xml.etree.ElementTree as etree
@@ -330,10 +332,10 @@
# cmd = nviz.GetCommand()
cmds = nviz.GetCommandSeries(['aspect', 'elevation'], 'color_map')
for cmd in cmds:
- print cmd
+ print(cmd)
returncode, message = RunCommand(
getErrorMsg=True, prog=cmd[0], **cmd[1])
- print returncode, message
+ print(returncode, message)
if __name__ == '__main__':
Modified: grass/trunk/gui/wxpython/animation/temporal_manager.py
===================================================================
--- grass/trunk/gui/wxpython/animation/temporal_manager.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/animation/temporal_manager.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -17,6 +17,8 @@
@author Anna Kratochvilova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import os
import datetime
@@ -373,14 +375,14 @@
try:
warn = temp.EvaluateInputData()
- print warn
+ print(warn)
except GException as e:
- print e
+ print(e)
return
- print '///////////////////////////'
+ print('///////////////////////////')
gran = temp.GetGranularity()
- print "granularity: " + str(gran)
+ print("granularity: " + str(gran))
pprint(temp.GetLabelsAndMaps())
Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/core/gcmd.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -25,6 +25,8 @@
@author Martin Landa <landa.martin gmail.com>
"""
+from __future__ import print_function
+
import os
import sys
import time
@@ -603,7 +605,7 @@
except OSError as e:
self.error = str(e)
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
return 1
if self.stdin: # read stdin if requested ...
Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/core/gconsole.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -20,6 +20,8 @@
@author Anna Kratochvilova <kratochanna gmail.com> (refactoring)
"""
+from __future__ import print_function
+
import os
import sys
import re
@@ -540,7 +542,7 @@
GUI(parent=self._guiparent,
giface=self._giface).ParseCommand(command)
except GException as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
return
@@ -694,7 +696,7 @@
try:
task = GUI(show=None).ParseCommand(event.cmd)
except GException as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
task = None
return
Modified: grass/trunk/gui/wxpython/core/menutree.py
===================================================================
--- grass/trunk/gui/wxpython/core/menutree.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/core/menutree.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -33,6 +33,8 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import os
import sys
import copy
@@ -275,7 +277,7 @@
elif action == 'commands':
menudata.PrintCommands(sys.stdout)
elif action == 'dump':
- print menudata.model
+ print(menudata.model)
else:
import grass.script.core as gscore
gscore.fatal("Unknown value for parameter action: " % action)
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/core/settings.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -19,6 +19,8 @@
@author Luca Delucchi <lucadeluge gmail.com> (language choice)
"""
+from __future__ import print_function
+
import os
import sys
import copy
@@ -46,7 +48,7 @@
try:
self.ReadSettingsFile()
except GException as e:
- print >> sys.stderr, e.value
+ print(e.value, file=sys.stderr)
# define internal settings
self._internalSettings() # -> self.internalSettings
@@ -997,11 +999,12 @@
self.Append(settings, group, key, subkey, value)
idx += 2
except ValueError as e:
- print >>sys.stderr, _(
+ print(_(
"Error: Reading settings from file <%(file)s> failed.\n"
"\t\tDetails: %(detail)s\n"
"\t\tLine: '%(line)s'\n") % {
- 'file': filename, 'detail': e, 'line': line}
+ 'file': filename, 'detail': e, 'line': line},
+ file=sys.stderr)
fd.close()
fd.close()
@@ -1134,8 +1137,8 @@
return settings[group][key][subkey]
except KeyError:
- print >> sys.stderr, "Settings: unable to get value '%s:%s:%s'\n" % (
- group, key, subkey)
+ print("Settings: unable to get value '%s:%s:%s'\n" % (
+ group, key, subkey), file=sys.stderr)
def Set(self, group, value, key=None, subkey=None, settings_type='user'):
"""Set value of key/subkey
@@ -1206,8 +1209,9 @@
if overwrite or (not overwrite and not hasValue):
dict[group][key][subkey[0]][subkey[1]] = value
except TypeError:
- print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
- ' (' + group + ':' + key + ':' + subkey[0] + ':' + subkey[1] + ')'
+ print(_("Unable to parse settings '%s'") % value +
+ ' (' + group + ':' + key + ':' + subkey[0] +
+ ':' + subkey[1] + ')', file=sys.stderr)
else:
if subkey not in dict[group][key]:
hasValue = False
@@ -1216,8 +1220,9 @@
if overwrite or (not overwrite and not hasValue):
dict[group][key][subkey] = value
except TypeError:
- print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
- ' (' + group + ':' + key + ':' + subkey + ')'
+ print(_("Unable to parse settings '%s'") % value +
+ ' (' + group + ':' + key + ':' + subkey + ')',
+ file=sys.stderr)
def GetDefaultSettings(self):
"""Get default user settings"""
Modified: grass/trunk/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/trunk/gui/wxpython/core/toolboxes.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/core/toolboxes.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -12,6 +12,8 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import os
import sys
import copy
@@ -865,10 +867,10 @@
sys.stdout.write(line)
someDiff = True
if someDiff:
- print "Difference between files."
+ print("Difference between files.")
return 1
else:
- print "OK"
+ print("OK")
return 0
@@ -876,8 +878,8 @@
try:
etree.parse(filename)
except ETREE_EXCEPTIONS as error:
- print "XML file <{name}> is not well formed: {error}".format(
- name=filename, error=error)
+ print("XML file <{name}> is not well formed: {error}".format(
+ name=filename, error=error))
return 1
return 0
Modified: grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -24,6 +24,8 @@
@author Refactoring, SQLBUilderUpdate by Stepan Turek <stepan.turek seznam.cz> (GSoC 2012, mentor: Martin Landa)
"""
+from __future__ import print_function
+
import os
import sys
@@ -837,7 +839,7 @@
if __name__ == "__main__":
if len(sys.argv) not in [3, 4]:
- print >>sys.stderr, __doc__
+ print(__doc__, file=sys.stderr)
sys.exit()
if len(sys.argv) == 3:
@@ -850,7 +852,7 @@
elif sys.argv[1] == 'update':
sqlBuilder = SQLBuilderUpdate
else:
- print >>sys.stderr, __doc__
+ print(__doc__, file=sys.stderr)
sys.exit()
app = wx.App(0)
Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/gcp/manager.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -26,6 +26,8 @@
@author Support for GraphicsSet added by Stepan Turek <stepan.turek seznam.cz> (2012)
"""
+from __future__ import print_function
+
import os
import sys
import shutil
@@ -588,8 +590,8 @@
def OnMkGroup(self, event):
"""Create new group in source location/mapset"""
- if self.xygroup == '':
- self.xygroup = self.cb_group.GetValue()
+ if self.xygroup == '':
+ self.xygroup = self.cb_group.GetValue()
dlg = GroupDialog(parent=self, defaultGroup=self.xygroup)
dlg.DisableSubgroupEdit()
dlg.ShowModal()
@@ -605,10 +607,10 @@
def OnVGroup(self, event):
"""Add vector maps to group"""
-
- if self.xygroup == '':
- self.xygroup = self.cb_group.GetValue()
+ if self.xygroup == '':
+ self.xygroup = self.cb_group.GetValue()
+
dlg = VectGroup(parent=self,
id=wx.ID_ANY,
grassdb=self.grassdatabase,
@@ -814,7 +816,7 @@
p = RunCommand('g.region', 'vector=src_map')
if p.returncode == 0:
- print 'returncode = ', str(p.returncode)
+ print('returncode = ', str(p.returncode))
self.parent.Map.region = self.parent.Map.GetRegion()
except:
pass
@@ -1610,7 +1612,7 @@
# provide feedback on failure
if ret != 0:
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
elif maptype == 'vector':
# loop through all vectors in VREF
@@ -1654,7 +1656,7 @@
# provide feedback on failure
if ret != 0:
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
self.grwiz.SwitchEnv('target')
@@ -1668,7 +1670,7 @@
if returncode == 0:
self.VectGRList.append(self.outname)
- print '*****vector list = ' + str(self.VectGRList)
+ print('*****vector list = ' + str(self.VectGRList))
else:
self._giface.WriteError(
_('Georectification of vector map <%s> failed') %
@@ -2466,11 +2468,11 @@
'@' +
self.xymapset)
- dirname = os.path.dirname(self.vgrpfile)
-
- if not os.path.exists(dirname):
- os.makedirs(dirname)
+ dirname = os.path.dirname(self.vgrpfile)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
f = open(self.vgrpfile, mode='w')
try:
for vect in vgrouplist:
Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -40,6 +40,8 @@
@author Matej Krejci <matejkrejci gmail.com> (VectorCategorySelect)
"""
+from __future__ import print_function
+
import os
import sys
import glob
@@ -66,8 +68,9 @@
try:
from grass.pygrass import messages
except ImportError as e:
- print >> sys.stderr, _("Unable to import pyGRASS: %s\n"
- "Some functionality will be not accessible") % e
+ print(_("Unable to import pyGRASS: %s\n"
+ "Some functionality will be not accessible") % e,
+ file=sys.stderr)
from gui_core.widgets import ManageSettingsWidget, CoordinatesValidator
Modified: grass/trunk/gui/wxpython/gui_core/treeview.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/treeview.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/gui_core/treeview.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -14,6 +14,8 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import os
import wx
@@ -261,11 +263,11 @@
szr.SetSizeHints(self)
def OnSelChanged(self):
- print 'selected items: ' + \
- str([node.label for node in self.tree.GetSelected()])
+ print('selected items: ' + \
+ str([node.label for node in self.tree.GetSelected()]))
def OnItemActivated(self, node):
- print 'activated: ' + node.label
+ print('activated: ' + node.label)
def main():
Modified: grass/trunk/gui/wxpython/iclass/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/toolbars.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/iclass/toolbars.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -18,6 +18,8 @@
@author Anna Kratochvilova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import wx
from core.utils import _
@@ -193,7 +195,7 @@
))
def OnMotion(self, event):
- print self.choice.GetStringSelection()
+ print(self.choice.GetStringSelection())
def OnSelectCategory(self, event):
idx = self.choice.GetSelection()
Modified: grass/trunk/gui/wxpython/image2target/ii2t_manager.py
===================================================================
--- grass/trunk/gui/wxpython/image2target/ii2t_manager.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/image2target/ii2t_manager.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -31,6 +31,8 @@
#TODO: i.ortho.transform looks for REF_POINTS/CONTROL_POINTS and not POINTS
#TODO: CHECK CONTROL_POINTS format and create it for i.ortho.transform to use.
+from __future__ import print_function
+
import os
import sys
import shutil
@@ -837,7 +839,7 @@
p = RunCommand('g.region', 'vector=src_map')
if p.returncode == 0:
- print 'returncode = ', str(p.returncode)
+ print('returncode = ', str(p.returncode))
self.parent.Map.region = self.parent.Map.GetRegion()
except:
pass
@@ -1676,7 +1678,7 @@
# provide feedback on failure
if ret != 0:
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
elif maptype == 'vector':
# loop through all vectors in VREF
@@ -1720,7 +1722,7 @@
# provide feedback on failure
if ret != 0:
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
self.grwiz.SwitchEnv('target')
@@ -1734,7 +1736,8 @@
if returncode == 0:
self.VectGRList.append(self.outname)
- print '*****vector list = ' + str(self.VectGRList)
+ print('*****vector list = ' + str(self.VectGRList),
+ file=sys.stderr)
else:
self._giface.WriteError(
_('Georectification of vector map <%s> failed') %
Modified: grass/trunk/gui/wxpython/iscatt/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/frame.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/iscatt/frame.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -17,6 +17,9 @@
@author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
"""
+
+from __future__ import print_function
+
import os
import sys
@@ -333,8 +336,8 @@
def OnClose(self, event):
"""Close dialog"""
- # TODO
- print "closed"
+ # TODO: why todo here, why print? just delete?
+ print("closed")
self.scatt_mgr.CleanUp()
self.Destroy()
Modified: grass/trunk/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/giface.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/lmgr/giface.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -15,6 +15,8 @@
@author Vaclav Petras <wenzeslaus gmail.com>
"""
+from __future__ import print_function
+
import os
from grass.pydispatch.signal import Signal
@@ -139,8 +141,8 @@
Avoid using this method, it might be removed in the future.
"""
if key == 'name':
- print "giface.GetLayerByData(): Do not with use key='name',"
- " use GetLayersByName instead."
+ print("giface.GetLayerByData(): Do not with use key='name',"
+ " use GetLayersByName instead.")
item = self._tree.FindItemByData(key=key, value=value)
if item is None:
return None
Modified: grass/trunk/gui/wxpython/lmgr/pyshell.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/pyshell.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/lmgr/pyshell.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -18,6 +18,8 @@
@author Martin Landa <landa.martin gmail.com>
"""
+from __future__ import print_function
+
import sys
import wx
@@ -65,7 +67,7 @@
self._layout()
def _displayhook(self, value):
- print value # do not modify __builtin__._
+ print(value) # do not modify __builtin__._
def _layout(self):
sizer = wx.BoxSizer(wx.VERTICAL)
Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/mapdisp/main.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -26,6 +26,8 @@
@author Anna Kratochvilova <kratochanna gmail.com> (MapFrameBase)
"""
+from __future__ import print_function
+
import os
import sys
import time
@@ -480,11 +482,11 @@
width, height = self.MapWindow.GetClientSize()
for line in fileinput.input(monFile['env'], inplace=True):
if 'GRASS_RENDER_WIDTH' in line:
- print 'GRASS_RENDER_WIDTH={0}'.format(width)
+ print('GRASS_RENDER_WIDTH={0}'.format(width))
elif 'GRASS_RENDER_HEIGHT' in line:
- print 'GRASS_RENDER_HEIGHT={0}'.format(height)
+ print('GRASS_RENDER_HEIGHT={0}'.format(height))
else:
- print line.rstrip('\n')
+ print(line.rstrip('\n'))
class MapApp(wx.App):
@@ -587,7 +589,7 @@
if __name__ == "__main__":
if len(sys.argv) != 6:
- print __doc__
+ print(__doc__)
sys.exit(0)
# set command variable
Modified: grass/trunk/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/buffered.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/mapwin/buffered.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -21,6 +21,8 @@
@author Vaclav Petras <wenzeslaus gmail.com> (refactoring)
"""
+from __future__ import print_function
+
import os
import time
import math
@@ -589,7 +591,7 @@
gcdc = wx.GCDC(dc)
self.pdcVector.DrawToDCClipped(gcdc, rgn)
except NotImplementedError as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
self.pdcVector.DrawToDCClipped(dc, rgn)
self.bufferLast = None
@@ -604,7 +606,7 @@
gcdc = wx.GCDC(dc)
self.pdcVector.DrawToDC(gcdc)
except NotImplementedError as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
self.pdcVector.DrawToDC(dc)
# store buffered image
@@ -621,7 +623,7 @@
gcdc = wx.GCDC(dc)
self.pdcTransparent.DrawToDC(gcdc)
except NotImplementedError as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
self.pdcTransparent.DrawToDC(dc)
# draw temporary object on the foreground
Modified: grass/trunk/gui/wxpython/nviz/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/wxnviz.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/nviz/wxnviz.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -22,6 +22,8 @@
@author Anna Kratochvilova <KratochAnna seznam.cz> (Google SoC 2011)
"""
+from __future__ import print_function
+
import sys
import locale
import struct
@@ -35,7 +37,7 @@
"standard Python distribution). See the Numeric Python site "
"(http://numpy.scipy.org) for information on downloading source or "
"binaries.")
- print >> sys.stderr, "wxnviz.py: " + msg
+ print("wxnviz.py: " + msg, file=sys.stderr)
import wx
@@ -65,7 +67,7 @@
if log:
log.write(msg)
else:
- print msg
+ print(msg)
return 0
@@ -78,7 +80,7 @@
progress.SetRange(100)
progress.SetValue(value)
else:
- print value
+ print(value)
return 0
Modified: grass/trunk/gui/wxpython/photo2image/ip2i_manager.py
===================================================================
--- grass/trunk/gui/wxpython/photo2image/ip2i_manager.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/photo2image/ip2i_manager.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -24,6 +24,8 @@
@author Yann modified: graphical replacement of i.photo.2image (was in v6 using Vask lib)
"""
+from __future__ import print_function
+
import os
import sys
import shutil
@@ -162,7 +164,7 @@
p = RunCommand('g.region', 'raster='+self.src_map)
if p.returncode == 0:
- print 'returncode = ', str(p.returncode)
+ print('returncode = ', str(p.returncode))
self.Map.region = self.Map.GetRegion()
except:
pass
@@ -1035,9 +1037,9 @@
# provide feedback on failure
if ret != 0:
- print >> sys.stderr, 'ip2i: Error in i.rectify'
- print >> sys.stderr, self.grwiz.src_map
- print >> sys.stderr, msg
+ print('ip2i: Error in i.rectify', file=sys.stderr)
+ print(self.grwiz.src_map, file=sys.stderr)
+ print(msg, file=sys.stderr)
busy = wx.BusyInfo(message=_("Writing output image to group, please wait..."),
parent=self)
@@ -1053,10 +1055,10 @@
busy.Destroy()
if ret1 != 0:
- print >> sys.stderr, 'ip2i: Error in i.group'
- print >> sys.stderr, self.grwiz.src_map.split('@')[0]
- print >> sys.stderr, self.extension
- print >> sys.stderr, msg1
+ print('ip2i: Error in i.group', file=sys.stderr)
+ print(self.grwiz.src_map.split('@')[0], file=sys.stderr)
+ print(self.extension, file=sys.stderr)
+ print(msg1, file=sys.stderr)
self.grwiz.SwitchEnv('target')
Modified: grass/trunk/gui/wxpython/tools/build_modules_xml.py
===================================================================
--- grass/trunk/gui/wxpython/tools/build_modules_xml.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/tools/build_modules_xml.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -12,6 +12,8 @@
@author Anna Petrasova <kratochanna gmail.com>
"""
+from __future__ import print_function
+
import sys
from datetime import datetime
@@ -120,17 +122,17 @@
def module_test():
grass_commands = gcore.get_commands()[0]
if not 'g.region' in grass_commands:
- print "No g.region"
+ print("No g.region")
return 1
if not 'm.proj' in grass_commands:
- print "No m.proj"
+ print("No m.proj")
return 1
if not 't.rast.univar' in grass_commands:
- print "No t.rast.univar"
+ print("No t.rast.univar")
return 1
- print get_module_metadata('g.region')
- print get_module_metadata('m.proj')
- print get_module_metadata('t.rast.univar')
+ print(get_module_metadata('g.region'))
+ print(get_module_metadata('m.proj'))
+ print(get_module_metadata('t.rast.univar'))
def main():
Modified: grass/trunk/gui/wxpython/tools/update_menudata.py
===================================================================
--- grass/trunk/gui/wxpython/tools/update_menudata.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/tools/update_menudata.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -19,6 +19,8 @@
@author Martin Landa <landa.martin gmail.com>
"""
+from __future__ import print_function
+
import os
import sys
import tempfile
@@ -120,7 +122,9 @@
try:
data.tree.write(file)
except IOError:
- print >> sys.stderr, "'%s' not found. Please run the script from 'gui/wxpython'." % file
+ print("'%s' not found."
+ " Please run the script from 'gui/wxpython'." % file,
+ file=sys.stderr)
return
try:
@@ -130,7 +134,8 @@
finally:
f.close()
except IOError:
- print >> sys.stderr, "ERROR: Unable to write to menudata file."
+ print("ERROR: Unable to write to menudata file.",
+ file=sys.stderr)
def main(argv=None):
@@ -143,7 +148,7 @@
printDiff = False
if len(argv) > 1 and argv[1] == '-h':
- print >> sys.stderr, __doc__
+ print(sys.stderr, __doc__, file=sys.stderr)
return 1
nuldev = file(os.devnull, 'w+')
Modified: grass/trunk/gui/wxpython/vdigit/wxdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdisplay.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/vdigit/wxdisplay.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -17,6 +17,8 @@
@author Martin Landa <landa.martin gmail.com>
"""
+from __future__ import print_function
+
import locale
import wx
@@ -43,7 +45,7 @@
if log:
log.write(msg + os.linesep)
else:
- print msg
+ print(msg)
global last_error
last_error += ' ' + msg
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2017-11-26 23:10:23 UTC (rev 71851)
+++ grass/trunk/gui/wxpython/wxgui.py 2017-11-26 23:17:33 UTC (rev 71852)
@@ -17,6 +17,8 @@
@author Vaclav Petras <wenzeslaus gmail.com> (menu customization)
"""
+from __future__ import print_function
+
import os
import sys
import getopt
@@ -108,10 +110,10 @@
def printHelp():
""" Print program help"""
- print >> sys.stderr, "Usage:"
- print >> sys.stderr, " python wxgui.py [options]"
- print >> sys.stderr, "%sOptions:" % os.linesep
- print >> sys.stderr, " -w\t--workspace file\tWorkspace file to load"
+ print("Usage:", file=sys.stderr)
+ print(" python wxgui.py [options]", file=sys.stderr)
+ print("%sOptions:" % os.linesep, file=sys.stderr)
+ print(" -w\t--workspace file\tWorkspace file to load", file=sys.stderr)
sys.exit(1)
@@ -146,8 +148,8 @@
except getopt.error as msg:
raise Usage(msg)
except Usage as err:
- print >> sys.stderr, err.msg
- print >> sys.stderr, "for help use --help"
+ print(err.msg, file=sys.stderr)
+ print(sys.stderr, "for help use --help", file=sys.stderr)
printHelp()
workspaceFile = process_opt(opts, args)
More information about the grass-commit
mailing list