本文整理汇总了Python中Interface.Interface.createStamp方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.createStamp方法的具体用法?Python Interface.createStamp怎么用?Python Interface.createStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interface.Interface
的用法示例。
在下文中一共展示了Interface.createStamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import createStamp [as 别名]
#.........这里部分代码省略.........
self.stampsModel.addStamp(Stamp('Google+', 'images/stamps/googlePlusIcon.png', GooglePlusConfigWidget(), lambda: GooglePlusWorker()))
self.stampsModel.addStamp(Stamp('Picasa', 'images/stamps/picasaIcon.png', PicasaConfigWidget(), lambda: GooglePlusWorker()))
self.stampsModel.addStamp(Stamp('Ubuntu One', 'images/stamps/ubuntuOneIcon.png', UbuntuOneConfigWidget(), lambda: UbuntuOneWorker()))
def initializeQmlScene(self):
self.rootContext = self.ui.declarativeView.rootContext()
self.rootContext.setContextProperty('stampSheetModel', self.stampsModel)
self.rootContext.setContextProperty('servicesModel', self.servicesModel)
self.rootContext.setContextProperty('imageListModel', self.fileDetailsModel)
self.rootContext.setContextProperty('mainInterface', self.interface)
self.ui.declarativeView.setSource(QtCore.QUrl.fromLocalFile(postmanconfig.get_data_path() + "/qml/main.qml"))
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.acceptProposedAction()
def dropEvent(self, event):
self.addFiles(event.mimeData().urls())
def addFiles(self, urls):
# files cannot be added while delivering files
if self.currentScreen == 'deliveryView':
return
fileList = []
for u in urls:
# if it's a file simply add to the list
localFile = u.toLocalFile()
if not localFile:
continue
# check if it is a file or a directory
fileInfo = QtCore.QFileInfo(localFile)
if fileInfo.isFile():
if self.isValidFile(localFile):
fileList.append(localFile)
elif fileInfo.isDir():
dirIter = QtCore.QDirIterator(localFile, QtCore.QDir.Files | QtCore.QDir.NoDotAndDotDot, QtCore.QDirIterator.Subdirectories)
while dirIter.hasNext():
dirIter.next()
if self.isValidFile(dirIter.filePath()):
fileList.append(dirIter.filePath())
for f in fileList:
self.fileDetailsModel.addItem(FileDetails(f))
# switch to photo view
self.interface.forceScreenChange('stackView')
def isValidFile(self, filepath):
fileInfo = QtCore.QFileInfo(filepath)
if fileInfo.isFile():
# check extension
if fileInfo.suffix().lower() in self.validExtensions:
return True
return False
def addStamp(self, service):
# get icon for this service
stamp = self.stampsModel.getStampByName(service)
if stamp:
self.interface.createStamp(service, stamp.iconSource)
def stampSelectionChanged(self, uid):
self.loadConfigWidget()
def loadConfigWidget(self):
selectedUid = self.servicesModel.selectedStampUid
if selectedUid == -1:
self.dockWindow.setWindowTitle('Service Configuration')
self.dockWindow.setWidget(self.serviceInstructionsWidget)
else:
service = self.servicesModel.getByUid(selectedUid)
serviceName = service['name']
configWidget = self.stampsModel.getStampByName(serviceName).configWidget
configWidget.setServiceModel(self.servicesModel)
configWidget.setService(service)
self.dockWindow.setWindowTitle('')
self.dockWindow.setWidget(configWidget)
def screenChanged(self, screen):
self.currentScreen = screen
if screen == 'stackView':
self.dockWindow.setWindowTitle('Add Images')
self.dockWindow.setWidget(self.addImagesWidget)
elif screen == 'gridView':
self.dockWindow.setWindowTitle('Image Details')
self.dockWindow.setWidget(self.imageDetailsWidget)
elif screen == 'stampView':
self.dockWindow.setWindowTitle('Service Configuration')
self.loadConfigWidget()
elif screen == 'deliveryView':
self.dockWindow.setWindowTitle('Delivery')
self.dockWindow.setWidget(None)