porting gui2py (pythoncard fork) to py3k+phoenix: it works! but some issues found

Dear:

Thank you for your excellent work in py3k + phoenix, just using 2to3
and minor fixes I almost could get my code working from wx2.8 to
wx2.9.5.81 (py2.5 to py3.2) in an initial attempt.

I found the following issues:

wx.DatePickerCtrl is not there, what should be used instead?

wx.gizmos.TreeListCtrl seems not to be there too, what should be used instead?
No module named wx.propgrid, will it be supported?

maskededit seems to be unported (uses types module, old string
manipulation and some py2 constructs), are you planing to maintain it
in phoenix?
I could fix some minor issues in maskedit.py and numctrl.py (attached
diff) but I'm not sure about several needed changes, for example:

in numctrl.py I get the following exception about Validator_IsSilent,
how should it be fixed?

  File "/home/reingart/gui2py/3/wx/lib/masked/numctrl.py", line 971,
in _disallowValue
    if not wx.Validator_IsSilent():
AttributeError: 'module' object has no attribute 'Validator_IsSilent'

In listctrl (and in maskededit too), its checks with type to look for
a string / unicode, how this check should be made in py3k + phoenix?

  File "/home/reingart/gui2py/3/wx/lib/mixins/listctrl.py", line 157,
in __ColumnSorter
    if type(item1) == unicode and type(item2) == unicode:

Sorry if this is replied in some place, I did a quick search at
http://wiki.wxpython.org/ProjectPhoenix but didn't found specific info

For the curious, this is how gui2py looks in phoenix + py3k:

https://gui2py.googlecode.com/hg/screenshots/ubuntu/sample_phoenix.png

(yes, it looks almost identical to classic, including notebook, tree,
grid, list, label, textbox, etc., but with the mentioned issues on
maskedit and datepicker)

https://gui2py.googlecode.com/hg/screenshots/ubuntu/minimal_phoenix.png

The visual designer is not working right now as TreeListCtrl and
PropertyGrid are not supported on this version of phoenix, but the
applications made with the library run well (with the issues described
before).

If anyone is interested, in the commit messages are the description of
the changes needed to port from classic to phoenix:

https://code.google.com/p/gui2py/source/list

For more info in the project, see:

https://code.google.com/p/gui2py/

Let me know if I can be of any further help

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com

masked.diff (2.58 KB)

Hi Mariano,

···

On 23 April 2013 17:30, Mariano Reingart wrote:

Dear:

Thank you for your excellent work in py3k + phoenix, just using 2to3

and minor fixes I almost could get my code working from wx2.8 to

wx2.9.5.81 (py2.5 to py3.2) in an initial attempt.

I found the following issues:

wx.DatePickerCtrl is not there, what should be used instead?

It is now in the wx.adv module, as wx.adv.DatePickerCtrl.

wx.gizmos.TreeListCtrl seems not to be there too, what should be used instead?

I think Robin has decided to drop the gizmos package, so I guess your only alternatives are related to wx.lib.agw.hypertreelist and wx.adv.TreeListCtrl (not sure how compatible the last one is with wx.gizmos.TreeListCtrl).

No module named wx.propgrid, will it be supported?

I think so, as soon as it gets “ported” to Phoenix (i.e., the various wrappers for SIP are ready). This is for Robin to decide and mostly depends on how much time he has to devote to wxPython.

maskededit seems to be unported (uses types module, old string

manipulation and some py2 constructs), are you planing to maintain it

in phoenix?

I could fix some minor issues in maskedit.py and numctrl.py (attached

diff) but I’m not sure about several needed changes, for example:

in numctrl.py I get the following exception about Validator_IsSilent,

how should it be fixed?

File “/home/reingart/gui2py/3/wx/lib/masked/numctrl.py”, line 971,

in _disallowValue

if not wx.Validator_IsSilent():

AttributeError: ‘module’ object has no attribute ‘Validator_IsSilent’

I think Werner has done some major work to support masked controls, have you checked if you have the very latest tarball of Phoenix?

In listctrl (and in maskededit too), its checks with type to look for

a string / unicode, how this check should be made in py3k + phoenix?

File “/home/reingart/gui2py/3/wx/lib/mixins/listctrl.py”, line 157,

in __ColumnSorter

if type(item1) == unicode and type(item2) == unicode:

I don’t think anyone has started porting the mixins (for list and tree controls) yet.

Sorry if this is replied in some place, I did a quick search at

