当前位置: 首页>>代码示例>>Python>>正文


Python ide.IDE类代码示例

本文整理汇总了Python中ninja_ide.gui.ide.IDE的典型用法代码示例。如果您正苦于以下问题:Python IDE类的具体用法?Python IDE怎么用?Python IDE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IDE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _rename_file

 def _rename_file(self):
     path = self.model().filePath(self.currentIndex())
     name = file_manager.get_basename(path)
     new_name, ok = QInputDialog.getText(
         self, translations.TR_RENAME_FILE,
         translations.TR_ENTER_NEW_FILENAME,
         text=name)
     if ok and new_name.strip():
         filename = file_manager.create_path(
             file_manager.get_folder(path), new_name)
         if path == filename:
             return
         ninjaide = IDE.get_service("ide")
         print(ninjaide.filesystem.get_files())
         current_nfile = ninjaide.get_or_create_nfile(path)
         editable = ninjaide.get_editable(nfile=current_nfile)
         current_nfile.move(filename)
         if editable is not None:
             main_container = IDE.get_service("main_container")
             main_container.combo_area.bar.update_item_text(
                 editable, new_name)
             tree = ninjaide.filesystem.get_files()
             # FIXME: this is bad
             tree[filename] = tree.pop(path)
         print(ninjaide.filesystem.get_files())
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:25,代码来源:tree_projects_widget.py

示例2: __init__

    def __init__(self, parent=None):
        super().__init__(parent)
        # Register signals connections
        layout = QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self.__buttons = []
        self.__action_number = 1
        self.__buttons_visibility = {}
        self.__current_widget = None
        self.__last_index = -1

        self._stack_widgets = QStackedWidget()
        layout.addWidget(self._stack_widgets)

        # Buttons Widget
        self.buttons_widget = QWidget()
        self.buttons_widget.setObjectName("tools_dock")
        self.buttons_widget.setFixedHeight(26)
        self.buttons_widget.setLayout(QHBoxLayout())
        self.buttons_widget.layout().setContentsMargins(2, 2, 5, 2)
        self.buttons_widget.layout().setSpacing(10)

        IDE.register_service("tools_dock", self)
        _ToolsDock.__created = True
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:26,代码来源:tools_dock.py

示例3: find

 def find(self, backward=False, forward=False, rehighlight=True):
     """Collect flags and execute search in the editor"""
     main_container = IDE.get_service("main_container")
     editor = main_container.get_current_editor()
     if editor is None:
         return
     cs, wo, highlight = self.search_flags
     index, matches = 0, 0
     found = editor.find_match(self.search_text, cs, wo, backward, forward)
     if found:
         if rehighlight:
             editor.clear_found_results()
             index, matches = editor.highlight_found_results(
                 self.search_text, cs, wo)
     else:
         editor.clear_found_results()
     if matches == 0 and found:
         index, matches = editor._get_find_index_results(
             self.search_text, cs, wo)
         matches = len(matches)
         if index == 1:
             ide = IDE.get_service("ide")
             ide.show_message(translations.TR_SEARCH_FROM_TOP)
     self._line_search.counter.update_count(
         index, matches, len(self.search_text) > 0)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:25,代码来源:status_bar.py

示例4: __init__

    def __init__(self, parent=None):
        super(CentralWidget, self).__init__(parent)
        self.parent = parent
        #This variables are used to save the splitter sizes before hide
        self.lateralPanel = LateralPanel()

        self._add_functions = {
            "central": self._insert_widget_inside,
            "lateral": self._insert_widget_base,
        }
        self._items = {}

        hbox = QHBoxLayout(self)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.setSpacing(0)
        #Create Splitters to divide the UI 3 regions
        self._splitterBase = dynamic_splitter.DynamicSplitter(Qt.Horizontal)
        self._splitterBase.setOpaqueResize(True)
        self._splitterInside = dynamic_splitter.DynamicSplitter(Qt.Vertical)
        self._splitterInside.setOpaqueResize(True)
        self._splitterBase.addWidget(self._splitterInside)

        #Add to Main Layout
        hbox.addWidget(self._splitterBase)
        IDE.register_service('central_container', self)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:25,代码来源:central_widget.py

