本文整理汇总了Python中PyQt4.QtDeclarative.QDeclarativeView.showFullScreen方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.showFullScreen方法的具体用法?Python QDeclarativeView.showFullScreen怎么用?Python QDeclarativeView.showFullScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.showFullScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Infoboard
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import showFullScreen [as 别名]
class Infoboard(object):
def __init__(self, schedule_dir):
self.schedule_dir = schedule_dir
self.videos = {}
self.playlist = []
self.app = QApplication(sys.argv)
self.view = QDeclarativeView()
self.view.setSource(QUrl('scene.qml'))
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.viewRoot = self.view.rootObject()
self.viewRoot.quit.connect(self.app.quit)
self.viewRoot.finished.connect(self.show_next)
self.view.setGeometry(100, 100, 400, 240)
self.view.showFullScreen()
self.watcher = QFileSystemWatcher()
def schedule_dir_changed(self, filename):
self.process_all_schedules()
self.playlist = []
def run(self):
self.watcher.addPath(self.schedule_dir)
self.watcher.directoryChanged.connect(self.schedule_dir_changed)
self.process_all_schedules()
self.show_next()
self.app.exec_()
def process_schedule(self, key, fobj):
self.videos[key] = []
for line in fobj:
line = line.strip()
if (not line) or line.startswith('#'): continue
try:
self.videos[key].append(Video(line))
except:
pass
def process_all_schedules(self):
for filename in glob.glob(self.schedule_dir + '/*.txt'):
filename = os.path.abspath(filename)
with open(filename, 'rb') as f:
self.process_schedule(filename, f)
def show_next(self):
item = self.playlist_next()
if not item:
return
if item.type == 'image':
self.viewRoot.showImage(item.filename)
QTimer.singleShot(item.duration * 1000, self.show_next)
elif item.type == 'video':
self.viewRoot.showVideo(item.filename)
def playlist_next(self):
if len(self.playlist) == 0:
self.process_all_schedules()
today = date.today()
all_videos = []
for key in sorted(self.videos.keys()):
all_videos += self.videos[key]
self.playlist = [video for video in all_videos
if video.start_date <= today and video.end_date >= today]
if len(self.playlist) == 0:
return None
return self.playlist.pop(0)