[Openlp-core] macOS Test Results: Passed

2019-07-01 Thread Raoul Snyman
macOS tests passed!
-- 
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] [Merge] lp:~raoul-snyman/openlp/zeroconf into lp:openlp

2019-07-01 Thread Raoul Snyman
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/zeroconf into 
lp:openlp.

Commit message:
Add Zeroconf services to OpenLP so that external devices can find OpenLP on the 
network.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554

Add Zeroconf services to OpenLP so that external devices can find OpenLP on the 
network.
-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.
=== added file 'openlp/core/api/zeroconf.py'
--- openlp/core/api/zeroconf.py	1970-01-01 00:00:00 +
+++ openlp/core/api/zeroconf.py	2019-07-01 22:48:21 +
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+##
+# OpenLP - Open Source Lyrics Projection #
+# -- #
+# Copyright (c) 2008-2019 OpenLP Developers  #
+# -- #
+# This program is free software: you can redistribute it and/or modify   #
+# it under the terms of the GNU General Public License as published by   #
+# the Free Software Foundation, either version 3 of the License, or  #
+# (at your option) any later version.#
+##
+# This program is distributed in the hope that it will be useful,#
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  #
+# GNU General Public License for more details.   #
+##
+# You should have received a copy of the GNU General Public License  #
+# along with this program.  If not, see . #
+##
+"""
+The :mod:`~openlp.core.api.zeroconf` module runs a Zerconf server so that OpenLP can advertise the
+RESTful API for devices on the network to discover.
+"""
+import socket
+from time import sleep
+
+from zeroconf import ServiceInfo, Zeroconf
+
+from openlp.core.common import get_local_ip4
+from openlp.core.common.registry import Registry
+from openlp.core.common.settings import Settings
+from openlp.core.threading import ThreadWorker, run_thread
+
+
+class ZeroconfWorker(ThreadWorker):
+"""
+This thread worker runs a Zeroconf service
+"""
+address = None
+http_port = 4316
+ws_port = 4317
+_can_run = False
+
+def __init__(self, ip_address, http_port=4316, ws_port=4317):
+"""
+Create the worker for the Zeroconf service
+"""
+super().__init__()
+self.address = socket.inet_aton(ip_address)
+self.http_port = http_port
+self.ws_port = ws_port
+
+def can_run(self):
+"""
+Check if the worker can continue to run. This is mostly so that we can override this method
+and test the class.
+"""
+return self._can_run
+
+def start(self):
+"""
+Start the service
+"""
+http_info = ServiceInfo('_http._tcp.local.', 'OpenLP._http._tcp.local.',
+address=self.address, port=self.http_port, properties={})
+ws_info = ServiceInfo('_ws._tcp.local.', 'OpenLP._ws._tcp.local.',
+  address=self.address, port=self.ws_port, properties={})
+zc = Zeroconf()
+zc.register_service(http_info)
+zc.register_service(ws_info)
+self._can_run = True
+while self.can_run():
+sleep(0.1)
+zc.unregister_service(http_info)
+zc.unregister_service(ws_info)
+zc.close()
+
+def stop(self):
+"""
+Stop the service
+"""
+self._can_run = False
+
+
+def start_zeroconf():
+"""
+Start the Zeroconf service
+"""
+# When we're running tests, just skip this set up if this flag is set
+if Registry().get_flag('no_web_server'):
+return
+ifaces = get_local_ip4()
+for key in iter(ifaces):
+address = ifaces.get(key)['ip']
+break
+http_port = Settings().value('api/port')
+ws_port = Settings().value('api/websocket port')
+worker = ZeroconfWorker(address, http_port, ws_port)
+run_thread(worker, 'api_zeroconf')

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2019-05-24 18:50:51 +
+++ openlp/core/ui/mainwindow.py	2019-07-01 22:48:21 +
@@ -33,8 +33,9 @@
 from PyQt5 import QtCore, QtGui, QtWidgets
 
 from openlp.core.state import State
-from openlp.core.api import 

[Openlp-core] macOS Test Results: Failed

2019-07-01 Thread Raoul Snyman
macOS tests failed, please see https://ci.openlp.io/job/MP-04-macOS-Tests/107/ 
for more details
-- 
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] Linting: Passed

2019-07-01 Thread Raoul Snyman
Linting passed!
-- 
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] Linux Test Results: Passed

2019-07-01 Thread Raoul Snyman
Linux tests passed!
-- 
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] Linux Test Results: Failed

2019-07-01 Thread Raoul Snyman
Linux tests failed, please see https://ci.openlp.io/job/MP-02-Linux_Tests/201/ 
for more details
-- 
https://code.launchpad.net/~raoul-snyman/openlp/zeroconf/+merge/369554
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/zeroconf into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] Linting: Failed

2019-07-01 Thread Raoul Snyman
Linting failed, please see https://ci.openlp.io/job/MP-03-Linting/134/ for more 
details
-- 
https://code.launchpad.net/~ic90/openlp/animated-alerts/+merge/369540
Your team OpenLP Core is subscribed to branch lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] Linux Test Results: Passed

2019-07-01 Thread Raoul Snyman
Linux tests passed!
-- 
https://code.launchpad.net/~ic90/openlp/animated-alerts/+merge/369540
Your team OpenLP Core is subscribed to branch lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] [Merge] lp:~ic90/openlp/animated-alerts into lp:openlp

2019-07-01 Thread Nico Opiyo
Nico Opiyo has proposed merging lp:~ic90/openlp/animated-alerts into lp:openlp.

Commit message:
Added scrolling alerts

