Best Python code snippet using fMBT_python
sf_window.py
Source:sf_window.py
...40 @property41 def content(self):42 return self.__view43 @property44 def windowStatus(self):45 status = super(SFWindow, self).windowStatus46 return WindowStatus.LOADING if status == WindowStatus.LOADED and self.__view is None else status47 def isParamsEqual(self, loadParams, scope=EVENT_BUS_SCOPE.DEFAULT, fireEvent=True, *args, **kwargs):48 return self.__loadParams.viewKey == loadParams.viewKey and self.args == args and self.kwargs == kwargs49 def load(self):50 _logger.debug('Loading window: %r', self)51 if self.windowStatus != WindowStatus.CREATED:52 raise SoftException('Window {} has already loaded!'.format(self.__loadParams.viewKey))53 super(SFWindow, self).load()54 if self.__fireEvent:55 g_eventBus.handleEvent(events.LoadViewEvent(self.__loadParams, *self.args, **self.kwargs), self.__scope)56 def setContent(self, view):57 self.__view = view58 view.onDispose += self.__onViewDispose...
AlarmEventData.py
Source:AlarmEventData.py
1#encoding:utf-82from lib.protocol.m300.M300Base import M300Base3'''4å®ä¹æ¥è¦äºä»¶éè¦çæ°æ®å
5'''6class AlarmEventData(M300Base):7 def __init__(self):8 pass9 ########################################################10 # è·åCANç¶ææ°æ®å
11 ########################################################12 def getCANStatusData(self,safeStatus=0,doorStatus=0,lockStatus=0,windowStatus=0,lightStatus=0,swichStatusA=0,swichStatusB=0):13 statusMask = "ffffffffffffffffffff" # ç¶ææ©ç 14 safeStatus = self.int2hexStringByBytes(safeStatus) # å®å
¨ç¶æ15 doorStatus = self.int2hexStringByBytes(doorStatus) # é¨ç¶æ16 lockStatus = self.int2hexStringByBytes(lockStatus) # éç¶æ17 windowStatus = self.int2hexStringByBytes(windowStatus) # çªæ·ç¶æ18 lightStatus = self.int2hexStringByBytes(lightStatus) # ç¯ç¶æ19 swichStatusA = self.int2hexStringByBytes(swichStatusA) # å¼å
³ç¶æA20 swichStatusB = self.int2hexStringByBytes(swichStatusB) # å¼å
³ç¶æB21 retain1 = "00" # é¢ç22 retain2 = "00" # é¢ç23 retain3 = "00" # é¢ç24 data = statusMask + safeStatus + doorStatus + lockStatus + windowStatus + lightStatus25 data = data + swichStatusA + swichStatusB + retain1 + retain2 + retain326 return data27if __name__ == "__main__":...
hyadesStart.py
Source:hyadesStart.py
1import time2from time import sleep3import RPi.GPIO as GPIO4import getWindowStatus5windowStatus = getWindowStatus.windowStatus()6rainSensor = 117motorLeft = 378motor2Right = 339GPIO.setmode (GPIO.BOARD)10GPIO.setup(rainSensor, GPIO.IN)11GPIO.setup(motorLeft, GPIO.OUT)12GPIO.setup(motor2Right, GPIO.OUT)13GPIO.output(motor2Right, GPIO.LOW)14GPIO.output(motorLeft, GPIO.LOW)15print(windowStatus)16try:17 while True:18 if(GPIO.input(rainSensor) == GPIO.LOW and windowStatus == 0):19 print('Closing!')20 GPIO.output(motorLeft, GPIO.HIGH)21 GPIO.output(motor2Right, GPIO.HIGH)22 sleep(4.65)23 GPIO.output(motorLeft, GPIO.LOW)24 sleep(1.25)25 GPIO.output(motor2Right, GPIO.LOW)26 windowStatus = getWindowStatus.windowStatus()27 sleep(6000)28finally:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!