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


Python IDE.getInstance方法代码示例

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


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

示例1: add_editor

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def add_editor(self, fileName=None, ignore_checkers=False):
        print("filename::", fileName)
        ninjaide = IDE.getInstance()
        editable = ninjaide.get_or_create_editable(fileName)
        if editable.editor:
            self.current_widget.set_current(editable)
            print("\n\nreturn")
            return self.current_widget.currentWidget()
        else:
            editable.ignore_checkers = ignore_checkers

        editorWidget = self.create_editor_from_editable(editable)

        #add the tab
        keep_index = (self.splitter.count() > 1 and
                      self.combo_area.stacked.count() > 0)
        self.combo_area.add_editor(editable, keep_index)

        #emit a signal about the file open
        self.fileOpened.emit(fileName)
        if keep_index:
            self.current_widget.set_current(editable)

        self.stack.setCurrentWidget(self.splitter)
        return editorWidget
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:27,代码来源:main_container.py

示例2: install

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def install(self):
        """Install StatusBar as a service."""
        self.hide()
        ide = IDE.getInstance()
        self._codeLocator = locator_widget.LocatorWidget(ide)

        ui_tools.install_shortcuts(self, actions.ACTIONS_STATUS, ide)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:9,代码来源:status_bar.py

示例3: _close

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def _close(self, path, temp):
     if temp:
         nfile = self._temp_files.get(temp, None)
     else:
         ninjaide = IDE.getInstance()
         nfile = ninjaide.get_or_create_nfile(path)
     if nfile is not None:
         nfile.close()
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:10,代码来源:files_handler.py

示例4: _get_save_folder

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def _get_save_folder(self, fileName):
     """
     Returns the root directory of the 'Main Project' or the home folder
     """
     ninjaide = IDE.getInstance()
     current_project = ninjaide.get_current_project()
     if current_project:
         return current_project.path
     return os.path.expanduser("~")
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:11,代码来源:main_container.py

示例5: _file_opened_by_main

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def _file_opened_by_main(self, path):
     index = self.stacked.currentIndex()
     ninjaide = IDE.getInstance()
     editable = ninjaide.get_or_create_editable(path)
     print("_file_opened_by_main", editable)
     self.add_editor(editable)
     self.bar.set_current_by_index(index)
     if index == -1:
         self.bar.set_current_by_index(0)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:11,代码来源:combo_editor.py

示例6: __init__

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def __init__(self):
        super(ConsoleWidget, self).__init__('>>> ')
        self.setUndoRedoEnabled(False)
        self.apply_editor_style()
        self.setToolTip(self.tr("Show/Hide (F4)"))
        self.moveCursor(QTextCursor.EndOfLine)

        self._patIsWord = re.compile('\w+')
        self.prompt = '>>> '
        self._console = console.Console()
        self._history = []
        self.history_index = 0
        self._current_command = ''
        self._braces = None
        self.imports = ['import __builtin__']
        self.patFrom = re.compile('^(\\s)*from ((\\w)+(\\.)*(\\w)*)+ import')
        self.patImport = re.compile('^(\\s)*import (\\w)+')
        self.patObject = re.compile('[^a-zA-Z0-9_\\.]')
        #self.completer = completer_widget.CompleterWidget(self)
        self.okPrefix = QRegExp('[.)}:,\]]')

        self._pre_key_press = {
            Qt.Key_Enter: self._enter_pressed,
            Qt.Key_Return: self._enter_pressed,
            Qt.Key_Tab: self._tab_pressed,
            Qt.Key_Home: self._home_pressed,
            Qt.Key_PageUp: lambda x: True,
            Qt.Key_PageDown: lambda x: True,
            Qt.Key_Left: self._left_pressed,
            Qt.Key_Up: self._up_pressed,
            Qt.Key_Down: self._down_pressed,
            Qt.Key_Backspace: self._backspace,
        }

        #Create Context Menu
        self._create_context_menu()

        #Set Font
        self.set_font(settings.FONT)
        #Create Highlighter
        parts_scanner, code_scanner, formats = \
            syntax_highlighter.load_syntax(python_syntax.syntax)
        self.highlighter = syntax_highlighter.SyntaxHighlighter(
            self.document(),
            parts_scanner, code_scanner, formats)

        self.cursorPositionChanged.connect(self.highlight_current_line)
        self.highlight_current_line()

        self._proc = QProcess(self)
        self._proc.readyReadStandardOutput.connect(self._python_path_detected)
        self._proc.error['QProcess::ProcessError'].connect(self.process_error)
        self._add_system_path_for_frozen()

        ninjaide = IDE.getInstance()
        ninjaide.ns_preferences_editor_font.connect(self.set_font)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:58,代码来源:console_widget.py