http://wiki.wxpython.org/ProjectPhoenix but didn’t found specific info

For the curious, this is how gui2py looks in phoenix + py3k:

https://gui2py.googlecode.com/hg/screenshots/ubuntu/sample_phoenix.png

Nice one, keep up the good work.

Let me know if I can be of any further help

I believe the Phoenix project could use some more people helping in the porting of pure-Python widgets (i.e., the ones in wx.lib and sub-folders).

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://www.infinity77.net

-------------------------------------------------------------

def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
    send_message(email)
else:

    install_malware()
    erase_hard_drives()

-------------------------------------------------------------

Dear:

Thank you for your excellent work in py3k + phoenix, just using 2to3
and minor fixes I almost could get my code working from wx2.8 to
wx2.9.5.81 (py2.5 to py3.2) in an initial attempt.

I found the following issues:

wx.DatePickerCtrl is not there, what should be used instead?

see:
http://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html

wx.gizmos.TreeListCtrl seems not to be there too, what should be used instead?
No module named wx.propgrid, will it be supported?

maskededit seems to be unported (uses types module, old string
manipulation and some py2 constructs), are you planing to maintain it
in phoenix?

I hope so:-) , I just about only use the masked controls.

Werner

···

On 23/04/2013 17:30, Mariano Reingart wrote:

Only Phoenix related and nothing for py3.
I think/guess that you should do:
if ‘phoenix’ in wx.PlatformInfo:
if not wx.Validator.IsSilent():
etc
else:
if not wx.Validator_IsSilent(): etc
Or something along these lines.
Werner

···

Hi,

  On 23/04/2013 17:45, Andrea Gavana wrote:
          in

numctrl.py I get the following exception about
Validator_IsSilent,

          how should it be fixed?



            File "/home/reingart/gui2py/3/wx/lib/masked/numctrl.py",

line 971,

          in _disallowValue

              if not wx.Validator_IsSilent():

          AttributeError: 'module' object has no attribute

‘Validator_IsSilent’

          I think Werner has done some major work to

support masked controls, have you checked if you have the
very latest tarball of Phoenix?

Ok, I'll try to fix and test that issues (at least I think I can help
with pure python modules like masked and mixins).

But, what about py3k issues, for example:

    if type(item1) == unicode and type(item2) == unicode:

Could be rewriten to (in py2x):

    if isinstance(item1, basestring) and isinstance(item2, basestring):

It will need be ported with 2to3 to:

    if isinstance(item1, str) and isinstance(item2, str):

There are other cases, like numctrl using types module (you could see
the attached patch in the first email):

- elif type(value) in (types.StringType, types.UnicodeType):
+ elif isinstance(value, basestring):

or are you using six or other python 2/3 compatibility library?

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar

···

On Tue, Apr 23, 2013 at 1:28 PM, werner <wbruhin@free.fr> wrote:

Hi,

On 23/04/2013 17:45, Andrea Gavana wrote:

in numctrl.py I get the following exception about Validator_IsSilent,
how should it be fixed?

  File "/home/reingart/gui2py/3/wx/lib/masked/numctrl.py", line 971,
in _disallowValue
    if not wx.Validator_IsSilent():
AttributeError: 'module' object has no attribute 'Validator_IsSilent'

I think Werner has done some major work to support masked controls, have you
checked if you have the very latest tarball of Phoenix?

Only Phoenix related and nothing for py3.

I think/guess that you should do:
        if 'phoenix' in wx.PlatformInfo:
             if not wx.Validator.IsSilent():
                 etc
        else:
            if not wx.Validator_IsSilent():
                 etc

Or something along these lines.

Mariano Reingart wrote:

Dear:

Thank you for your excellent work in py3k + phoenix, just using 2to3
and minor fixes I almost could get my code working from wx2.8 to
wx2.9.5.81 (py2.5 to py3.2) in an initial attempt.

I found the following issues:

wx.gizmos.TreeListCtrl seems not to be there too, what should be used instead?

There is a wx.adv.TreeListCtrl that is similar. It is derived from the DataViewCtrl and so it has many of the same capabilities. If you need something more flexible, with a pluggable data model, renderers, etc. then you can also use DataViewCtrl directly and get hierarchical and/or tabular data views.

No module named wx.propgrid, will it be supported?

Eventually.

maskededit seems to be unported (uses types module, old string
manipulation and some py2 constructs), are you planing to maintain it
in phoenix?

