Skip to content

Commit

Permalink
Merge pull request #13 from petrasovaa/fix-digitizer-py3
Browse files Browse the repository at this point in the history
wxGUI/digitizer: fixes for python 3
  • Loading branch information
landam committed May 22, 2019
2 parents b43bb26 + f7047e0 commit 826170d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gui/wxpython/dbmgr/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def UpdateDialog(self, map=None, query=None, cats=None, fid=-1,
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

Expand Down Expand Up @@ -530,7 +530,7 @@ def UpdateDialog(self, map=None, query=None, cats=None, fid=-1,
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]
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/vdigit/wxdigit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ def InitCats(self):
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
Expand Down
9 changes: 8 additions & 1 deletion gui/wxpython/vdigit/wxdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
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:
Expand All @@ -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)
Expand Down Expand Up @@ -346,7 +351,9 @@ def _drawObject(self, robj):
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
Expand Down

0 comments on commit 826170d

Please sign in to comment.