本文整理汇总了Python中Tc2Config.readWriteImageFormats方法的典型用法代码示例。如果您正苦于以下问题:Python Tc2Config.readWriteImageFormats方法的具体用法?Python Tc2Config.readWriteImageFormats怎么用?Python Tc2Config.readWriteImageFormats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tc2Config
的用法示例。
在下文中一共展示了Tc2Config.readWriteImageFormats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onButtonSaveImageClicked
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import readWriteImageFormats [as 别名]
def onButtonSaveImageClicked(self):
imageFormats = imageFormats = Tc2Config.readWriteImageFormats()
fileName = Tc2Config.dlgOpenSaveFile(
parent=self,
openFile=False,
title='Save Screenshot..',
fileFilters=('Images (%s)' % ' '.join(['*.%s' % i for i in imageFormats]), 'All Files (*)'),
defaultSuffix='png',
settingsKey=self.SettingsKeyDialogSaveImageState,
)
if fileName is None:
return
fileInfo = QtCore.QFileInfo(fileName)
format = fileInfo.suffix().toLower()
if not self.labelPixmap.pixmap().save(fileName, format):
Tc2Config.msgWarning(self, 'Could Not Save Image')
示例2: onButtonBackgroundImageClicked
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import readWriteImageFormats [as 别名]
def onButtonBackgroundImageClicked(self):
imageFormats = Tc2Config.readWriteImageFormats()
fileName = Tc2Config.dlgOpenSaveFile(
parent=self,
openFile=True,
title='Open Background Image..',
fileFilters=('Images (%s)' % ' '.join(['*.%s' % i for i in imageFormats]), 'All Files (*)'),
settingsKey=self.SettingsKeyDialogOpenImageState,
)
if fileName is None:
return
imageName, pixmap = self.imageFromFileName(fileName)
if imageName is None:
Tc2Config.msgWarning(self, 'Could not open background image')
return
self.setBackgroundImage(imageName, pixmap)
示例3: onActionOpenImageTriggered
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import readWriteImageFormats [as 别名]
def onActionOpenImageTriggered(self):
imageFormats = Tc2Config.readWriteImageFormats()
fileName = Tc2Config.dlgOpenSaveFile(
parent=self,
openFile=True,
title='Open Image..',
fileFilters=('Images (%s)' % ' '.join(['*.%s' % i for i in imageFormats]), 'All Files (*)'),
settingsKey=self.SettingsKeyDialogImageOpenState,
)
if fileName is None:
return
pixmap = QtGui.QPixmap()
if not pixmap.load(fileName):
Tc2Config.msgWarning(self, 'Could not open image')
return
fileInfo = QtCore.QFileInfo(fileName)
screenshotName = fileInfo.baseName()
self.setPixmap(pixmap=pixmap)
示例4: onActionSaveImageTriggered
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import readWriteImageFormats [as 别名]
def onActionSaveImageTriggered(self):
if self.labelInputImage.pixmap() is None:
self.actionSaveImage.setEnabled(False)
return
imageFormats = imageFormats = Tc2Config.readWriteImageFormats()
fileName = Tc2Config.dlgOpenSaveFile(
parent=self,
openFile=False,
title='Save Image..',
fileFilters=('Images (%s)' % ' '.join(['*.%s' % i for i in imageFormats]), 'All Files (*)'),
defaultSuffix='png',
settingsKey=self.SettingsKeyDialogImageSaveState,
)
if fileName is None:
return
fileInfo = QtCore.QFileInfo(fileName)
format = fileInfo.suffix().toLower()
if not self.labelInputImage.pixmap().save(fileName, format):
Tc2Config.msgWarning(self, 'Could Not Save Image')