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


Python QRegExp.capturedTexts方法代码示例

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


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

示例1: WaitForHStableCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class WaitForHStableCommand():
    def __init__(self):
        self.regexp_str="Wait(?: at most "+Regexfloat+" secs)? for magnet (X|Y|Z) to finish ramping"
        self.label="Wait (at most X secs) for magnet (X|Y|Z) to finish ramping"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
        self.waiting=False
        self.waiting_start=0
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #wait for field to stabilize (and lock only when accessing the instrument)
        with main.reserved_access_to_instr:
            magnet=eval("main.magnet_"+values[2])
            stat=magnet.query_status()
        if self.waiting==False:
            self.waiting=True
            self.waiting_start=time.clock()
        if not(stat=='RAMPING to programmed current/field') or (values[1]!='' and time.clock()-self.waiting_start>float(values[1])):
            #ramping is finished or time limit is reached, go to next line of macro
            self.waiting=False
            self.next_move=1
            self.wait_time=500
        else:
            #wait 5s and check again
            self.next_move=0
            self.wait_time=5000       
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:29,代码来源:Macro_editor.py

示例2: SetTempVTICommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetTempVTICommand():
    def __init__(self):
        self.regexp_str="Set VTI Loop (\d+) to "+Regexfloat+" K(?: @ "+Regexfloat+" K/min)?"
        self.label="Set VTI Loop X to X K (@ X K/min)"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
        self.waiting=False
        self.waiting_start=0
        
    def run(self,main):
        values=self.regexp.capturedTexts()
        ##get the loop index and setpoint value
        loop=float(values[1])
        setpoint=float(values[2])
        #if a ramp rate was also provided, go to this setpoint at this rate
        VTI=main.instr_9
        if values[3]!='':
            rate=float(values[3])
            with main.reserved_access_to_instr:
                VTI.conf_ramp(loop,rate,'on')
                VTI.set_setpoint(loop,setpoint)
        else:        
            with main.reserved_access_to_instr:            
                VTI.switch_ramp(loop,'off')
                VTI.set_setpoint(loop,setpoint)
        #go to next line of macro after stdwtime (give some time to process other events)
        self.next_move=1
        self.wait_time=500
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:30,代码来源:Macro_editor.py

示例3: AngleCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class AngleCommand():
    def __init__(self):
        #Text that will appear in the list of commands on the right side of the Macro editor
        self.label="Set start|stop|step angle to FLOAT"
        #Regular expression which may or may not catch parameters
        self.regexp_str="Set (start|stop|step) angle to "+Regexfloat
        #Add this to the beginning and end of the regular expression
        #so that whitespaces before and after will not prevent the regex from matching
        self.regexp_str="^ *"+self.regexp_str+" *$"
        #instantiate regex
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        #what to do when the regex defined just above in __init__
        #has matched the current line of the Macro
        #get the captured parameters
        values=self.regexp.capturedTexts()
        #set the corresponding angle box
        if values[1] in ['stop','step','start']:
            anglebox=eval("main.ui.angle"+values[1])
            anglebox.setValue(float(values[2]))           
        #Finally go to next line of macro...
        self.next_move=1
        #...after 10 milliseconds
        self.wait_time=10 
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:27,代码来源:Macro_editor.py

示例4: SetSaveFileCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetSaveFileCommand():
    def __init__(self):
        self.regexp_str="Set Save file to "+Regexsimplefile+""
        self.label="Set Save file to X"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        main.ui.savefile_txt_input.setText(values[1])
        #new file name is set, go to next line of macro
        self.next_move=1
        self.wait_time=500                                     
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:15,代码来源:Macro_editor.py

示例5: WaitCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class WaitCommand():
    def __init__(self):
        self.regexp_str="Wait "+Regexfloat+" secs"
        self.label="Wait X secs"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #self.values[1]!=''
        #go to next line of macro after 'values[1]' seconds
        self.next_move=1
        self.wait_time=float(values[1])*1000      
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:15,代码来源:Macro_editor.py

