Clean up theme export

This commit is contained in:
Tim Bentley 2017-05-21 08:11:36 +01:00
parent 08a58844c6
commit fa89be414c
2 changed files with 7 additions and 9 deletions

View File

@ -698,7 +698,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ServiceMa
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
else:
file_name, filter_uesd = QtWidgets.QFileDialog.getSaveFileName(
file_name, filter_used = QtWidgets.QFileDialog.getSaveFileName(
self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
if not file_name:

View File

@ -379,11 +379,10 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ThemeManage
critical_error_message_box(message=translate('OpenLP.ThemeManager', 'You have not selected a theme.'))
return
theme = item.data(QtCore.Qt.UserRole)
path = QtWidgets.QFileDialog.getExistingDirectory(self,
translate('OpenLP.ThemeManager',
'Save Theme - ({name})').format(name=theme),
Settings().value(self.settings_section +
'/last directory export'))
path, filter_used = QtWidgets.QFileDialog.getSaveFileName(self.main_window,
translate('OpenLP.ThemeManager', 'Save Theme - ({name})').format(name=theme),
Settings().value(self.settings_section + '/last directory export'),
translate('OpenLP.ThemeManager', 'OpenLP Themes (*.otz)'))
self.application.set_busy_cursor()
if path:
Settings().setValue(self.settings_section + '/last directory export', path)
@ -394,13 +393,12 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ThemeManage
'Your theme has been successfully exported.'))
self.application.set_normal_cursor()
def _export_theme(self, path, theme):
def _export_theme(self, theme_path, theme):
"""
Create the zipfile with the theme contents.
:param path: Location where the zip file will be placed
:param theme_path: Location where the zip file will be placed
:param theme: The name of the theme to be exported
"""
theme_path = os.path.join(path, theme + '.otz')
theme_zip = None
try:
theme_zip = zipfile.ZipFile(theme_path, 'w')