[GRASS-SVN] r73341 - in grass/trunk/gui/wxpython: gui_core nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 15 20:21:46 PDT 2018
Author: annakrat
Date: 2018-09-15 20:21:45 -0700 (Sat, 15 Sep 2018)
New Revision: 73341
Modified:
grass/trunk/gui/wxpython/gui_core/prompt.py
grass/trunk/gui/wxpython/nviz/main.py
grass/trunk/gui/wxpython/nviz/mapwindow.py
grass/trunk/gui/wxpython/nviz/tools.py
grass/trunk/gui/wxpython/nviz/wxnviz.py
Log:
wxGUI: fixes for Python 3 - 3D view and running commands from command console
Modified: grass/trunk/gui/wxpython/gui_core/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/prompt.py 2018-09-16 03:19:01 UTC (rev 73340)
+++ grass/trunk/gui/wxpython/gui_core/prompt.py 2018-09-16 03:21:45 UTC (rev 73341)
@@ -118,7 +118,7 @@
cmd = utils.split(str(cmdString))
except UnicodeError:
cmd = utils.split(EncodeString((cmdString)))
- cmd = map(DecodeString, cmd)
+ cmd = list(map(DecodeString, cmd))
self.promptRunCmd.emit(cmd=cmd)
Modified: grass/trunk/gui/wxpython/nviz/main.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/main.py 2018-09-16 03:19:01 UTC (rev 73340)
+++ grass/trunk/gui/wxpython/nviz/main.py 2018-09-16 03:21:45 UTC (rev 73341)
@@ -24,7 +24,7 @@
from nviz import mapwindow
from nviz import tools
from nviz import workspace
- import wxnviz
+ from nviz import wxnviz
haveNviz = True
except (ImportError, NameError) as err:
haveNviz = False
Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py 2018-09-16 03:19:01 UTC (rev 73340)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py 2018-09-16 03:21:45 UTC (rev 73341)
@@ -24,7 +24,6 @@
import time
import copy
import math
-import types
from threading import Thread
@@ -238,7 +237,7 @@
wx.CallLater(3000, self._warningDepthBuffer)
# cplanes cannot be initialized now
- wx.CallAfter(self.InitCPlanes)
+ wx.CallLater(1000, self.InitCPlanes)
def _warningDepthBuffer(self):
if not self.initView:
@@ -1485,11 +1484,11 @@
if sec1 == 'position':
data[sec][sec1]['update'] = None
continue
- if isinstance(data[sec][sec1], types.DictType):
+ if isinstance(data[sec][sec1], dict):
for sec2 in data[sec][sec1].keys():
if sec2 not in ('all', 'init', 'id'):
data[sec][sec1][sec2]['update'] = None
- elif isinstance(data[sec][sec1], types.ListType):
+ elif isinstance(data[sec][sec1], list):
for i in range(len(data[sec][sec1])):
for sec2 in data[sec][sec1][i].keys():
data[sec][sec1][i][sec2]['update'] = None
@@ -1932,7 +1931,7 @@
elif attrb == 'transp':
self._display.UnsetSurfaceTransp(id)
else:
- if isinstance(value, types.StringType):
+ if isinstance(value, str):
if len(value) == 0: # ignore empty values (TODO: warning)
continue
if map and not grass.find_file(value, element='cell')[
@@ -2048,7 +2047,7 @@
elif attrb == 'transp':
self._display.UnsetIsosurfaceTransp(id, isosurfId)
else:
- if isinstance(value, types.StringType):
+ if isinstance(value, str):
if len(value) == 0: # ignore empty values (TODO: warning)
continue
if map and not grass.find_file(value, element='grid3')[
Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py 2018-09-16 03:19:01 UTC (rev 73340)
+++ grass/trunk/gui/wxpython/nviz/tools.py 2018-09-16 03:21:45 UTC (rev 73341)
@@ -22,7 +22,6 @@
import os
import sys
import copy
-import types
import six
import wx
@@ -3504,22 +3503,22 @@
for key, item in six.iteritems(self.win[name]):
if key in ('map', 'surface', 'new', 'planes'):
continue
- if isinstance(item, types.DictType):
+ if isinstance(item, dict):
for skey, sitem in six.iteritems(self.win[name][key]):
- if isinstance(sitem, types.DictType):
+ if isinstance(sitem, dict):
for ssitem in six.itervalues(self.win[name][key][skey]):
- if not isinstance(ssitem, types.BooleanType) and \
- isinstance(ssitem, types.IntType):
+ if not isinstance(ssitem, bool) and \
+ isinstance(ssitem, int):
self.FindWindowById(ssitem).Enable(enabled)
else:
# type(bool) != types.IntType but
# isinstance(bool) == types.IntType
- if not isinstance(sitem, types.BooleanType) and \
- isinstance(sitem, types.IntType):
+ if not isinstance(sitem, bool) and \
+ isinstance(sitem, int):
self.FindWindowById(sitem).Enable(enabled)
else:
- if not isinstance(item, types.BooleanType) and \
- isinstance(item, types.IntType):
+ if not isinstance(item, bool) and \
+ isinstance(item, int):
self.FindWindowById(item).Enable(enabled)
def SetMapObjUseMap(self, nvizType, attrb, map=None):
@@ -4898,8 +4897,8 @@
except: # TODO disabled page
planeIndex = -1
- if event.GetId() in (self.win['cplane']['rotation']['rot'].values() +
- self.win['cplane']['rotation']['tilt'].values()):
+ if event.GetId() in (list(self.win['cplane']['rotation']['rot'].values()) +
+ list(self.win['cplane']['rotation']['tilt'].values())):
action = 'rotation'
else:
action = 'position'
@@ -5281,7 +5280,7 @@
self.FindWindowById(
self.win['surface']['color']['map']).SetValue(value)
else: # constant
- color = map(int, value.split(':'))
+ color = list(map(int, value.split(':')))
self.FindWindowById(
self.win['surface']['color']['const']).SetColour(color)
self.SetMapObjUseMap(
@@ -5362,7 +5361,7 @@
if name == "selection":
win.SetSelection(value)
elif name == "colour":
- color = map(int, value.split(':'))
+ color = list(map(int, value.split(':')))
win.SetColour(color)
else:
win.SetValue(value)
@@ -5434,7 +5433,7 @@
width.SetValue(data['lines']['width']['value'])
color = self.FindWindowById(self.win['vector']['lines']['color'])
- color.SetValue(map(int, data['lines']['color']['value'].split(':')))
+ color.SetValue(list(map(int, data['lines']['color']['value'].split(':'))))
for vtype in ('lines', 'points'):
if vtype == 'lines':
@@ -5490,7 +5489,7 @@
if name == 'selection':
win.SetSelection(data['points'][prop]['value'])
elif name == 'color':
- color = map(int, data['points'][prop]['value'].split(':'))
+ color = list(map(int, data['points'][prop]['value'].split(':')))
win.SetValue(color)
else:
win.SetValue(data['points'][prop]['value'])
@@ -5616,7 +5615,7 @@
self.FindWindowById(
self.win['volume'][attrb]['map']).SetValue(value)
else: # constant
- color = map(int, value.split(':'))
+ color = list(map(int, value.split(':')))
self.FindWindowById(
self.win['volume'][attrb]['const']).SetColour(color)
else:
Modified: grass/trunk/gui/wxpython/nviz/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/wxnviz.py 2018-09-16 03:19:01 UTC (rev 73340)
+++ grass/trunk/gui/wxpython/nviz/wxnviz.py 2018-09-16 03:21:45 UTC (rev 73341)
@@ -59,7 +59,7 @@
from core.debug import Debug
from core.utils import _, autoCropImageFromFile
-from core.gcmd import EncodeString
+from core.gcmd import EncodeString, DecodeString
from core.globalvar import wxPythonPhoenix
from gui_core.wrap import Rect
import grass.script as grass
@@ -72,6 +72,8 @@
"""Redirect stderr"""
global log
if log:
+ if sys.version_info.major >= 3:
+ msg = DecodeString(msg.data)
log.write(msg)
else:
print(msg)
More information about the grass-commit
mailing list