Timothy Smith:
I have a problem with my custom control not being displayed correctly by the grid editor.
it works correctly under gtk, but windows it's nothing but a line of text (it should display 2 timectrl's, text and a spinctrl). if someone could please try the attached demo under windows and verify it's not just a problem with my setup or advise on a fix i'd be greatful.
With wxPython 2.6.3.2-unicode on Python 2.4/Windows XP, I see the controls as soon as I click on one of the blue cells. I had to comment out the calls to self.AutoSizeRows and self.AutoSizeColums, btw. After I fill in one of the cells I see this traceback, which seems to suggest a bug in wx.lib.masked.timectrl:
Traceback (most recent call last):
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\ev
tmgr.py", line 442, in handleEvent
self.publisher.sendMessage(topic=self.topic, data=event)
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\pu
bsub.py", line 755, in sendMessage
self.__deliveryCount += \
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\pu
bsub.py", line 467, in sendMessage
deliveryCount += node.sendMessage(message)
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\pu
bsub.py", line 304, in sendMessage
listener(message)
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\ev
tmgr.py", line 480, in deliverEvent
self.eventHandler(event) # Perform the call as wxWindows would
File "demo.py", line 56, in TotalTime
if self.Start.GetMxDateTime().strftime('%p') == 'PM' and self.Finish.GetMxDa
teTime().strftime('%p') == 'AM':
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\ma
sked\timectrl.py", line 771, in GetMxDateTime
t = self.GetValue(as_mxDateTime=True)
File "c:\Program Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\ma
sked\timectrl.py", line 659, in GetValue
value = DateTime.DateTime(1970, 1, 1, value.GetHour(), value.GetMinute(), value.GetSecond())
NameError: global name 'DateTime' is not defined
Under wxPython 2.7.1.3-unicode, I get these tracebacks and python crashes:
Traceback (most recent call last):
File "demo.py", line 124, in Create
self._tc = TimeControl(parent,-1)
File "demo.py", line 21, in __init__
self.Name = wx.StaticText(self,id,"")
File "C:\Program Files\Python24\lib\site-packages\wx-2.7.1-msw-unicode\wx\_cor
e.py", line 7952, in SetName
return _core_.Window_SetName(*args, **kwargs)
TypeError: String or Unicode type required
Traceback (most recent call last):
File "demo.py", line 139, in SetSize
self._tc.SetDimensions(rect.x, rect.y, rect.width+2, rect.height+2,
AttributeError: 'RosterTimeEditor' object has no attribute '_tc'
demo.py:149: DeprecationWarning: Please use PyGridCellEditor.Show instead.
self.base_Show(show, attr)
HTH, Frank