forked from openlp/openlp
Moved initial images list conversion to app_startup
This commit is contained in:
parent
97184a9ea1
commit
a5e6cc358b
@ -35,7 +35,6 @@ from PyQt4 import QtCore
|
|||||||
|
|
||||||
from openlp.core.lib import Settings, Registry, UiStrings
|
from openlp.core.lib import Settings, Registry, UiStrings
|
||||||
from openlp.core.utils import get_application_version
|
from openlp.core.utils import get_application_version
|
||||||
from openlp.plugins.images.converter import ImagesListSaver
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -301,13 +300,10 @@ class Plugin(QtCore.QObject):
|
|||||||
# FIXME: Remove after 2.2 release.
|
# FIXME: Remove after 2.2 release.
|
||||||
# This is needed to load the list of images/media/presentation from the config saved
|
# This is needed to load the list of images/media/presentation from the config saved
|
||||||
# before the settings rewrite.
|
# before the settings rewrite.
|
||||||
if self.mediaItemClass is not None:
|
if self.mediaItemClass is not None and self.name != u'images':
|
||||||
loaded_list = Settings().get_files_from_config(self)
|
loaded_list = Settings().get_files_from_config(self)
|
||||||
# Now save the list to the config using our Settings class.
|
# Now save the list to the config using our Settings class.
|
||||||
if self.name == u'images':
|
Settings().setValue(u'%s/%s files' % (self.settingsSection, self.name), loaded_list)
|
||||||
ImagesListSaver.save_converted_images_list(loaded_list)
|
|
||||||
else:
|
|
||||||
Settings().setValue(u'%s/%s files' % (self.settingsSection, self.name), loaded_list)
|
|
||||||
|
|
||||||
def usesTheme(self, theme):
|
def usesTheme(self, theme):
|
||||||
"""
|
"""
|
||||||
|
@ -34,7 +34,7 @@ import logging
|
|||||||
from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, Settings, build_icon, translate
|
from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, Settings, build_icon, translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||||
from openlp.plugins.images.lib.db import init_schema
|
from openlp.plugins.images.lib.db import init_schema, ImageFilenames
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -69,6 +69,23 @@ class ImagePlugin(Plugin):
|
|||||||
'provided by the theme.')
|
'provided by the theme.')
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
|
def app_startup(self):
|
||||||
|
"""
|
||||||
|
Perform tasks on application startup
|
||||||
|
"""
|
||||||
|
Plugin.app_startup(self)
|
||||||
|
# Convert old settings-based image list to the database
|
||||||
|
files_from_config = Settings().get_files_from_config(self)
|
||||||
|
if len(files_from_config) > 0:
|
||||||
|
log.debug(u'Importing images list from old config: %s' % files_from_config)
|
||||||
|
for filename in files_from_config:
|
||||||
|
imageFile = ImageFilenames()
|
||||||
|
imageFile.group_id = 0
|
||||||
|
imageFile.filename = unicode(filename)
|
||||||
|
self.manager.save_object(imageFile)
|
||||||
|
self.mediaItem.loadFullList(self.manager.get_all_objects(ImageFilenames,
|
||||||
|
order_by_ref=ImageFilenames.filename))
|
||||||
|
|
||||||
def setPluginTextStrings(self):
|
def setPluginTextStrings(self):
|
||||||
"""
|
"""
|
||||||
Called to define all translatable texts of the plugin
|
Called to define all translatable texts of the plugin
|
||||||
|
Loading…
Reference in New Issue
Block a user