Пример #1
0
    def __init__(self):
        self.write = signal()
        self.waiting_for_input = signal()
        self.flush = signal()
        self.close = signal()

        self._wait = signal()
        self.have_input = False
Пример #2
0
    def __init__(self, locals=None, filename=''):
        logger.debug("Shell initializing.")
        self.write_to_stream = signal(str, str)
        self.execute_finished = signal()
        self.waiting_for_input = signal()
        self.write_object = signal()

        self.locals = locals
        if not self.locals:
            self.locals = {}
        self.locals['__name__'] = filename
        self.completer = Completer(self.locals)
        self.packages = find_packages()
        self.os = os
        self.locals['__shell__'] = self

        logger.debug("Shell initializing interpreter.")
        self.interpreter = InteractiveInterpreter(locals=self.locals)
        self.msg_stream = SignalStream()
        self.interpreter.write = self.msg_stream.write

        logger.debug("Shell redirecting streams.")
        sys.stdin = SignalStream()
        sys.stdout = SignalStream()
        sys.stderr = SignalStream()

        logger.debug("Shell connecting streams.")
        logger.debug("                  stdout.")
        sys.stdout.write.connect_named("stdout", self.write_to_stream)
        logger.debug("                  stderr.")
        sys.stderr.write.connect_named("stderr", self.write_to_stream)
        logger.debug("                  interpretter.")
        self.msg_stream.write.connect_named("msg", self.write_to_stream)
        logger.debug("                  stdin.")
        sys.stdin.waiting_for_input.connect(self.waiting_for_input)
        logger.debug("Shell streams connected.")

        sys.displayhook = self.display_hook
Пример #3
0
    def __init__(self, parent=None):
        super(KateEditorWidget, self).__init__(parent=parent)

        self.name_changed = signal()

        self.view = kate.createDocument(self).createView(parent)
        self.doc = self.view.document()
        self.doc.setMode("Python")

        self.widget.setStyleSheet("""
            QFrame { border:none }
            QScrollBar:horizontal {
                width: 0px;
            }
        """)
        self.doc.documentNameChanged.connect(self._name_changed)