Selaa lähdekoodia

wxGUI/digitizer: fixes for python 3 (https://trac.osgeo.org/grass/ticket/3777)

Anna Petrasova 6 vuotta sitten
vanhempi
commit
f7047e0225

+ 2 - 2
gui/wxpython/dbmgr/dialogs.py

@@ -439,7 +439,7 @@ class DisplayAttributesDialog(wx.Dialog):
         if fid > 0:
             self.fid = fid
         elif len(self.cats.keys()) > 0:
-            self.fid = self.cats.keys()[0]
+            self.fid = list(self.cats.keys())[0]
         else:
             self.fid = -1
 
@@ -530,7 +530,7 @@ class DisplayAttributesDialog(wx.Dialog):
                     ctype = columns[name]['ctype']
 
                     if columns[name]['values'][idx] is not None:
-                        if columns[name]['ctype'] != types.StringType:
+                        if not isinstance(columns[name]['ctype'], six.string_types):
                             value = str(columns[name]['values'][idx])
                         else:
                             value = columns[name]['values'][idx]

+ 1 - 1
gui/wxpython/vdigit/wxdigit.py

@@ -1767,7 +1767,7 @@ class IVDigit:
                 Vect_cidx_get_cat_by_index(self.poMapInfo, i, j,
                                            byref(cat), byref(type), byref(id))
                 if field in self.cats:
-                    if cat > self.cats[field]:
+                    if self.cats[field] is None or cat.value > self.cats[field]:
                         self.cats[field] = cat.value
                 else:
                     self.cats[field] = cat.value

+ 8 - 1
gui/wxpython/vdigit/wxdisplay.py

@@ -22,10 +22,13 @@ from __future__ import print_function
 import locale
 import six
 
+import os
+import sys
 import wx
 
 from core.debug import Debug
 from core.settings import UserSettings
+from core.gcmd import DecodeString
 from gui_core.wrap import Rect
 
 try:
@@ -48,6 +51,8 @@ def print_error(msg, type):
     """Redirect stderr"""
     global log
     if log:
+        if sys.version_info.major >= 3:
+            msg = DecodeString(msg.data)
         log.write(msg + os.linesep)
     else:
         print(msg)
@@ -346,7 +351,9 @@ class DisplayDriver:
                             point_beg.y,
                             0,
                             0))
-                    pdc.SetIdBounds(dcId, wx.RectPP(point_beg, point_end))
+                    pdc.SetIdBounds(dcId, Rect(point_beg.x, point_beg.y,
+                                               point_end.x - point_beg.x,
+                                               point_end.y - point_beg.y))
                     pdc.DrawLine(point_beg.x, point_beg.y,
                                  point_end.x, point_end.y)
                     i += 1