Yep. With lots of help from the community. <hint!> See ProjectPhoenix/LibraryMigration - wxPyWiki

I could fix some minor issues in maskedit.py and numctrl.py (attached
diff) but I'm not sure about several needed changes, for example:

in numctrl.py I get the following exception about Validator_IsSilent,
how should it be fixed?

   File "/home/reingart/gui2py/3/wx/lib/masked/numctrl.py", line 971,
in _disallowValue
     if not wx.Validator_IsSilent():
AttributeError: 'module' object has no attribute 'Validator_IsSilent'

See the section in the Migration Guide about static methods. wxPython Project Phoenix Migration Guide — wxPython Phoenix 4.2.3a1 documentation

In listctrl (and in maskededit too), its checks with type to look for
a string / unicode, how this check should be made in py3k + phoenix?

   File "/home/reingart/gui2py/3/wx/lib/mixins/listctrl.py", line 157,
in __ColumnSorter
     if type(item1) == unicode and type(item2) == unicode:

We're using a copy of the six module to help make code be both Py2.7 and Py3 compatible. For example, for just testing if something is a string type then you could do:

  import wx.lib.six as six
  if isinstance(item1, six.string_types):
    ...

But in this specific case I think I would just add another layer of conditionals to the statement checking for the Python version, something like:

  if not six.PY3:
    current code
  else:
    new code

···

--
Robin Dunn
Software Craftsman

Thanks very much!

I was able to fix all the blocking issues (masked, numctrl, listctrl
mixin), so gui2py now runs without issues on phoenix (still with some
minor deprecation warning, but working fine)

I'll move the discussion to wxpython-dev with the proposed patch, and,
if accepted, clarification of the wiki with the recommendations in
this thread.

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar

···

On Tue, Apr 23, 2013 at 10:53 PM, Robin Dunn <robin@alldunn.com> wrote:

Mariano Reingart wrote:

Dear:

Thank you for your excellent work in py3k + phoenix, just using 2to3
and minor fixes I almost could get my code working from wx2.8 to
wx2.9.5.81 (py2.5 to py3.2) in an initial attempt.

I found the following issues:

wx.gizmos.TreeListCtrl seems not to be there too, what should be used
instead?

There is a wx.adv.TreeListCtrl that is similar. It is derived from the
DataViewCtrl and so it has many of the same capabilities. If you need
something more flexible, with a pluggable data model, renderers, etc. then
you can also use DataViewCtrl directly and get hierarchical and/or tabular
data views.

No module named wx.propgrid, will it be supported?

Eventually.

maskededit seems to be unported (uses types module, old string
manipulation and some py2 constructs), are you planing to maintain it
in phoenix?

Yep. With lots of help from the community. <hint!> See
ProjectPhoenix/LibraryMigration - wxPyWiki

I could fix some minor issues in maskedit.py and numctrl.py (attached
diff) but I'm not sure about several needed changes, for example:

in numctrl.py I get the following exception about Validator_IsSilent,
how should it be fixed?

   File "/home/reingart/gui2py/3/wx/lib/masked/numctrl.py", line 971,
in _disallowValue
     if not wx.Validator_IsSilent():
AttributeError: 'module' object has no attribute 'Validator_IsSilent'

See the section in the Migration Guide about static methods.
wxPython Project Phoenix Migration Guide — wxPython Phoenix 4.2.3a1 documentation

In listctrl (and in maskededit too), its checks with type to look for
a string / unicode, how this check should be made in py3k + phoenix?

   File "/home/reingart/gui2py/3/wx/lib/mixins/listctrl.py", line 157,
in __ColumnSorter
     if type(item1) == unicode and type(item2) == unicode:

We're using a copy of the six module to help make code be both Py2.7 and Py3
compatible. For example, for just testing if something is a string type
then you could do:

        import wx.lib.six as six
        if isinstance(item1, six.string_types):
                ...

But in this specific case I think I would just add another layer of
conditionals to the statement checking for the Python version, something
like:

        if not six.PY3:
                current code
        else:
                new code

Just wondering if this has gotten any traction recently. I’d like to use wxPython as part of a solution for a customer of mine, but my scenario requires propgrid. I’d like to make use of the Phoenix project if at all possible, as getting Classic up and running is a pain. :slight_smile:

Thanks,
–Jose

···

On Tuesday, April 23, 2013 8:53:38 PM UTC-5, Robin Dunn wrote:

Mariano Reingart wrote:

No module named wx.propgrid, will it be supported?

Eventually.