Skip to main content

For the love of python and qml

Project description

soloman Downloads

For the love of python and qml

refer to milestone

Installation

pip install soloman

Python Usage

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.4

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.4

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
...

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.4

ApplicationWindow {
	visible: true
	width: 800
	height: 500

    SVideo {
        objectName: "screen_01"  // declare objectName to be used in python
    }

}

Wiki

The wiki can be located here

Project details


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.4.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

soloman-2.4.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file soloman-2.4.1.tar.gz.

File metadata

  • Download URL: soloman-2.4.1.tar.gz
  • Upload date:
  • Size: 9.9 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

Hashes for soloman-2.4.1.tar.gz
Algorithm Hash digest
SHA256 f49bea76ed5f90416ee9f15bb67dd45adea8d9d1986eb6a4e0c512b9d8ad4a0d
MD5 6bd944a6d386643f004a82211ccad1a1
BLAKE2b-256 2d08f1a8ebefd70580afbba5eef1930c29e2286f05db3410525504796ff121ee

See more details on using hashes here.

Provenance

File details

Details for the file soloman-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: soloman-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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

Hashes for soloman-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4caf3b39c19ede7516071667b4d23a5e24b3cfeea2efdc7f685a591b4e2ddef
MD5 b1f4f5fd3e381b50123faa3499a6506d
BLAKE2b-256 4d66e242a917b0ff66927ca1ee819e40a4b8b7a408457cb42b41151ff00290df

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page