Exemplo n.º 1
0
    def __init__(self):
        QWidget.__init__(self)
        self.__programs = []

        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)

        connections = (
            {
                "target": "tools_dock",
                "signal_name": "executeFile",
                "slot": self.execute_file
            },
            {
                "target": "tools_dock",
                "signal_name": "executeProject",
                "slot": self.execute_project
            },
            {
                "target": "tools_dock",
                "signal_name": "executeSelection",
                "slot": self.execute_selection
            },
            {
                "target": "tools_dock",
                "signal_name": "stopApplication",
                "slot": self.kill_application
            }
        )
        IDE.register_signals("tools_dock", connections)

        self._tabs = QTabWidget()
        self._tabs.setTabsClosable(True)
        self._tabs.setMovable(True)
        self._tabs.setDocumentMode(True)
        vbox.addWidget(self._tabs)
        # Menu for tab
        self._tabs.tabBar().setContextMenuPolicy(Qt.CustomContextMenu)
        self._tabs.tabBar().customContextMenuRequested.connect(
            self._menu_for_tabbar)
        self._tabs.tabCloseRequested.connect(self.close_tab)

        IDE.register_service("run_widget", self)
        _ToolsDock.register_widget(translations.TR_OUTPUT, self)
Exemplo n.º 2
0
    def __init__(self, parent=None):
        super().__init__()
        self.setUndoRedoEnabled(False)
        self.setCursorWidth(10)
        self.setFrameShape(0)
        self.moveCursor(QTextCursor.EndOfLine)
        self.__incomplete = False
        # History
        self._history_index = 0
        self._history = []
        self._current_command = ''
        # Console
        self._console = console.Console()
        self.setFont(settings.FONT)
        # Set highlighter and indenter for Python
        syntax = highlighter.build_highlighter(language='python')
        if syntax is not None:
            self._highlighter = Highlighter(
                self.document(),
                syntax.partition_scanner,
                syntax.scanners,
                syntax.context
            )
        #     self._highlighter = Highlighter(self.document(), syntax)
        self._indenter = indenter.load_indenter(self, lang="python")
        # Sidebar
        self.sidebar = ConsoleSideBar(self)
        self.setViewportMargins(self.sidebar.sizeHint().width(), 0, 0, 0)
        # Key operations
        self._key_operations = {
            Qt.Key_Enter: self.__manage_enter,
            Qt.Key_Return: self.__manage_enter,
            Qt.Key_Left: self.__manage_left,
            Qt.Key_Up: self.__up_pressed,
            Qt.Key_Down: self.__down_pressed,
            Qt.Key_Home: self.__manage_home,
            Qt.Key_Backspace: self.__manage_backspace
        }
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._context_menu)

        _ToolsDock.register_widget("Interpreter", self)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        super().__init__()
        self.setUndoRedoEnabled(False)
        self.setCursorWidth(10)
        self.setFrameShape(0)
        self.moveCursor(QTextCursor.EndOfLine)
        self.__incomplete = False
        # History
        self._history_index = 0
        self._history = []
        self._current_command = ''
        # Console
        self._console = console.Console()
        self.setFont(settings.FONT)
        # Set highlighter and indenter for Python
        syntax = highlighter.build_highlighter(language='python')
        if syntax is not None:
            self._highlighter = Highlighter(self.document(),
                                            syntax.partition_scanner,
                                            syntax.scanners, syntax.context)
        #     self._highlighter = Highlighter(self.document(), syntax)
        self._indenter = indenter.load_indenter(self, lang="python")
        # Sidebar
        self.sidebar = ConsoleSideBar(self)
        self.setViewportMargins(self.sidebar.sizeHint().width(), 0, 0, 0)
        # Key operations
        self._key_operations = {
            Qt.Key_Enter: self.__manage_enter,
            Qt.Key_Return: self.__manage_enter,
            Qt.Key_Left: self.__manage_left,
            Qt.Key_Up: self.__up_pressed,
            Qt.Key_Down: self.__down_pressed,
            Qt.Key_Home: self.__manage_home,
            Qt.Key_Backspace: self.__manage_backspace
        }
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._context_menu)

        _ToolsDock.register_widget("Interpreter", self)
Exemplo n.º 4
0
 def __init__(self, parent=None):
     super().__init__(parent)
     _ToolsDock.register_widget(translations.TR_FIND_IN_FILES, self)
Exemplo n.º 5
0
 def __init__(self, parent=None):
     super().__init__(parent)
     _ToolsDock.register_widget(translations.TR_FIND_IN_FILES, self)