[Openlp-core] [Merge] lp:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-11 Thread noreply
The proposal to merge lp:~phill-ridout/openlp/pathlib2 into lp:openlp has been 
updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328825
-- 
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-11 Thread Tim Bentley
Review: Approve


-- 
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328825
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-11 Thread Raoul Snyman
Review: Approve

Looks OK to me.
-- 
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328825
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-10 Thread Phill
Phill has proposed merging lp:~phill-ridout/openlp/pathlib2 into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328825

Definitely ready for merging, unless, of course you guys find some more issues!

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2763)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2125/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2033/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1938/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1315/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1157/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/287/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/132/
Stopping after failure

-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== added file 'openlp/core/common/path.py'
--- openlp/core/common/path.py	1970-01-01 00:00:00 +
+++ openlp/core/common/path.py	2017-08-10 06:57:18 +
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###
+# OpenLP - Open Source Lyrics Projection  #
+# --- #
+# Copyright (c) 2008-2017 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; version 2 of the License.  #
+# #
+# 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, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA  #
+###
+
+from pathlib import Path
+
+
+def path_to_str(path):
+"""
+A utility function to convert a Path object or NoneType to a string equivalent.
+
+:param path: The value to convert to a string
+:type: pathlib.Path or None
+
+:return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
+:rtype: str
+"""
+if not isinstance(path, Path) and path is not None:
+raise TypeError('parameter \'path\' must be of type Path or NoneType')
+if path is None:
+return ''
+else:
+return str(path)
+
+
+def str_to_path(string):
+"""
+A utility function to convert a str object to a Path or NoneType.
+
+This function is of particular use because initating a Path object with an empty string causes the Path object to
+point to the current working directory.
+
+:param string: The string to convert
+:type string: str
+
+:return: None if :param:`string` is empty, or a Path object representation of :param:`string`
+:rtype: pathlib.Path or None
+"""
+if not isinstance(string, str):
+raise TypeError('parameter \'string\' must be of type str')
+if string == '':
+return None
+return Path(string)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2017-08-06 07:23:26 +
+++ openlp/core/lib/__init__.py	2017-08-10 06:57:18 +
@@ -608,8 +608,42 @@
 return list_to_string
 
 
+def replace_params(args, kwargs, params):
+"""
+Apply a transformation function to the specified args or kwargs
+
+:param args: Positional arguments
+:type args: (,)
+
+:param kwargs: Key Word arguments
+:type kwargs: dict
+
+:param params: A tuple of tuples with the position and the key word to replace.
+:type params: ((int, str, path_to_str),)
+
+:return: The modified positional and keyword arguments
+:rtype: (tuple, dict)
+
+
+Usage:
+Take a method with the following signature, and assume we which to apply the str function to arg2:
+def method(arg1=None, arg2=None, arg3=None)
+
+As arg2 can be specified postitionally as the second argument (1 with a zero index) or as a keyword, 

[Openlp-core] [Merge] lp:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-10 Thread Phill
The proposal to merge lp:~phill-ridout/openlp/pathlib2 into lp:openlp has been 
updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328805
-- 
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-09 Thread Phill
The proposal to merge lp:~phill-ridout/openlp/pathlib2 into lp:openlp has been 
updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328694
-- 
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-09 Thread Phill
Phill has proposed merging lp:~phill-ridout/openlp/pathlib2 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328805

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2763)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2125/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2033/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1938/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1315/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1157/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/287/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/132/
Stopping after failure

-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== added file 'openlp/core/common/path.py'
--- openlp/core/common/path.py	1970-01-01 00:00:00 +
+++ openlp/core/common/path.py	2017-08-09 20:16:07 +
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###
+# OpenLP - Open Source Lyrics Projection  #
+# --- #
+# Copyright (c) 2008-2017 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; version 2 of the License.  #
+# #
+# 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, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA  #
+###
+
+from pathlib import Path
+
+
+def path_to_str(path):
+"""
+A utility function to convert a Path object or NoneType to a string equivalent.
+
+:param path: The value to convert to a string
+:type: pathlib.Path or None
+
+:return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
+:rtype: str
+"""
+if not isinstance(path, Path) and path is not None:
+raise TypeError('parameter \'path\' must be of type Path or NoneType')
+if path is None:
+return ''
+else:
+return str(path)
+
+
+def str_to_path(string):
+"""
+A utility function to convert a str object to a Path or NoneType.
+
+This function is of particular use because initating a Path object with an empty string causes the Path object to
+point to the current working directory.
+
+:param string: The string to convert
+:type string: str
+
+:return: None if :param:`string` is empty, or a Path object representation of :param:`string`
+:rtype: pathlib.Path or None
+"""
+if not isinstance(string, str):
+raise TypeError('parameter \'string\' must be of type str')
+if string == '':
+return None
+return Path(string)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2017-08-06 07:23:26 +
+++ openlp/core/lib/__init__.py	2017-08-09 20:16:07 +
@@ -608,8 +608,42 @@
 return list_to_string
 
 
+def replace_params(args, kwargs, params):
+"""
+Apply a transformation function to the specified args or kwargs
+
+:param args: Positional arguments
+:type args: (,)
+
+:param kwargs: Key Word arguments
+:type kwargs: dict
+
+:param params: A tuple of tuples with the position and the key word to replace.
+:type params: ((int, str, path_to_str),)
+
+:return: The modified positional and keyword arguments
+:rtype: (tuple, dict)
+
+
+Usage:
+Take a method with the following signature, and assume we which to apply the str function to arg2:
+def method(arg1=None, arg2=None, arg3=None)
+
+As arg2 can be specified postitionally as the second argument (1 with a zero index) or as a keyword, the we
+would call this function as follows:
+
+

