Example #1
0
    def __init__(self,
                 fh,
                 map=None,
                 maxdata=None,
                 ignore_broken_pipe=False,
                 logger=None,
                 **obsopt):
        """Wrap a dispatcher around the passed filehandle.

        If `ignore_broken_pipe` is `True`, an `EPIPE` or `EBADF` error will
        call `handle_close()` instead of `handle_expt()`. Useful when broken
        pipes should be handled quietly.

        `logger` is a logger which will be used to log unusual exceptions;
        otherwise, they will be printed to stderr.
        """
        self.maxdata = maxdata if maxdata else self.pipe_maxdata
        self.__logger = logger
        if ignore_broken_pipe:
            self.__ignore_errno = [EPIPE, EBADF]
        else:
            self.__ignore_errno = []
        self.__filehandle = fh
        # Check for overduplication of the file descriptor and close the extra
        fddup = os.dup(fh.fileno())
        file_dispatcher.__init__(self, fddup, map=map)
        if (self._fileno != fddup): os.close(fddup)
        Observable.__init__(self, **obsopt)
Example #2
0
    def __init__(self, device, sender):
        file_dispatcher.__init__(self, device)
        self.device = device
        self.sender = sender

        self.last_mov_x = 0
        self.last_mov_y = 0
Example #3
0
 def __init__(self, objects):
     F710.__init__(self)
     threading.Thread.__init__(self)
     file_dispatcher.__init__(self, self.f710)
     self.car = objects.get('car')
     self.barrel_writer = objects.get('barrelwriter')
     self.logger = objects.get('logger')
     self._start_time = None
Example #4
0
    def __init__(self, fh, map=None, maxdata=None, ignore_broken_pipe=False, logger=None, **obsopt):
        """Wrap a dispatcher around the passed filehandle.

        If `ignore_broken_pipe` is `True`, an `EPIPE` or `EBADF` error will
        call `handle_close()` instead of `handle_expt()`. Useful when broken
        pipes should be handled quietly.

        `logger` is a logger which will be used to log unusual exceptions;
        otherwise, they will be printed to stderr.
        """
        self.maxdata = maxdata if maxdata else self.pipe_maxdata
        self.__logger = logger
        if ignore_broken_pipe:
            self.__ignore_errno = [EPIPE, EBADF]
        else:
            self.__ignore_errno = []
        self.__filehandle = fh
        # Check for overduplication of the file descriptor and close the extra
        fddup = os.dup(fh.fileno())
        file_dispatcher.__init__(self, fddup, map=map)
        if (self._fileno != fddup): os.close (fddup)
        Observable.__init__(self, **obsopt)
Example #5
0
 def __init__(self, device):
     self.device = device
     file_dispatcher.__init__(self, device)
     self.modify_key = ModifyKeyEvent()
Example #6
0
 def __init__(self, device, uarm):
     self.device = device
     self.uarm = uarm
     file_dispatcher.__init__(self, device)
Example #7
0
 def __init__(self):
     self.device = device
     file_dispatcher.__init__(self, device)
Example #8
0
	def __init__(self, device):
		self.device = device
		file_dispatcher.__init__(self, device)
Example #9
0
 def __init__(self, device, args):
     self.device = device
     self.args = args
     self._pendingKeyPress = None
     self.logger = logging.getLogger(__name__)
     file_dispatcher.__init__(self, device)
 def __init__(self, device, ButtonPressMethod, connectionLostMethod):
   self.device = device
   self.ButtonPressMethod = ButtonPressMethod
   self.connectionLostMethod = connectionLostMethod
   file_dispatcher.__init__(self, device)
Example #11
0
 def __init__(self, fh, subproc, map=None, maxdata=512):
     self.subproc = subproc
     self.maxdata = maxdata
     self.__filehandle = fh
     file_dispatcher.__init__(self, os.dup(fh.fileno()), map=map)
Example #12
0
 def __init__(self, device):
     """Store device."""
     self.device = device
     file_dispatcher.__init__(self, device)