class UpdatesView(QDialog, Ui_UpdatesView): def __init__(self, parent, appargs): QDialog.__init__(self, parent) self.setupUi(self) self._app = esky.Esky(sys.executable, "http://10.78.55.218/pyrite/downloads") self._appargs = appargs self.connectActions() self.updateView() def connectActions(self): self.btnCheckForUpdates.clicked.connect(self.updateView) self.btnInstallUpdate.clicked.connect(self.installUpdate) self.btnClose.clicked.connect(self.reject) def updateView(self): self.lblCurrentVersion.setText("You are currently running Pyrite version:" " {0}".format(version.version)) update = self._app.find_update() if update is not None: self.lblAvailableUpdate.setText("Pyrite version {0} is available for" " download".format(update)) self.btnInstallUpdate.setEnabled(True) else: self.lblAvailableUpdate.setText("There are no new updates available at" " this time.") def installUpdate(self): try: # setup progress dialog self._progressDlg = QProgressDialog(self) self._progressDlg.setWindowModality(Qt.WindowModal) self._progressDlg.setAutoClose(True) self._progressDlg.setMinimum(0) self._progressDlg.setMaximum(100) self._progressDlg.setLabelText("Auto-Updating") self._progressDlg.setCancelButton(None) self._progressDlg.setValue(0) self._app.auto_update(self.autoUpdateCallback) appexe = esky.util.appexe_from_executable(sys.executable) os.execv(appexe, self._appargs) QMessageBox.information(None, "Updating", "Update complete!") self._app.cleanup() self._progressDlg.reset() sys.exit() except Exception, e: print("ERROR AUTO-UPDATING APP: {0}".format(e))
def notifyRun(vcfPath, vcfAttributes, xAttribute, yAttribute, softFilters, forcedCategoricals, featurePaths): global canceled, splash, window splash = QProgressDialog("Loading %s" % os.path.split(vcfPath)[1], "Cancel", 0, 1000, parent=None) splash.setWindowModality(Qt.WindowModal) splash.setAutoReset(False) splash.setAutoClose(False) splash.show() canceled = False vData = variantData(vcfPath, vcfAttributes, forcedCategoricals) vParams = variantLoadingParameters(passFunction=vData.addVariant, rejectFunction=None, callbackArgs={}, tickFunction=tick, tickInterval=0.1, individualsToInclude=[], individualAppendString="", lociToInclude=None, mask=None, invertMask=False, attributesToInclude=None, attributeAppendString="", skipGenotypeAttributes=True, returnFileObject=False, alleleMatching=allele.STRICT, attemptRepairsWhenComparing=True) try: variantFile.parseVcfFile(vcfPath, vParams) except cancelButtonException: splash.close() window.window.show() return if softFilters == None: softFilters = {} for k in vData.axisLookups.iterkeys(): if k == xAttribute or k == yAttribute: if vData.axisLookups[k].hasNumeric: fivePercent = 0.05*(vData.axisLookups[k].maximum-vData.axisLookups[k].minimum) ranges = [(vData.axisLookups[k].maximum-fivePercent,vData.axisLookups[k].maximum)] else: ranges = None values = [] else: ranges = None values = None softFilters[k] = valueFilter(values=values, ranges=ranges, includeNone=True, includeBlank=True, includeInf=True, includeNaN=True, includeMissing=True, includeAlleleMasked=True, listMode=valueFilter.LIST_INCLUSIVE) intMan = interactionManager(vData,softFilters) # TODO fData = featureData(featurePaths) if canceled: splash.close() window.window.show() return splash.close() appWindow = appWidget(vData,fData,intMan,xAttribute,yAttribute) intMan.setApp(appWindow)
class setupApp: def __init__(self, params): loader = QUiLoader() infile = QFile("gui/ui/Setup.ui") infile.open(QFile.ReadOnly) self.window = loader.load(infile, None) self.loadPrefs() self.window.quitButton.clicked.connect(self.closeApp) self.window.saveButton.clicked.connect(self.savePrefs) self.window.runButton.clicked.connect(self.runSV) self.splash = QProgressDialog("Loading", "Cancel", 0, 100, parent=None) self.splash.setWindowModality(Qt.WindowModal) self.splash.setAutoReset(False) self.splash.setAutoClose(False) self.splash.hide() self.canceled = False self.window.show() self.runningApp = None def loadPrefs(self): infile = open(PREFS_FILE,'r') self.window.textEdit.setPlainText(infile.read()) infile.close() def savePrefs(self): outfile=open(PREFS_FILE,'w') outfile.write(self.window.textEdit.toPlainText()) outfile.close() def showProgressWidget(self, estimate=100, message="Loading..."): self.splash.setLabelText(message) self.splash.setMaximum(estimate) self.splash.setValue(0) self.splash.show() def tickProgressWidget(self, numTicks=1, message=None): if self.canceled: return if message != None: self.splash.setLabelText(message) newValue = min(self.splash.maximum(),numTicks+self.splash.value()) self.splash.setValue(newValue) self.canceled = self.splash.wasCanceled() return self.canceled def runSV(self, params=PREFS_FILE): self.savePrefs() self.window.hide() appPrefs = prefs.generateFromText(self.window.textEdit.toPlainText()) self.showProgressWidget(appPrefs.maxTicks, "Loading files...") self.canceled = False vData = appPrefs.loadDataObjects(callback=self.tickProgressWidget) if self.canceled: self.splash.hide() self.window.show() return self.showProgressWidget(vData.estimateTicks(), "Writing files...") success = vData.dumpVcfFile(path='/Users/Home/Desktop/chr3-seq_parsed.vcf',callback=self.tickProgressWidget) if not success: self.splash.hide() self.window.show() return sys.exit(0) # TODO write to file def closeApp(self): self.window.reject()