本文整理汇总了Python中AnyQt.QtCore.QCoreApplication.applicationVersion方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.applicationVersion方法的具体用法?Python QCoreApplication.applicationVersion怎么用?Python QCoreApplication.applicationVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtCore.QCoreApplication
的用法示例。
在下文中一共展示了QCoreApplication.applicationVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: splash_screen
# 需要导入模块: from AnyQt.QtCore import QCoreApplication [as 别名]
# 或者: from AnyQt.QtCore.QCoreApplication import applicationVersion [as 别名]
def splash_screen():
"""
"""
pm = QPixmap(
pkg_resources.resource_filename(
__name__, "icons/orange-splash-screen.png")
)
version = QCoreApplication.applicationVersion()
size = 21 if len(version) < 5 else 16
font = QFont("Helvetica")
font.setPixelSize(size)
font.setBold(True)
font.setItalic(True)
font.setLetterSpacing(QFont.AbsoluteSpacing, 2)
metrics = QFontMetrics(font)
br = metrics.boundingRect(version).adjusted(-5, 0, 5, 0)
br.moveCenter(QPoint(436, 224))
p = QPainter(pm)
p.setRenderHint(QPainter.Antialiasing)
p.setRenderHint(QPainter.TextAntialiasing)
p.setFont(font)
p.setPen(QColor("#231F20"))
p.drawText(br, Qt.AlignCenter, version)
p.end()
return pm, QRect(88, 193, 200, 20)
示例2: cache_dir
# 需要导入模块: from AnyQt.QtCore import QCoreApplication [as 别名]
# 或者: from AnyQt.QtCore.QCoreApplication import applicationVersion [as 别名]
def cache_dir():
"""
Return the application cache directory. If the directory path
does not yet exists then create it.
"""
init()
cachedir = QStandardPaths.writableLocation(QStandardPaths.CacheLocation)
version = QCoreApplication.applicationVersion()
cachedir = os.path.join(cachedir, version)
if not os.path.exists(cachedir):
os.makedirs(cachedir)
return cachedir
示例3: data_dir
# 需要导入模块: from AnyQt.QtCore import QCoreApplication [as 别名]
# 或者: from AnyQt.QtCore.QCoreApplication import applicationVersion [as 别名]
def data_dir():
"""
Return the application data directory. If the directory path
does not yet exists then create it.
"""
init()
datadir = QStandardPaths.writableLocation(QStandardPaths.DataLocation)
version = QCoreApplication.applicationVersion()
datadir = os.path.join(datadir, version)
if not os.path.isdir(datadir):
try:
os.makedirs(datadir, exist_ok=True)
except OSError:
pass
return datadir
示例4: splash_screen
# 需要导入模块: from AnyQt.QtCore import QCoreApplication [as 别名]
# 或者: from AnyQt.QtCore.QCoreApplication import applicationVersion [as 别名]
def splash_screen():
# type: () -> Tuple[QPixmap, QRect]
"""
Return a splash screen pixmap and an text area within it.
The text area is used for displaying text messages during application
startup.
The default implementation returns a bland rectangle splash screen.
Returns
-------
t : Tuple[QPixmap, QRect]
A QPixmap and a rect area within it.
"""
path = pkg_resources.resource_filename(
__name__, "icons/orange-canvas-core-splash.svg")
pm = QPixmap(path)
version = QCoreApplication.applicationVersion()
if version:
version_parsed = LooseVersion(version)
version_comp = version_parsed.version
version = ".".join(map(str, version_comp[:2]))
size = 21 if len(version) < 5 else 16
font = QFont()
font.setPixelSize(size)
font.setBold(True)
font.setItalic(True)
font.setLetterSpacing(QFont.AbsoluteSpacing, 2)
metrics = QFontMetrics(font)
br = metrics.boundingRect(version).adjusted(-5, 0, 5, 0)
br.moveBottomRight(QPoint(pm.width() - 15, pm.height() - 15))
p = QPainter(pm)
p.setRenderHint(QPainter.Antialiasing)
p.setRenderHint(QPainter.TextAntialiasing)
p.setFont(font)
p.setPen(QColor("#231F20"))
p.drawText(br, Qt.AlignCenter, version)
p.end()
textarea = QRect(15, 15, 170, 20)
return pm, textarea