Robin, All,
@Robin:
I have started testing AGW against Phoenix (using the simple snippets
in the docstrings, not the full blown demo in AGW), and the first
three widgets did not give encouraging results:
1) AdvancedSplash:
C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw>python
advancedsplash.py
Traceback (most recent call last):
File "advancedsplash.py", line 164, in <module>
class AdvancedSplash(wx.Frame):
File "advancedsplash.py", line 172, in AdvancedSplash
style=wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.STAY_ON_TOP,
AttributeError: 'module' object has no attribute 'FRAME_SHAPED'
Looks like somebody didn't add it to the interface headers so there wasn't
anything for the ETG script to extract. I'll add it for tonight's build.
OK then, let's remove wx.FRAME_SHAPED from the style bits then:
C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw>python
advancedsplash.py
advancedsplash.py:556: wxPyDeprecationWarning: Call to deprecated item
'EmptyBitmap'.
bitmap = wx.EmptyBitmap(100, 100)
Traceback (most recent call last):
File "advancedsplash.py", line 557, in <module>
splash = AdvancedSplash(None, bitmap=bitmap, timeout=5000,
agwStyle=AS_TIMEOUT)
File "advancedsplash.py", line 255, in __init__
self.reg = wx.RegionFromBitmap(self.bmp)
AttributeError: 'module' object has no attribute 'RegionFromBitmap'
Now you should just use wx.Region(self.bmp). The overloading support in SIP
will take care of routing it to the proper C++ constructor. See the note
about overloaded functions in the migration guide.
I realized a few weeks back that the generic description for most things in
the migration guide is not always helpful enough, so I made a wiki page
where people can record details about the things like this that they needed
to change while porting to Phoenix.
http://wiki.wxpython.org/ProjectPhoenix/PortingIssues
I had to stop as without wx.RegionFromBitmap there is no
AdvancedSplash. Also, the deprecation of wx.EmptyBitmap (and its
friend, wx.EmptyBitmapRGBA) is going to kill a good chunk of wx.lib
(but we can get away by automatically replacing it via some scripts).
2) AquaButton:
C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw>python aquabutton.py
aquabutton.py:305: wxPyDeprecationWarning: Using deprecated class Colour.
rc2.width, wx.NamedColour("grey"), wx.WHITE)
aquabutton.py:348: wxPyDeprecationWarning: Call to deprecated item
'EmptyBitmapRGBA'.
self._storedBitmap = wx.EmptyBitmapRGBA(max(width, 1), max(height, 1))
wx.Colour can not be a deprecated class.
Try it with last night's binaries. I made some changes yesterday that
should make the deprecation messages be more clear, and most of them should
now tell you what you should be using instead.
But I went back and changed wx.EmptyBitmapRGBA to wx.Bitmap.FromRGBA,
but all I get are two grey rectangles (where the AquaButtons should
be) and the application frame can not be closed (it's hanging). Not
sure what it means though.
3) CubeColourDialog:
Traceback (most recent call last):
File "cubecolourdialog.py", line 3503, in <module>
dlg = CubeColourDialog(None, colourData)
File "cubecolourdialog.py", line 2918, in __init__
self.DoLayout()
File "cubecolourdialog.py", line 3026, in DoLayout
panelSizer.Add((0, 0), 1, wx.EXPAND)
TypeError: Sizer.Add(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'tuple'
overload 2: argument 1 has unexpected type 'tuple'
overload 3: argument 1 has unexpected type 'tuple'
overload 4: argument 1 has unexpected type 'tuple'
overload 5: argument 1 has unexpected type 'tuple'
overload 6: argument 1 has unexpected type 'tuple'
Oops I thought that Add() and the others had an overload taking a wxSize,
which can be automatically converted from a 2 element sequence... I'll take
a look at doing something to get those working again.
It's going to be funny . After unpacking the tuple into width,
height for Sizer.Add to be happy (and changing all the instances of
wx.EmptyBitmap, DrawRectangleRect and SetClippingRect), it seems to
run OK, although when I close the CubeColourDialog window (it's a
simple dialog called via ShowModal), the app does not exit (it hangs
there, although the dialog has disappeared) as I clicked on the "OK"
button and called Destroy() on it.
I'll do some more testing in the next few days.
I have done some more porting and testing in the last few days while
porting AGW, and there are a few remarks I have written down.
First of all, if anyone cares, this file:
http://xoomer.virgilio.it/infinity77/Zipped/classic_vs_phoenix.txt
Contains a list of the most common wxPython functions, classes and
wx.Window/wx.Sizer methods which need to be changed to a new syntax in
Phoenix; it's a 2-columns, tab-separated file containing the old
wxPython name on the left and the new (if it exists) Phoenix name on
the right. I found it impressively useful while porting AGW to
Phoenix.
Few more comments follow.
General syntax:
1) All modules using wx.Font (not only AGW, also in wx.lib and in all
of your applications):
Old constructors are broken, i.e.:
wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD)
TypeError: Font(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type 'int'
overload 3: argument 4 has unexpected type 'FontStyle'
overload 4: argument 1 has unexpected type 'int'
overload 5: argument 4 has unexpected type 'FontStyle'
overload 6: argument 1 has unexpected type 'int'
overload 7: argument 1 has unexpected type 'int'
They *need* to be:
wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)
I.e., parameters 2 to 4 need to have the proper type in front of them
(FONTFAMILY_*, FONTSTYLE_* and FONTWEIGHT_*).
2) All modules using wx.Brush and wx.Pen (not only AGW, also in wx.lib
and in all of your applications):
Old constructors are broken, i.e.:
wx.Brush(wx.RED, wx.SOLID)
wx.Pen(wx.BLACK, 1, wx.DOT)
TypeError: Brush(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 2 has unexpected type 'PenStyle'
overload 3: argument 1 has unexpected type 'Colour'
overload 4: argument 1 has unexpected type 'Colour'
They *need* to be converted into:
wx.Brush(wx.RED, wx.BRUSHSTYLE_SOLID)
wx.Pen(wx.BLACK, 1, wx.PENSTYLE_DOT)
3) The Calc{Scrolled|Unscrolled}Position methods do not accept a
wx.Point or a tuple anymore, they need to be converted to 2 integer
arguments.
AGW:
Module which seem to work: AdvancedSplash, BalloonTip, ButtonPanel,
CustomTreeCtrl, FoldPanelBar, FourWaySplitter, HyperLinkCtrl,
KnobCtrl, PeakMeter, PieCtrl, PyBusyInfo, PyCollapsiblePane, PyGauge,
RulerCtrl, ShapedButton, SuperToolTip, ThumbnailCtrl, ToasterBox,
UltimateListCtrl, ZoomBar.
1) AquaButton still displays grey, empty rectangles: the OnPaint
method is never called, for some reason (see comment on GradientButton
as well);
2) CubeColourDialog seems to work, but the app still hangs after
closing the dialog (via any button), even though I explicitely call
dlg.Destroy();
3) FlatMenu has too many dependencies in need to be ported, so no
testing for now;
4) FlatNotebook:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python flatnotebook.py
Traceback (most recent call last):
File "flatnotebook.py", line 6689, in <module>
frame = MyFrame(None)
File "flatnotebook.py", line 6666, in __init__
notebook = FlatNotebook(panel, -1)
File "flatnotebook.py", line 3929, in __init__
self._pages = PageContainer(self, wx.ID_ANY, wx.DefaultPosition,
wx.DefaultSize, style)
File "flatnotebook.py", line 5129, in __init__
self._pDropTarget = FNBDropTarget(self)
File "flatnotebook.py", line 1058, in __init__
self._dataobject = wx.CustomDataObject(wx.CustomDataFormat("FlatNotebook"))
AttributeError: 'module' object has no attribute 'CustomDataFormat'
Commenting out the code with wx.CustomDataFormat I get this:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python flatnotebook.py
Traceback (most recent call last):
File "flatnotebook.py", line 5183, in OnPaint
renderer.DrawTabs(self, dc)
File "flatnotebook.py", line 2363, in DrawTabs
self.DrawLeftArrow(pc, dc)
File "flatnotebook.py", line 1852, in DrawLeftArrow
arrowBmp = wx.Bitmap(left_arrow_xpm)
TypeError: Bitmap(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type 'list'
overload 3: argument 1 has unexpected type 'list'
overload 4: argument 1 has unexpected type 'list'
overload 5: argument 1 has unexpected type 'list'
overload 6: argument 1 has unexpected type 'list'
overload 7: argument 1 has unexpected type 'list'
Now, how do we handle XPM data in Phoenix? All the available
constructors seem to reject it, although one of the wxWidgets
constructors has it:
http://docs.wxwidgets.org/trunk/classwx_bitmap.html#a0b750963aa91e021dfa222138d1678ed
5) FloatSpin:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python floatspin.py
Traceback (most recent call last):
File "floatspin.py", line 1749, in <module>
frame = MyFrame(None)
File "floatspin.py", line 1740, in __init__
increment=0.01, value=0.1, agwStyle=FS_LEFT)
File "floatspin.py", line 498, in __init__
self._textctrl.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
AttributeError: 'module' object has no attribute 'EVT_TEXT_ENTER'
6) GenericMessageDialog seems to work, but the app still hangs after
closing the dialog (via any button), even though I explicitely call
dlg.Destroy();
7) GradientButton has the same problem as AquaButton, so I believe it
is something related to wx.GCDC/wx.GraphicsContext;
8) HyperTreeList:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python hypertreelist.py
Traceback (most recent call last):
File "hypertreelist.py", line 4884, in <module>
frame = MyFrame(None)
File "hypertreelist.py", line 4868, in __init__
tree_list = HyperTreeList(self)
File "hypertreelist.py", line 4155, in __init__
self.SetBuffered(IsBufferingSupported())
File "hypertreelist.py", line 372, in IsBufferingSupported
if wx.App.GetComCtl32Version() >= 600:
AttributeError: type object 'App' has no attribute 'GetComCtl32Version'
Commenting out that code I also see:
AttributeError: 'module' object has no attribute 'TR_EXTENDED'
and:
AttributeError: 'module' object has no attribute 'TR_COLUMN_LINES'
After that HyperTreeList appears to be working (with the exception of
GetComCtl32Version).
9) InfoBar depends on wx.aui, but after removing that dependency I get this:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python infobar.py
Traceback (most recent call last):
File "infobar.py", line 866, in <module>
frame = MyFrame(None)
File "infobar.py", line 843, in __init__
self._infoBar = InfoBar(self)
File "infobar.py", line 349, in __init__
self.Init()
File "infobar.py", line 405, in Init
self._showEffect = wx.SHOW_EFFECT_MAX
AttributeError: 'module' object has no attribute 'SHOW_EFFECT_MAX'
10) LabelBook needs a bunch of XPM Bitmaps, which fail as in FlatNotebook;
11) MultiDirDialog:
E:\Phoenix\wxPython\Phoenix\wx\lib\agw>python multidirdialog.py
Traceback (most recent call last):
File "multidirdialog.py", line 128, in <module>
DD_DIR_MUST_EXIST = wx.DD_DIR_MUST_EXIST
AttributeError: 'module' object has no attribute 'DD_DIR_MUST_EXIST'
Same applies to DD_NEW_DIR_BUTTON.
12) PyProgress works, but the application hangs after destroying the
dialog (as all the other dialogs in AGW);
13) ShortcutEditor has too many dependencies on not-yet-ported stuff
in wx.lib to be tested;
14) SpeedMeter works if the dependency on wx.lib.fancytext is removed;
15) XLSGrid depends on wx.grid, so no testing for the moment.
I'll try and concentrate on other wx.lib modules (especially the ones
needed by AGW, such as wx.lib.buttons, wx.lib.fancytext and
wx.lib.embeddedimage) in the next few days. By the way,
wx.lib.embeddedimage is so fundamental (and so NOT working in Python 3
because of the idiotic string/bytes changes) that it would be nice if
some of you could try and make it runnable on both Python versions.
Last comment:
http://trac.wxwidgets.org/changeset/72064
(i.e., phoenix-port and unittest for wx.lib.stattext).
The module doesn't comply with one of the rules spelled out by the
BDFL a few days back:
"A module in wx.lib will not be considered ready (and thus not
included in the Phoenix distribution) if it doesn't have proper
documentation and unittest."
I would say that, documentation-wise, wx.lib.stattext is not ready.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
# ------------------------------------------------------------- #
def ask_mailing_list_support(email):
if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# ------------------------------------------------------------- #
···
On 10 July 2012 21:50, Robin Dunn wrote:
On 7/10/12 11:56 AM, Andrea Gavana wrote: