Beispiel #1
0
    def _readline_from_keyboard_poll(self):
        pastebuffer = self.mode.paste_line_buffer
        if len(pastebuffer) > 0:
            self.l_buffer = lineobj.ReadLineTextBuffer(pastebuffer[0])
            self._update_line()
            self.mode.paste_line_buffer = pastebuffer[1:]
            return True
        c = self.console

        def nop(e):
            pass

        try:
            event = c.getkeypress()
        except KeyboardInterrupt:
            event = self.handle_ctrl_c()

        try:
            result = self.mode.process_keyevent(event.keyinfo)
        except EOFError:
            logger.stop_logging()
            raise

        self._update_line()
        return result
Beispiel #2
0
    def _readline_from_keyboard_poll(self):
        pastebuffer = self.mode.paste_line_buffer
        if len(pastebuffer) > 0:
            #paste first line in multiline paste buffer
            self.l_buffer = lineobj.ReadLineTextBuffer(pastebuffer[0])
            self._update_line()
            self.mode.paste_line_buffer = pastebuffer[1:]
            return True

        c = self.console

        def nop(e):
            pass

        try:
            event = c.getkeypress()
        except KeyboardInterrupt:
            event = self.handle_ctrl_c()
        try:
            result = self.mode.process_keyevent(event.keyinfo)
        except EOFError:
            logger.stop_logging()
            raise
        self._update_line()
        return result
Beispiel #3
0
    def _readline_from_keyboard_poll(self):
        pastebuffer = self.mode.paste_line_buffer
        if len(pastebuffer) > 0:
            #paste first line in multiline paste buffer
            self.l_buffer = lineobj.ReadLineTextBuffer(pastebuffer[0])
            self._update_line()
            self.mode.paste_line_buffer = pastebuffer[1:]
            return True

        c = self.console
        def nop(e):
            pass
        shouldUpdateLine = True
        try:
            event = c.getkeypress()
            log("Got event %s is printable=%s more events=%s" % (event,event.keyinfo.isPrintable(), c.more_events_pending()))
            if c.more_events_pending() and event.keyinfo.isPrintable():
                log("don't update line char=" + event.char) 
                shouldUpdateLine = False
        except KeyboardInterrupt:
            event = self.handle_ctrl_c()
        try:
            result = self.mode.process_keyevent(event.keyinfo)
        except EOFError:
            logger.stop_logging()
            raise
        if shouldUpdateLine:
            if self.mode.shouldUpdateLine():
                self._update_line()
            else:
                # just move cursor
                self._set_cursor()
        return result
Beispiel #4
0
    def _readline_from_keyboard_poll(self):
        pastebuffer = self.mode.paste_line_buffer
        if len(pastebuffer) > 0:
            #paste first line in multiline paste buffer
            self.l_buffer = lineobj.ReadLineTextBuffer(pastebuffer[0])
            self._update_line()
            self.mode.paste_line_buffer = pastebuffer[1:]
            return True

        c = self.console

        def nop(e):
            pass

        shouldUpdateLine = True
        try:
            event = c.getkeypress()
            log("Got event %s is printable=%s more events=%s" %
                (event, event.keyinfo.isPrintable(), c.more_events_pending()))
            if c.more_events_pending() and event.keyinfo.isPrintable():
                log("don't update line char=" + event.char)
                shouldUpdateLine = False
        except KeyboardInterrupt:
            event = self.handle_ctrl_c()
        try:
            result = self.mode.process_keyevent(event.keyinfo)
        except EOFError:
            logger.stop_logging()
            raise
        if shouldUpdateLine:
            if self.mode.shouldUpdateLine():
                self._update_line()
            else:
                # just move cursor
                self._set_cursor()
        return result
Beispiel #5
0
        if os.path.exists(libzmq):
            ctypes.cdll.LoadLibrary(libzmq)

#
# CellProfiler expects NaN as a result during calculation
#
np.seterr(all='ignore')
#
# Defeat pyreadline which graciously sets its logging to DEBUG and it
# appears when CP is frozen
#
try:
    from pyreadline.logger import stop_logging, pyreadline_logger

    pyreadline_logger.setLevel(logging.INFO)
    stop_logging()
except:
    pass

if not hasattr(sys, 'frozen'):
    root = os.path.split(__file__)[0]
else:
    root = os.path.split(sys.argv[0])[0]
if len(root) == 0:
    root = os.curdir
root = os.path.abspath(root)
site_packages = os.path.join(root, 'site-packages').encode('utf-8')
if os.path.exists(site_packages) and os.path.isdir(site_packages):
    import site

    site.addsitedir(site_packages)
        libzmq = os.path.join(here, 'libzmq.dll')
        if os.path.exists(libzmq):
            ctypes.cdll.LoadLibrary(libzmq)
import zmq
#
# CellProfiler expects NaN as a result during calculation
#
np.seterr(all='ignore')
#
# Defeat pyreadline which graciously sets its logging to DEBUG and it
# appears when CP is frozen
#
try:
    from pyreadline.logger import stop_logging, pyreadline_logger
    pyreadline_logger.setLevel(logging.INFO)
    stop_logging()
except:
    pass

if not hasattr(sys, 'frozen'):
    root = os.path.split(__file__)[0]
else:
    root = os.path.split(sys.argv[0])[0]
if len(root) == 0:
    root = os.curdir
root = os.path.abspath(root)
site_packages = os.path.join(root, 'site-packages').encode('utf-8')
if os.path.exists(site_packages) and os.path.isdir(site_packages):
    import site
    site.addsitedir(site_packages)