Custom Dialog Problems and Observations

Lawrence Gray <[email protected]> Fri, 24 Apr 2020 01:50:03 -0400
Newsgroups gmane.comp.python.wxglade
Message-ID <CAJFU_KqizCN4eJ5CqOvbd-ouG-uEPSZi4aoYRSpYZQY9XmyFpQ@mail.gmail.com>
Hi:

I am a beginner using wxGlade and while learning I quickly saw the need to
come up to speed with custom widgets. I decided to try to extend the
SpeedMeter widget as a learning example which was one of the included
custom widget examples. Using wxGlade 0.9.4, I managed to reproduce the 1st
of 6  SpeedMeter widgets in the wxPython demo program, liberally borrowing
from the same and learned a lot about the purpose and using the code panel
for the widget. I just installed wxGlade 0.9.5 and see that the code for
this widget example has been upgraded in a similar manner I accomplished.

Adding extra properties in the code panel, was problematic as I encountered
an unexpected problem, which is not alluded to in any documentation that I
have seen. When the python output file is generated, the code for setting
the various properties is listed in alphabetical order of the property
names that are listed. In my case, this has the unfortunate effect of
placing the necessary operations out of logical order in the
__set__properties function. Properties named 'Intervals' and
'IntervalColours' are listed in the code with the second one first, the
opposite of what is needed as the second cannot be set until the first is
properly declared.

I have attached the wxGlade code file for reference.

Initially, I thought that the code would be generated in the order the
properties were listed in the code pane and I am wondering if there is any
way to rearrange the list of properties and force the code generator to
respect the listed order.  This might be a useful enhancement but I will
let others decide as I don't know if this is overall a significant problem.

Now that I know, in the future I will choose my property names wisely, so
the generated code will be in the logical and alphabetic order. I thought
others might like to know about this "gotcha"

Regards

-- 
------------------------------
*Lawrence Gray*
------------------------------

_______________________________________________
wxGlade-general mailing list
wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/wxglade-general
speedmeter test.wxg (application/octet-stream, 4.7 KB) - not displayed