[Openlp-core] macOS Test Results: Passed

2019-05-01 Thread Raoul Snyman
macOS tests passed!
-- 
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366785
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-05-01 Thread Raoul Snyman
Linux tests passed!
-- 
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366785
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] Linting: Passed

2019-05-01 Thread Raoul Snyman
Linting passed!
-- 
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366785
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:~tomasgroth/openlp/portable-path into lp:openlp

2019-05-01 Thread Tomas Groth
Tomas Groth has proposed merging lp:~tomasgroth/openlp/portable-path into 
lp:openlp.

Commit message:
Make it possible to specify the portable path to use for OpenLP Data when in 
portable mode. This is very useful during development.

Requested reviews:
  Phill (phill-ridout)

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366785
-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/app.py'
--- openlp/core/app.py	2019-04-13 13:00:22 +
+++ openlp/core/app.py	2019-05-01 19:29:26 +
@@ -30,6 +30,7 @@
 import logging
 import sys
 import time
+import os
 from datetime import datetime
 from traceback import format_exception
 
@@ -40,7 +41,7 @@
 from openlp.core.common.applocation import AppLocation
 from openlp.core.loader import loader
 from openlp.core.common.i18n import LanguageManager, UiStrings, translate
-from openlp.core.common.path import copytree, create_paths
+from openlp.core.common.path import copytree, create_paths, Path
 from openlp.core.common.registry import Registry
 from openlp.core.common.settings import Settings
 from openlp.core.display.screens import ScreenList
@@ -301,6 +302,9 @@
 help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".')
 parser.add_argument('-p', '--portable', dest='portable', action='store_true',
 help='Specify if this should be run as a portable app, ')
+parser.add_argument('-pp', '--portable-path', dest='portablepath', default=None,
+help='Specify the path of the portable data, defaults to "{dir_name}".'.format(
+dir_name=os.path.join('', '..', '..')))
 parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true',
 help='Turn off the Web and Socket Server ')
 parser.add_argument('rargs', nargs='?', default=[])
@@ -356,7 +360,14 @@
 application.setApplicationName('OpenLPPortable')
 Settings.setDefaultFormat(Settings.IniFormat)
 # Get location OpenLPPortable.ini
-portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / '..').resolve()
+if args.portablepath:
+if os.path.isabs(args.portablepath):
+portable_path = Path(args.portablepath)
+else:
+portable_path = AppLocation.get_directory(AppLocation.AppDir) / '..' / args.portablepath
+else:
+portable_path = AppLocation.get_directory(AppLocation.AppDir) / '..' / '..'
+portable_path = portable_path.resolve()
 data_path = portable_path / 'Data'
 set_up_logging(portable_path / 'Other')
 log.info('Running portable')

=== modified file 'tests/functional/openlp_core/test_app.py'
--- tests/functional/openlp_core/test_app.py	2019-04-13 13:00:22 +
+++ tests/functional/openlp_core/test_app.py	2019-05-01 19:29:26 +
@@ -29,6 +29,7 @@
 sys.modules['PyQt5.QtWebEngineWidgets'] = MagicMock()
 
 from openlp.core.app import OpenLP, parse_options
+from openlp.core.common import is_win
 from openlp.core.common.settings import Settings
 from tests.utils.constants import RESOURCE_PATH
 
@@ -84,6 +85,28 @@
 assert args.rargs == [], 'The service file should be blank'
 
 
