For the love of python and qml
Project description
soloman
For the love of python and qml
Change Log
version 2.2.2
- Frames per second is universally used
- Allow user to set Frames per second
- More formats are now supported ("asf", "avi", "flv", "gif", "mov", "3gp", "3gpp", "mkv", "webm")
Installation
pip install soloman
Python Usage
Show cv2 frame
example.py
import sys
import cv2
import threading
from time import sleep
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml QQmlApplicationEngine
import soloman
app = QGuiApplication(sys.argv)
# Create a QML engine.
engine = QQmlApplicationEngine()
engine.quit.connect(app.quit)
engine.load(QUrl('example.qml'))
# Get SVideo
vid = soloman.Video(engine)
vid.get_SVideo('screen_01') # objectName goes here
# Capture
capture = cv2.VideoCapture(0) # capture camera
def start_capt():
# start thread
o_thread = threading.Thread(target=_start_capt)
o_thread.daemon = True
o_thread.start()
def _start_capt():
while True:
ret, frame = capture.read()
if not ret:
break
vid.show_frame(frame)
sleep(1/24)
# Call to start capturing
start_capt()
# Run the app
ret_value = app.exec_()
capture.release()
sys.exit(0)
example.qml
import QtQuick 2.14
import QtQuick.Controls 2.14
import solomon 2.2
ApplicationWindow {
visible: true
width: 800
height: 500
SVideo {
objectName: "screen_01" // declare objectName to be used in python
}
}
Play audio
from soloman import Audio
aud = Audio()
aud.play('/path/to/music.mp3')
Qml Usage
example.py
import soloman
...
engine = QQmlApplicationEngine()
...
engine.load('example.qml')
Play audio
example.qml
import QtQuick 2.14
...
import soloman 2.2
SAudio {
id: aud
}
Button {
text: "Play"
onClicked: aud.play('path/to/music.mp3')
}
Play videos
example.qml
Play a video file
import QtQuick 2.14
...
import soloman 2.1
SVideo {
id: vid
}
Button {
text: "Play video"
onClicked: vid.play('path/to/video.mp4')
}
Play stills
Option one
...
onClicked: vid.play('path/to/video_stills_01.jpg') # possibly the first image
...
Option two
...
onClicked: vid.play('path/to/') # make sure folder contains only stills
...
Wiki
The wiki can be located here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
soloman-2.2.2.tar.gz
(9.5 kB
view details)
Built Distribution
soloman-2.2.2-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file soloman-2.2.2.tar.gz
.
File metadata
- Download URL: soloman-2.2.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a17b804f54a90e9e1b4d632282e16f9014d355b332fd834c4de9e9f707d35d |
|
MD5 | 9ffc1b7fdbf19d74ae710e663da33390 |
|
BLAKE2b-256 | 46ebfcc2a0ea40ce7f20455ef7212b57a6d0ae35811f1104dc8e591ab7115a8d |
Provenance
File details
Details for the file soloman-2.2.2-py3-none-any.whl
.
File metadata
- Download URL: soloman-2.2.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98e59b0ba4ba862e96df95113ff03ed1955b7db79292f2bc7a07dcc8fb516222 |
|
MD5 | 54150504674f8f74e629d30c69909a9b |
|
BLAKE2b-256 | 7e7490b26253032a6168dfc03c05f75e14124160e6f0ed1b0882d80591f7250c |