Esempio n. 1
0
    def __init__(self):
        self.logger = logger('USBPcapCMD')

        if not os.path.isfile(_PATH_USBPCAP):
            self.logger.critical(
                'Not found "USBPcapCMD.exe" in path C:\\Program Files\\USBPcap'
            )
            exit()

        self.usb_interface = None
        self.capture_process = None
Esempio n. 2
0
    def __init__(self):
        self.HOME_DIR = os.getcwd()
        self.race_file = None

        self.race_name = None
        self.erg_line = {}
        self.participant_name = {}
        self.total_distance = None
        self.race_data = {}
        self.race_team = 1
        self.team_data = {}
        self.finish_time = {}

        self.address = None
        self.token = None
        self.timeout = 0

        self.logger = logger('PyStrokeSide')
        #self.config = Config()
        #self.restore_config()

        self.race_logger = None
        self.new_race_logger()
        self.raw_logger = raw_logger()
        self.raw_logger.setLevel("INFO")

        self.usbpcapcmd = None

        try:
            if self.address is not None:
                self.sio = socketio.Client()
                self.sio.connect(self.address)
                self.sio.emit('login', {'token': self.token})
                self.logger.info("Соединение с сервером установлено")
        except socketio.exceptions.ConnectionError:
            self.logger.warning(
                'Не удалось установить соединение с сервером. '
                'Проверьте интернет соединение или работоспособность сервера.')
Esempio n. 3
0
            if len(self.listEvent) > 0:
                if (event.getUrl() != self.listEvent[-1].getUrl()):
                    return self.CambioUrl(event)
                if ((event.timeStamp) -
                    (self.listEvent[-1].timeStamp)) > self.dwallingTime:
                    return self.flush()
            self.listEvent.append(event)
        except:
            error = "error approbes"
            return None


if __name__ == '__main__':
    from navigationByKeyH import NavigationByKeyH
    import loggers
    logger = loggers.logger()
    server = ""
    puerto = ""
    token = ""
    logger.setListOflink("lista")
    logger.reconfigureForKobold(server, puerto, token)
    deltaTime = datetime.timedelta(0, 3, 33000)
    fS = Finder("F.FlashScroll", logger, 3, 14000, deltaTime,
                'FlashScrollingAccessibilityNVDA')
    event = NavigationByKeyH("nombre1", "www.site1.com", "", "", "id=1")
    import time
    print("_________________")
    print("Test Local")
    print(
        fS.approbes(
            NavigationByKeyH("nombre1", "www.site1.com", "", "", "id=1")))
