Old bug appears in new XRCed & pyXRC

Hi Shen,

Hi,
    New XRCed (google code) in wxPython 2.8.7.1 has bugs in dealing
with wx.Menu.
How to repeat the bug:
1. Create a Menu and insert some MenuItem.
2. Give a name to a MenuItem, and check "assign variable"
3. Auto generate python code.
4. Create a instance of the Menu... (crash for None object has no attr
"FindItemById")

The generated code is:
   eg: self.IDM_EXIT = self.GetMenuBar().FindItemById(xrc.XRCID("IDM_EXIT"))
It should be:
  self.IDM_EXIT = self.FindItemById(xrc.XRCID("IDM_EXIT"))
Actually, I have submit a bugfix in previous wxPython release for this
problem. But now, it appears again. hehe

You're right, the version in the google code branch didn't include the
latest changes you've made. I'm going to merge them. Please use pywxrc
from wxPython before 2.8.7.1 meanwhile.

In addition, new XRCed lose all properties of items when "Make
sibling" or "Make child" operation...unstable behavior when doing tree
item selection... If I have time, I will try to fix them all.

It looses the sizeritem properties, but normally should keep the main
properties with the same name and window style flags. What kind of
problems you have with the item selection? Is it on Windows?

Regards,

Roman

···

On Sat, 2007-12-08 at 12:51 +0800, 甜瓜 wrote:

p.s. Is there any wxEvent corresponding to WM_DEVICECHANGE? I'm
writing a wx program to handle USB devices. I have to know if a new
device is plugged in or out.

Thank you!

---
ShenLei

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Thank you very much! :slight_smile:

Yeah, I have read the doc. I am using this features now. It works! Thank you.

I suggest a new XRCed useful feature:
For subclass / custom controls, the programmer usually add in their
own properties. If those properties can be also store in XRC by XRCed,
that would be very cool!
For examle, XRCed can provide a "custom data" tab for each control.
Programmer can add:
  AlphaRender = 10
  BlinkTimes = 5
  Rotate = True
  .... to the tab. Then, XRCed stored them into XRC:
        <object class="MyButton" name="BtnUpdate">
          <label>Update</label>
          <XRCED>
            <assign_var>1</assign_var>
          </XRCED>
          <Custom>
            <AlphaRender> 10 </AlphaRender>
            <BlinkTimes> 5 </BlinkTimes>
            <Rotate> True </Rotate>
          </Custom>
        </object>
Finally, pywxrc can automatically attach custom properities to the
class instance...

You can define custom properties if you define a component plugin for
XRCed. In order to use it in an application you need to derive a class
from xrc.XMLHandler where you can "read" object properties and set them
to your control instance.

There's an example here:
http://wiki.wxpython.org/XRCed_Component_Plugins

XRC library contains functions which can be used in principle to read he
custom properties after the object is constructed, however this is
probably not the best way and not easier than programming XML handler.

Subclasses can't have custom properties, because no special handler is
used to read their data, they are initialized in the same way as the
corresponding base class.

···

On Thu, 2007-12-13 at 10:43 +0800, 甜瓜 wrote:

  ^_^

  Thank you for your attention.
---
ShenLei

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
Roman Rolinsky