示例6: SetVTIHeaterCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetVTIHeaterCommand():
    def __init__(self):
        self.regexp_str="Set VTI heater range to (\d)"
        self.label="Set VTI heater range to DIGIT"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #set the heater range
        with main.reserved_access_to_instr:
            main.instr_9.set_heater_range(int(values[1]))                     
        #go to next line of macro
        self.next_move=1
        self.wait_time=500         
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:17,代码来源:Macro_editor.py

示例7: SetVCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetVCommand():
    def __init__(self):
        self.regexp_str="Set voltage (\d) to "+Regexfloat+" V"
        self.label="Set voltage DIGIT to FLOAT V"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #set the voltage
        if values[1] in ['1','2','3']:
            V_source_setpoint=eval("main.ui.V_setpoint_"+values[1])
            V_source_setpoint.setValue(float(values[2]))
        #go to next line of macro
        self.next_move=1
        self.wait_time=500
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:18,代码来源:Macro_editor.py

示例8: StartMeasureCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class StartMeasureCommand():
    def __init__(self):
        #type name_of_program() to start it
        self.regexp_str="Start "+Regexprogramfile+"\((.*)\)"
        self.label="Start PROGRAM()"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        main.ui.measMode.setCurrentIndex(main.ui.measMode.findText(values[1]))
        #start measurements
        main.start_measurements()
        #go to next line of macro
        self.next_move=1
        self.wait_time=500                      
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:18,代码来源:Macro_editor.py

示例9: WaitForEpoch

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class WaitForEpoch():
    def __init__(self):
        self.regexp_str="Wait for Epoch \+ "+Regexfloat+" secs"
        self.label="Wait for Epoch + X secs"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #test if the current time is greater than the time provided in the macro (in Epoch seconds)
        if float(values[1])>time.time():
            self.next_move=0
            self.wait_time=5000
        else:
            self.next_move=1
            self.wait_time=100
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:18,代码来源:Macro_editor.py

示例10: SetICommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetICommand():
    def __init__(self):
        self.regexp_str="Set current (\d) to "+Regexfloat+" A"
        self.label="Set current DIGIT to FLOAT A"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #set the current
        if values[1]=='1':
            main.ui.I_source_setpoint.setValue(float(values[2])*1e6)
        elif values[1] in ['2','3']:
            I_source_setpoint=eval("main.ui.I_source_setpoint_"+values[1])
            I_source_setpoint.setValue(float(values[2])*1e6)
        #go to next line of macro
        self.next_move=1
        self.wait_time=10
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:20,代码来源:Macro_editor.py

示例11: EmailCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class EmailCommand():
    def __init__(self):
        self.regexp_str="E-mail message: "+Regexsimplefile
        self.label="E-mail message: MESSAGE"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        msg=values[1]
        try:
            email_alert=Email_alert(message=msg.encode('utf8'),address=main.ui.email_address.text(),subject="Message from PyGMI",smtpadd=main.mainconf['smtpadd'],login=main.mainconf['login'],mdp=main.mainconf['mdp'],smtpport=main.mainconf['smtpport'])
            print "message successfully sent by e-mail"
        except:
            print "Exception: message could not be sent by e-mail"
        #go to next line of macro
        self.next_move=1
        self.wait_time=500   
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:20,代码来源:Macro_editor.py

示例12: EmailDirCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class EmailDirCommand():
    def __init__(self):
        self.regexp_str="E-mail directory: "+Regexsimplefile
        self.label="E-mail directory: DIRECTORY"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        dir_path=values[1]
        try:
            message="Hi,\n\nat your request, here is the directory: "+os.path.normpath(os.path.abspath(dir_path.encode('utf8').strip()))+"\n\n PyGMI"
            email_alert=Email_directory(directory=dir_path.encode('utf8').strip(),address=main.ui.email_address.text(),message=message,subject="Data directory from PyGMI",smtpadd=main.mainconf['smtpadd'],login=main.mainconf['login'],mdp=main.mainconf['mdp'],smtpport=main.mainconf['smtpport'])
            print  "directory successfully sent by e-mail"
        except:
            print "Exception: directory could not be sent by e-mail"
        #go to next line of macro
        self.next_move=1
        self.wait_time=500   
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:21,代码来源:Macro_editor.py

