forked from openlp/openlp
Merge branch 'qr_code' into 'master'
Replace QR code with generator and update tests See merge request openlp/openlp!416
This commit is contained in:
commit
72fb6347bb
@ -30,7 +30,7 @@ install:
|
||||
# Update pip
|
||||
- python -m pip install --upgrade pip
|
||||
# Install generic dependencies from pypi
|
||||
- python -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc zeroconf flask-cors pytest-qt pyenchant pysword
|
||||
- python -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc zeroconf flask-cors pytest-qt pyenchant pysword qrcode pillow
|
||||
# Install Windows only dependencies
|
||||
- cmd: python -m pip install pyodbc pypiwin32
|
||||
# Mac only dependencies
|
||||
|
@ -21,6 +21,11 @@
|
||||
"""
|
||||
The :mod:`~openlp.core.api.tab` module contains the settings tab for the API
|
||||
"""
|
||||
|
||||
import PIL.ImageQt
|
||||
import PIL.Image
|
||||
import qrcode
|
||||
|
||||
from time import sleep
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
@ -213,9 +218,7 @@ class ApiTab(SettingsTab):
|
||||
'Show thumbnails of non-text slides in remote and stage view.'))
|
||||
self.app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Remote App'))
|
||||
self.app_qr_description_label.setText(
|
||||
translate('RemotePlugin.RemoteTab',
|
||||
'Scan the QR code or click <a href="{qr}">download</a> to download an app for your mobile device'
|
||||
).format(qr='https://openlp.org/#mobile-app-downloads'))
|
||||
translate('RemotePlugin.RemoteTab', 'Scan the QR code to open the remote view on your mobile device'))
|
||||
self.user_login_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'User Authentication'))
|
||||
self.web_remote_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Web Remote'))
|
||||
self.check_version_button.setText(translate('RemotePlugin.RemoteTab', 'Check for Updates'))
|
||||
@ -268,14 +271,15 @@ class ApiTab(SettingsTab):
|
||||
Update the display based on the data input on the screen
|
||||
"""
|
||||
ip_address = self.get_ip_address(self.address_edit.text())
|
||||
http_url = 'http://{url}:{text}/'.format(url=ip_address, text=self.port_spin_box.text())
|
||||
self.remote_url.setText('<a href="{url}">{url}</a>'.format(url=http_url))
|
||||
http_url_temp = http_url + 'stage'
|
||||
self.stage_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
|
||||
http_url_temp = http_url + 'chords'
|
||||
self.chords_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
|
||||
http_url_temp = http_url + 'main'
|
||||
self.live_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
|
||||
http_url = f'http://{ip_address}:{self.port_spin_box.text()}/'
|
||||
self.remote_url.setText(f'<a href="{http_url}">{http_url}</a>')
|
||||
self.stage_url.setText(f'<a href="{http_url}stage">{http_url}stage</a>')
|
||||
self.chords_url.setText(f'<a href="{http_url}chords">{http_url}chords</a>')
|
||||
self.live_url.setText(f'<a href="{http_url}main">{http_url}main</a>')
|
||||
img = qrcode.make(http_url)
|
||||
img = PIL.ImageQt.ImageQt(img)
|
||||
image = QtGui.QPixmap.fromImage(img)
|
||||
self.app_qr_code_label.setPixmap(image)
|
||||
|
||||
def get_server_states(self):
|
||||
"""
|
||||
|
2
setup.py
2
setup.py
@ -106,6 +106,7 @@ using a computer and a data projector.""",
|
||||
'flask-cors',
|
||||
'lxml',
|
||||
'Mako',
|
||||
"pillow",
|
||||
'pymediainfo >= 2.2',
|
||||
'pyobjc; platform_system=="Darwin"',
|
||||
'pyobjc-framework-Cocoa; platform_system=="Darwin"',
|
||||
@ -115,6 +116,7 @@ using a computer and a data projector.""",
|
||||
'python-vlc',
|
||||
'pywin32; platform_system=="Windows"',
|
||||
'QtAwesome',
|
||||
"qrcode",
|
||||
'requests',
|
||||
'SQLAlchemy >= 0.5',
|
||||
'waitress',
|
||||
|
@ -21,6 +21,7 @@
|
||||
"""
|
||||
This module contains tests for the lib submodule of the Remotes plugin.
|
||||
"""
|
||||
import hashlib
|
||||
import pytest
|
||||
import re
|
||||
|
||||
@ -94,6 +95,11 @@ def test_set_urls(api_tab):
|
||||
assert api_tab.live_url.text() == \
|
||||
"<a href=\"http://192.168.1.1:4316/main\">http://192.168.1.1:4316/main</a>", \
|
||||
'The return value should be a fully formed main link'
|
||||
assert api_tab.chords_url.text() == \
|
||||
"<a href=\"http://192.168.1.1:4316/chords\">http://192.168.1.1:4316/chords</a>", \
|
||||
'The return value should be a fully formed chords link'
|
||||
assert hashlib.sha256(api_tab.app_qr_code_label.text().encode()).hexdigest() \
|
||||
== 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Incorrect QR Code generated'
|
||||
|
||||
|
||||
def test_address_revert_button_clicked(api_tab, settings):
|
||||
|
Loading…
Reference in New Issue
Block a user