[Openlp-core] [Merge] lp:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-07 Thread Phill
Phill has proposed merging lp:~phill-ridout/openlp/pathlib2 into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328694

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2763)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2125/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2033/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1938/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1315/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1157/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/287/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/132/
Stopping after failure

-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== added file 'openlp/core/common/path.py'
--- openlp/core/common/path.py	1970-01-01 00:00:00 +
+++ openlp/core/common/path.py	2017-08-07 21:22:21 +
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###
+# OpenLP - Open Source Lyrics Projection  #
+# --- #
+# Copyright (c) 2008-2017 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; version 2 of the License.  #
+# #
+# 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, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA  #
+###
+
+from pathlib import Path
+
+
+def path_to_str(path):
+"""
+A utility function to convert a Path object or NoneType to a string equivalent.
+
+:param path: The value to convert to a string
+:type: pathlib.Path or None
+
+:return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
+:rtype: str
+"""
+if not isinstance(path, Path) and path is not None:
+raise TypeError('parameter \'path\' must be of type Path or NoneType')
+if path is None:
+return ''
+else:
+return str(path)
+
+
+def str_to_path(string):
+"""
+A utility function to convert a str object to a Path or NoneType.
+
+This function is of particular use because initating a Path object with an empty string causes the Path object to
+point to the current working directory.
+
+:param string: The string to convert
+:type string: str
+
+:return: None if :param:`string` is empty, or a Path object representation of :param:`string`
+:rtype: pathlib.Path or None
+"""
+if not isinstance(string, str):
+raise TypeError('parameter \'string\' must be of type str')
+if string == '':
+return None
+return Path(string)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2017-08-06 07:23:26 +
+++ openlp/core/lib/__init__.py	2017-08-07 21:22:21 +
@@ -608,8 +608,42 @@
 return list_to_string
 
 
