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


Python QFileInfo.lastModified方法代码示例

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


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

示例1: __installEric6Doc

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import lastModified [as 别名]
 def __installEric6Doc(self, engine):
     """
     Private method to install/update the eric6 help documentation.
     
     @param engine reference to the help engine (QHelpEngineCore)
     @return flag indicating success (boolean)
     """
     versionKey = "eric6_ide"
     info = engine.customValue(versionKey, "")
     lst = info.split('|')
     
     dt = QDateTime()
     if len(lst) and lst[0]:
         dt = QDateTime.fromString(lst[0], Qt.ISODate)
     
     qchFile = ""
     if len(lst) == 2:
         qchFile = lst[1]
     
     docsPath = QDir(getConfig("ericDocDir") + QDir.separator() + "Help")
     
     files = docsPath.entryList(["*.qch"])
     if not files:
         engine.setCustomValue(
             versionKey, QDateTime().toString(Qt.ISODate) + '|')
         return False
     
     for f in files:
         if f == "source.qch":
             fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
             if dt.isValid() and \
                fi.lastModified().toString(Qt.ISODate) == \
                 dt.toString(Qt.ISODate) and \
                qchFile == fi.absoluteFilePath():
                 return False
             
             namespace = QHelpEngineCore.namespaceName(
                 fi.absoluteFilePath())
             if not namespace:
                 continue
             
             if namespace in engine.registeredDocumentations():
                 engine.unregisterDocumentation(namespace)
             
             if not engine.registerDocumentation(fi.absoluteFilePath()):
                 self.errorMessage.emit(
                     self.tr(
                         """<p>The file <b>{0}</b> could not be"""
                         """ registered. <br/>Reason: {1}</p>""")
                     .format(fi.absoluteFilePath, engine.error())
                 )
                 return False
             
             engine.setCustomValue(
                 versionKey,
                 fi.lastModified().toString(Qt.ISODate) + '|' +
                 fi.absoluteFilePath())
             return True
     
     return False
开发者ID:pycom,项目名称:EricShort,代码行数:62,代码来源:HelpDocsInstaller.py

示例2: __insertFlashCookie

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import lastModified [as 别名]
 def __insertFlashCookie(self, path):
     """
     Private method to insert a Flash cookie into the cache.
     
     @param path Flash cookies path
     @type str
     """
     solFile = QFile(path)
     if not solFile.open(QFile.ReadOnly):
         return
     
     dataStr = ""
     data = bytes(solFile.readAll())
     if data:
         try:
             reader = FlashCookieReader()
             reader.setBytes(data)
             reader.parse()
             dataStr = reader.toString()
         except FlashCookieReaderError as err:
             dataStr = err.msg
     
     solFileInfo = QFileInfo(solFile)
     
     cookie = FlashCookie()
     cookie.contents = dataStr
     cookie.name = solFileInfo.fileName()
     cookie.path = solFileInfo.canonicalPath()
     cookie.size = int(solFile.size())
     cookie.lastModified = solFileInfo.lastModified()
     cookie.origin = self.__extractOriginFrom(path)
     
     self.__flashCookies.append(cookie)
开发者ID:testmana2,项目名称:test,代码行数:35,代码来源:FlashCookieManager.py

示例3: prepareAPIs

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import lastModified [as 别名]
 def prepareAPIs(self, ondemand=False, rawList=None):
     """
     Public method to prepare the APIs if necessary.
     
     @keyparam ondemand flag indicating a requested preparation (boolean)
     @keyparam rawList list of raw API files (list of strings)
     """
     if self.__apis is None or self.__inPreparation:
         return
     
     needsPreparation = False
     if ondemand:
         needsPreparation = True
     else:
         # check, if a new preparation is necessary
         preparedAPIs = self.__defaultPreparedName()
         if preparedAPIs:
             preparedAPIsInfo = QFileInfo(preparedAPIs)
             if not preparedAPIsInfo.exists():
                 needsPreparation = True
             else:
                 preparedAPIsTime = preparedAPIsInfo.lastModified()
                 apifiles = sorted(
                     Preferences.getEditorAPI(self.__language))
                 if self.__apifiles != apifiles:
                     needsPreparation = True
                 for apifile in apifiles:
                     if QFileInfo(apifile).lastModified() > \
                             preparedAPIsTime:
                         needsPreparation = True
                         break
     
     if needsPreparation:
         # do the preparation
         self.__apis.clear()
         if rawList:
             apifiles = rawList
         else:
             apifiles = Preferences.getEditorAPI(self.__language)
         for apifile in apifiles:
             self.__apis.load(apifile)
         self.__apis.prepare()
         self.__apifiles = apifiles
开发者ID:pycom,项目名称:EricShort,代码行数:45,代码来源:APIsManager.py

示例4: __installQtDoc

# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import lastModified [as 别名]
    def __installQtDoc(self, name, version, engine):
        """
        Private method to install/update a Qt help document.
        
        @param name name of the Qt help document (string)
        @param version Qt version of the help documens (integer)
        @param engine reference to the help engine (QHelpEngineCore)
        @return flag indicating success (boolean)
        """
        versionKey = "qt_version_{0}@@{1}".format(version, name)
        info = engine.customValue(versionKey, "")
        lst = info.split("|")

        dt = QDateTime()
        if len(lst) and lst[0]:
            dt = QDateTime.fromString(lst[0], Qt.ISODate)

        qchFile = ""
        if len(lst) == 2:
            qchFile = lst[1]

        if version == 4:
            docsPath = QDir(QLibraryInfo.location(QLibraryInfo.DocumentationPath) + QDir.separator() + "qch")
        elif version == 5:
            docsPath = QDir(QLibraryInfo.location(QLibraryInfo.DocumentationPath))
        else:
            # unsupported Qt version
            return False

        files = docsPath.entryList(["*.qch"])
        if not files:
            engine.setCustomValue(versionKey, QDateTime().toString(Qt.ISODate) + "|")
            return False

        for f in files:
            if f.startswith(name):
                fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
                namespace = QHelpEngineCore.namespaceName(fi.absoluteFilePath())
                if not namespace:
                    continue

                if (
                    dt.isValid()
                    and namespace in engine.registeredDocumentations()
                    and fi.lastModified().toString(Qt.ISODate) == dt.toString(Qt.ISODate)
                    and qchFile == fi.absoluteFilePath()
                ):
                    return False

                if namespace in engine.registeredDocumentations():
                    engine.unregisterDocumentation(namespace)

                if not engine.registerDocumentation(fi.absoluteFilePath()):
                    self.errorMessage.emit(
                        self.tr(
                            """<p>The file <b>{0}</b> could not be""" """ registered. <br/>Reason: {1}</p>"""
                        ).format(fi.absoluteFilePath, engine.error())
                    )
                    return False

                engine.setCustomValue(versionKey, fi.lastModified().toString(Qt.ISODate) + "|" + fi.absoluteFilePath())
                return True

        return False
开发者ID:testmana2,项目名称:test,代码行数:66,代码来源:HelpDocsInstaller.py


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