editor doesn't show correctly

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.

demo.py (15.3 KB)

Timothy Smith wrote:

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.

------------------------------------------------------------------------

after some playing around i've found it's a problem with my windows install. some of my windows clients are still using the wx 2.4 build, due to some problems upgrading them. is it possible to fix this issue and make it work with 2.4, or am i going to have to bite the bullet and upgrade them to 2.6.3.3 ?

Timothy Smith wrote:

Timothy Smith wrote:

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.

------------------------------------------------------------------------

after some playing around i've found it's a problem with my windows install. some of my windows clients are still using the wx 2.4 build, due to some problems upgrading them. is it possible to fix this issue and make it work with 2.4, or am i going to have to bite the bullet and upgrade them to 2.6.3.3 ?

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

i have upgraded my windows development system to 2.6, however now the renderer doesn't display correctly!!!
it appears that \n is not recognised as a valid newline inside a grid cell? (string type)

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

Frank Niessink wrote:

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

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

both your errors are bugs in wx. i seem to be stumbling all over them on this project.
with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

Timothy Smith wrote:

with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

If you want to draw multiple lines of text then you need to DrawText multiple times.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Timothy Smith wrote:

with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

If you want to draw multiple lines of text then you need to DrawText multiple times.

ok how does that work when i'm filling inital values in the gridtable though?

Timothy Smith wrote:

Robin Dunn wrote:

Timothy Smith wrote:

with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

If you want to draw multiple lines of text then you need to DrawText multiple times.

ok how does that work when i'm filling inital values in the gridtable though?

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

also, another interesting thing has happened since i started doing multiple DrawText's. the editor now spans 2 extra cells for some bizzare reason!
the inital edit is fine, but then when i go back to edit it again it spands the next 2 cells over.
again, this only happens under windows, wx 2.6.1 py 2.4.1

Timothy Smith wrote:

Robin Dunn wrote:

Timothy Smith wrote:

with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

If you want to draw multiple lines of text then you need to DrawText multiple times.

ok how does that work when i'm filling inital values in the gridtable though?

here is the attmented demo

demo.py (15.5 KB)

Timothy Smith wrote:

Timothy Smith wrote:

Robin Dunn wrote:

Timothy Smith wrote:

with an upgrade to 2.6 i can now see the editor without error, but the renderer doesn't recognise \n as a newline it just shows it as a little square.

If you want to draw multiple lines of text then you need to DrawText multiple times.

ok how does that work when i'm filling inital values in the gridtable though?

Make your renderer smart enough to draw something indicating that the cell has no data yet.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Timothy Smith wrote:

also, another interesting thing has happened since i started doing multiple DrawText's. the editor now spans 2 extra cells for some bizzare reason!
the inital edit is fine, but then when i go back to edit it again it spands the next 2 cells over.
again, this only happens under windows, wx 2.6.1 py 2.4.1

When the grid thinks that the content will be too wide to edit in a single cell, it will expand the cell to make the editor bigger. You can disable this by calling

  self.SetDefaultCellOverflow(False)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!