示例5: _add_file_to_project

 def _add_file_to_project(self, path):
     """Add the file for 'path' in the project the user choose here."""
     if self._active_project:
         pathProject = [self._active_project.project]
         addToProject = add_to_project.AddToProject(pathProject, self)
         addToProject.exec_()
         if not addToProject.pathSelected:
             return
         main_container = IDE.get_service('main_container')
         if not main_container:
             return
         editorWidget = main_container.get_current_editor()
         if not editorWidget.file_path:
             name = QInputDialog.getText(None,
                                         translations.TR_ADD_FILE_TO_PROJECT,
                                         translations.TR_FILENAME + ": ")[0]
             if not name:
                 QMessageBox.information(
                     self,
                     translations.TR_INVALID_FILENAME,
                     translations.TR_INVALID_FILENAME_ENTER_A_FILENAME)
                 return
         else:
             name = file_manager.get_basename(editorWidget.file_path)
         new_path = file_manager.create_path(addToProject.pathSelected, name)
         ide_srv = IDE.get_service("ide")
         old_file = ide_srv.get_or_create_nfile(path)
         new_file = old_file.save(editorWidget.get_text(), new_path)
         #FIXME: Make this file replace the original in the open tab
     else:
         pass
开发者ID:LeoYao,项目名称:ninja-ide,代码行数:31,代码来源:tree_projects_widget.py

示例6: __init__

    def __init__(self, parent=None):
        super(ProjectTreeColumn, self).__init__(parent,
                                                Qt.WindowStaysOnTopHint)
        vbox = QVBoxLayout(self)
        vbox.setSizeConstraint(QVBoxLayout.SetDefaultConstraint)
        vbox.setContentsMargins(0, 0, 0, 0)
        self._buttons = []

        self._combo_project = QComboBox()
        self._combo_project.setMinimumHeight(30)
        self._combo_project.setContextMenuPolicy(Qt.CustomContextMenu)
        vbox.addWidget(self._combo_project)

        self._projects_area = QStackedLayout()
        logger.debug("This is the projects area")
        logger.debug(self._projects_area)
        vbox.addLayout(self._projects_area)

        self.projects = []

        self._combo_project.currentIndexChanged[int].connect(self._change_current_project)
        self._combo_project.customContextMenuRequested['const QPoint &'].connect(self.context_menu_for_root)
        connections = (
            {'target': 'main_container',
             'signal_name': 'addToProject',#(QString)
             'slot': self._add_file_to_project},
            {'target': 'main_container',
             'signal_name': 'showFileInExplorer',#(QString)
             'slot': self._show_file_in_explorer},
        )
        IDE.register_service('projects_explorer', self)
        IDE.register_signals('projects_explorer', connections)
        ExplorerContainer.register_tab(translations.TR_TAB_PROJECTS, self)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:33,代码来源:tree_projects_widget.py

示例7: __init__

    def __init__(self, parent=None):
        super(TreeSymbolsWidget, self).__init__(parent,
            Qt.WindowStaysOnTopHint)
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.tree = QTreeWidget()
        vbox.addWidget(self.tree)
        self.tree.header().setHidden(True)
        self.tree.setSelectionMode(self.tree.SingleSelection)
        self.tree.setAnimated(True)
        self.tree.header().setHorizontalScrollMode(
            QAbstractItemView.ScrollPerPixel)
        self.tree.header().setResizeMode(0, QHeaderView.ResizeToContents)
        self.tree.header().setStretchLastSection(False)
        self.actualSymbols = ('', {})
        self.docstrings = {}
        self.collapsedItems = {}

        self.connect(self, SIGNAL("itemClicked(QTreeWidgetItem *, int)"),
            self._go_to_definition)
        self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
            self._go_to_definition)
        self.tree.setContextMenuPolicy(Qt.CustomContextMenu)
        self.connect(self,
            SIGNAL("customContextMenuRequested(const QPoint &)"),
            self._menu_context_tree)
        self.connect(self, SIGNAL("itemCollapsed(QTreeWidgetItem *)"),
            self._item_collapsed)
        self.connect(self, SIGNAL("itemExpanded(QTreeWidgetItem *)"),
            self._item_expanded)

        IDE.register_service('symbols_explorer', self)
        ExplorerContainer.register_tab(translations.TR_TAB_SYMBOLS, self)
开发者ID:JuloWaks,项目名称:ninja-ide,代码行数:34,代码来源:tree_symbols_widget.py

示例8: _add_file_to_project

 def _add_file_to_project(self, path):
     """Add the file for 'path' in the project the user choose here."""
     if self._active_project:
         pathProject = [self._active_project.project]
         addToProject = add_to_project.AddToProject(pathProject, self)
         addToProject.exec_()
         if not addToProject.pathSelected:
             return
         main_container = IDE.get_service('main_container')
         if not main_container:
             return
         editorWidget = main_container.get_current_editor()
         if not editorWidget.file_path:
             name = QInputDialog.getText(None,
                 self.tr("Add File To Project"), self.tr("File Name:"))[0]
             if not name:
                 QMessageBox.information(self, self.tr("Invalid Name"),
                     self.tr("The file name is empty, please enter a name"))
                 return
         else:
             name = file_manager.get_basename(editorWidget.file_path)
         new_path = file_manager.create_path(addToProject.pathSelected, name)
         ide_srv = IDE.get_service("ide")
         old_file, ide_srv.get_or_create_nfile(path)
         new_file = old_file.save(editorWidget.get_text(), path)
         #FIXME: Make this file replace the original in the open tab
     else:
         pass