示例13: SetPersistFieldCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetPersistFieldCommand():
    def __init__(self):
        self.regexp_str="Set persistent field in magnet (X|Y|Z) to "+Regexfloat+" T"
        self.label="Set persistent field in magnet X|Y|Z to x T"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
            
    def run(self,main):
        values=self.regexp.capturedTexts()
        ##set the loop index and setpoint value
        magnet_setpoint=eval("main.ui.B_"+values[1]+"_setpoint")
        magnet_setpoint.setValue(float(values[2]))
        time.sleep(1)
        main.ui.measMode.setCurrentIndex(main.ui.measMode.findText("Change_persistent_"+values[1]+"_field"))
        #start measurements
        main.start_measurements()     
        #go to next line of macro after stdwtime (give some time to process other events)
        self.next_move=1
        self.wait_time=500
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:21,代码来源:Macro_editor.py

示例14: WaitForTStableCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class WaitForTStableCommand():
    def __init__(self):
        self.regexp_str="Wait(?: at most "+Regexfloat+" secs)? for channel (\w) to reach "+Regexfloat+" \+/\- "+Regexfloat+" K"
        self.label="Wait(at most X secs) for channel X to reach X +/- X K"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
        self.waiting=False
        self.waiting_start=0
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        #wait for temperature to stabilize (and lock only when accessing the instrument)
        with main.reserved_access_to_instr:
            T=main.temp_controller.query_temp(values[2])
        if self.waiting==False:
            self.waitTcounter=0
            self.waiting=True
            self.waiting_start=time.clock()
        if values[1]!='' and time.clock()-self.waiting_start>float(values[1]):
            #time limit is reached, go to next line of macro
            self.waiting=False
            self.next_move=1
            self.wait_time=500
        elif abs(T-float(values[3]))<float(values[4]):
            #Wait for the temperature measurement to be ten times
            #within the specified limits, in a row, to consider it stable
            if self.waitTcounter<10:
                #count one, wait 0.5 secs and measure T again
                self.waitTcounter+=1
                self.next_move=0
                self.wait_time=500
            else:
                #Temperature is stable, go to next line of macro
                self.waitTcounter=0
                self.waiting=False
                self.next_move=1
                self.wait_time=500                
        else:
            #wait 10s and check again, but reset the stable temperature counter
            self.waitTcounter=0
            self.next_move=0
            self.wait_time=10000 
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:44,代码来源:Macro_editor.py

示例15: SetFieldCommand

# 需要导入模块: from PySide.QtCore import QRegExp [as 别名]
# 或者: from PySide.QtCore.QRegExp import capturedTexts [as 别名]
class SetFieldCommand():
    def __init__(self):
        self.regexp_str="Set Field of magnet (X|Y|Z) to "+Regexfloat+" G(?: @ "+Regexfloat+" G/s)?"
        self.label="Set Field of magnet X|Y|Z to X G (@ X G/s)"
        self.regexp_str="^ *"+self.regexp_str+" *$" #so that the same string with heading and trailing whitespaces also matches
        self.regexp=QRegExp(self.regexp_str)
    
    def run(self,main):
        values=self.regexp.capturedTexts()
        with main.reserved_access_to_instr:
            magnet=eval("main.magnet_"+values[1])
            if values[3]!='':
                #if a ramp rate was also provided, go to this setpoint at this rate
                magnet.program_ramp_rate_in_Gauss_per_second(float(values[3]))    
            #print "Setting Field to ",
            magnet.program_field_in_kG(float(values[2])*1e-3)
            magnet.ramp_to_programmed_field()
        #go to next line of macro
        self.next_move=1
        self.wait_time=500  
开发者ID:Max-Leroux,项目名称:PyGMI,代码行数:22,代码来源:Macro_editor.py


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