forked from openlp/openlp
Presentation fixes
This commit is contained in:
parent
b4eb42fed2
commit
4d749a89ac
@ -373,8 +373,7 @@ s
|
|||||||
duplicates_found = False
|
duplicates_found = False
|
||||||
files_added = False
|
files_added = False
|
||||||
for file_path in files:
|
for file_path in files:
|
||||||
filename = os.path.split(str(file_path))[1]
|
if file_path in full_list:
|
||||||
if filename in names:
|
|
||||||
duplicates_found = True
|
duplicates_found = True
|
||||||
else:
|
else:
|
||||||
files_added = True
|
files_added = True
|
||||||
|
@ -74,6 +74,7 @@ class ImagePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
Perform tasks on application startup.
|
Perform tasks on application startup.
|
||||||
"""
|
"""
|
||||||
|
# TODO: Can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
|
||||||
Plugin.app_startup(self)
|
Plugin.app_startup(self)
|
||||||
# Convert old settings-based image list to the database.
|
# Convert old settings-based image list to the database.
|
||||||
files_from_config = Settings().get_files_from_config(self)
|
files_from_config = Settings().get_files_from_config(self)
|
||||||
@ -94,6 +95,7 @@ class ImagePlugin(Plugin):
|
|||||||
|
|
||||||
:param settings: The Settings object containing the old settings.
|
:param settings: The Settings object containing the old settings.
|
||||||
"""
|
"""
|
||||||
|
# TODO: Can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
|
||||||
files_from_config = settings.get_files_from_config(self)
|
files_from_config = settings.get_files_from_config(self)
|
||||||
if files_from_config:
|
if files_from_config:
|
||||||
log.debug('Importing images list from old config: %s' % files_from_config)
|
log.debug('Importing images list from old config: %s' % files_from_config)
|
||||||
|
@ -229,16 +229,19 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.main_window.display_progress_bar(len(row_list))
|
self.main_window.display_progress_bar(len(row_list))
|
||||||
for item in items:
|
for item in items:
|
||||||
filepath = str(item.data(QtCore.Qt.UserRole))
|
filepath = str(item.data(QtCore.Qt.UserRole))
|
||||||
for cidx in self.controllers:
|
self.delete_presentation(filepath)
|
||||||
doc = self.controllers[cidx].add_document(filepath)
|
|
||||||
doc.presentation_deleted()
|
|
||||||
doc.close_presentation()
|
|
||||||
self.main_window.increment_progress_bar()
|
self.main_window.increment_progress_bar()
|
||||||
self.main_window.finished_progress_bar()
|
self.main_window.finished_progress_bar()
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
for row in row_list:
|
for row in row_list:
|
||||||
self.list_view.takeItem(row)
|
self.list_view.takeItem(row)
|
||||||
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
|
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
|
||||||
|
|
||||||
|
def delete_presentation(self, filepath):
|
||||||
|
for cidx in self.controllers:
|
||||||
|
doc = self.controllers[cidx].add_document(filepath)
|
||||||
|
doc.presentation_deleted()
|
||||||
|
doc.close_presentation()
|
||||||
|
|
||||||
def generate_slide_data(self, service_item, item=None, xml_version=False, remote=False,
|
def generate_slide_data(self, service_item, item=None, xml_version=False, remote=False,
|
||||||
context=ServiceItemContext.Service, presentation_file=None):
|
context=ServiceItemContext.Service, presentation_file=None):
|
||||||
|
@ -27,13 +27,14 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists
|
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, md5_hash
|
||||||
from openlp.core.lib import create_thumb, validate_thumb
|
from openlp.core.lib import create_thumb, validate_thumb
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -139,13 +140,21 @@ class PresentationDocument(object):
|
|||||||
"""
|
"""
|
||||||
The location where thumbnail images will be stored
|
The location where thumbnail images will be stored
|
||||||
"""
|
"""
|
||||||
return os.path.join(self.controller.thumbnail_folder, self.get_file_name())
|
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
||||||
|
folder = md5_hash('', self.file_path)
|
||||||
|
else:
|
||||||
|
folder = self.get_file_name()
|
||||||
|
return os.path.join(self.controller.thumbnail_folder, folder)
|
||||||
|
|
||||||
def get_temp_folder(self):
|
def get_temp_folder(self):
|
||||||
"""
|
"""
|
||||||
The location where thumbnail images will be stored
|
The location where thumbnail images will be stored
|
||||||
"""
|
"""
|
||||||
return os.path.join(self.controller.temp_folder, self.get_file_name())
|
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
||||||
|
folder = md5_hash('', self.file_path)
|
||||||
|
else:
|
||||||
|
folder = folder = self.get_file_name()
|
||||||
|
return os.path.join(self.controller.temp_folder, folder)
|
||||||
|
|
||||||
def check_thumbnails(self):
|
def check_thumbnails(self):
|
||||||
"""
|
"""
|
||||||
|
@ -35,7 +35,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import AppLocation, translate
|
from openlp.core.common import AppLocation, Settings, translate
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon
|
from openlp.core.lib import Plugin, StringContent, build_icon
|
||||||
from openlp.plugins.presentations.lib import PresentationController, PresentationMediaItem, PresentationTab
|
from openlp.plugins.presentations.lib import PresentationController, PresentationMediaItem, PresentationTab
|
||||||
|
|
||||||
@ -50,7 +50,8 @@ __default_settings__ = {'presentations/override app': QtCore.Qt.Unchecked,
|
|||||||
'presentations/Powerpoint': QtCore.Qt.Checked,
|
'presentations/Powerpoint': QtCore.Qt.Checked,
|
||||||
'presentations/Powerpoint Viewer': QtCore.Qt.Checked,
|
'presentations/Powerpoint Viewer': QtCore.Qt.Checked,
|
||||||
'presentations/Pdf': QtCore.Qt.Checked,
|
'presentations/Pdf': QtCore.Qt.Checked,
|
||||||
'presentations/presentations files': []
|
'presentations/presentations files': [],
|
||||||
|
'presentations/thumbnail_scheme': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,6 +142,19 @@ class PresentationPlugin(Plugin):
|
|||||||
self.register_controllers(controller)
|
self.register_controllers(controller)
|
||||||
return bool(self.controllers)
|
return bool(self.controllers)
|
||||||
|
|
||||||
|
def app_startup(self):
|
||||||
|
"""
|
||||||
|
Perform tasks on application startup.
|
||||||
|
"""
|
||||||
|
super().app_startup()
|
||||||
|
files_from_config = Settings().value('presentations/presentations files')
|
||||||
|
for file in files_from_config:
|
||||||
|
self.media_item.delete_presentation(file)
|
||||||
|
#Settings().setValue('presentations/presentations files', [])
|
||||||
|
self.media_item.list_view.clear()
|
||||||
|
Settings().setValue('presentations/thumbnail_scheme', 'md5')
|
||||||
|
self.media_item.validate_and_load(files_from_config)
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
Return information about this plugin.
|
Return information about this plugin.
|
||||||
|
Loading…
Reference in New Issue
Block a user