示例7: _add_model

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def _add_model(self):
        print("_add_model:_add_model")
        ninjaide = IDE.getInstance()
        files = ninjaide.opened_files
        # print("_add_model::", files, "\n", self._model.keys())
        # Update model
        # old = set(self._model.keys())
        # now = set([nfile.file_path for nfile in files])
        # new = old - now
        # for item in new:
        #     del self._model[item]

        past = set(self._model.keys())
        now = set([nfile.file_path for nfile in files])
        old = past - now
        # print("\n_model:past:", past)
        # print("\n_model:now:", now)
        # print("\n_model:old:", old)
        for item in old:
            del self._model[item]

        current_editor = self._main_container.get_current_editor()
        current_path = None
        if current_editor:
            current_path = current_editor.file_path
        model = []
        # print("len(files)", len(files), [nfile.file_path for nfile in files], "\n\n")
        for nfile in files:
            if (nfile.file_path not in self._model and
                    nfile.file_path is not None):
                self._model[nfile.file_path] = 0
            neditable = ninjaide.get_or_create_editable(nfile=nfile)
            checkers = neditable.sorted_checkers
            checks = []
            for items in checkers:
                checker, color, _ = items
                if checker.dirty:
                    # Colors needs to be reversed for QML
                    color = "#%s" % color[::-1]
                    checks.append(
                        {"checker_text": checker.dirty_text,
                         "checker_color": color})
            modified = neditable.editor.is_modified
            temp_file = str(uuid.uuid4()) if nfile.file_path is None else ""
            filepath = nfile.file_path if nfile.file_path is not None else ""
            model.append([nfile.file_name, filepath, checks, modified,
                          temp_file])
            if temp_file:
                self._temp_files[temp_file] = nfile
        if current_path:
            index = self._model[current_path]
            self._max_index = max(self._max_index, index) + 1
            self._model[current_path] = self._max_index
        model = sorted(model, key=lambda x: self._model.get(x[1], False),
                       reverse=True)
        self._root.set_model(model)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:58,代码来源:files_handler.py

示例8: install

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def install(self):
        ide = IDE.getInstance()
        ide.place_me_on("main_container", self, "central", top=True)

        self.combo_area = combo_editor.ComboEditor(original=True)
        self.combo_area.allFilesClosed.connect(self._files_closed)
        self.splitter.add_widget(self.combo_area)
        self.add_widget(self.splitter)

        self.current_widget = self.combo_area

        ui_tools.install_shortcuts(self, actions.ACTIONS, ide)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:14,代码来源:main_container.py

示例9: __init__

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def __init__(self, editor):
        super(Pep8Checker, self).__init__()
        self._editor = editor
        self._path = ''
        self._encoding = ''
        self.checks = {}

        self.checker_icon = QStyle.SP_MessageBoxWarning

        ninjaide = IDE.getInstance()
        ninjaide.ns_preferences_editor_checkStyle.connect(lambda: remove_pep8_checker())
        self.checkerCompleted.connect(self.refresh_display)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:14,代码来源:pep8_checker.py

示例10: open

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def open(self):
     """Open the selected file in the proper line."""
     if not self._find_widget.isVisible():
         ninjaide = IDE.getInstance()
         actual_projects_obj = ninjaide.filesystem.get_projects()
         actual_projects = [path for path in actual_projects_obj]
         actual = ninjaide.get_current_project()
         actual_path = None
         if actual:
             actual_path = actual.path
         self._find_widget.show(actual_project=actual_projects,
             actual=actual_path)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:14,代码来源:find_in_files.py

示例11: __init__

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def __init__(self, editor):
        super(ErrorsChecker, self).__init__()
        self._editor = editor
        self._path = ''
        self._encoding = ''
        self.checks = {}
        self.reporter = None

        self.checker_icon = ":img/bug"

        ninjaide = IDE.getInstance()
        ninjaide.ns_preferences_editor_errors.connect(lambda: remove_error_checker())
        self.checkerCompleted.connect(self.refresh_display)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:15,代码来源:errors_checker.py

示例12: install

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def install(self):
        ide = IDE.getInstance()
        ide.place_me_on("explorer_container", self, "lateral")

        for obj in ExplorerContainer.__TABS:
            tabname, icon = ExplorerContainer.__TABS[obj]
            self.add_tab(tabname, obj, icon)
            obj.dockWidget.connect(self._dock_widget)
            obj.undockWidget.connect(self._undock_widget)
            obj.changeTitle.connect(self._change_tab_title)

        if self.count() == 0:
            self.hide()
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:15,代码来源:explorer_container.py

示例13: install

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
    def install(self):
        """Install triggered by the ide."""
        self.setup_ui()
        ninjaide = IDE.getInstance()
        ninjaide.place_me_on("tools_dock", self, "central")
        ui_tools.install_shortcuts(self, actions.ACTIONS, ninjaide)

        ninjaide.goingDown.connect(self.save_configuration)

        qsettings = IDE.ninja_settings()
        value = qsettings.value("tools_dock/visible", True, type=bool)
        self.setVisible(value)
        print("\ninstall")
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:15,代码来源:tools_dock.py

示例14: _open

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def _open(self, path, temp, project):
     if project:
         path = os.path.join(os.path.split(project)[0], path)
         self._main_container.open_file(path)
     elif temp:
         nfile = self._temp_files[temp]
         ninjaide = IDE.getInstance()
         neditable = ninjaide.get_or_create_editable(nfile=nfile)
         self._main_container.current_widget.set_current(neditable)
     else:
         self._main_container.open_file(path)
         index = self._model[path]
         self._max_index = max(self._max_index, index) + 1
         self._model[path] = self._max_index
     self.hide()
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:17,代码来源:files_handler.py

示例15: _delete_file

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import getInstance [as 别名]
 def _delete_file(self, path=''):
     if not path:
         path = self.model().filePath(self.currentIndex())
     val = QMessageBox.question(self, translations.TR_DELETE_FILE,
                                translations.TR_DELETE_FOLLOWING_FILE + path,
                                QMessageBox.Yes, QMessageBox.No)
     if val == QMessageBox.Yes:
         path = file_manager.create_path(path)
         main_container = ide_srv = IDE.get_service('main_container')
         if main_container and main_container.is_open(path):
             main_container.close_deleted_file(path)
         #FIXME: Manage the deletion signal instead of main container
         #fiddling here
         ide_srv = IDE.getInstance()
         current_nfile = ide_srv.get_or_create_nfile(path)
         current_nfile.delete()
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:18,代码来源:tree_projects_widget.py


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