+def test_parse_options_portable_and_portable_path():
+"""
+Test the parse options process works portable and portable-path
+"""
+# GIVEN: a a set of system arguments.
+if is_win():
+data_path = 'c:\\temp\\openlp-data'
+else:
+data_path = '/tmp/openlp-data'
+sys.argv[1:] = ['--portable', '--portable-path', '{datapath}'.format(datapath=data_path)]
+
+# WHEN: We we parse them to expand to options
+args = parse_options()
+
+# THEN: the following fields will have been extracted.
+assert args.loglevel == 'warning', 'The log level should be set to warning'
+assert args.no_error_form is False, 'The no_error_form should be set to False'
+assert args.portable is True, 'The portable flag should be set to true'
+assert args.portablepath == data_path, 'The portable path should be set as expected'
+assert args.rargs == [], 'The service file should be blank'
+
+
 def test_parse_options_all_no_file():
 """
 Test the parse options process works with two options

___
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:~tomasgroth/openlp/portable-path into lp:openlp

2019-05-01 Thread Tomas Groth
The proposal to merge lp:~tomasgroth/openlp/portable-path into lp:openlp has 
been updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366734
-- 
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Tomas Groth
Good point!
I will test a bit later.
I think it's a good thing to use pymupdf, but a bit annoying that we need to 
keep the support for the bin mupdf.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Bastian Germann
So it is not a blocker.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Bastian Germann
That is right and therefore I added it as optional dependency. The other PDF 
controller types are still there and are of a higher priority than PyMuPDF.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Tomas Groth
Review: Needs Information

As far as I know pymupdf is not available in Debian and Ubuntu, which is a 
blocker for now.
Feel free to correct me if I'm wrong.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Bastian Germann
The advantage over the current method (subprocess) is it is more performant and 
you get rid of having to depend on an executable. PyMuPDF has binary wheels 
available on PyPI so this has advantages for packaging.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Bastian Germann
No, we do not have to include MuPDF's source code. The AGPL has additional 
obligations for an OPERATOR who makes a AGPL-licenced work available via 
network. As OpenLP has the remote features, this applies here.

So a church that runs a MODIFIED MuPDF with OpenLP would have to provide its 
MuPDF version via a website to their users. I do not think that this will apply 
to any users.

In fact if you apply a strict interpretation of the AGPL's term "covered work" 
you already have this situation now when using MuPDF via subprocess.
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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


Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/portable-path into lp:openlp

2019-05-01 Thread Phill
Also tests failed!
-- 
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366734
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


Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/portable-path into lp:openlp

2019-05-01 Thread Phill
Review: Needs Fixing

Sorry, a few nit picks...

Diff comments:

> === modified file 'openlp/core/app.py'
> --- openlp/core/app.py2019-03-28 21:03:32 +
> +++ openlp/core/app.py2019-04-30 19:47:11 +
> @@ -301,6 +302,8 @@
>  help='Set logging to LEVEL level. Valid values are 
> "debug", "info", "warning".')
>  parser.add_argument('-p', '--portable', dest='portable', 
> action='store_true',
>  help='Specify if this should be run as a portable 
> app, ')
> +parser.add_argument('-pp', '--portable-path', dest='portablepath', 
> default=None,
> +help='Specify the path of the portable data, 
> defaults to "/../../".')

we have *some* window users can you make this:

'Specify the path of the portable data, defaults to 
"{dir_name}".'.format(dir_name=os.path.join('', '..', '..'))

>  parser.add_argument('-w', '--no-web-server', dest='no_web_server', 
> action='store_true',
>  help='Turn off the Web and Socket Server ')
>  parser.add_argument('rargs', nargs='?', default=[])
> @@ -356,7 +359,14 @@
>  application.setApplicationName('OpenLPPortable')
>  Settings.setDefaultFormat(Settings.IniFormat)
>  # Get location OpenLPPortable.ini
> -portable_path = (AppLocation.get_directory(AppLocation.AppDir) / 
> '..' / '..').resolve()
> +if args.portablepath:
> +if os.path.isabs(args.portablepath):
> +portable_path = str_to_path(args.portablepath).resolve()

str_to_path isn't required here. str_to_path('') == None, Path('') == working 
directory.
The line above (if args.portablepath:) already ensures that you're not passing 
an empty str.

Make it:
+portable_path = Path(args.portablepath)

> +else:
> +portable_path = 
> (AppLocation.get_directory(AppLocation.AppDir) / '..' /
> + str_to_path(args.portablepath)).resolve()

No need for str_to_path here either, args.portablepath is a string, using the 
'/' operator way of joining paths can take os.pathlike or string objects.

Make it:
+ AppLocation.get_directory(AppLocation.AppDir) 
/ '..' / args.portablepath

> +else:
> +portable_path = (AppLocation.get_directory(AppLocation.AppDir) / 
> '..' / '..').resolve()

As with the above two comments move resolve() down.

Make it:
+portable_path = AppLocation.get_directory(AppLocation.AppDir) / 
'..' / '..'

Finally, just the tidy the above up move each ".resolve()" down here:
+ portable_path = portable_path.resolve()

>  data_path = portable_path / 'Data'
>  set_up_logging(portable_path / 'Other')
>  log.info('Running portable')


-- 
https://code.launchpad.net/~tomasgroth/openlp/portable-path/+merge/366734
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


Re: [Openlp-core] [Merge] lp:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Phill
Review: Needs Information

So what you're saying is that if we merge this proposed code, we will need to 
include the source code for MuPDF with OpenLP?

What advantage does this have over the current method?
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
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] macOS Test Results: Passed

2019-05-01 Thread Raoul Snyman
macOS tests passed!
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
Your team OpenLP Core is requested to review the proposed merge of 
lp:~bastian-germann/openlp/pymupdf 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-05-01 Thread Raoul Snyman
Linting passed!
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
Your team OpenLP Core is requested to review the proposed merge of 
lp:~bastian-germann/openlp/pymupdf 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-05-01 Thread Raoul Snyman
Linux tests passed!
-- 
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749
Your team OpenLP Core is requested to review the proposed merge of 
lp:~bastian-germann/openlp/pymupdf 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:~bastian-germann/openlp/pymupdf into lp:openlp

2019-05-01 Thread Bastian Germann
Bastian Germann has proposed merging lp:~bastian-germann/openlp/pymupdf into 
lp:openlp.

Commit message:
Add PyMuPDF as additional PDF controller

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749

PyMuPDF itself is GPLv3+ licenced. However, MuPDF is AGPLv3+ licenced. You can 
argue that calling the executable via subprocess does not make OpenLP a 
derivative work of MuPDF, however, using the library this argument does not 
hold. So if the new code is used, people running OpenLP with PyMuPDF have to 
comply with AGPLv3+. That means the source code of the actual running MuPDF has 
to be provided to remote users (if there are any). For the original MuPDF 
versions this is done by MuPDF's authors. If someone has changes to MuPDF, 
these changes would have to be provided via a network service to remote users.

People who have private changes to MuPDF will probably know about their 
obligations.
As a reminder I used agpl-pdf as a keyword for the dependency.
-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~bastian-germann/openlp/pymupdf into lp:openlp.
=== modified file 'openlp/plugins/presentations/lib/pdfcontroller.py'
--- openlp/plugins/presentations/lib/pdfcontroller.py	2019-04-13 13:00:22 +
+++ openlp/plugins/presentations/lib/pdfcontroller.py	2019-05-01 09:29:24 +
@@ -34,6 +34,12 @@
 if is_win():
 from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
 
+try:
+import fitz
+PYMUPDF_AVAILABLE = True
+except ImportError:
+PYMUPDF_AVAILABLE = False
+
 log = logging.getLogger(__name__)
 
 PDF_CONTROLLER_FILETYPES = ['pdf', 'xps', 'oxps']
@@ -151,8 +157,10 @@
 return True
 elif self.gsbin:
 return True
-else:
-return False
+elif PYMUPDF_AVAILABLE:
+self.also_supports = ['xps', 'oxps']
+return True
+return False
 
 def kill(self):
 """
