Skip to main content

For the love of Artificial Intelligence, Python and QML

Project description

soloman Downloads

For the love of Artificial Intelligence, 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.15
...
import soloman 2.5

SAudio {
    id: aud
}

Button {
    text: "Play"
    onClicked: aud.play('path/to/music.mp3')
}

Play videos

example.qml

Play a video file

import QtQuick 2.15
...
import soloman 2.5

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.15
import QtQuick.Controls 2.15
import solomon 2.5

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

Uploaded Source

Built Distribution

soloman-3.0.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: soloman-3.0.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for soloman-3.0.2.tar.gz
Algorithm Hash digest
SHA256 053e9aa35bc5f9ada7eb04422c81ea12d70b34e9f27e3fecd0afce6614e7c7a9
MD5 78281a34230300c0707e7bda298cb6a2
BLAKE2b-256 9f1f40b32b1d3c9fd2f645026a2e035ba20380550ffd16acf5328648baa28687

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: soloman-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for soloman-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c495a22771d072a4835f7355d405755d705a472cc93695f02ff191f56985ae4
MD5 ac3f8197c93d61f2a873106b1fffd7d2
BLAKE2b-256 2ab9bdcfa49d0557a8504c334908b105de03229dfceda56a57d9f413fba9b37c

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