def queueRedoAllImmages(self): argu=["readdir"] result=Leash.initcommand(self.app.options,argu,self.app.netconf) #self.log("reread directory") msgBox=QtGui.QMessageBox(self) msgBox.setText( result); msgBox.exec_();
def cleanup(self): if self.localserver: self.localserverstop.value = 1 argu = ["abort"] result = json.loads( Leash.initcommand(self.options, argu, self.netconf))
def startmerge(self): mergeok = self.checkinput() if mergeok == "OK": argu = ["mergedata", self.filename] result = json.loads( Leash.initcommand(self.app.options, argu, self.app.netconf)) print result if result['result'] == "Error" or result['result'] == "ServerError": errormessage = QtGui.QErrorMessage(parent=self.app) errormessage.setWindowTitle("Server Error") errormessage.setMinimumSize(400, 300) errormessage.showMessage(result['data']["Error"]) else: self.localmergetstatusthread.start() self.statusfield.clear() self.writeToStatus( "\n\n******************************************") tempstr = str(datetime.now().strftime( self.timeformat)) + ": Datamerge has started!" self.writeToStatus(tempstr) self.writeToStatus( "******************************************") self.submitlabel.setText("Merging data!") self.submitbutton.setEnabled(False) self.app.submitbutton.setEnabled(False) else: errormessage = QtGui.QErrorMessage(parent=self.app) errormessage.setWindowTitle("Configuration Error") errormessage.setMinimumSize(400, 300) errormessage.showMessage(mergeok)
def startmerge(self): mergeok = self.checkinput() if mergeok == "OK": argu=["mergedata",self.filename] result=json.loads(Leash.initcommand(self.app.options,argu,self.app.netconf)) print result if result['result']=="Error" or result['result']=="ServerError": errormessage=QtGui.QErrorMessage(parent=self.app) errormessage.setWindowTitle("Server Error") errormessage.setMinimumSize(400, 300) errormessage.showMessage(result['data']["Error"]) else: self.localmergetstatusthread.start() self.statusfield.clear() self.writeToStatus("\n\n******************************************") tempstr = str(datetime.now().strftime(self.timeformat)) + ": Datamerge has started!" self.writeToStatus(tempstr) self.writeToStatus("******************************************") self.submitlabel.setText("Merging data!") self.submitbutton.setEnabled(False) self.app.submitbutton.setEnabled(False) else: errormessage=QtGui.QErrorMessage(parent=self.app) errormessage.setWindowTitle("Configuration Error") errormessage.setMinimumSize(400, 300) errormessage.showMessage(mergeok)
def abortqueue(self): argu = ["abort"] result = Leash.initcommand(self.app.options, argu, self.app.netconf) #self.log("reread directory") msgBox = QtGui.QMessageBox(self) msgBox.setText(result) msgBox.exec_()
def startqueue(self): data=self.calibeditor.model.getjson() self.calibeditor.model.save() argu=["new", data] result={} title = str(data['Title']) usrfolder = str(data['Directory'][0]) titlestr='The title and the selected user folder do NOT match. Are you sure you are user: '******' ?' if title.find(usrfolder)==-1: res=QMessageBox.warning(self, self.tr("User folder"),self.tr(titlestr), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) else: res = QMessageBox.Yes if res==QMessageBox.Yes: try: result=json.loads(Leash.initcommand(self.options,argu,self.netconf)) except Exception as e: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage( str(e)) if 'result' in result and result['result']=="new queue": self.setqueuesynced() self.plotthread.start() else: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage( result["data"]["Error"])
def abortqueue(self): argu=["abort"] result=json.loads(Leash.initcommand(self.app.options,argu,self.app.netconf)) self.emit(QtCore.SIGNAL('queueaborted()')) msgBox=QtGui.QMessageBox(self) msgBox.setText( result["result"]); msgBox.exec_();
def run(self): while True: argu = ["getmergestat"] returndict = json.loads(Leash.initcommand(self.app.app.options,argu,self.app.app.netconf)) self.returnstring = returndict['data']["mergeinfo"] if self.returnstring!="": self.emit(QtCore.SIGNAL('sig_writeToStatus(QString)'),self.returnstring) #self.app.writeToStatus(self.returnstring) time.sleep(1)
def run(self): while True: argu = ["getmergestat"] returndict = json.loads( Leash.initcommand(self.app.app.options, argu, self.app.app.netconf)) self.returnstring = returndict['data']["mergeinfo"] if self.returnstring != "": self.emit(QtCore.SIGNAL('sig_writeToStatus(QString)'), self.returnstring) #self.app.writeToStatus(self.returnstring) time.sleep(1)
def startmerge(self): argu=["mergedata",self.filename] result=json.loads(Leash.initcommand(self.app.options,argu,self.app.netconf)) if result['result']=="Error" or result['result']=="ServerError": errormessage=QtGui.QErrorMessage(parent=self.app) errormessage.setWindowTitle("Server Error") errormessage.setMinimumSize(400, 300) errormessage.showMessage(result['data']["Error"]) else: message=QtGui.QMessageBox(parent=self.app) message.setWindowTitle("Merge Started") message.setText("Data merge has been initiated."); message.exec_();
def queueRedoAllImmages(self): argu=["readdir"] result=json.loads(Leash.initcommand(self.app.options,argu,self.app.netconf)) print result try: access = result["data"]["Error"] self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(result["data"]["Error"]) except: titlestr=result["result"] #res=QMessageBox.information(self, self.tr("Restart..."),self.tr(titlestr), QMessageBox.Ok,QMessageBox.Ok) msgBox=QtGui.QMessageBox(self) msgBox.setText(str(titlestr)); msgBox.exec_();
def _checkdirectorycollision(self,pathlist): if not self.serverid=="Local": serverconfs=json.load(open(os.path.expanduser("~"+os.sep+".saxsdognetwork"))) mydir=os.path.normpath(os.sep.join(pathlist)) for i,conf in enumerate(serverconfs): if i!=self.serverid and self.serverid!="Local": argu=["get"] opt=atrdict.AttrDict({"serverno":i,"server":conf["Server"]}) result=json.loads(Leash.initcommand(opt,argu,conf)) if result['result']=="cal": otherpath=os.path.normpath(os.sep.join(result["data"]["cal"]['Directory'])) if ((otherpath.startswith(mydir) or mydir.startswith(otherpath)) or (otherpath=="." or mydir==".")): raise DirectoryCollisionException("Directory collides with: "+otherpath)
def startqueue(self): data = self.calibeditor.model.getjson() try: title = str(data['Title']) except Exception as e: return self.calibeditor.model.save() argu = ["new", data] result = {} title = str(data['Title']) usrfolder = str(data['Directory'][0]) titlestr = 'The title and the selected user folder do NOT match. Are you sure you are user: '******' ?' if title.find(usrfolder) == -1: res = QMessageBox.warning(self, self.tr("User folder"), self.tr(titlestr), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) else: res = QMessageBox.Yes if res == QMessageBox.Yes: try: result = json.loads( Leash.initcommand(self.options, argu, self.netconf)) except Exception as e: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(str(e)) if 'result' in result and result['result'] == "new queue": self.setqueuesynced() self.plotthread.start() self.consolidatepanel.submitbutton.setEnabled(True) folderpath = "/" for text in data['Directory']: folderpath += text + "/" titlestr = 'Successfully loaded new calibration to Server!\n\nDo you want to re-integrate all images in ' + folderpath + ' ?' res = QMessageBox.information(self, self.tr("Re-integrate?"), self.tr(titlestr), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if res == QMessageBox.Yes: self.menue.queueRedoAllImmages() else: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(result["data"]["Error"])
def startqueue(self): data=self.calibeditor.model.getjson() argu=["new", data] result={} try: result=json.loads(Leash.initcommand(self.options,argu,self.netconf)) except Exception as e: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage( str(e)) if 'result' in result and result['result']=="new queue": print result self.setqueuesynced() self.plotthread.start() else: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(json.dumps(result,indent=2))
def startqueue(self): data = self.calibeditor.model.getjson() argu = ["new", data] result = {} try: result = json.loads( Leash.initcommand(self.options, argu, self.netconf)) except Exception as e: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(str(e)) if 'result' in result and result['result'] == "new queue": print result self.setqueuesynced() self.plotthread.start() else: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(json.dumps(result, indent=2))
def startqueue(self): data=self.calibeditor.model.getjson() try : title = str(data['Title']) except Exception as e: return self.calibeditor.model.save() argu=["new", data] result={} title = str(data['Title']) usrfolder = str(data['Directory'][0]) titlestr='The title and the selected user folder do NOT match. Are you sure you are user: '******' ?' if title.find(usrfolder)==-1: res=QMessageBox.warning(self, self.tr("User folder"),self.tr(titlestr), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) else: res = QMessageBox.Yes if res==QMessageBox.Yes: try: result=json.loads(Leash.initcommand(self.options,argu,self.netconf)) except Exception as e: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage(str(e)) if 'result' in result and result['result']=="new queue": self.setqueuesynced() self.plotthread.start() self.consolidatepanel.submitbutton.setEnabled(True) folderpath = "/" for text in data['Directory']: folderpath+=text + "/" titlestr='Successfully loaded new calibration to Server!\n\nDo you want to re-integrate all images in '+folderpath+' ?' res=QMessageBox.information(self, self.tr("Re-integrate?"),self.tr(titlestr), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if res==QMessageBox.Yes: self.menue.queueRedoAllImmages() else: self.errormessage.setWindowTitle("Server Error") self.errormessage.setMinimumSize(400, 300) self.errormessage.showMessage( result["data"]["Error"])
def parscecommandline(self): self.options, self.args = Leash.parsecommandline()
def cleanup(self): if self.localserver: self.localserverstop.value=1 argu=["abort"] result=json.loads(Leash.initcommand(self.options,argu,self.netconf))
def parscecommandline(self): self.options,self.args= Leash.parsecommandline()