def __init__(self): #register our interest in the patients stored on the backend gmDispatcher.connect(self.OnDemographicsUpdated, gmSignals.demographics_updated()) |
def OnDemographicsUpdated(self, id): #id is irrelevant here; we just update the whole displayed list self.UpdatePatientList() |
def UpdatePatientList(self): #request a backend connection db = gmPG.ConnectionPool().GetConnection('demographica') cursor = db.cursor() #query patients to be displayed cursor.execute(....) result = cursor.fetchall() #display the result |
def OnPatientSelected(self, id): |
def __init__(self): #code to display and place the widget # now register our callback function with the dispatcher gmDispatcher.connect(self.Update, gmSignals.patient_selected()) |
def Update(self, id_patient): "show the currently selected patient" patient = gmCachedPerson.CachedPerson.dictresult() self.TxtctrlSurname.SetValue(patient['surname'] .... |