开发者ID:abracadaber,项目名称:ninja-ide,代码行数:28,代码来源:tree_projects_widget.py

示例9: __init__

    def __init__(self, parent=None):
        super(CentralWidget, self).__init__(parent)
        self.parent = parent
        main_container = QHBoxLayout(self)
        main_container.setContentsMargins(0, 0, 0, 0)
        main_container.setSpacing(0)
        # This variables are used to save the spliiter sizes
        self.lateral_panel = LateralPanel()

        self._add_functions = {
            "central": self._insert_widget_inside,
            "lateral": self._insert_widget_base
        }
        self._items = {}

        # Toolbar
        self._toolbar = ntoolbar.NToolBar(self)
        main_container.addWidget(self._toolbar)

        # Create Splitters to divide the UI 3 regions
        self._splitter_base = dynamic_splitter.DynamicSplitter(Qt.Horizontal)
        self._splitter_inside = dynamic_splitter.DynamicSplitter(Qt.Vertical)
        self._splitter_base.addWidget(self._splitter_inside)

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

        vbox.addWidget(self._splitter_base)
        tools_dock = IDE.get_service("tools_dock")
        vbox.addWidget(tools_dock.buttons_widget)
        main_container.addLayout(vbox)
        # main_container.addWidget(self._splitter_base)
        IDE.register_service("central_container", self)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:34,代码来源:central_widget.py

示例10: install

    def install(self):
        ide = IDE.get_service('ide')
        ide.place_me_on("explorer_container", self, "lateral")
        #Searching the Preferences
        self.tree_projects = None
        self._treeSymbols = None
        if settings.SHOW_SYMBOLS_LIST:
            self.add_tab_symbols()
        self._inspector = None
        if settings.SHOW_WEB_INSPECTOR and settings.WEBINSPECTOR_SUPPORTED:
            self.add_tab_inspector()
        self._listErrors = None
        if settings.SHOW_ERRORS_LIST:
            self.add_tab_errors()
        self._listMigration = None
        if settings.SHOW_MIGRATION_LIST:
            self.add_tab_migration()

        if self.count() == 0:
            central_container = IDE.get_service("central_container")
            central_container.change_explorer_visibility(force_hide=True)
        ui_tools.install_shortcuts(self, actions.ACTIONS, ide)
        for each_tab in self.__tabs:
            if hasattr(each_tab, "install"):
                each_tab.install()
开发者ID:Zekom,项目名称:ninja-ide,代码行数:25,代码来源:explorer_container.py

示例11: __init__

    def __init__(self, parent=None):
        super(CentralWidget, self).__init__(parent)
        self.parent = parent
        #This variables are used to save the splitter sizes before hide
        self._splitterBaseSizes = None
        self._splitterInsideSizes = None
        self.lateralPanel = LateralPanel()

        self._add_functions = {
            "central": self._insert_widget_region0,
            "lateral": self._insert_widget_region1,
        }
        self._items = {}

        hbox = QHBoxLayout(self)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.setSpacing(0)
        #Create Splitters to divide the UI 3 regions
        self._splitterBase = dynamic_splitter.DynamicSplitter(Qt.Horizontal)
        self._splitterInside = dynamic_splitter.DynamicSplitter(Qt.Vertical)
        self._splitterBase.addWidget(self._splitterInside)

        #Add to Main Layout
        hbox.addWidget(self._splitterBase)
        connects = (
            {"target": "main_container",
            "signal_name": "cursorPositionChange(int, int)",
            "slot": self.update_column_number},
        )
        IDE.register_service('central_container', self)
        IDE.register_signals("central_container", connects)
开发者ID:jsargiot,项目名称:ninja-ide,代码行数:31,代码来源:central_widget.py

