def _on_identity_item_activated(self, event): data = self._LCTRL_identity.get_selected_item_data(only_one = True) if data is None: gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') # <ctrl> down ? if not wx.GetKeyState(wx.WXK_CONTROL): gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') # <ctrl> down ! if isinstance(data, gmPerson.cPersonName): ea = gmDemographicsWidgets.cPersonNameEAPnl(self, -1, name = data) dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Cloning name')) dlg.ShowModal() return if isinstance(data, dict): key = list(data)[0] val = data[key] if key == 'id': ea = gmDemographicsWidgets.cExternalIDEditAreaPnl(self, -1, external_id = val) ea.id_holder = gmPerson.gmCurrentPatient() dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Editing external ID')) dlg.ShowModal() return if key == 'job': gmDemographicsWidgets.edit_occupation() return
def _on_identity_item_activated(self, event): data = self._LCTRL_identity.get_selected_item_data(only_one = True) if data is None: gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') # <ctrl> down ? if not wx.GetKeyState(wx.WXK_CONTROL): gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') # <ctrl> down ! if isinstance(data, gmPerson.cPersonName): ea = gmDemographicsWidgets.cPersonNameEAPnl(self, -1, name = data) dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Cloning name')) dlg.ShowModal() return if isinstance(data, dict): key = list(data.keys())[0] val = data[key] if key == 'id': ea = gmDemographicsWidgets.cExternalIDEditAreaPnl(self, -1, external_id = val) ea.id_holder = gmPerson.gmCurrentPatient() dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Editing external ID')) dlg.ShowModal() return if key == 'job': gmDemographicsWidgets.edit_occupation() return
def edit_region(parent=None, region=None): ea = cProvinceEAPnl(parent, -1, region = region) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = (region is not None)) dlg.SetTitle(gmTools.coalesce(region, _('Adding region'), _('Editing region'))) result = dlg.ShowModal() dlg.DestroyLater() return (result == wx.ID_OK)
def _add_comm(self): ea = cCommChannelEditAreaPnl(self, -1) ea.channel_owner = self.__channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea) dlg.SetTitle(_('Adding new communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _edit_comm(self, comm_channel): ea = cCommChannelEditAreaPnl(self, -1, comm_channel = comm_channel) ea.channel_owner = self.__channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Editing communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _add_address(self): ea = gmAddressWidgets.cAddressEAPnl(self, -1) ea.address_holder = self.__identity dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea) dlg.SetTitle(_('Adding new address')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _add_address(self): ea = gmAddressWidgets.cAddressEAPnl(self, -1) ea.address_holder = self.__identity dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea) dlg.SetTitle(_('Adding new address')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _add_comm(self): ea = cCommChannelEditAreaPnl(self, -1) ea.channel_owner = self.__channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea) dlg.SetTitle(_('Adding new communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def create_new_person(parent=None, activate=False): if parent is None: parent = wx.GetApp().GetTopWindow() if activate: # meaning we will switch away from the current patient if any msg = _('Before creating a new person review the encounter details\n' 'of the patient you just worked on:\n') gmEncounterWidgets.sanity_check_encounter_of_active_patient( parent=parent, msg=msg) msg = _( 'Edit the current encounter of the patient you are ABOUT TO LEAVE:' ) dbcfg = gmCfg.cCfgSQL() def_region = dbcfg.get2( option='person.create.default_region', workplace=gmPraxis.gmCurrentPraxisBranch().active_workplace, bias='user') def_country = None if def_region is None: def_country = dbcfg.get2( option='person.create.default_country', workplace=gmPraxis.gmCurrentPraxisBranch().active_workplace, bias='user') else: countries = gmDemographicRecord.get_country_for_region( region=def_region) if len(countries) == 1: def_country = countries[0]['code_country'] ea = cNewPatientEAPnl(parent, -1, country=def_country, region=def_region) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area=ea, single_entry=True) dlg.SetTitle(_('Adding new person')) ea._PRW_lastname.SetFocus() result = dlg.ShowModal() pat = ea.data dlg.Destroy() if result != wx.ID_OK: return False _log.debug('created new person [%s]', pat.ID) if activate: from Gnumed.wxpython import gmPatSearchWidgets gmPatSearchWidgets.set_active_patient(patient=pat) gmDispatcher.send(signal='display_widget', name='gmNotebookedPatientEditionPlugin') return True
def edit_episode(parent=None, episode=None): ea = cEpisodeEditAreaPnl(parent, -1) ea.data = episode ea.mode = gmTools.coalesce(episode, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(episode, _('Adding a new episode'), _('Editing an episode'))) if dlg.ShowModal() == wx.ID_OK: return True return False
def edit_episode(parent=None, episode=None, single_entry=True): ea = cEpisodeEditAreaPnl(parent, -1) ea.data = episode ea.mode = gmTools.coalesce(episode, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(episode, _('Adding a new episode'), _('Editing an episode'))) if dlg.ShowModal() == wx.ID_OK: return True return False
def edit_encounter_type(parent=None, encounter_type=None): ea = cEncounterTypeEditAreaPnl(parent = parent, id = -1) ea.data = encounter_type ea.mode = gmTools.coalesce(encounter_type, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea) dlg.SetTitle(gmTools.coalesce(encounter_type, _('Adding new encounter type'), _('Editing local encounter type name'))) if dlg.ShowModal() == wx.ID_OK: return True return False
def edit_encounter_type(parent=None, encounter_type=None): ea = cEncounterTypeEditAreaPnl(parent, -1) ea.data = encounter_type ea.mode = gmTools.coalesce(encounter_type, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea) dlg.SetTitle(gmTools.coalesce(encounter_type, _('Adding new encounter type'), _('Editing local encounter type name'))) if dlg.ShowModal() == wx.ID_OK: return True return False
def _edit_id(self, ext_id): ea = cExternalIDEditAreaPnl(self, -1, external_id = ext_id) ea.id_holder = self.__unit dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Editing external ID')) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_comm_channel(parent=None, comm_channel=None, channel_owner=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cCommChannelEditAreaPnl(parent, -1, comm_channel=comm_channel) ea.channel_owner = channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(-1, edit_area=ea, single_entry=True) dlg.SetTitle(_('Editing communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _add_id(self): ea = cExternalIDEditAreaPnl(self, -1) ea.id_holder = self.__unit dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea) dlg.SetTitle(_('Adding new external ID')) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def _on_add_new_address_button_pressed(self, event): ea = gmAddressWidgets.cAddressEAPnl(self, -1) ea.address_holder = self.__unit ea.type_is_editable = False dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea) dlg.SetTitle(_('Adding new address')) if dlg.ShowModal() != wx.ID_OK: return False self.__refresh() return True
def _on_add_new_address_button_pressed(self, event): ea = gmAddressWidgets.cAddressEAPnl(self, -1) ea.address_holder = self.__unit ea.type_is_editable = False dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea) dlg.SetTitle(_('Adding new address')) if dlg.ShowModal() != wx.ID_OK: return False self.__refresh() return True
def edit_comm_channel(parent=None, comm_channel=None, channel_owner=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cCommChannelEditAreaPnl(parent, -1, comm_channel = comm_channel) ea.channel_owner = channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Editing communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def _add_id(self): ea = cExternalIDEditAreaPnl(self, -1) ea.id_holder = self.__unit dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea) dlg.SetTitle(_('Adding new external ID')) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_template(parent=None, template=None, single_entry=False): ea = cFormTemplateEAPnl(parent, -1) ea.data = template ea.mode = gmTools.coalesce(template, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(template, _('Adding new form template'), _('Editing form template'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_org(parent=None, org=None, single_entry=False): ea = cOrganizationEAPnl(parent, -1) ea.data = org ea.mode = gmTools.coalesce(org, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(org, _('Adding new organization'), _('Editing organization'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_hospital_stay(parent=None, hospital_stay=None): ea = cHospitalStayEditAreaPnl(parent, -1) ea.data = hospital_stay ea.mode = gmTools.coalesce(hospital_stay, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(hospital_stay, _('Adding a hospitalization'), _('Editing a hospitalization'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_vaccine(parent=None, vaccine=None, single_entry=True): ea = cVaccineEAPnl(parent = parent, id = -1) ea.data = vaccine ea.mode = gmTools.coalesce(vaccine, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(vaccine, _('Adding new vaccine'), _('Editing vaccine'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_external_care_item(parent=None, external_care_item=None): ea = cExternalCareEAPnl(parent = parent, id = -1) ea.data = external_care_item ea.mode = gmTools.coalesce(external_care_item, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(external_care_item, _('Adding external care'), _('Editing external care'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def _edit_comm(self, comm_channel): ea = cCommChannelEditAreaPnl(self, -1, comm_channel=comm_channel) ea.channel_owner = self.__channel_owner dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea, single_entry=True) dlg.SetTitle(_('Editing communications channel')) if dlg.ShowModal() == wx.ID_OK: return True return False
def edit_health_issue(parent=None, issue=None): ea = cHealthIssueEditAreaPnl(parent, -1) ea.data = issue ea.mode = gmTools.coalesce(issue, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = (issue is not None)) dlg.SetTitle(gmTools.coalesce(issue, _('Adding a new health issue'), _('Editing a health issue'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_family_history(parent=None, family_history=None): ea = cFamilyHistoryEAPnl(parent, -1) ea.data = family_history ea.mode = gmTools.coalesce(family_history, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(family_history, _('Adding family history'), _('Editing family history'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def create_new_person(parent=None, activate=False): if parent is None: parent = wx.GetApp().GetTopWindow() if activate: # meaning we will switch away from the current patient if any msg = _( 'Before creating a new person review the encounter details\n' 'of the patient you just worked on:\n' ) gmEncounterWidgets.sanity_check_encounter_of_active_patient(parent = parent, msg = msg) msg = _('Edit the current encounter of the patient you are ABOUT TO LEAVE:') dbcfg = gmCfg.cCfgSQL() def_region = dbcfg.get2 ( option = 'person.create.default_region', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) def_country = None if def_region is None: def_country = dbcfg.get2 ( option = 'person.create.default_country', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) else: countries = gmDemographicRecord.get_country_for_region(region = def_region) if len(countries) == 1: def_country = countries[0]['code_country'] ea = cNewPatientEAPnl(parent, -1, country = def_country, region = def_region) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Adding new person')) ea._PRW_lastname.SetFocus() result = dlg.ShowModal() pat = ea.data dlg.DestroyLater() if result != wx.ID_OK: return False _log.debug('created new person [%s]', pat.ID) if activate: from Gnumed.wxpython import gmPatSearchWidgets gmPatSearchWidgets.set_active_patient(patient = pat) gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') return True
def edit_procedure(parent=None, procedure=None): ea = cProcedureEAPnl(parent, -1) ea.data = procedure ea.mode = gmTools.coalesce(procedure, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(procedure, _('Adding a procedure'), _('Editing a procedure'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_health_issue(parent=None, issue=None, single_entry=False): ea = cHealthIssueEditAreaPnl(parent, -1) ea.data = issue ea.mode = gmTools.coalesce(issue, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(issue, _('Adding a new health issue'), _('Editing a health issue'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_procedure(parent=None, procedure=None, single_entry=True): ea = cProcedureEAPnl(parent, -1) ea.data = procedure ea.mode = gmTools.coalesce(procedure, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(procedure, _('Adding a procedure'), _('Editing a procedure'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_translation(parent=None, translation=None, single_entry=False): ea = cDatabaseTranslationEAPnl(parent, -1) ea.data = translation ea.mode = gmTools.coalesce(translation, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(translation, _('Adding new translation'), _('Editing translation'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_org(parent=None, org=None, single_entry=False): ea = cOrganizationEAPnl(parent = parent, id = -1) ea.data = org ea.mode = gmTools.coalesce(org, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(org, _('Adding new organization'), _('Editing organization'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_family_history(parent=None, family_history=None): ea = cFamilyHistoryEAPnl(parent = parent, id = -1) ea.data = family_history ea.mode = gmTools.coalesce(family_history, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(family_history, _('Adding family history'), _('Editing family history'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def _edit_address(self, address): ea = gmAddressWidgets.cAddressEAPnl(self, -1, address = address) ea.address_holder = self.__identity dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea) dlg.SetTitle(_('Editing address')) if dlg.ShowModal() == wx.ID_OK: # did we add an entirely new address ? # if so then unlink the old one as implied by "edit" if ea.address['pk_address'] != address['pk_address']: self.__identity.unlink_address(address = address) return True return False
def _edit_address(self, address): ea = gmAddressWidgets.cAddressEAPnl(self, -1, address=address) ea.address_holder = self.__identity dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area=ea) dlg.SetTitle(_('Editing address')) if dlg.ShowModal() == wx.ID_OK: # did we add an entirely new address ? # if so then unlink the old one as implied by "edit" if ea.address['pk_address'] != address['pk_address']: self.__identity.unlink_address(address=address) return True return False
def edit(expansion=None): ea = cTextExpansionEditAreaPnl(parent, -1, expansion = expansion) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea) if expansion is None: title = _('Adding keyword expansion') else: title = _('Editing keyword expansion "%s"') % expansion['keyword'] dlg.SetTitle(title) if dlg.ShowModal() == wx.ID_OK: return True return False
def edit_substance_abuse(parent=None, intake=None, patient=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cSubstanceAbuseEAPnl(parent, -1, intake = intake, patient = patient) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = (intake is not None)) dlg.SetTitle(gmTools.coalesce(intake, _('Adding substance abuse'), _('Editing substance abuse'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_waiting_list_entry(parent=None, entry=None, patient=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cWaitingListEntryEditAreaPnl(parent, -1, patient = gmTools.bool2subst((entry is None), patient, None)) ea.data = entry ea.mode = gmTools.coalesce(entry, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(entry, _('Adding new waiting list entry'), _('Editing waiting list entry'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_waiting_list_entry(parent=None, entry=None, patient=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cWaitingListEntryEditAreaPnl(parent, -1, patient = gmTools.bool2subst((entry is None), patient, None)) ea.data = entry ea.mode = gmTools.coalesce(entry, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(gmTools.coalesce(entry, _('Adding new waiting list entry'), _('Editing waiting list entry'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_org_unit(parent=None, org_unit=None, single_entry=False, org=None): ea = cOrgUnitEAPnl(parent, -1) ea.data = org_unit ea.mode = gmTools.coalesce(org_unit, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) if org is not None: ea.organization = org dlg.SetTitle(gmTools.coalesce(org_unit, _('Adding new organizational unit'), _('Editing organizational unit'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_vaccination(parent=None, vaccination=None, single_entry=True): ea = cVaccinationEAPnl(parent, -1) ea.data = vaccination ea.mode = gmTools.coalesce(vaccination, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(vaccination, _('Adding new vaccinations'), _('Editing vaccination'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() if not single_entry: return True return False
def edit_inbox_message(parent=None, message=None, single_entry=True): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cInboxMessageEAPnl(parent = parent, id = -1) ea.data = message ea.mode = gmTools.coalesce(message, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(message, _('Adding new inbox message'), _('Editing inbox message'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_dynamic_hint(parent=None, hint=None, single_entry=True): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cAutoHintEAPnl(parent = parent, id = -1) ea.data = hint ea.mode = gmTools.coalesce(hint, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(hint, _('Adding automatic dynamic hint'), _('Editing automatic dynamic hint'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_inbox_message(parent=None, message=None, single_entry=True): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cInboxMessageEAPnl(parent, -1) ea.data = message ea.mode = gmTools.coalesce(message, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = single_entry) dlg.SetTitle(gmTools.coalesce(message, _('Adding new inbox message'), _('Editing inbox message'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_dynamic_hint(parent=None, hint=None, single_entry=True): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cAutoHintEAPnl(parent=parent, id=-1) ea.data = hint ea.mode = gmTools.coalesce(hint, "new", "edit") dlg = gmEditArea.cGenericEditAreaDlg2(parent=parent, id=-1, edit_area=ea, single_entry=single_entry) dlg.SetTitle(gmTools.coalesce(hint, _("Adding automatic dynamic hint"), _("Editing automatic dynamic hint"))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_external_care_item(parent=None, external_care_item=None): ea = cExternalCareEAPnl(parent, -1) ea.data = external_care_item ea.mode = gmTools.coalesce(external_care_item, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area=ea, single_entry=True) dlg.SetTitle( gmTools.coalesce(external_care_item, _('Adding external care'), _('Editing external care'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_hospital_stay(parent=None, hospital_stay=None): ea = cHospitalStayEditAreaPnl(parent=parent, id=-1) ea.data = hospital_stay ea.mode = gmTools.coalesce(hospital_stay, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent=parent, id=-1, edit_area=ea, single_entry=True) dlg.SetTitle( gmTools.coalesce(hospital_stay, _('Adding a hospitalization'), _('Editing a hospitalization'))) if dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return True dlg.Destroy() return False
def edit_org_unit(parent=None, org_unit=None, single_entry=False, org=None): ea = cOrgUnitEAPnl(parent, -1) ea.data = org_unit ea.mode = gmTools.coalesce(org_unit, 'new', 'edit') dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area=ea, single_entry=single_entry) if org is not None: ea.organization = org dlg.SetTitle( gmTools.coalesce(org_unit, _('Adding new organizational unit'), _('Editing organizational unit'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False
def edit_substance_abuse(parent=None, intake=None, patient=None): if parent is None: parent = wx.GetApp().GetTopWindow() ea = cSubstanceAbuseEAPnl(parent, -1, intake=intake, patient=patient) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area=ea, single_entry=(intake is not None)) dlg.SetTitle( gmTools.coalesce(intake, _('Adding substance abuse'), _('Editing substance abuse'))) if dlg.ShowModal() == wx.ID_OK: dlg.DestroyLater() return True dlg.DestroyLater() return False