def sendEDF(self): """Sends an email containing an attachment of biomedical data to a remote server or an email address""" try: dlg = wx.ProgressDialog("Sending EDF", "Sending EDF... Please Wait...", maximum = 5, parent=self._frame, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE ) dlg.Update(1,"Loading") t = Triage('rxbox.cfg') dlg.Update(2,"Logging In") t.login() dlg.Update(3,"Loading Data") headers = {'Subject': self.emailmode + ' ' + self.topic, 'X-Eccs-Priority': 'emergency', 'X-Eccs-Rxboxextension': '2001'} body = self.body afilename = [self._engine._myedf.edfilename]+self._panel['snapshot'].pics attach = {} for i in afilename: f = open(i, 'r') attach[i] = f.read() f.close() dlg.Update(4,"Sending Data") t.request(headers, body, attach) dlg.Update(5,"Sent") except: dlg.Destroy() raise
def requestVoip(self): """Sends an email containing an attachment of biomedical data to a remote server or an email address""" try: dlg = wx.ProgressDialog("Sending VoIP Request", "Sending VoIP Ticket... Please Wait...", maximum = 5, parent=self._frame, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE ) dlg.Update(1,"Loading") t = Triage('rxbox.cfg') dlg.Update(2,"Logging In") t.login() dlg.Update(3,"Loading Data") headers = {'Subject': self.emailmode + ' ' + self.topic, 'X-Eccs-Voip': self._config.get('voip', 'id'), 'X-Eccs-Rxboxextension': '2001'} body = self.body dlg.Update(4,"Sending Ticket") t.request(headers, body, {}) dlg.Update(5,"Sent") except: dlg.Destroy() raise
def sendLog(self): """Sends an email containing an attachment of biomedical data to a remote server or an email address""" try: dlg = wx.ProgressDialog("Sending Log Files", "Sending Log Files... Please Wait...", maximum = 5, parent=self._frame, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE ) dlg.Update(1,"Loading") t = Triage('rxbox.cfg') dlg.Update(2,"Logging In") t.login() dlg.Update(3,"Loading Data") headers = {'Subject': self.emailmode + ' ' + self.topic, 'X-Eccs-Priority': 'emergency', 'X-Eccs-Rxboxextension': '2001'} body = self.body afilename = ['rxboxlog'] attach = {} for i in afilename: f = open(i, 'r') attach[i] = f.read() f.close() attach['dmesg'] = subprocess.Popen("dmesg",shell=True,stdout=subprocess.PIPE).stdout.read() attach['ifconfig'] = subprocess.Popen("ifconfig",shell=True,stdout=subprocess.PIPE).stdout.read() attach['psaux'] = subprocess.Popen("ps aux",shell=True,stdout=subprocess.PIPE).stdout.read() dlg.Update(4,"Sending Data") t.request(headers, body, attach) dlg.Update(5,"Sent") except: dlg.Destroy() raise