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


Python IDE.data_settings方法代码示例

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


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

示例1: _on_click_on_favorite

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
 def _on_click_on_favorite(self, path, value):
     settings = IDE.data_settings()
     recent_projects = settings.value("recentProjects")
     properties = recent_projects[path]
     properties["isFavorite"] = value
     recent_projects[path] = properties
     settings.setValue("recentProjects", recent_projects)
开发者ID:Darriall,项目名称:ninja-ide,代码行数:9,代码来源:start_page.py

示例2: load_items

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
    def load_items(self):
        settings = IDE.data_settings()
        listByFavorites = []
        listNoneFavorites = []
        recent_projects_dict = dict(settings.value('recentProjects', {}))
        #Filter for favorites
        for recent_project_path, content in list(recent_projects_dict.items()):
            if bool(dict(content)["isFavorite"]):
                listByFavorites.append((recent_project_path,
                    content["lastopen"]))
            else:
                listNoneFavorites.append((recent_project_path,
                    content["lastopen"]))
        if len(listByFavorites) > 1:
            # sort by date favorites
            listByFavorites = sorted(listByFavorites,
                key=lambda date: listByFavorites[1])

        if len(listNoneFavorites) > 1:
            #sort by date last used
            listNoneFavorites = sorted(listNoneFavorites,
                key=lambda date: listNoneFavorites[1])

        for recent_project_path in listByFavorites:
            path = recent_project_path[0]
            name = recent_projects_dict[path]['name']
            self.root.add_project(name, path, True)

        for recent_project_path in listNoneFavorites:
            path = recent_project_path[0]
            name = recent_projects_dict[path]['name']
            self.root.add_project(name, path, False)
        self.root.forceActiveFocus()
开发者ID:Darriall,项目名称:ninja-ide,代码行数:35,代码来源:start_page.py

示例3: save_recent_projects

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
    def save_recent_projects(self, folder):
        settings = IDE.data_settings()
        recent_project_list = settings.value('recentProjects', {})
        #if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = translations.TR_NO_DESCRIPTION

        if folder in recent_project_list:
            properties = recent_project_list[folder]
            properties["lastopen"] = QDateTime.currentDateTime()
            properties["name"] = name
            properties["description"] = description
            recent_project_list[folder] = properties
        else:
            recent_project_list[folder] = {
                "name": name,
                "description": description,
                "isFavorite": False, "lastopen": QDateTime.currentDateTime()}
            #if the length of the project list it's high that 10 then delete
            #the most old
            #TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open(
                    recent_project_list)]
        settings.setValue('recentProjects', recent_project_list)
开发者ID:LeoYao,项目名称:ninja-ide,代码行数:34,代码来源:tree_projects_widget.py

示例4: _on_ide_going_down

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
 def _on_ide_going_down(self):
     """Save some settings before close"""
     if self.current_tree is None:
         return
     ds = IDE.data_settings()
     show_filesize = not bool(self.current_tree.isColumnHidden(1))
     ds.setValue("projectsExplorer/showFileSize", show_filesize)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:9,代码来源:tree_projects_widget.py

示例5: save_bookmarks

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
 def save_bookmarks(self):
     """Save all bookmarks"""
     bookmarks = []
     for bookmark in self._manager.all_bookmarks():
         bookmarks.append((
             bookmark.filename, bookmark.lineno,
             bookmark.linetext, bookmark.note
         ))
     data_settings = IDE.data_settings()
     data_settings.setValue("bookmarks", bookmarks)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:12,代码来源:bookmark_manager.py

示例6: load_bookmarks

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
 def load_bookmarks(self):
     """Load all bookmarks from data settings"""
     data_settings = IDE.data_settings()
     bookmarks = data_settings.value("bookmarks")
     if bookmarks is None:
         return
     for bookmark_data in bookmarks:
         fname, lineno, linetext, note = bookmark_data
         bookmark = Bookmark(fname, lineno)
         bookmark.linetext = linetext
         bookmark.note = note
         self.add_bookmark(bookmark)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:14,代码来源:bookmark_manager.py

示例7: __format_tree

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
    def __format_tree(self):
        """If not called after setting model, all the column format
        options are reset to default when the model is set"""
        self.setSelectionMode(QTreeView.SingleSelection)
        self.setAnimated(True)
        self.setHeaderHidden(True)
        self.header().setSectionResizeMode(QHeaderView.ResizeToContents)
        pal = self.palette()
        pal.setColor(pal.Base, pal.base().color())
        self.setPalette(pal)

        self.hideColumn(1)  # Size
        self.hideColumn(2)  # Type
        self.hideColumn(3)  # Modification date
        self.setUniformRowHeights(True)

        ds = IDE.data_settings()
        if ds.value("projectsExplorer/showFileSize", type=bool):
            self.show_filesize_info()
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:21,代码来源:tree_projects_widget.py

示例8: install

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
    def install(self):
        ninjaide = IDE.get_service("ide")
        ninjaide.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.combo_area.allFilesClosed.connect(
            lambda: self.allFilesClosed.emit())
        self.combo_area.fileClosed.connect(self._add_to_last_opened)
        self.splitter.add_widget(self.combo_area)
        self.add_widget(self.splitter)
        # self.current_widget = self.combo_area
        # Code Locator
        self._code_locator = locator_widget.LocatorWidget(ninjaide)

        data_settings = IDE.data_settings()
        recent_files = data_settings.value("lastSession/recentFiles")
        if recent_files is not None:
            self.__last_opened_files = recent_files
        ui_tools.install_shortcuts(self, actions.ACTIONS, ninjaide)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:22,代码来源:main_container.py

示例9: _on_click_on_delete

# 需要导入模块: from ninja_ide.gui.ide import IDE [as 别名]
# 或者: from ninja_ide.gui.ide.IDE import data_settings [as 别名]
 def _on_click_on_delete(self, path):
     settings = IDE.data_settings()
     recent_projects = settings.value("recentProjects")
     if path in recent_projects:
         del recent_projects[path]
         settings.setValue("recentProjects", recent_projects)
开发者ID:Darriall,项目名称:ninja-ide,代码行数:8,代码来源:start_page.py


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