Skip to content

Commit

Permalink
Solving wx3 problems with unicode in listStr
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdonline committed Jul 31, 2015
1 parent 8b9ab16 commit 5513bf9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
build/
dist/
docs/build/
*.bak
5 changes: 3 additions & 2 deletions traitsui/list_str_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _get_can_edit ( self ):
return self.can_edit

def _get_drag ( self ):
return unicode( self.item )
return unicode( self.item, "latin-1" )

def _get_can_drop ( self ):
return isinstance( self.value, basestring )
Expand All @@ -280,7 +280,8 @@ def _get_item ( self ):
return self.item

def _get_text ( self ):
return unicode( self.item )
return unicode( self.item, "latin-1" )


#-- Private Methods --------------------------------------------------------

Expand Down
7 changes: 6 additions & 1 deletion traitsui/wx/list_str_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def OnGetItemAttr ( self, index ):
# manage the reference count for the returned object, and it seems to be
# gc'ed before they finish using it. So we store an object reference to
# it to prevent it from going away too soon...
self._attr = attr = wx.ListItemAttr()
try:
#This is raising an error!?
self._attr = attr = wx.ListItemAttr()
except:
return None
editor = self._editor
adapter = editor.adapter

Expand Down Expand Up @@ -169,6 +173,7 @@ class _ListStrEditor ( Editor ):
# The current search string:
search = Str

_conversion = Any

#---------------------------------------------------------------------------
# Finishes initializing the editor by creating the underlying toolkit
Expand Down

0 comments on commit 5513bf9

Please sign in to comment.