Esempio n. 4
0
class AppModule(firefox.AppModule):
    url = ""
    logger = loggers.logger()

    def event_gainFocus(self, obj, nextHandler):
        try:
            if str(obj.role) == "52":
                self.configurado = True
                self.url = self.buscarbyid(obj, "id", "url")
                self.server = self.buscarbyid(obj, "id", "server")
                self.puerto = self.buscarbyid(obj, "id", "puerto")
                self.api = self.buscarbyid(obj, "id", "api")
                self.token = self.buscarbyid(obj, "id", "token")
                self.logger.reconfigure(self.server, self.puerto, self.api,
                                        self.token)
            nextHandler()
        except:
            error = "Error event_gainFocus"

    def buscarbyid(self, obj, id, value):
        try:
            obj1 = self.searchAmongTheChildren(id, value, obj)
            if not obj1:
                return
            return obj1
        except:
            error = "Error buscarbyid"

    def searchAmongTheChildren(self, id, value, obj):
        try:
            if not obj:
                return (None)
            obj = obj.firstChild
            if id in obj.IA2Attributes.keys():
                if obj.IA2Attributes[id] == value:
                    data = (str(obj.firstChild.IA2Attributes[id]))
                    return data
            while obj:
                if id in obj.IA2Attributes.keys():
                    if obj.IA2Attributes[id] == value:
                        data = str(obj.firstChild.IA2Attributes[id])
                        break
                obj = obj.next
            return data
        except:
            x = 1
            error = "Error searchAmongTheChildren"

    def event_typedCharacter(self, obj, nextHandler):
        try:
            self.logger.push()
            nextHandler()
        except:
            error = "Error event_typedCharacter"

    def event_valueChange(self, obj, nextHandler):
        try:
            self.logger.push()
            nextHandler()
        except:
            error = "Error event_valueChange"

    def event_stateChange(self, obj, nextHandler):
        try:
            self.logger.push()
            nextHandler()
        except:
            error = "Error event_stateChange"

    def script_dispatchEventPrevious(self, gesture):
        try:
            if not self.objNav():
                gesture.send()
            else:
                if self.modo():
                    gesture.send()
                else:
                    if (not self.navegar('previous', gesture)):
                        fecha = datetime.datetime.now().strftime(
                            "%Y-%m-%d %H:%M:%S")
                        shift = True
                        obj = api.getNavigatorObject()
                        childrens = 0
                        if gesture.mainKeyName == 'l':
                            while not obj.role == controlTypes.ROLE_LIST:
                                obj = obj.parent
                                childrens = obj.childCount
                        xpath = str(obj.IA2Attributes["id"])
                        self.logger.event(str(fecha), shift,
                                          gesture.mainKeyName, xpath, self.url,
                                          'previous', childrens)
        except:
            error = "Error script_dispatchEventPrevious"

    def script_dispatchEventNext(self, gesture):
        try:
            #ui.message("corriendo")
            if not self.objNav():
                gesture.send()
            else:
                if self.modo():
                    gesture.send()
                else:
                    if (not self.navegar('next', gesture)):
                        fecha = datetime.datetime.now().strftime(
                            "%Y-%m-%d %H:%M:%S")
                        shift = True
                        obj = api.getNavigatorObject()
                        childrens = 0
                        if gesture.mainKeyName == 'l':
                            while not obj.role == controlTypes.ROLE_LIST:
                                obj = obj.parent
                        childrens = obj.childCount
                        xpath = str(obj.IA2Attributes["id"])
                        self.logger.event(str(fecha), shift,
                                          gesture.mainKeyName, xpath, self.url,
                                          'next', childrens)
        except:
            error = "Error script_dispatchEventNext"

    def modo(self):
        try:
            focus = api.getFocusObject()
            vbuf = focus.treeInterceptor
            if not vbuf:
                #ui.message("no2")
                for obj in itertools.chain((api.getFocusObject(), ),
                                           reversed(api.getFocusAncestors())):
                    try:
                        obj.treeInterceptorClass
                    except:
                        continue
                    break
                else:
                    return
                ti = treeInterceptorHandler.update(obj, force=True)
                if not ti:
                    return
                if focus in ti:
                    focus.treeInterceptor = ti
                    if isinstance(ti, browseMode.BrowseModeTreeInterceptor
                                  ) and not ti.passThrough:
                        browseMode.reportPassThrough(ti, False)
                return

            if not isinstance(vbuf, browseMode.BrowseModeTreeInterceptor):
                return
            if vbuf.passThrough:
                return True
            else:
                return False
        except:
            error = "Error modo"

    def ignorar_gesto(self, gesto):
        api.getFocusObject().treeInterceptor.script_collapseOrExpandControl(
            gesto)

    def navegar(self, direction, gesture):
        try:
            obj = api.getNavigatorObject().treeInterceptor
            previo = api.getNavigatorObject()
            inputGesture = gesture.mainKeyName
            if inputGesture == "h":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading(
                        obj, gesture)
            if inputGesture == "l":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextList(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousList(
                        obj, gesture)
            if inputGesture == "i":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextListItem(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousListItem(
                        obj, gesture)
            if inputGesture == "t":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextTable(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousTable(
                        obj, gesture)
            if inputGesture == "k":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextLink(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousLink(
                        obj, gesture)
            if inputGesture == "n":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextNotLinkBlock(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousNotLinkBlock(
                        obj, gesture)
            if inputGesture == "f":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextFormField(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previoustFormField(
                        obj, gesture)
            if inputGesture == "u":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextUnvisitedLink(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousUnvisitedLink(
                        obj, gesture)
            if inputGesture == "v":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextVisitedLink(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousVisitedLink(
                        obj, gesture)
            if inputGesture == "e":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextEdit(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousEdit(
                        obj, gesture)
            if inputGesture == "b":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextButton(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousButton(
                        obj, gesture)
            if inputGesture == "x":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextCheckBox(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousCheckBox(
                        obj, gesture)
            if inputGesture == "c":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextComboBox(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousComboBox(
                        obj, gesture)
            if inputGesture == "r":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextRadioButton(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousRadioButton(
                        obj, gesture)
            if inputGesture == "q":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextBlockQuote(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousBlockQuote(
                        obj, gesture)
            if inputGesture == "s":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextSeparator(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousSeparator(
                        obj, gesture)
            if inputGesture == "m":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextFrame(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousFrame(
                        obj, gesture)
            if inputGesture == "g":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextGraphic(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousGraphic(
                        obj, gesture)
            if inputGesture == "d":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextLandmark(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousLandmark(
                        obj, gesture)
            if inputGesture == "o":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextEmbeddedObject(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousEmbeddedObject(
                        obj, gesture)
            if inputGesture == "1":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading1(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading1(
                        obj, gesture)
            if inputGesture == "2":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading2(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading2(
                        obj, gesture)
            if inputGesture == "3":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading3(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading3(
                        obj, gesture)
            if inputGesture == "4":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading4(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading4(
                        obj, gesture)
            if inputGesture == "5":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading5(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading5(
                        obj, gesture)
            if inputGesture == "6":
                if direction == "next":
                    browseMode.BrowseModeTreeInterceptor.script_nextHeading6(
                        obj, gesture)
                if direction == "previous":
                    browseMode.BrowseModeTreeInterceptor.script_previousHeading6(
                        obj, gesture)
            if previo == api.getNavigatorObject():

                return True
            else:
                return False
        except:
            error = "Error navegar"

    def objNav(self):
        try:
            #ui.message("objNav")
            obj = api.getFocusObject()
            while not obj.role == controlTypes.ROLE_DOCUMENT:
                obj = obj.parent
            return True
        except:
            return False

    __gestures = {
        "kb:h": "dispatchEventNext",
        "kb:shift+h": "dispatchEventPrevious",
        "kb:l": "dispatchEventNext",
        "kb:shift+l": "dispatchEventPrevious",
        "kb:i": "dispatchEventNext",
        "kb:shift+i": "dispatchEventPrevious",
        "kb:t": "dispatchEventNext",
        "kb:shift+t": "dispatchEventPrevious",
        "kb:k": "dispatchEventNext",
        "kb:shift+k": "dispatchEventPrevious",
        "kb:n": "dispatchEventNext",
        "kb:shift+k": "dispatchEventPrevious",
        "kb:f": "dispatchEventNext",
        "kb:shift+f": "dispatchEventPrevious",
        "kb:u": "dispatchEventNext",
        "kb:shift+u": "dispatchEventPrevious",
        "kb:v": "dispatchEventNext",
        "kb:shift+v": "dispatchEventPrevious",
        "kb:e": "dispatchEventNext",
        "kb:shift+e": "dispatchEventPrevious",
        "kb:b": "dispatchEventNext",
        "kb:shift+b": "dispatchEventPrevious",
        "kb:x": "dispatchEventNext",
        "kb:shift+x": "dispatchEventPrevious",
        "kb:c": "dispatchEventNext",
        "kb:shift+c": "dispatchEventPrevious",
        "kb:r": "dispatchEventNext",
        "kb:shift+r": "dispatchEventPrevious",
        "kb:q": "dispatchEventNext",
        "kb:shift+q": "dispatchEventPrevious",
        "kb:s": "dispatchEventNext",
        "kb:shift+s": "dispatchEventPrevious",
        "kb:m": "dispatchEventNext",
        "kb:shift+m": "dispatchEventPrevious",
        "kb:g": "dispatchEventNext",
        "kb:shift+g": "dispatchEventPrevious",
        "kb:d": "dispatchEventNext",
        "kb:shift+d": "dispatchEventPrevious",
        "kb:o": "dispatchEventNext",
        "kb:shift+o": "dispatchEventPrevious",
        "kb:1": "dispatchEventNext",
        "kb:shift+1": "dispatchEventPrevious",
        "kb:2": "dispatchEventNext",
        "kb:shift+2": "dispatchEventPrevious",
        "kb:3": "dispatchEventNext",
        "kb:shift+3": "dispatchEventPrevious",
        "kb:4": "dispatchEventNext",
        "kb:shift+4": "dispatchEventPrevious",
        "kb:5": "dispatchEventNext",
        "kb:shift+5": "dispatchEventPrevious",
        "kb:6": "dispatchEventNext",
        "kb:shift+6": "dispatchEventPrevious"
    }