def __init__(self, parent, id): wxPanel.__init__(self, parent, id, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER) PatientHolder.__init__(self) #-------------------- #add the main heading #-------------------- self.pasthistorypanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel( self, -1, " PAST HISTORY ") #---------------------------------- #dummy panel above the editing area #---------------------------------- self.dummypanel1 = wxPanel(self, -1, wxDefaultPosition, wxDefaultSize, 0) self.dummypanel1.SetBackgroundColour(wxColor(222, 222, 222)) #-------------------------------------------------- #now create the editarea specific for past history #------------------------------------------------- #self.editarea = gmEditArea.EditArea(self,-1,pasthistoryprompts,gmSECTION_PASTHISTORY) self.editarea = gmEditArea.gmPastHistoryEditArea(self, -1) self.dummypanel2 = wxPanel(self, -1, wxDefaultPosition, wxDefaultSize, 0) self.dummypanel2.SetBackgroundColour(wxColor(222, 222, 222)) #----------------------------------------------- #add the divider headings below the editing area #----------------------------------------------- self.significant_history_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel( self, -1, _("Significant Past Problems")) self.sizer_significant_history_heading = wxBoxSizer(wxHORIZONTAL) self.sizer_significant_history_heading.Add( self.significant_history_heading, 1, wxEXPAND) #-------------------------------------------------------------------------------------- #add the list of significant problems # # c++ Default Constructor: # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, # const wxSize& size = wxDefaultSize, long style = wxLC_ICON, # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl") # #-------------------------------------------------------------------------------------- #self.significant_problem_list = wxListCtrl(self, ID_SIGNIFICANTPASTHISTORYLIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) self.significant_problem_list = gmMultiColumnList.MultiColumnList( self, -1) self.significant_problem_list.SetFont( wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, False, '')) #self.active_problem_list = wxListCtrl(self, ID_ACTIVEPROBLEMLIST, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) self.active_problem_list = gmMultiColumnList.MultiColumnList(self, -1) self.active_problem_list.SetFont( wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, False, '')) #--------------------------------------------------------- # add some dummy data to the significant past problem list #--------------------------------------------------------- #self.significant_problem_list.InsertColumn(0, _("year onset")) #self.significant_problem_list.InsertColumn(1, _("Condition")) #self.significant_problem_list.InsertColumn(2, _("Notes")) #------------------------------------------------------------------------- #loop through the significanthistorydata array and add to the list control #note the different syntax for the first column of each row #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!! #-------------------------------------------------------------------------- #self.significant_mapper = gmListCtrlMapper(self.significant_problem_list) #self.significant_mapper.SetData( significanthistorydata) self.significant_problem_list.SetData(significanthistorydata) #items = significanthistorydata.items() #for x in range(len(items)): # key, data = items[x] # gmLog.gmDefLog.Log (gmLog.lData, items[x]) # self.significant_problem_list.InsertItem(x, data[0]) # self.significant_problem_list.SetItem(x, 1, data[1]) # self.significant_problem_list.SetItemData(x, key) # self.significant_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE) #self.significant_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE) #------------------------------------------------ #add some dummy data to the active problems list #------------------------------------------------ #self.active_problem_list.InsertColumn(0, _("Year Onset")) #self.active_problem_list.InsertColumn(1, _("Condition")) #self.active_problem_list.InsertColumn(2, _("Notes")) #------------------------------------------------------------- #loop through the activehistorydata array and add to the list control #note the different syntax for the first column of each row #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!! #------------------------------------------------------------- #self.active_mapper = gmListCtrlMapper(self.active_problem_list) #self.active_mapper.SetData( activehistorydata) self.active_problem_list.SetData(activehistorydata) #items = activehistorydata.items() #for x in range(len(items)): # key, data = items[x] # gmLog.gmDefLog.Log (gmLog.lData, items[x]) # self.active_problem_list.InsertItem(x, data[0]) # self.active_problem_list.SetItem(x, 1, data[1]) # self.active_problem_list.SetItemData(x, key) #self.active_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE) #self.active_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE) #-------------------------------------------------------------------------------------- #add a richtext control or a wxTextCtrl multiline to display the class text information #e.g. would contain say information re the penicillins #-------------------------------------------------------------------------------------- self.active_problems_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel( self, -1, _("Active Problems")) #---------------------------------------- #add an alert caption panel to the bottom #---------------------------------------- self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel( self, -1, " Alerts ") #--------------------------------------------- #add all elements to the main background sizer #--------------------------------------------- self.mainsizer = wxBoxSizer(wxVERTICAL) self.mainsizer.Add(self.pasthistorypanelheading, 0, wxEXPAND) #self.mainsizer.Add(self.dummypanel1,0,wxEXPAND) self.mainsizer.Add(self.editarea, 6, wxEXPAND) #self.mainsizer.Add(self.dummypanel2,0,wxEXPAND) self.mainsizer.Add(self.significant_history_heading, 0, wxEXPAND) self.mainsizer.Add(self.significant_problem_list, 4, wxEXPAND) self.mainsizer.Add(self.active_problems_heading, 0, wxEXPAND) self.mainsizer.Add(self.active_problem_list, 4, wxEXPAND) self.mainsizer.Add(self.alertpanel, 0, wxEXPAND) self.SetSizer(self.mainsizer) self.mainsizer.Fit self.SetAutoLayout(True) self.Show(True) gmDispatcher.connect(self._updateUI, 'clin_history_updated') self.significant_problem_list.addItemListener( self._significantPastItemSelected) self.active_problem_list.addItemListener(self._activePastItemSelected)
def callback(self, otherparam='default'): #if 'otherparam' is not passe as parameter, there is a default print "-> callback of test2 called with parameter %s\n" % otherparam gmDispatcher.send('allergy_changed', sender=None, allergy_id=1) def __call__(self, param): print "\nThis one shows how to use the dispatcher within a class definition" print "it works:", param #create an instance of each of the two classes / modules dummy = module1() dummy2=module2() #register the callback functions gmDispatcher.connect(dummy.callback, 'some signal') gmDispatcher.connect(dummy.OnAllergy, 'allergy_changed') gmDispatcher.connect(dummy2.callback, 'some signal') #now post a message (event) to all receivers #who have registered an interest in the event "some signal" #In the case of module2, the callback function catching the event will #post another message which should be handled by module1's #'OnAllergy" callback function print "\n# Posting the event 'some signal' with the parameters 'abc' and 'def'" print "# Read the code and learn why only parameter 'abc' has been handled\n" gmDispatcher.send('some signal', param='abc', ignoredparam="def") gmDispatcher.send('weird', param='abc', ignoredparam="def") print "\n# Now we send a message without a required parameter. See what happens:\n"
def __init__(self): print "instance of class test2 is initialized\n" #look at how we pass the method __call__ as 'self': gmDispatcher.connect(self, 'weird')
def __init__(self, parent,id): wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER) PatientHolder.__init__(self) #-------------------- #add the main heading #-------------------- self.pasthistorypanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1, " PAST HISTORY ") #---------------------------------- #dummy panel above the editing area #---------------------------------- self.dummypanel1 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0) self.dummypanel1.SetBackgroundColour(wxColor(222,222,222)) #-------------------------------------------------- #now create the editarea specific for past history #------------------------------------------------- #self.editarea = gmEditArea.EditArea(self,-1,pasthistoryprompts,gmSECTION_PASTHISTORY) self.editarea = gmEditArea.gmPastHistoryEditArea(self,-1) self.dummypanel2 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0) self.dummypanel2.SetBackgroundColour(wxColor(222,222,222)) #----------------------------------------------- #add the divider headings below the editing area #----------------------------------------------- self.significant_history_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Significant Past Problems")) self.sizer_significant_history_heading = wxBoxSizer(wxHORIZONTAL) self.sizer_significant_history_heading.Add(self.significant_history_heading,1, wxEXPAND) #-------------------------------------------------------------------------------------- #add the list of significant problems # # c++ Default Constructor: # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, # const wxSize& size = wxDefaultSize, long style = wxLC_ICON, # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl") # #-------------------------------------------------------------------------------------- #self.significant_problem_list = wxListCtrl(self, ID_SIGNIFICANTPASTHISTORYLIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) self.significant_problem_list = gmMultiColumnList.MultiColumnList(self, -1) self.significant_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, '')) #self.active_problem_list = wxListCtrl(self, ID_ACTIVEPROBLEMLIST, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) self.active_problem_list = gmMultiColumnList.MultiColumnList(self, -1) self.active_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, '')) #--------------------------------------------------------- # add some dummy data to the significant past problem list #--------------------------------------------------------- #self.significant_problem_list.InsertColumn(0, _("year onset")) #self.significant_problem_list.InsertColumn(1, _("Condition")) #self.significant_problem_list.InsertColumn(2, _("Notes")) #------------------------------------------------------------------------- #loop through the significanthistorydata array and add to the list control #note the different syntax for the first coloum of each row #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!! #-------------------------------------------------------------------------- #self.significant_mapper = gmListCtrlMapper(self.significant_problem_list) #self.significant_mapper.SetData( significanthistorydata) self.significant_problem_list.SetData( significanthistorydata) #items = significanthistorydata.items() #for x in range(len(items)): # key, data = items[x] # gmLog.gmDefLog.Log (gmLog.lData, items[x]) # self.significant_problem_list.InsertItem(x, data[0]) # self.significant_problem_list.SetItem(x, 1, data[1]) # self.significant_problem_list.SetItemData(x, key) # self.significant_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE) #self.significant_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE) #------------------------------------------------ #add some dummy data to the active problems list #------------------------------------------------ #self.active_problem_list.InsertColumn(0, _("Year Onset")) #self.active_problem_list.InsertColumn(1, _("Condition")) #self.active_problem_list.InsertColumn(2, _("Notes")) #------------------------------------------------------------- #loop through the activehistorydata array and add to the list control #note the different syntax for the first coloum of each row #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!! #------------------------------------------------------------- #self.active_mapper = gmListCtrlMapper(self.active_problem_list) #self.active_mapper.SetData( activehistorydata) self.active_problem_list.SetData( activehistorydata) #items = activehistorydata.items() #for x in range(len(items)): # key, data = items[x] # gmLog.gmDefLog.Log (gmLog.lData, items[x]) # self.active_problem_list.InsertItem(x, data[0]) # self.active_problem_list.SetItem(x, 1, data[1]) # self.active_problem_list.SetItemData(x, key) #self.active_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE) #self.active_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE) #-------------------------------------------------------------------------------------- #add a richtext control or a wxTextCtrl multiline to display the class text information #e.g. would contain say information re the penicillins #-------------------------------------------------------------------------------------- self.active_problems_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems")) #---------------------------------------- #add an alert caption panel to the bottom #---------------------------------------- self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ") #--------------------------------------------- #add all elements to the main background sizer #--------------------------------------------- self.mainsizer = wxBoxSizer(wxVERTICAL) self.mainsizer.Add(self.pasthistorypanelheading,0,wxEXPAND) #self.mainsizer.Add(self.dummypanel1,0,wxEXPAND) self.mainsizer.Add(self.editarea,6,wxEXPAND) #self.mainsizer.Add(self.dummypanel2,0,wxEXPAND) self.mainsizer.Add(self.significant_history_heading,0,wxEXPAND) self.mainsizer.Add(self.significant_problem_list,4,wxEXPAND) self.mainsizer.Add(self.active_problems_heading,0,wxEXPAND) self.mainsizer.Add(self.active_problem_list,4,wxEXPAND) self.mainsizer.Add(self.alertpanel,0,wxEXPAND) self.SetSizer(self.mainsizer) self.mainsizer.Fit self.SetAutoLayout(True) self.Show(True) gmDispatcher.connect(self._updateUI, 'clin_history_updated') self.significant_problem_list.addItemListener( self._significantPastItemSelected) self.active_problem_list.addItemListener(self._activePastItemSelected)
def __init__(self, parent,id): wxPanel.__init__(self,parent,id,wxDefaultPosition,wxDefaultSize,style = wxRAISED_BORDER) PatientHolder.__init__(self) #------------------------------------------------------------------------ #import social history if available this will be the top item on the page #------------------------------------------------------------------------ try: import gmGP_SocialHistory self.socialhistory = gmGP_SocialHistory.SocialHistory(self,-1) except: pass #------------------------------------------------------------------------ #import social history if available this will be the top item on the page #------------------------------------------------------------------------ try: import gmGP_FamilyHistorySummary self.familyhistorysummary = gmGP_FamilyHistorySummary.FamilyHistorySummary(self,-1) except: pass #--------------------------------------- #import active problem list if available #--------------------------------------- try: import gmGP_ActiveProblems self.activeproblemlist = gmGP_ActiveProblems.ActiveProblems(self,-1) except: pass #------------------------------ #import habits and risk factors #------------------------------ try: import gmGP_HabitsRiskFactors self.habitsriskfactors = gmGP_HabitsRiskFactors.HabitsRiskFactors(self,-1) except: pass #------------ #import inbox #------------ try: import gmGP_Inbox self.inbox = gmGP_Inbox.Inbox(self,-1) except: sys.exit(0) pass self.heading1 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems" )) self.heading2 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_(" Habits Risk Factors")) self.heading3 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Inbox")) self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1,_(" Alerts ")) #------------------------------------------------------------ #now that we have all the elements, construct the whole panel #------------------------------------------------------------ # FIXME: NO !! maybe we DON'T have all the elements ... self.sizer = wxBoxSizer(wxVERTICAL) self.sizer.Add(self.socialhistory,5,wxEXPAND) self.sizer.Add(self.familyhistorysummary,5,wxEXPAND) self.sizer.Add(self.heading1,0,wxEXPAND) self.sizer.Add(self.activeproblemlist,8,wxEXPAND) self.sizer.Add(self.heading2,0,wxEXPAND) self.sizer.Add(self.habitsriskfactors,5,wxEXPAND) self.sizer.Add(self.heading3,0,wxEXPAND) self.sizer.Add(self.inbox,5,wxEXPAND) self.sizer.Add(self.alertpanel,0,wxEXPAND) self.SetSizer(self.sizer) #set the sizer self.sizer.Fit(self) #set to minimum size as calculated by sizer self.SetAutoLayout(True) #tell frame to use the sizer self.Show(True) gmDispatcher.connect(self._updateActiveProblemsUI, u'clin_history_updated')
def __init__(self, parent,id): wxPanel.__init__(self,parent,id,wxDefaultPosition,wxDefaultSize,style = wxRAISED_BORDER) PatientHolder.__init__(self) #------------------------------------------------------------------------ #import social history if available this will be the top item on the page #------------------------------------------------------------------------ try: import gmGP_SocialHistory self.socialhistory = gmGP_SocialHistory.SocialHistory(self,-1) except Exception: pass #------------------------------------------------------------------------ #import social history if available this will be the top item on the page #------------------------------------------------------------------------ try: import gmGP_FamilyHistorySummary self.familyhistorysummary = gmGP_FamilyHistorySummary.FamilyHistorySummary(self,-1) except Exception: pass #--------------------------------------- #import active problem list if available #--------------------------------------- try: import gmGP_ActiveProblems self.activeproblemlist = gmGP_ActiveProblems.ActiveProblems(self,-1) except Exception: pass #------------------------------ #import habits and risk factors #------------------------------ try: import gmGP_HabitsRiskFactors self.habitsriskfactors = gmGP_HabitsRiskFactors.HabitsRiskFactors(self,-1) except Exception: pass #------------ #import inbox #------------ try: import gmGP_Inbox self.inbox = gmGP_Inbox.Inbox(self,-1) except Exception: sys.exit(0) pass self.heading1 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems" )) self.heading2 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_(" Habits Risk Factors")) self.heading3 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Inbox")) self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1,_(" Alerts ")) #------------------------------------------------------------ #now that we have all the elements, construct the whole panel #------------------------------------------------------------ # FIXME: NO !! maybe we DON'T have all the elements ... self.sizer = wxBoxSizer(wxVERTICAL) self.sizer.Add(self.socialhistory,5,wxEXPAND) self.sizer.Add(self.familyhistorysummary,5,wxEXPAND) self.sizer.Add(self.heading1,0,wxEXPAND) self.sizer.Add(self.activeproblemlist,8,wxEXPAND) self.sizer.Add(self.heading2,0,wxEXPAND) self.sizer.Add(self.habitsriskfactors,5,wxEXPAND) self.sizer.Add(self.heading3,0,wxEXPAND) self.sizer.Add(self.inbox,5,wxEXPAND) self.sizer.Add(self.alertpanel,0,wxEXPAND) self.SetSizer(self.sizer) #set the sizer self.sizer.Fit(self) #set to minimum size as calculated by sizer self.SetAutoLayout(True) #tell frame to use the sizer self.Show(True) gmDispatcher.connect(self._updateActiveProblemsUI, 'clin_history_updated')