Upgrade to 3.0 issues - mostly deprecated warnings and modal windows

Hi, Robin,

···

---------- Forwarded message ----------
From: Jacob Barhak jacob.barhak@gmail.com

Date: Sun, Feb 16, 2014 at 9:32 PM
Subject: Re: Upgrade to 3.0 issues - mostly deprecated warnings and modal windows
To: wx-users@googlegroups.com

Thanks to Robin, those issues have been resolved.

I am adding the resolutions to this post in case someone finds those helpful.

Issue 1:

wx.PySimpleApp is wx.App in the new version

wx.InitAllImageHandlers() is deprecated and can be safely removed from the code

Issue 2:

GetString was replaced with GetRange in the new version

Issue 3:

The issue was more complicated and involved a missing Event.skip() in a combo box implementation upon exit. This was application specific, yet it seems there is a difference on how some events are handled in the new version so applications should be tested thoroughly when upgrading.

Issue 4:

MakeModal was deprecated, and users should be aware of this and write their own. In this specific example the application also used wx.ProgressDialog that changed it behavior in a way that interfered with MakeModal. The solution that worked was to replace wx.ProgressDialog with wx.GenericProgressDialog and replacing MakeModal with:

def MyMakeModal(self, modal=True):
if self.IsTopLevel():
for w in wx.GetTopLevelWindows():
if w is not self and ‘Inspection’ not in str(w):
w.Enable(not modal)

Note that this MakeModal code will allow inspecting the application without locking the inspection app by another modal window

I hope this documentation of solutions will help other users.

Is all this documented for the wxPython 3.0?

Thank you.

Jacob

On Thursday, February 13, 2014 3:53:54 PM UTC-6, Jacob Barhak wrote:

Hello,

The new 3.0 release brings some incompatibilities that brake previous code.

I moved to WxPython 3.0 using conda install with anaconda 1.9 on win7 64 bit

With this upgrade move my application MIST no longer behaves as before. Here is a link tot he code I am running for reference:

https://github.com/Jacob-Barhak/MIST

Here are issues I discovered in a few minutes of playing with the app:

  1. Upon launch the following warning message appear:

Main.py:527: wxPyDeprecationWarning: Using deprecated class PySimpleApp.

app = wx.PySimpleApp(0)
Main.py:528: wxPyDeprecationWarning: Call to deprecated item ‘InitAllImageHandlers’.
wx.InitAllImageHandlers()

  1. When making changes in combo boxes in the application - the following warning appear that do not make sense:

C:\Users\Work\Desktop\MIST\CDMLib.py:1781: wxPyDeprecationWarning: Call to deprecated item ‘GetRange’. Use GetRange instead.
return str(self.GetTextCtrl().GetString(0,-1))

C:\Users\Work\Desktop\MIST\CDMLib.py:2094: wxPyDeprecationWarning: Call to deprecated item ‘GetRange’. Use GetRange instead.

RawString = self.GetString(0,-1)

C:\Users\Work\Desktop\MIST\CDMLib.py:1316: wxPyDeprecationWarning: Call to deprecated item ‘GetRange’. Use GetRange instead.
value = ctrl.GetString(0,-1)

Note that the warning message is self repeating - I assume the meaning is: GetString is deprecated - call GetRange - yet correct me if I am wrong.

  1. In a specific case in the project form it is not possible to change text in a combo box by typing - the behavior changed to the degree it hurts the user
  1. Windows that are supposed to be modal and by this block access to the parent form are no longer modal. This is unfortunate since the app is designed not to allow it the modality is important.

I assume that replacing the old deprecated code with newer functions may fix some of those issues - however, I could not find documentation of replacement with a Google search of deprecated - can someone point me to the replacements and give some advice to help migrate this code?

I hope there is a simple solution.

Jacob

Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wx-users