@@ -276,6 +284,16 @@
'-r{res}'.format(res=resolution), '-dTextAlphaBits=4', '-dGraphicsAlphaBits=4',
'-sOutputFile={output}'.format(output=temp_dir_path / 'mainslide%03d.png'),
str(self.file_path)], startupinfo=self.startupinfo)
+elif PYMUPDF_AVAILABLE:
+log.debug('loading presentation using PyMuPDF')
+pdf = fitz.open(str(self.file_path))
+for i, page in enumerate(pdf, start=1):
+src_size = page.bound().round()
+# keep aspect ratio
+scale = min(size.width() / src_size.width, size.height() / src_size.height)
+m = fitz.Matrix(scale, scale)
+page.getPixmap(m, alpha=False).writeImage(str(temp_dir_path / 'mainslide{:03d}.png'.format(i)))
+pdf.close()
 created_files = sorted(temp_dir_path.glob('*'))
 for image_path in created_files:
 if image_path.is_file():

=== modified file 'scripts/appveyor.yml'
--- scripts/appveyor.yml	2019-04-02 00:05:46 +
+++ scripts/appveyor.yml	2019-05-01 09:29:24 +
@@ -16,11 +16,7 @@
 
 install:
   # Install dependencies from pypi
-  - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo"
-  # Download and unpack mupdf
-  - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip
-  - 7z x mupdf-1.14.0-windows.zip
-  - cp mupdf-1.14.0-windows/mutool.exe openlp-branch/mutool.exe
+  - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF"
 
 build: off
 

=== modified file 'setup.py'
--- setup.py	2019-04-13 13:00:22 +
+++ setup.py	2019-05-01 09:29:24 +
@@ -187,6 +187,7 @@
 'websockets'
 ],
 extras_require={
+'agpl-pdf': ['PyMuPDF'],
 'darkstyle': ['QDarkStyle'],
 'mysql': ['mysql-connector-python'],
 'odbc': ['pyodbc'],

___
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] [Bug 1795876] Re: License violations

2019-05-01 Thread Bastian Germann
** Branch unlinked: lp:~bastian-germann/openlp/gpl3

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1795876

Title:
  License violations

Status in OpenLP:
  Fix Committed
Status in OpenLP 2.0 series:
  Won't Fix
Status in OpenLP 2.2 series:
  Won't Fix
Status in OpenLP 2.4 series:
  Won't Fix
Status in OpenLP trunk series:
  Fix Committed

Bug description:
  OpenLP (GPLv2 only) is currently violating at least two licenses: PyQt5's 
GPLv3 only and request's Apache 2.0.
  There are two options to heal these violations: relicense OpenLP or replace 
the dependencies. A third option would be aquiring a commercial PyQt5 license 
from Riverbank and replacing requests only, but as it is paid per developer 
this seems to be infeasible for an open source project.

  REPLACING
  =
  Replacing requests would be feasible: urllib is already used throughout the 
codebase. Just use it for the currently three files which import requests as 
well.

  I do not know if it would be feasible to replace PyQt5 with PySide2.

  RELICENSING
  ===
  You would have to use the GPLv3 license to heal both of the violations (GPLv3 
is compatible with Apache 2.0). You could also use GPLv2 or later, but the 
logical license combined with PyQt5 is always GPLv3. That leads to another 
issue: pysword is GPLv2 only and a license move would require you to drop this 
optional dependency. But I guess this would be a minor issue as it is not 
released yet (?).

  I do not know if relicensing is feasible as you would have to ask the
  majority of copyright holders to agree with the license change.

  In either case you should inform your users not later than with your
  next (fixed!) release about the license violation as they could be in
  trouble using OpenLP.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1795876/+subscriptions

___
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