当前位置: 首页>>代码示例>>Python>>正文


Python Connector.performInitalCheck方法代码示例

本文整理汇总了Python中connector.Connector.performInitalCheck方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.performInitalCheck方法的具体用法?Python Connector.performInitalCheck怎么用?Python Connector.performInitalCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connector.Connector的用法示例。


在下文中一共展示了Connector.performInitalCheck方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import performInitalCheck [as 别名]

#.........这里部分代码省略.........
        
        
    def changeOutputType(self):
        '''
        This method is called whenever the combobox for output type is
        changed. It appends the correct reco-output directory.
        '''
        types = ['rec_8bit','rec_DMP','rec_DMP_HF5','rec_16bit','rec_8bit','unknown_output']
        ind = self.outputtype.currentIndex()
        self.dirs.setOutputDirectory(types[ind])
        
        
    def submitAndSingleSliceContextMenu(self,point):
        '''
        Context menu for "Submit" and "SingleSlice" buttons. When right-
        clicking on one of these and "setting a target" the
        "changeSubmissionTarget" method gets executed.
        '''
        menu     = QMenu()
        button_handle = self.sender()
        
        submit1 = menu.addAction("Set to x02da")
        submit2 = menu.addAction("Set to Merlin")
    
        self.connect(submit1,SIGNAL("triggered()"),
                    lambda param='x02da': self.changeSubmissionTarget(param))
        self.connect(submit2,SIGNAL("triggered()"),
                    lambda param='Merlin': self.changeSubmissionTarget(param))
        menu.exec_(button_handle.mapToGlobal(point))
        
        
    def changeSubmissionTarget(self,target):
        '''
        Sets the "target" property accordingly and additionally labels
        the GUI buttons. If Merlin is the target, then the Merlin
        username is asked (by running "performInitalCheck" from the job
        object) in order to create correct directory paths on Merlin.
        '''
        self.target = target
        self.submit.setText("Submit "+"("+target+")")
        self.singleslice.setText("Single slice "+"("+target+")")
        if target == 'Merlin':
            self.afsaccount.setChecked(1)
            self.job.performInitalCheck()
            if not self.dirs.merlin_mount_dir:
                self.getDirectory('merlin_mount_dir','Select where the Merlin directory is mounted')
        
                
    def dragEnterEvent(self, event):
        '''
        This method accepts dragging files from outside into the
        application
        '''
        if event.mimeData().hasUrls():
            event.accept()
        else:
            event.ignore()


    def dropEvent(self, event):
        '''
        This method tries to load a config file after being dropped
        into the application. When multiple files are dropped, only the
        last one is loaded.
        '''
        for path in event.mimeData().urls():
            self.loadConfigFile( path.toLocalFile().toLocal8Bit().data() )
            
            
    def appendPostfix(self):
        '''
        This method opens a textfield and appends a postfix to all
        directories: cpr, fltp, sin, rec_Xbit
        '''
        logwin = Postfix(self.parent)
        if not logwin.exec_() == Postfix.Accepted:  # if ESC is hit
            return

        if not logwin.postfix.text():  # if postfix text is empty
            added_string = '/'
        else:
            added_string = '__'+str(logwin.postfix.text())+'/'
            
        fields = ['cprdirectory','fltpdirectory','sindirectory','recodirectory']
        
        for item in fields:
            handle = getattr(self,item)
            item_txt = str(handle.text())
            if not item_txt:
                continue
            else:
                if item_txt[-1] == '/':
                    newstring = item_txt[:-1]
                else:
                    newstring = item_txt
            try:
                ind = newstring.index('__')
            except ValueError:
                ind = len(newstring)
            handle.setText(newstring[0:ind]+added_string)
开发者ID:habi,项目名称:grecoman,代码行数:104,代码来源:main.py

示例2: MainWindow

# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import performInitalCheck [as 别名]

#.........这里部分代码省略.........
        ParameterWrap()(self,'geometry','-G',[],False)
        
        # we add radio box as well which depend on input directories
        ParameterWrap()(self,'sin_fromtif','',['inputdirectory'],False)
        ParameterWrap()(self,'sin_fromcpr','',['cprdirectory'],False)
        ParameterWrap()(self,'sin_fromfltp','',['fltpdirectory'],False)
        ParameterWrap()(self,'fltp_fromcpr','',['cprdirectory'],False)
        ParameterWrap()(self,'fltp_fromtif','',['cprdirectory'],False)
        
 
    def submitToCluster(self):
        '''
        method that launches all the checks and if successful submits the
        command to cons-2 for starting the job
        '''
        if not self.checkAllParamters():
            return
        
        # (1) Create command line string
        if not str(self.jobname.text()):
            self.jobname_str = 'GRecoM'
        else:
            self.jobname_str = str(self.jobname.text())
            
        self.cmd = ''
        if not self.createCommand():
            return
        
        if self.print_cmd.isChecked():
            if not self.displayYesNoMessage('Submit to cons-2?', self.cmd):
                return
        
        # (2) run SSH-connector and check all account credentials
        if not self.job.performInitalCheck():
            return
        
        # (3) run SSh-connector to launch the job
        if self.afsaccount.isChecked():
            self.job.submitJobViaGateway(self.cmd+'\n','x02da-gw','x02da-cons-2')
        elif self.cons2.isChecked():
            self.job.submitJobLocally(self.cmd)
            
            
    def calcSingleSlice(self):
        '''
        method for renconstructing a single slice for a given sinogram.
        '''
        if not str(self.sinograms.currentText()):
            self.displayErrorMessage('No sinogram selected', 'Select the Sinogram directory and press Enter. Then select one to be reconstructed.')
            return
        
        ## (1) check whether we have defined the location from where we run the reconstruction
        if not self.checkComputingLocation():
            return
        
        ## (2) before calculating on x02da-cons-2, we need to rewrite the path of the sino dir
        if self.afsaccount.isChecked():
            single_sino = self.dirs.afsPath2Cons2(self.sinogramdirectory.text())
        elif self.cons2.isChecked():
            single_sino = str(self.sinogramdirectory.text())

        ## (3) create the command line string for single slice reconstruction
        self.cmd_string = 'python /afs/psi.ch/project/tomcatsvn/executeables/grecoman/externals/singleSliceFunc.py '
        
        combos_single = ['filter','geometry']  # removed: 'outputtype' (let's always have DMP!)
        for combo in combos_single:
开发者ID:arcaduf,项目名称:grecoman,代码行数:70,代码来源:grecoman.py


注:本文中的connector.Connector.performInitalCheck方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。