+def replace_params(args, kwargs, params):
+"""
+Apply a transformation function to the specified args or kwargs
+
+:param args: Positional arguments
+:type args: (,)
+
+:param kwargs: Key Word arguments
+:type kwargs: dict
+
+:param params: A tuple of tuples with the position and the key word to replace.
+:type params: ((int, str, path_to_str),)
+
+:return: The modified positional and keyword arguments
+:rtype: (tuple, dict)
+
+
+Usage:
+Take a method with the following signature, and assume we which to apply the str function to arg2:
+def method(arg1=None, arg2=None, arg3=None)
+
+As arg2 can be specified postitionally as the second argument (1 with a zero index) or as a keyword, the we
+would call this function as follows:
+
+

[Openlp-core] [Merge] lp:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-07 Thread Phill
The proposal to merge lp:~phill-ridout/openlp/pathlib2 into lp:openlp has been 
updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328616
-- 
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-04 Thread Raoul Snyman
We already have a custom file dialog, why not extend that one rather than write 
a completely new class?
-- 
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328616
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-04 Thread Phill
Phill has proposed merging lp:~phill-ridout/openlp/pathlib2 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328616

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2759)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2115/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2025/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1933/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1310/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1153/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/283/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/128/
Stopping after failure

-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== added file 'openlp/core/common/path.py'
--- openlp/core/common/path.py	1970-01-01 00:00:00 +
+++ openlp/core/common/path.py	2017-08-04 22:00:43 +
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###
+# OpenLP - Open Source Lyrics Projection  #
+# --- #
+# Copyright (c) 2008-2017 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; version 2 of the License.  #
+# #
+# 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, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA  #
+###
+
+from pathlib import Path
+
+
+def path_to_str(path):
+"""
+A utility function to convert a Path object or NoneType to a string equivalent.
+
+:param path: The value to convert to a string
+:type: pathlib.Path or None
+
+:return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
+:rtype: str
+"""
+if not isinstance(path, Path) and path is not None:
+raise TypeError('parameter \'path\' must be of type Path or NoneType')
+if path is None:
+return ''
+else:
+return str(path)
+
+
+def str_to_path(string):
+"""
+A utility function to convert a str object to a Path or NoneType.
+
+This function is of particular use because initating a Path object with an empty string causes the Path object to
+point to the current working directory.
+
+:param string: The string to convert
+:type string: str
+
+:return: None if :param:`string` is empty, or a Path object representation of :param:`string`
+:rtype: pathlib.Path or None
+"""
+if not isinstance(string, str):
+raise TypeError('parameter \'string\' must be of type str')
+if string == '':
+return None
+return Path(string)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2017-05-20 05:51:58 +
+++ openlp/core/lib/__init__.py	2017-08-04 22:00:43 +
@@ -608,6 +608,41 @@
 return list_to_string
 
 
+def replace_params(args, kwargs, params):
+"""
+Apply a transformation function to the specified args or kwargs
+
+:param args: Positional arguments
+:type args: (,)
+
+:param kwargs: Key Word arguments
+:type kwargs: dict
+
+:param params: A tuple of tuples with the position and the key word to replace.
+:type params: ((int, str, path_to_str),)
+
+:return: The modified positional and keyword arguments
+:rtype: (tuple, dict)
+
+
+Usage:
+Take a method with the following signature, and assume we which to apply the str function to arg2:
+def method(arg1=None, arg2=None, arg3=None)
+
+As arg2 can be specified postitionally as the second argument (1 with a zero index) or as a keyword, the we
+would call this function as follows:
+
+replace_params(args, kwargs, ((1, 'arg2', 

[Openlp-core] [Merge] lp:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-04 Thread Phill
The proposal to merge lp:~phill-ridout/openlp/pathlib2 into lp:openlp has been 
updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328595
-- 
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-04 Thread Tim Bentley
Review: Needs Fixing

Trunk is fine

Advanced Tab 
Traceback (most recent call last):
  File 
"/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/mainwindow.py", line 
810, in on_settings_configure_iem_clicked
self.settings_form.exec()
  File 
"/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/settingsform.py", 
line 70, in exec
self.insert_tab(self.general_tab)
  File 
"/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/settingsform.py", 
line 89, in insert_tab
log.debug('Inserting {text} tab'.format(text=tab_widget.tab_title))
AttributeError: 'NoneType' object has no attribute 'tab_title'

Theme Edit with image 
Traceback (most recent call last):
  File 
"/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/thememanager.py", 
line 326, in on_edit_theme
self.theme_form.exec(True)
  File "/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/themeform.py", 
line 279, in exec
self.set_defaults()
  File "/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/themeform.py", 
line 109, in set_defaults
self.set_background_page_values()
  File "/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/ui/themeform.py", 
line 322, in set_background_page_values
self.image_path_edit.path = path_to_str(self.theme.background_filename)
  File "/home/tim/Projects/OpenLP/openlp/pathlib2/openlp/core/common/path.py", 
line 37, in path_to_str
raise TypeError('parameter \'path\' must be of type Path or NoneType')
TypeError: parameter 'path' must be of type Path or NoneType


-- 
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328595
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:~phill-ridout/openlp/pathlib2 into lp:openlp

2017-08-04 Thread Phill
Phill has proposed merging lp:~phill-ridout/openlp/pathlib2 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/pathlib2/+merge/328595

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2758)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2114/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2024/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1932/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1309/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1152/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/282/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/127/
Stopping after failure

-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~phill-ridout/openlp/pathlib2 into lp:openlp.
=== added file 'openlp/core/common/path.py'
--- openlp/core/common/path.py	1970-01-01 00:00:00 +
+++ openlp/core/common/path.py	2017-08-04 18:15:25 +
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###
+# OpenLP - Open Source Lyrics Projection  #
+# --- #
+# Copyright (c) 2008-2017 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; version 2 of the License.  #
+# #
+# 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, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA  #
+###
+
+from pathlib import Path
+
+
+def path_to_str(path):
+"""
+A utility function to convert a Path object or NoneType to a string equivalent.
+
+:param path: The value to convert to a string
+:type: pathlib.Path or None
+
+:return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
+:rtype: str
+"""
+if not isinstance(path, Path) and path is not None:
+raise TypeError('parameter \'path\' must be of type Path or NoneType')
+if path is None:
+return ''
+else:
+return str(path)
+
+
+def str_to_path(string):
+"""
+A utility function to convert a str object to a Path or NoneType.
+
+This function is of particular use because initating a Path object with an empty string causes the Path object to
+point to the current working directory.
+
+:param string: The string to convert
+:type string: str
+
+:return: None if :param:`string` is empty, or a Path object representation of :param:`string`
+:rtype: pathlib.Path or None
+"""
+if not isinstance(string, str):
+raise TypeError('parameter \'string\' must be of type str')
+if string == '':
+return None
+return Path(string)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2017-05-20 05:51:58 +
+++ openlp/core/lib/__init__.py	2017-08-04 18:15:25 +
@@ -608,6 +608,41 @@
 return list_to_string
 
 
+def replace_params(args, kwargs, params):
+"""
+Apply a transformation function to the specified args or kwargs
+
+:param args: Positional arguments
+:type args: (,)
+
+:param kwargs: Key Word arguments
+:type kwargs: dict
+
+:param params: A tuple of tuples with the position and the key word to replace.
+:type params: ((int, str, path_to_str),)
+
+:return: The modified positional and keyword arguments
+:rtype: (tuple, dict)
+
+
+Usage:
+Take a method with the following signature, and assume we which to apply the str function to arg2:
+def method(arg1=None, arg2=None, arg3=None)
+
+As arg2 can be specified postitionally as the second argument (1 with a zero index) or as a keyword, the we
+would call this function as