Hi Ed and Paul,
Here is an update on the Mask situation:
I've been digging on the datanav, dTextBox wx.lib.masked.TextCtrl
interaction and i have solved the problem.
You just have to remove te Caption from the dTextBox construction, as
far as i know, it is not needed anyway....
Now, why does this happens? Well, first of all, i'm a newbie in python,
so i think i lack the knoledge to fully understand what is going on,
anyway, here are my finding so you guys can take a look at it.
As soon as i have the time, i will too, but for now, i just need it
working, and without the caption, it does work fine ;)
My findings:
- The font related error message happens because in dPemMixin.py line
1847 (_setDaboFont) gets not a dFont but a wxFont as a parameter, hence
the assert. I thing it doesnt hurt to patch it like this:
def _setDaboFont(self, val):
#PVG: also accep wxFont parameter
if isinstance(val, wx._gdi.Font):
val = dabo.ui.dFont(_nativeFont=self.GetFont())
assert isinstance(val, dabo.ui.dFont)
if self._constructed():
self._font = val
self.SetFont(val._nativeFont)
val.bindEvent(dabo.dEvents.FontPropertiesChanged,
self._onFontPropsChanged)
else:
self._properties["Font"] = val
so we can also accept a wxFont as a parameter.
This fixes the problem... the even with the Caption passed as an argument.
Now comes the part i dont understand... my python skills are far from
perfect, but hey...i'm a quick learner...:D
With this problem fixed, i started getting the _autofit problem, but not
in the Masked field, no, in the next created field, a plain regular
dTextBox without a Mask.
I added some debugging prints around and this is what i found:
It seems like as soon as i add a mask all of the dTextBoxes become
wx.lib.masked.TextCtrl and not plain simple wx.TextCtrls
For example:
txt = dabo.ui.dTextBox(self, Name="txt", Mask="####-###")
#wx.lib.masked.TextCtrl
#do someting with txt
txt = dabo.ui.dTextBox(self, Name="txt1") #wx.lib.masked.TextCtrl(?!?!?!)
To my knoledge, it should be a plain wx.TextCtrl, right? dTextBox
__init__ should use wx.TextCtrl as __bases__ right?
I tried changing the dTextBox demo in dabo\demo to reflect this multiple
Masked, not Masked fields and if i use the same txt variable as above,
they all are wx.lib.masked.TextCtrl, i only get the desired behaviour if
i do this:
txt = dabo.ui.dTextBox(self, Name="txt", Mask="####-###")
#wx.lib.masked.TextCtrl
#do someting with txt
txt1 = dabo.ui.dTextBox(self, Name="txt1") #wx.TextCtrl
The reason we we only got errors in datanav apps is because only there
we use the Caption on dTextBox, and as far as i know, it is useless, right?
I also detected another bug in the use of Masks, here is a patch:
dTextBoxMixin.py:662
if strVal != self.GetValue():
setter(strVal)
becomes:
if strVal != self.GetValue():
#PVG: maskedtextedit sometimes fails, on value
error..allow the code to continue
try:
setter(strVal)
except ValueError:
pass
If we dont do this, we will get semi-full forms when a field has data in
the db that does not validates with the Mask
I would go further on this one if i had the time, but right now this is
all i can do, my itch is scratched, i hope a shed some light in to it,
when i have the time i will dig it a little further.
BTW, you guys know you rock right?
Dabo is really turning into a GREAT framework, it still need polish as
you well know, but it has my full confidence.
I hope i helped in getting it to be PERFECT, and i also hope i will help
more!
Thanks Ed and Paul!..and all!
Sorry for my english, i'm portuguese, if i was not clear in some point,
please tell me and i will try to explain myself.
Regards,
Pedro Vale de Gato
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]