This is my first post on this list so apologies for any breaches of etiquette.
I have a problem with validators. At one point in my app I create a dialog box (based on wx.Dialog), that contains a text control to which is attached a validator. The problem is when validation fails... sometimes. The application is running on a Linux box, and when it is displayed via ssh to another Linux box it works fine. When it is displayed via ssh to a Solaris box, however, invalid input causes the application to hang.
Here's the code to Validate():
def Validate(self, window):
self.TransferFromWindow()
valid = (0 not in [c in self.allowable for c in self.value])
if self.errorCallback and not valid:
self.errorCallback("The name you have entered contains invalid
characters.")
return valid
The error message gets displayed fine, and then dismissed, and then Validate() returns False. At this point the dialog box disappears and the program hangs, if you're displaying it on Solaris. If I replace the final line of Validate() with "return True" it doesn't hang, but that doesn't really help very much.
So, the whole platform-dependence really confuses me here and I don't know where to start. Any suggestions?
···
--
Dr. Richard Lanyon
Multiple Sclerosis Research Co-ordinator
NMR Research Unit, Institute of Neurology, WC1N 3BG
Phone: 020 7837 3611 ext 4249 // Fax: 020 7278 5616
This is my first post on this list so apologies for any breaches of etiquette.
I have a problem with validators. At one point in my app I create a dialog box (based on wx.Dialog), that contains a text control to which is attached a validator. The problem is when validation fails... sometimes. The application is running on a Linux box, and when it is displayed via ssh to another Linux box it works fine. When it is displayed via ssh to a Solaris box, however, invalid input causes the application to hang.
Is your app running on the Solaris box and the display being exported to your local X-Server, or is it running on the Linux box with the display exported to the Solaris box?
Here's the code to Validate():
def Validate(self, window):
self.TransferFromWindow()
valid = (0 not in [c in self.allowable for c in self.value])
if self.errorCallback and not valid:
self.errorCallback("The name you have entered contains invalid
characters.")
return valid
The error message gets displayed fine, and then dismissed, and then Validate() returns False. At this point the dialog box disappears and the program hangs, if you're displaying it on Solaris. If I replace the final line of Validate() with "return True" it doesn't hang, but that doesn't really help very much.
Does it make any difference if you don't display a dialog for the error message?
So, the whole platform-dependence really confuses me here and I don't know where to start. Any suggestions?
If the app is running on different boxes (and it's not just a difference in which X-Server is used for the display) then it could be some problem exposed by different versions of GTK, or other libs that wxGTK depends upon. If it is just the X-Server that is different, then I have heard of problems with Solaris's X, although nothing as significant as you describe.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I have a problem with validators. At one point in my app I create a dialog box (based on wx.Dialog), that contains a text control to which is attached a validator.
...
When it is displayed via ssh to a Solaris box, however, invalid input causes the application to hang.
Is your app running on the Solaris box and the display being exported to your local X-Server, or is it running on the Linux box with the display exported to the Solaris box?
The latter - the app is running on a Linux box.
Here's the code to Validate():
def Validate(self, window):
self.TransferFromWindow()
valid = (0 not in [c in self.allowable for c in self.value])
if self.errorCallback and not valid:
self.errorCallback("The name you have entered contains invalid
characters.")
return valid
The error message gets displayed fine, and then dismissed, and then Validate() returns False. At this point the dialog box disappears and the program hangs, if you're displaying it on Solaris.
Does it make any difference if you don't display a dialog for the error message?
Interestingly, yes it does. If I comment out the lines that check for a callback and that display the error message, it no longer hangs. But on the other hand, it can't be the error message itself that is causing the hang, because if I change the last line of Validate() to "return True" then the error message on its own doesn't cause a hang. Which just confuses me even more...
···
On Fri, 19 May 2006, Robin Dunn wrote:
--
Dr. Richard Lanyon
Multiple Sclerosis Research Co-ordinator
NMR Research Unit, Institute of Neurology, WC1N 3BG
Phone: 020 7837 3611 ext 4249 // Fax: 020 7278 5616
def Validate(self, window):
self.TransferFromWindow()
valid = (0 not in [c in self.allowable for c in self.value])
if self.errorCallback and not valid:
self.errorCallback("The name you have entered contains invalid
characters.")
return valid
The error message gets displayed fine, and then dismissed, and then Validate() returns False. At this point the dialog box disappears and the program hangs, if you're displaying it on Solaris.
Does it make any difference if you don't display a dialog for the error message?
Interestingly, yes it does. If I comment out the lines that check for a callback and that display the error message, it no longer hangs. But on the other hand, it can't be the error message itself that is causing the hang, because if I change the last line of Validate() to "return True" then the error message on its own doesn't cause a hang. Which just confuses me even more...
When a validator returns False then control will remain in the dialog in order for the user to correct the problem. When the error message dialog is dismissed then it tries to restore focus to wherever it was before the dialog was opened. So my guess is that there is some conflict there, but I don't know why it would only show up when running on the Solaris X-Server, there should not be any code there that is influenced by X...
As a workaround you might try launching the error dialog later with wx.CallAfter. Then by the time the error message is shown the focus should be back in the dialog and its event loop running like normal.
···
On Fri, 19 May 2006, Robin Dunn wrote:
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!