gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnumed-devel] re: using paint get around errors thrown on dispatcher lo


From: catmat
Subject: [Gnumed-devel] re: using paint get around errors thrown on dispatcher loop.
Date: Thu, 17 Mar 2005 09:11:40 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041231


regetMixin is using the paint event to refresh the view when the model
changes, by polling the model. the dispatcher is supposed to notify receivers
by pushing model change to the receivers, but the loop fails if any of the
receivers throw an uncaught exception. If the receiver send is wrapped in
a try, catch block, and the exception is caught and logged in the dispatcher, then the dispatcher will work as expected , so the polling with the paint event is not required.
This basically isolates errors from one gui module to another.

This means  a debugged ui module will refresh immediately
when the model changes i.e. a new patient becomes the current patient.
This avoids the problem of the ui not updating until painting is required,
e.g  when resizing.

Interestingly, the vaccination widget won't refresh to it's child listboxes
until it is first resized, and then it will refresh with each patient change thereafter.
Since the paint event isn't being listened to explicitly, I'm guessing it's
something to do with wxPython's setup of container windows.

Also the configEditor calls update() in its constructor without checking it is not a plugin.

Since I'm not the owner of these modules, it's just a suggestion.

I think the dispatcher change is a good idea anyway.


Index: pycommon/gmDispatcher.py
===================================================================
RCS file: /cvsroot/gnumed/gnumed/gnumed/client/pycommon/gmDispatcher.py,v
retrieving revision 1.2
diff -r1.2 gmDispatcher.py
9a10,11
> import Gnumed.pycommon.gmLog as gmLog
> import sys
10a13
> _log=gmLog.gmDefLog
162c165,169
< response = _call(receiver, signal=signal, sender=sender, **kwds)
---
>               try:
> response = _call(receiver, signal=signal, sender=sender, **kwds)
>               except:
> _log.LogException("Error in calling %s "% str(receiver), sys.exc_info())
>                       response = False

RCS file: /cvsroot/gnumed/gnumed/gnumed/client/wxpython/gmRegetMixin.py,v
retrieving revision 1.7
diff -r1.7 gmRegetMixin.py
47c47,48
<                       wx.EVT_PAINT(self, self._on_paint_event)
---
>                       #wx.EVT_PAINT(self, self._on_paint_event)
>                       pass
79,80c80,85
<               if self.GetUpdateRegion().IsEmpty() == 1:
<                       self._data_stale = True
---
>               #if self.GetUpdateRegion().IsEmpty() == 1:
>               #       self._data_stale = True
>               #       return True
>               #else:
>               if self.__populate_with_data():
>                       self.Refresh()
83,87c88
<                       if self.__populate_with_data():
<                               self.Refresh()
<                               return True
<                       else:
<                               return False
---
>                       return False


RCS file: /cvsroot/gnumed/gnumed/gnumed/client/wxpython/gui/gmConfigRegistry.py,v
retrieving revision 1.27
diff -r1.27 gmConfigRegistry.py
21a22
>
371c372,374
<       def __init__(self, parent, aUser,aWorkplace, plugin = 1):
---
>
> #def __init__(self, parent, aUser=gmWhoAmI.cWhoAmI().get_db_account(),aWorkplace=gmWhoAmI.cWhoAmI().get_workplace(), plugin = 1):
>       def __init__(self, parent, aUser, aWorkplace, plugin = 1):
484,485c487,490
<               if not plugin:
<                       self.configTree.update()
---
>               #if not plugin:
>               self.configTree.update()
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]