def contribute_translations(item=None): do_it = gmGuiHelpers.gm_show_question ( aTitle = _('Contributing translations'), aMessage = _('Do you want to contribute your translations to the GNUmed project ?') ) if not do_it: return False fname = gmTools.get_unique_filename(prefix = 'gm-db-translations-', suffix = '.sql') gmPG2.export_translations_from_database(filename = fname) msg = ( u'These are database string translations contributed by a GNUmed user.\n' '\n' '\tThe GNUmed "%s" Client' ) % gmI18N.system_locale if not gmNetworkTools.send_mail ( auth = {'user': gmNetworkTools.default_mail_sender, 'password': u'gnumed-at-gmx-net'}, sender = u'GNUmed Client <*****@*****.**>', receiver = [u'*****@*****.**'], subject = u'<contribution>: database translation', message = msg, encoding = gmI18N.get_encoding(), attachments = [[fname, u'text/plain', u'quoted-printable']] ): gmDispatcher.send(signal = 'statustext', msg = _('Unable to send mail. Cannot contribute translations to GNUmed community.') % report, beep = True) return False gmDispatcher.send(signal = 'statustext', msg = _('Thank you for your contribution to the GNUmed community!'), beep = True) return True
def _on_contribute_button_pressed(self, evt): report = self._PRW_report_name.GetValue().strip() if report == u'': gmDispatcher.send(signal = 'statustext', msg = _('Report must have a name for contribution.'), beep = False) return query = self._TCTRL_query.GetValue().strip() if query == u'': gmDispatcher.send(signal = 'statustext', msg = _('Report must have a query for contribution.'), beep = False) return do_it = gmGuiHelpers.gm_show_question ( _( 'Be careful that your contribution (the query itself) does\n' 'not contain any person-identifiable search parameters.\n' '\n' 'Note, however, that no query result data whatsoever\n' 'is included in the contribution that will be sent.\n' '\n' 'Are you sure you wish to send this query to\n' 'the gnumed community mailing list?\n' ), _('Contributing custom report') ) if not do_it: return auth = {'user': gmNetworkTools.default_mail_sender, 'password': u'gnumed-at-gmx-net'} msg = u"""--- This is a report definition contributed by a GNUmed user. --- Save it as a text file and drop it onto the Report Generator --- inside GNUmed in order to take advantage of the contribution. ---------------------------------------- --- %s %s ---------------------------------------- --- The GNUmed client. """ % (report, query) if not gmNetworkTools.send_mail ( sender = u'GNUmed Report Generator <*****@*****.**>', receiver = [u'*****@*****.**'], subject = u'user contributed report', message = msg, encoding = gmI18N.get_encoding(), server = gmNetworkTools.default_mail_server, auth = auth ): gmDispatcher.send(signal = 'statustext', msg = _('Unable to send mail. Cannot contribute report [%s] to GNUmed community.') % report, beep = True) return False gmDispatcher.send(signal = 'statustext', msg = _('Thank you for your contribution to the GNUmed community!'), beep = False) return True
def _on_contribute_button_pressed(self, evt): report = self._PRW_report_name.GetValue().strip() if report == u'': gmDispatcher.send(signal = 'statustext', msg = _('Report must have a name for contribution.'), beep = False) return query = self._TCTRL_query.GetValue().strip() if query == u'': gmDispatcher.send(signal = 'statustext', msg = _('Report must have a query for contribution.'), beep = False) return do_it = gmGuiHelpers.gm_show_question ( _( 'Be careful that your contribution (the query itself) does\n' 'not contain any person-identifiable search parameters.\n' '\n' 'Note, however, that no query result data whatsoever\n' 'is included in the contribution that will be sent.\n' '\n' 'Are you sure you wish to send this query to\n' 'the gnumed community mailing list?\n' ), _('Contributing custom report') ) if not do_it: return auth = {'user': gmNetworkTools.default_mail_sender, 'password': u'gnumed-at-gmx-net'} msg = u"""--- This is a report definition contributed by a GNUmed user. --- Save it as a text file and drop it onto the Report Generator --- inside GNUmed in order to take advantage of the contribution. ---------------------------------------- --- %s %s ---------------------------------------- --- The GNUmed client. """ % (report, query) if not gmNetworkTools.send_mail ( sender = u'GNUmed Report Generator <*****@*****.**>', receiver = [u'*****@*****.**'], subject = u'user contributed report', message = msg, encoding = gmI18N.get_encoding(), server = gmNetworkTools.default_mail_server, auth = auth ): gmDispatcher.send(signal = 'statustext', msg = _('Unable to send mail. Cannot contribute report [%s] to GNUmed community.') % report, beep = True) return False gmDispatcher.send(signal = 'statustext', msg = _('Thank you for your contribution to the GNUmed community!'), beep = False) return True
def contribute_translations(item=None): do_it = gmGuiHelpers.gm_show_question( aTitle=_('Contributing translations'), aMessage= _('Do you want to contribute your translations to the GNUmed project ?' )) if not do_it: return False fname = gmTools.get_unique_filename(prefix='gm-db-translations-', suffix='.sql') gmPG2.export_translations_from_database(filename=fname) msg = ( u'These are database string translations contributed by a GNUmed user.\n' '\n' '\tThe GNUmed "%s" Client') % gmI18N.system_locale if not gmNetworkTools.send_mail( auth={ 'user': gmNetworkTools.default_mail_sender, 'password': u'gnumed-at-gmx-net' }, sender=u'GNUmed Client <*****@*****.**>', receiver=[u'*****@*****.**'], subject=u'<contribution>: database translation', message=msg, encoding=gmI18N.get_encoding(), attachments=[[fname, u'text/plain', u'quoted-printable']]): gmDispatcher.send( signal='statustext', msg= _('Unable to send mail. Cannot contribute translations to GNUmed community.' ) % report, beep=True) return False gmDispatcher.send( signal='statustext', msg=_('Thank you for your contribution to the GNUmed community!'), beep=True) return True
def mail_log(parent=None, comment=None, helpdesk=None, sender=None): if (comment is None) or (comment.strip() == u''): comment = wx.GetTextFromUser ( message = _( 'Please enter a short note on what you\n' 'were about to do in GNUmed:' ), caption = _('Sending bug report'), parent = parent ) if comment.strip() == u'': comment = u'<user did not comment on bug report>' receivers = [] if helpdesk is not None: receivers = regex.findall ( '[\S]+@[\S]+', helpdesk.strip(), flags = regex.UNICODE | regex.LOCALE ) if len(receivers) == 0: if _is_public_database: receivers = [u'*****@*****.**'] receiver_string = wx.GetTextFromUser ( message = _( 'Edit the list of email addresses to send the\n' 'bug report to (separate addresses by spaces).\n' '\n' 'Note that <*****@*****.**> refers to\n' 'the public (!) GNUmed bugs mailing list.' ), caption = _('Sending bug report'), default_value = ','.join(receivers), parent = parent ) if receiver_string.strip() == u'': return receivers = regex.findall ( '[\S]+@[\S]+', receiver_string, flags = regex.UNICODE | regex.LOCALE ) dlg = gmGuiHelpers.c2ButtonQuestionDlg ( parent, -1, caption = _('Sending bug report'), question = _( 'Your bug report will be sent to:\n' '\n' '%s\n' '\n' 'Make sure you have reviewed the log file for potentially\n' 'sensitive information before sending out the bug report.\n' '\n' 'Note that emailing the report may take a while depending\n' 'on the speed of your internet connection.\n' ) % u'\n'.join(receivers), button_defs = [ {'label': _('Send report'), 'tooltip': _('Yes, send the bug report.')}, {'label': _('Cancel'), 'tooltip': _('No, do not send the bug report.')} ], show_checkbox = True, checkbox_msg = _('include log file in bug report') ) dlg._CHBOX_dont_ask_again.SetValue(_is_public_database) go_ahead = dlg.ShowModal() if go_ahead == wx.ID_NO: dlg.Destroy() return include_log = dlg._CHBOX_dont_ask_again.GetValue() if not _is_public_database: if include_log: result = gmGuiHelpers.gm_show_question ( _( 'The database you are connected to is marked as\n' '"in-production with controlled access".\n' '\n' 'You indicated that you want to include the log\n' 'file in your bug report. While this is often\n' 'useful for debugging the log file might contain\n' 'bits of patient data which must not be sent out\n' 'without de-identification.\n' '\n' 'Please confirm that you want to include the log !' ), _('Sending bug report') ) include_log = (result is True) if sender is None: sender = _('<not supplied>') else: if sender.strip() == u'': sender = _('<not supplied>') msg = u"""\ Report sent via GNUmed's handler for unexpected exceptions. user comment : %s client version: %s system account: %s staff member : %s sender email : %s # enable Launchpad bug tracking affects gnumed tag automatic-report importance medium """ % (comment, _client_version, _local_account, _staff_name, sender) if include_log: _log2.error(comment) _log2.warning('syncing log file for emailing') gmLog2.flush() attachments = [ [_logfile_name, 'text/plain', 'quoted-printable'] ] else: attachments = None dlg.Destroy() wx.BeginBusyCursor() try: gmNetworkTools.send_mail ( sender = '%s <%s>' % (_staff_name, gmNetworkTools.default_mail_sender), receiver = receivers, subject = u'<bug>: %s' % comment, message = msg, encoding = gmI18N.get_encoding(), server = gmNetworkTools.default_mail_server, auth = {'user': gmNetworkTools.default_mail_sender, 'password': u'gnumed-at-gmx-net'}, attachments = attachments ) gmDispatcher.send(signal='statustext', msg = _('Bug report has been emailed.')) except: _log2.exception('cannot send bug report') gmDispatcher.send(signal='statustext', msg = _('Bug report COULD NOT be emailed.')) wx.EndBusyCursor()
def mail_log(parent=None, comment=None, helpdesk=None, sender=None): if (comment is None) or (comment.strip() == u""): comment = wx.GetTextFromUser( message=_("Please enter a short note on what you\n" "were about to do in GNUmed:"), caption=_("Sending bug report"), parent=parent, ) if comment.strip() == u"": comment = u"<user did not comment on bug report>" receivers = [] if helpdesk is not None: receivers = regex.findall("[\S]+@[\S]+", helpdesk.strip(), flags=regex.UNICODE | regex.LOCALE) if len(receivers) == 0: if _is_public_database: receivers = [u"*****@*****.**"] receiver_string = wx.GetTextFromUser( message=_( "Edit the list of email addresses to send the\n" "bug report to (separate addresses by spaces).\n" "\n" "Note that <*****@*****.**> refers to\n" "the public (!) GNUmed bugs mailing list." ), caption=_("Sending bug report"), default_value=",".join(receivers), parent=parent, ) if receiver_string.strip() == u"": return receivers = regex.findall("[\S]+@[\S]+", receiver_string, flags=regex.UNICODE | regex.LOCALE) dlg = gmGuiHelpers.c2ButtonQuestionDlg( parent, -1, caption=_("Sending bug report"), question=_( "Your bug report will be sent to:\n" "\n" "%s\n" "\n" "Make sure you have reviewed the log file for potentially\n" "sensitive information before sending out the bug report.\n" "\n" "Note that emailing the report may take a while depending\n" "on the speed of your internet connection.\n" ) % u"\n".join(receivers), button_defs=[ {"label": _("Send report"), "tooltip": _("Yes, send the bug report.")}, {"label": _("Cancel"), "tooltip": _("No, do not send the bug report.")}, ], show_checkbox=True, checkbox_msg=_("include log file in bug report"), ) dlg._CHBOX_dont_ask_again.SetValue(_is_public_database) go_ahead = dlg.ShowModal() if go_ahead == wx.ID_NO: dlg.Destroy() return include_log = dlg._CHBOX_dont_ask_again.GetValue() if not _is_public_database: if include_log: result = gmGuiHelpers.gm_show_question( _( "The database you are connected to is marked as\n" '"in-production with controlled access".\n' "\n" "You indicated that you want to include the log\n" "file in your bug report. While this is often\n" "useful for debugging the log file might contain\n" "bits of patient data which must not be sent out\n" "without de-identification.\n" "\n" "Please confirm that you want to include the log !" ), _("Sending bug report"), ) include_log = result is True if sender is None: sender = _("<not supplied>") else: if sender.strip() == u"": sender = _("<not supplied>") msg = u"""\ Report sent via GNUmed's handler for unexpected exceptions. user comment : %s client version: %s system account: %s staff member : %s sender email : %s # enable Launchpad bug tracking affects gnumed tag automatic-report importance medium """ % ( comment, _client_version, _local_account, _staff_name, sender, ) if include_log: _log2.error(comment) _log2.warning("syncing log file for emailing") gmLog2.flush() attachments = [[_logfile_name, "text/plain", "quoted-printable"]] else: attachments = None dlg.Destroy() wx.BeginBusyCursor() try: gmNetworkTools.send_mail( sender="%s <%s>" % (_staff_name, gmNetworkTools.default_mail_sender), receiver=receivers, subject=u"<bug>: %s" % comment, message=msg, encoding=gmI18N.get_encoding(), server=gmNetworkTools.default_mail_server, auth={"user": gmNetworkTools.default_mail_sender, "password": u"gnumed-at-gmx-net"}, attachments=attachments, ) gmDispatcher.send(signal="statustext", msg=_("Bug report has been emailed.")) except: _log2.exception("cannot send bug report") gmDispatcher.send(signal="statustext", msg=_("Bug report COULD NOT be emailed.")) wx.EndBusyCursor()