initial fluent-widgets ui
This commit is contained in:
33
examples/media/avatar_widget/demo.py
Normal file
33
examples/media/avatar_widget/demo.py
Normal file
@ -0,0 +1,33 @@
|
||||
# coding:utf-8
|
||||
import sys
|
||||
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtGui import QPixmap, QMovie
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||
|
||||
from qfluentwidgets import AvatarWidget
|
||||
|
||||
|
||||
class Demo(QWidget):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.resize(400, 300)
|
||||
self.setStyleSheet('Demo {background: white}')
|
||||
self.hBoxLayout = QHBoxLayout(self)
|
||||
|
||||
avatar = QPixmap('resource/shoko.png')
|
||||
# avatar = 'resource/boqi.gif'
|
||||
|
||||
sizes = [96, 48, 32, 24]
|
||||
for s in sizes:
|
||||
w = AvatarWidget(avatar, self)
|
||||
w.setRadius(s // 2)
|
||||
self.hBoxLayout.addWidget(w)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
w = Demo()
|
||||
w.show()
|
||||
app.exec()
|
||||
BIN
examples/media/avatar_widget/resource/boqi.gif
Normal file
BIN
examples/media/avatar_widget/resource/boqi.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 393 KiB |
BIN
examples/media/avatar_widget/resource/shoko.png
Normal file
BIN
examples/media/avatar_widget/resource/shoko.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 262 KiB |
62
examples/media/media_player/demo.py
Normal file
62
examples/media/media_player/demo.py
Normal file
@ -0,0 +1,62 @@
|
||||
# coding: utf-8
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import QUrl, Qt
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
|
||||
from qfluentwidgets import setTheme, Theme
|
||||
from qfluentwidgets.multimedia import SimpleMediaPlayBar, StandardMediaPlayBar, VideoWidget
|
||||
|
||||
|
||||
class Demo1(QWidget):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
setTheme(Theme.DARK)
|
||||
self.vBoxLayout = QVBoxLayout(self)
|
||||
self.resize(500, 300)
|
||||
|
||||
# self.player = QMediaPlayer(self)
|
||||
# self.player.setMedia(QUrl.fromLocalFile(filename))
|
||||
# self.player.setPosition()
|
||||
|
||||
self.simplePlayBar = SimpleMediaPlayBar(self)
|
||||
self.standardPlayBar = StandardMediaPlayBar(self)
|
||||
|
||||
self.vBoxLayout.addWidget(self.simplePlayBar)
|
||||
self.vBoxLayout.addWidget(self.standardPlayBar)
|
||||
|
||||
# online music
|
||||
url = QUrl("https://files.cnblogs.com/files/blogs/677826/beat.zip?t=1693900324")
|
||||
self.simplePlayBar.player.setSource(url)
|
||||
|
||||
# local music
|
||||
url = QUrl.fromLocalFile(str(Path('resource/aiko - シアワセ.mp3').absolute()))
|
||||
self.standardPlayBar.player.setSource(url)
|
||||
|
||||
# self.standardPlayBar.play()
|
||||
|
||||
|
||||
class Demo2(QWidget):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.vBoxLayout = QVBoxLayout(self)
|
||||
self.videoWidget = VideoWidget(self)
|
||||
|
||||
self.videoWidget.setVideo(QUrl('https://media.w3.org/2010/05/sintel/trailer.mp4'))
|
||||
self.videoWidget.play()
|
||||
|
||||
self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.vBoxLayout.addWidget(self.videoWidget)
|
||||
self.resize(800, 450)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
demo1 = Demo1()
|
||||
demo1.show()
|
||||
demo2 = Demo2()
|
||||
demo2.show()
|
||||
sys.exit(app.exec())
|
||||
BIN
examples/media/media_player/resource/aiko - シアワセ.mp3
Normal file
BIN
examples/media/media_player/resource/aiko - シアワセ.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user