def _show_distance_on_map(self, address): if address is None: return False praxis_branch = gmPraxis.gmCurrentPraxisBranch() gmNetworkTools.open_url_in_browser( praxis_branch.get_distance2address_url(address), new=2, autoraise=True)
def _on_burn_items_button_pressed(self, event): event.Skip() found, external_cmd = gmShellAPI.detect_external_binary('gm-burn_doc') if not found: return False items = self._LCTRL_items.get_selected_item_data(only_one=False) if len(items) == 0: items = self._LCTRL_items.get_item_data() base_dir = None dlg = wx.DirDialog( self, message=_( 'If you wish to include an existing directory select it here:' ), defaultPath=os.path.join(gmTools.gmPaths().home_dir, 'gnumed'), style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST) choice = dlg.ShowModal() path2include = dlg.GetPath() if choice == wx.ID_OK: if not gmTools.dir_is_empty(path2include): base_dir = path2include export_dir = gmPerson.gmCurrentPatient().export_area.export( base_dir=base_dir, items=items, with_metadata=True) if export_dir is None: return False cmd = u'%s %s' % (external_cmd, export_dir) if os.name == 'nt': blocking = True else: blocking = False success = gmShellAPI.run_command_in_shell(command=cmd, blocking=blocking) if not success: gmGuiHelpers.gm_show_error( aMessage=_('Error burning documents to CD/DVD.'), aTitle=_('Burning documents')) return False self.save_soap_note(soap=_('Burned onto CD/DVD:\n - %s') % u'\n - '.join([i['description'] for i in items])) browse_index = gmGuiHelpers.gm_show_question( title=title, question=_('Browse patient data pack ?'), cancel_button=False) if browse_index: gmNetworkTools.open_url_in_browser( url=u'file://%s' % os.path.join(export_dir, u'index.html')) return True
def browse2schedules(vaccination=None): dbcfg = gmCfg.cCfgSQL() url = dbcfg.get2 ( option = 'external.urls.vaccination_plans', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user', default = gmVaccination.URL_vaccination_plan ) gmNetworkTools.open_url_in_browser(url = url) return False
def browse2schedules(vaccination=None): dbcfg = gmCfg.cCfgSQL() url = dbcfg.get2 ( option = 'external.urls.vaccination_plans', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user', default = u'http://www.bundesaerztekammer.de/downloads/STIKOEmpf2011.pdf' ) gmNetworkTools.open_url_in_browser(url = url) return False
def _on_report_button_pressed(self, event): event.Skip() dbcfg = gmCfg.cCfgSQL() url = dbcfg.get2 ( option = 'external.urls.report_vaccine_ADR', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) if url.strip() == '': url = dbcfg.get2 ( option = 'external.urls.report_ADR', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) gmNetworkTools.open_url_in_browser(url = url)
def __browse_patient_data(self, base_dir): msg = _('Documents saved into:\n\n %s') % base_dir browse_index = gmGuiHelpers.gm_show_question ( title = _('Browsing patient data excerpt'), question = msg + '\n\n' + _('Browse saved entries ?'), cancel_button = False ) if not browse_index: return if os.path.isfile(os.path.join(base_dir, 'index.html')): gmNetworkTools.open_url_in_browser(url = 'file://%s' % os.path.join(base_dir, 'index.html')) return gmMimeLib.call_viewer_on_file(base_dir, block = False)
def _on_report_button_pressed(self, event): event.Skip() dbcfg = gmCfg.cCfgSQL() url = dbcfg.get2 ( option = u'external.urls.report_vaccine_ADR', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = u'user', default = u'http://www.pei.de/cln_042/SharedDocs/Downloads/fachkreise/uaw/meldeboegen/b-ifsg-meldebogen,templateId=raw,property=publicationFile.pdf/b-ifsg-meldebogen.pdf' ) if url.strip() == u'': url = dbcfg.get2 ( option = u'external.urls.report_ADR', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = u'user' ) gmNetworkTools.open_url_in_browser(url = url)
def _on_check_url_button_pressed(self, event): url = self._TCTRL_url.GetValue().strip() if url == '': return if not gmNetworkTools.open_url_in_browser(url, new=2, autoraise=True): self.display_tctrl_as_valid(tctrl=self._TCTRL_url, valid=False) else: self.display_tctrl_as_valid(tctrl=self._TCTRL_url, valid=True)
def _on_check_url_button_pressed(self, event): url = self._TCTRL_url.GetValue().strip() if url == u"": return if not gmNetworkTools.open_url_in_browser(url, new=2, autoraise=True): self.display_tctrl_as_valid(tctrl=self._TCTRL_url, valid=False) else: self.display_tctrl_as_valid(tctrl=self._TCTRL_url, valid=True)
def _on_inbox_item_activated(self, event): data = self._LCTRL_inbox.get_selected_item_data(only_one = True) # if it is a dynamic hint open the URL for that if isinstance(data, gmAutoHints.cDynamicHint): if data['url'] is not None: gmNetworkTools.open_url_in_browser(data['url']) return # holding down <CTRL> when double-clicking an inbox # item indicates the desire to delete it # <ctrl> down ? if wx.GetKeyState(wx.WXK_CONTROL): # better safe than sorry: can only delete real inbox items if data is None: return if not isinstance(data, gmProviderInbox.cInboxMessage): return delete_it = gmGuiHelpers.gm_show_question ( question = _('Do you really want to\ndelete this inbox message ?'), title = _('Deleting inbox message') ) if not delete_it: return gmProviderInbox.delete_inbox_message(inbox_message = data['pk_inbox_message']) return if data is None: gmDispatcher.send(signal = 'display_widget', name = 'gmProviderInboxPlugin') return if not isinstance(data, gmProviderInbox.cInboxMessage): gmDispatcher.send(signal = 'display_widget', name = 'gmProviderInboxPlugin') return gmDispatcher.send(signal = 'display_widget', name = 'gmProviderInboxPlugin', filter_by_active_patient = True) return
def _on_save_items_button_pressed(self, event): event.Skip() items = self._LCTRL_items.get_selected_item_data(only_one=False) if len(items) == 0: items = self._LCTRL_items.get_item_data() if len(items) == 0: return pat = gmPerson.gmCurrentPatient() dlg = cCreatePatientMediaDlg(self, -1, burn2cd=False, patient=pat, item_count=len(items)) print("calling dlg.ShowModal()") choice = dlg.ShowModal() print("after returning from dlg.ShowModal()") if choice != wx.ID_SAVE: dlg.Destroy() return use_subdir = dlg._CHBOX_use_subdirectory.IsChecked() path = dlg._LBL_directory.Label.strip() remove_existing_data = dlg._RBTN_remove_data.Value is True generate_metadata = dlg._CHBOX_generate_metadata.IsChecked() dlg.Destroy() if use_subdir: path = gmTools.mk_sandbox_dir(prefix='%s-' % pat.subdir_name, base_dir=path) else: if remove_existing_data is True: if gmTools.rm_dir_content(path) is False: gmGuiHelpers.gm_show_error( title=_('Creating patient media'), error=_('Cannot remove content from\n [%s]') % path) return False exp_area = pat.export_area if generate_metadata: export_dir = exp_area.export(base_dir=path, items=items) else: export_dir = exp_area.dump_items_to_disk(base_dir=path, items=items) self.save_soap_note( soap=_('Saved to [%s]:\n - %s') % (export_dir, '\n - '.join([i['description'] for i in items]))) msg = _('Saved documents into directory:\n\n %s') % export_dir browse_index = gmGuiHelpers.gm_show_question( title=_('Creating patient media'), question=msg + '\n\n' + _('Browse patient data pack ?'), cancel_button=False) if browse_index: if generate_metadata: gmNetworkTools.open_url_in_browser( url='file://%s' % os.path.join(export_dir, 'index.html')) else: gmMimeLib.call_viewer_on_file(export_dir, block=False) return True
def _on_merge_button_pressed(self, event): if self._TCTRL_patient1.person is None: gmDispatcher.send(signal = 'statustext', msg = _('No patient selected on the left.'), beep = True) return if self._TCTRL_patient2.person is None: gmDispatcher.send(signal = 'statustext', msg = _('No patient selected on the right.'), beep = True) return if self._RBTN_patient1.GetValue(): patient2keep = self._TCTRL_patient1.person patient2merge = self._TCTRL_patient2.person else: patient2keep = self._TCTRL_patient2.person patient2merge = self._TCTRL_patient1.person if patient2merge['lastnames'] == 'Kirk': if _cfg.get(option = 'debug'): gmNetworkTools.open_url_in_browser(url = 'http://en.wikipedia.org/wiki/File:Picard_as_Locutus.jpg') gmGuiHelpers.gm_show_info(_('\n\nYou will be assimilated.\n\n'), _('The Borg')) return else: gmDispatcher.send(signal = 'statustext', msg = _('Cannot merge Kirk into another patient.'), beep = True) return doit = gmGuiHelpers.gm_show_question ( aMessage = _( 'Are you positively sure you want to merge patient\n\n' ' #%s: %s (%s, %s)\n\n' 'into patient\n\n' ' #%s: %s (%s, %s) ?\n\n' 'Note that this action can ONLY be reversed by a laborious\n' 'manual process requiring in-depth knowledge about databases\n' 'and the patients in question !\n' ) % ( patient2merge.ID, patient2merge['description_gender'], patient2merge['gender'], patient2merge.get_formatted_dob(format = '%Y %b %d'), patient2keep.ID, patient2keep['description_gender'], patient2keep['gender'], patient2keep.get_formatted_dob(format = '%Y %b %d') ), aTitle = _('Merging patients: confirmation'), cancel_button = False ) if not doit: return conn = gmAuthWidgets.get_dbowner_connection(procedure = _('Merging patients')) if conn is None: gmDispatcher.send(signal = 'statustext', msg = _('Cannot merge patients without admin access.'), beep = True) return success, msg = patient2keep.assimilate_identity(other_identity = patient2merge, link_obj = conn) conn.close() if not success: gmDispatcher.send(signal = 'statustext', msg = msg, beep = True) return msg = _( 'The patient\n' '\n' ' #%s: %s (%s, %s)\n' '\n' 'has successfully been merged into\n' '\n' ' #%s: %s (%s, %s)' ) % ( patient2merge.ID, patient2merge['description_gender'], patient2merge['gender'], patient2merge.get_formatted_dob(format = '%Y %b %d'), patient2keep.ID, patient2keep['description_gender'], patient2keep['gender'], patient2keep.get_formatted_dob(format = '%Y %b %d') ) title = _('Merging patients: success') curr_pat = gmPerson.gmCurrentPatient() # announce success if (curr_pat.connected) and (patient2keep.ID == curr_pat.ID): gmGuiHelpers.gm_show_info(aMessage = msg, aTitle = title) # and offer to activate kept patient if not active else: msg = msg + ( '\n\n\n' 'Do you want to activate that patient\n' 'now for further modifications ?\n' ) doit = gmGuiHelpers.gm_show_question ( aMessage = msg, aTitle = title, cancel_button = False ) if doit: wx.CallAfter(set_active_patient, patient = patient2keep) if self.IsModal(): self.EndModal(wx.ID_OK) else: self.Close()
def _show_distance_on_map(self, address): if address is None: return False praxis_branch = gmPraxis.gmCurrentPraxisBranch() gmNetworkTools.open_url_in_browser(praxis_branch.get_distance2address_url(address), new = 2, autoraise = True)
def _show_address_on_map(self, address): if address is None: return False gmNetworkTools.open_url_in_browser(address.as_map_url, new=2, autoraise=True)
def _on_schema_button_pressed(self, evt): # will block when called in text mode (that is, from a terminal, too !) gmNetworkTools.open_url_in_browser(url = 'http://wiki.gnumed.de/bin/view/Gnumed/DatabaseSchema')
def _on_schema_button_pressed(self, evt): # will block when called in text mode (that is, from a terminal, too !) gmNetworkTools.open_url_in_browser( url='http://wiki.gnumed.de/bin/view/Gnumed/DatabaseSchema')
def _on_save_items_button_pressed(self, event): event.Skip() items = self._LCTRL_items.get_selected_item_data(only_one=False) if len(items) == 0: items = self._LCTRL_items.get_item_data() dlg = wx.DirDialog( self, message=_( 'Select the directory into which to export the documents.'), defaultPath=os.path.join(gmTools.gmPaths().home_dir, 'gnumed')) choice = dlg.ShowModal() path = dlg.GetPath() if choice != wx.ID_OK: return True if not gmTools.dir_is_empty(path): reuse_nonempty_dir = gmGuiHelpers.gm_show_question( title=_(u'Saving export area documents'), question=_( u'The chosen export directory\n' u'\n' u' [%s]\n' u'\n' u'already contains files. Do you still want to save the\n' u'selected export area documents into that directory ?\n' u'\n' u'(this is useful for including the external documents\n' u' already stored in or below this directory)\n' u'\n' u'[NO] will create a subdirectory for you and use that.') % path, cancel_button=True) if reuse_nonempty_dir is None: return True if reuse_nonempty_dir is False: path = gmTools.mk_sandbox_dir( prefix=u'export-%s-' % gmPerson.gmCurrentPatient().dirname, base_dir=path) include_metadata = gmGuiHelpers.gm_show_question( title=_(u'Saving export area documents'), question=_(u'Create descriptive metadata files\n' u'and save them alongside the\n' u'selected export area documents ?'), cancel_button=True) if include_metadata is None: return True export_dir = gmPerson.gmCurrentPatient().export_area.export( base_dir=path, items=items, with_metadata=include_metadata) self.save_soap_note( soap=_('Saved to [%s]:\n - %s') % (export_dir, u'\n - '.join([i['description'] for i in items]))) title = _('Saving export area documents') msg = _('Saved documents into directory:\n\n %s') % export_dir if include_metadata: browse_index = gmGuiHelpers.gm_show_question( title=title, question=msg + u'\n\n' + _('Browse patient data pack ?'), cancel_button=False) if browse_index: gmNetworkTools.open_url_in_browser( url=u'file://%s' % os.path.join(export_dir, u'index.html')) else: gmGuiHelpers.gm_show_info(title=title, info=msg) return True
def _show_address_on_map(self, address): if address is None: return False gmNetworkTools.open_url_in_browser(address.as_map_url, new = 2, autoraise = True)
def _on_burn_items_button_pressed(self, event): event.Skip() # anything to do ? found, external_cmd = gmShellAPI.detect_external_binary('gm-burn_doc') if not found: return items = self._LCTRL_items.get_selected_item_data(only_one=False) if len(items) == 0: items = self._LCTRL_items.get_item_data() if len(items) == 0: return pat = gmPerson.gmCurrentPatient() dlg = cCreatePatientMediaDlg(self, -1, burn2cd=True, patient=pat, item_count=len(items)) choice = dlg.ShowModal() if choice != wx.ID_SAVE: return path2include = dlg._LBL_directory.Label.strip() include_selected_dir = dlg._CHBOX_include_directory.IsChecked() dlg.Destroy() # do the export base_dir = None if include_selected_dir: if gmTools.dir_is_empty(path2include) is False: base_dir = gmTools.get_unique_filename(suffix='.iso') try: shutil.copytree(path2include, base_dir) except shutil.Error: _log.exception( 'cannot copy include directory [%s] -> [%s]', path2include, base_dir) return export_dir = gmPerson.gmCurrentPatient().export_area.export( base_dir=base_dir, items=items, with_metadata=True) if export_dir is None: return # burn onto media cmd = '%s %s' % (external_cmd, export_dir) if os.name == 'nt': blocking = True else: blocking = False success = gmShellAPI.run_command_in_shell(command=cmd, blocking=blocking) if not success: gmGuiHelpers.gm_show_error( aMessage=_('Error burning documents to CD/DVD.'), aTitle=_('Burning documents')) return self.save_soap_note(soap=_('Burned onto CD/DVD:\n - %s') % '\n - '.join([i['description'] for i in items])) browse_index = gmGuiHelpers.gm_show_question( title=_('Creating patient media'), question=_('Browse patient data pack ?'), cancel_button=False) if browse_index: gmNetworkTools.open_url_in_browser( url='file://%s' % os.path.join(export_dir, 'index.html')) return True