示例12: __init__

    def __init__(self):
        super().__init__()
        self.current_status = _STATUSBAR_STATE_SEARCH
        vbox = QVBoxLayout(self)
        title = QLabel(translations.TR_SEARCH_TITLE)
        font = title.font()
        font.setPointSize(9)
        title.setFont(font)
        vbox.addWidget(title)
        spacing = 3
        if settings.IS_MAC_OS:
            spacing = 0
        vbox.setSpacing(spacing)
        # Search Layout
        self._search_widget = SearchWidget()
        vbox.addWidget(self._search_widget)
        # Replace Layout
        self._replace_widget = ReplaceWidget()
        self._replace_widget.hide()
        vbox.addWidget(self._replace_widget)
        # Not configurable shortcuts
        short_esc_status = QShortcut(QKeySequence(Qt.Key_Escape), self)
        short_esc_status.activated.connect(self.hide_status_bar)

        IDE.register_service("status_bar", self)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:25,代码来源:status_bar.py

示例13: _save

    def _save(self):
        qsettings = IDE.ninja_settings()
        editor_settings = IDE.editor_settings()

        qsettings.beginGroup("editor")
        editor_settings.beginGroup("editor")
        qsettings.beginGroup("behavior")
        editor_settings.beginGroup("behavior")

        settings.REMOVE_TRAILING_SPACES = self._check_remove_spaces.isChecked()
        qsettings.setValue("removeTrailingSpaces",
                           settings.REMOVE_TRAILING_SPACES)
        settings.ADD_NEW_LINE_AT_EOF = self._check_add_new_line.isChecked()
        qsettings.setValue("addNewLineAtEnd", settings.ADD_NEW_LINE_AT_EOF)
        settings.HIDE_MOUSE_CURSOR = self._check_hide_cursor.isChecked()
        qsettings.setValue("hideMouseCursor", settings.HIDE_MOUSE_CURSOR)
        settings.SCROLL_WHEEL_ZOMMING = self._check_scroll_wheel.isChecked()
        qsettings.setValue("scrollWheelZomming", settings.SCROLL_WHEEL_ZOMMING)

        settings.USE_TABS = bool(self._combo_tab_policy.currentIndex())
        editor_settings.setValue("use_tabs", settings.USE_TABS)
        settings.INDENT = self._spin_indent_size.value()
        editor_settings.setValue("indentation_width", settings.INDENT)

        qsettings.endGroup()
        qsettings.endGroup()
        editor_settings.endGroup()
        editor_settings.endGroup()
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:28,代码来源:preferences_editor_behavior.py

示例14: __init__

    def __init__(self):
        QTreeWidget.__init__(self)
        self.header().setHidden(True)
        self.setSelectionMode(self.SingleSelection)
        self.setAnimated(True)
        self.header().setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.header().setResizeMode(0, QHeaderView.ResizeToContents)
        self.header().setStretchLastSection(False)
        self.actualSymbols = ('', {})
        self.docstrings = {}
        self.collapsedItems = {}

        self.connect(self, SIGNAL("itemClicked(QTreeWidgetItem *, int)"),
            self._go_to_definition)
        self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
            self._go_to_definition)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.connect(self,
            SIGNAL("customContextMenuRequested(const QPoint &)"),
            self._menu_context_tree)
        self.connect(self, SIGNAL("itemCollapsed(QTreeWidgetItem *)"),
            self._item_collapsed)
        self.connect(self, SIGNAL("itemExpanded(QTreeWidgetItem *)"),
            self._item_expanded)

        IDE.register_service('symbols_explorer', self)
        ExplorerContainer.register_tab(translations.TR_TAB_SYMBOLS, self)
开发者ID:Hmaal,项目名称:ninja-ide,代码行数:27,代码来源:tree_symbols_widget.py

示例15: __init__

 def __init__(self, parent=None):
     super(_ToolsDock, self).__init__(parent)
     #Register signals connections
     connections = (
         {'target': 'main_container',
         'signal_name': "findOcurrences(QString)",
         'slot': self.show_find_occurrences},
         {'target': 'main_container',
         'signal_name': "updateFileMetadata()",
         'slot': self.show_find_occurrences},
         {'target': 'main_container',
         'signal_name': "findOcurrences(QString)",
         'slot': self.show_find_occurrences},
         {'target': 'main_container',
         'signal_name': "runFile(QString)",
         'slot': self.execute_file},
         {'target': 'explorer_container',
         'signal_name': "removeProjectFromConsole(QString)",
         'slot': self.remove_project_from_console},
         {'target': 'explorer_container',
         'signal_name': "addProjectToConsole(QString)",
         'slot': self.add_project_to_console},
         )
     IDE.register_signals('tools_dock', connections)
     IDE.register_service("tools_dock", self)
开发者ID:Zekom,项目名称:ninja-ide,代码行数:25,代码来源:misc_container.py


注:本文中的ninja_ide.gui.ide.IDE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。