Requested reviews:
  Nico Opiyo (ic90)
  Raoul Snyman (raoul-snyman)
  Tomas Groth (tomasgroth)

For more details, see:
https://code.launchpad.net/~ic90/openlp/animated-alerts/+merge/369540

Refactored the tests and optimized alert display code plus fixed spacing
-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== added file 'openlp/core/display/html/display.css'
--- openlp/core/display/html/display.css	1970-01-01 00:00:00 +
+++ openlp/core/display/html/display.css	2019-07-01 17:51:00 +
@@ -0,0 +1,80 @@
+@keyframes alert-scrolling-text {
+  0% { transform: translateX(100%); opacity: 1; }
+  99% { opacity: 1; }
+  100% { transform: translateX(-101%); opacity: 0;}
+}
+
+/* ALERT BACKGROUND STYLING */
+.bg-default {
+  position: absolute;
+  margin: 0;
+  padding: 0;
+  left: 0;
+  z-index: 11;
+  width: 100%;
+  height: 0;
+  min-height: 0;
+  overflow: hidden;
+  transform: translate(0,0);
+  transition: min-height 1s ease-out .5s;
+  white-space: nowrap;
+  display: flex;
+  flex-direction: row;  
+  align-items: center;
+  /* align-content: center; */
+}
+
+.bg-default span {
+  display: inline-block;
+  padding-left: 120%;
+}
+
+.show-bg {
+  /* height: auto; */
+  min-height: 25%;
+  transition: min-height 1s ease-in .5s;
+}
+
+.middle {  
+  align-items: center;
+}
+
+.alert-container {
+  position: absolute;
+  display: flex;
+  flex-direction: row;
+  height: 100vh;
+  width: 100vw;
+}
+
+.top { 
+  align-items: flex-start;
+}
+
+.bottom {  
+  align-items: flex-end;
+}
+
+/* ALERT TEXT STYLING */
+#alert {  
+  z-index: 100;  
+  overflow: visible;  
+  color: #ff;
+  font-size: 40pt;
+  padding: 0;
+  margin: 0;
+  opacity: 0; 
+  transition: opacity .5s linear;   
+}
+
+#alert.hide-text {
+  opacity: 0;
+}
+
+#alert.show-text {  
+  transform: none;
+  transition: none;
+  animation: none;
+  padding: auto 5px;
+  opacity: 1;   
+}

=== modified file 'openlp/core/display/html/display.html'
--- openlp/core/display/html/display.html	2019-03-17 10:36:12 +
+++ openlp/core/display/html/display.html	2019-07-01 17:51:00 +
@@ -2,7 +2,7 @@
 
   
 Display Window
-
+  
 
 body {
   background: transparent !important;
@@ -24,16 +24,21 @@
   visibility: visible;
   z-index: -1;
 }
-
+
+
 
 
 
   
+
   
+
+  Testing alerts
+
 
-  
+
   
   
-
+
   
 

=== modified file 'openlp/core/display/html/display.js'
--- openlp/core/display/html/display.js	2019-06-21 20:53:42 +
+++ openlp/core/display/html/display.js	2019-07-01 17:51:00 +
@@ -53,6 +53,50 @@
 };
 
 /**
+ * Transition state enumeration
+ */
+var TransitionState = {
+  EntranceTransition: "entranceTransition",
+  NoTransition: "noTransition",
+  ExitTransition: "exitTransition"
+};
+
+/**
+ * Animation state enumeration
+ */
+var AnimationState = {
+  NoAnimation: "noAnimation",
+  ScrollingText: "scrollingText",
+  NonScrollingText: "noScrollingText"
+};
+
+/**
+ * Alert location enumeration
+ */
+var AlertLocation = {
+  Top: 0,
+  Middle: 1,
+  Bottom: 2
+};
+
+/**
+ * Alert state enumeration
+ */
+var AlertState = {
+  Displaying: "displaying",  
+  NotDisplaying: "notDisplaying"
+}
+
+/**
+ * Alert delay enumeration 
+ */
+var AlertDelay = {
+  FiftyMilliseconds: 50,
+  OneSecond: 1000,
+  OnePointFiveSeconds: 1500
+}
+
+/**
  * Return an array of elements based on the selector query
  * @param {string} selector - The selector to find elements
  * @returns {array} An array of matching elements
@@ -234,7 +278,12 @@
  * The Display object is what we use from OpenLP
  */
 var Display = {
+  _alerts: [],
   _slides: {},
+  _alertSettings: {},
+  _alertState: AlertState.NotDisplaying,
+  _transitionState: TransitionState.NoTransition,
+  _animationState: AnimationState.NoAnimation,
   _revealConfig: {
 margin: 0.0,
 minScale: 1.0,
@@ -356,19 +405,197 @@
   /**
* Display an alert
* @param {string} text - The alert text
-   * @param {int} location - The location of the text (top, middle or bottom)
-  */
- alert: function (text, location) {
-  console.debug(" alert text: " + text, ", location: " + location);
-  /*
-   * The implementation should show an alert.
-   * It should be able to handle receiving a new alert before a previous one is "finished", basically queueing it.
-   */
-  return;
-},
-
-  /**
-   * Add a slides. If the slide exists but the HTML is different, update the slide.
+   * @param {string} JSON object - The settings for the alert object e.g '{"backgroundColor": "rgb(255, 85, 0)", 
+   * "location": 1, "fontFace": "Open Sans Condensed", "fontSize": 90, "fontColor": "rgb(255, 255, 255)", 
+   * "timeout": 10, "repeat": 2, "scroll": true}'
+  */
+  alert: function (text, alertSettings) {
+var alertBackground = $('#alert-background')[0];
+