def OnPharmDiff(self, e): timestamp = mainQuery.getTime() self.dirname = '' self.filelist = [] dlg = wx.FileDialog(self, "Choose a file", "", "", "*.*", wx.FD_MULTIPLE) if dlg.ShowModal() == wx.ID_OK: self.filelist = dlg.GetPaths() self.dirname = dlg.GetDirectory() if os.path.isfile(self.filelist[0]) and os.path.isfile(self.filelist[1]): dlg2 = wx.MessageDialog(self, "Proceed with file differentiation?\n\nFiles will be written to:\n"+str(self.dirname)+r"\pharmDiffResults"+timestamp+".csv", "Pharm Differential Analysis", wx.YES_NO) if dlg2.ShowModal() == wx.ID_YES: drugPharmAssoc.pharmDiff(self.filelist[0], self.filelist[1], str(self.dirname)+r"\pharmDiffResults"+timestamp+".csv") dlg2.Destroy() dlg.Destroy()
def OnGetPharm(self, e): self.downdir = '\\pharmacologic_class_indexing_spl_files'+mainQuery.getTime() dlg = wx.DirDialog(self, "Choose a directory", "", wx.DD_DIR_MUST_EXIST) if dlg.ShowModal() == wx.ID_OK: self.downdir = dlg.GetPath()+self.downdir if os.path.isfile(self.downdir+".zip") == True: if os.path.isdir(self.downdir) == True: return() else: if os.path.isdir(r"c:\cygwin64") == True or os.path.isdir(r"C:\cygwin") == True: dlg4 = wx.MessageDialog(self, "Download Complete\n\nWould you like to extract the files using cygwin? (Windows only)", "Download Status", wx.YES_NO) if dlg4.ShowModal() == wx.ID_YES: drugPharmAssoc.extractPharmData(self.downdir+".zip") dlg4.Destroy() return() else: dlg4.Destroy() return() else: dlg4 = wx.MessageDialog(self, "Download Complete", "Download Status", wx.OK) dlg4.ShowModal() dlg4.Destroy() return() dlg2 = wx.MessageDialog(self, "Click OK to download data to "+self.downdir+".zip"+"\n\nIt may take a few minutes for the file to appear", "Download In Progress", wx.OK | wx.CANCEL) if dlg2.ShowModal() == wx.ID_OK: print('Beginning download of pharmocologic index files...\n\n') drugPharmAssoc.getPharmData(self.downdir+".zip") print('Download complete\n\n') dlg2.Destroy() if os.path.isdir(r"c:\cygwin64") == True or os.path.isdir(r"C:\cygwin") == True: dlg3 = wx.MessageDialog(self, "Download Complete\n\nWould you like to extract the files using cygwin? (Windows only)", "Download Status", wx.YES_NO) if os.path.isfile(self.downdir+".zip") == True: if dlg3.ShowModal() == wx.ID_YES: drugPharmAssoc.extractPharmData(self.downdir+".zip") dlg3.Destroy() else: dlg3 = wx.MessageDialog(self, "Download Complete", "Download Status", wx.OK) dlg3.ShowModal() dlg3.Destroy() dlg.Destroy()