forked from openlp/openlp
Migration tools settings conversion
This commit is contained in:
parent
507cd19739
commit
97d9ab93f6
@ -31,7 +31,8 @@ from sqlalchemy import *
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
|
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
|
||||||
|
|
||||||
from openlp.core.lib import PluginConfig
|
from openlp.core.lib import SettingsManager
|
||||||
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.bibles.lib.models import *
|
from openlp.plugins.bibles.lib.models import *
|
||||||
|
|
||||||
class BaseModel(object):
|
class BaseModel(object):
|
||||||
@ -111,9 +112,8 @@ def init_models(url):
|
|||||||
class MigrateBibles():
|
class MigrateBibles():
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
self.display = display
|
self.display = display
|
||||||
self.config = PluginConfig(u'Bibles')
|
self.data_path = AppLocation.get_section_data_path(u'bibles')
|
||||||
self.data_path = self.config.get_data_path()
|
self.database_files = SettingsManager.get_files(u'bibles', u'.sqlite')
|
||||||
self.database_files = self.config.get_files(u'sqlite')
|
|
||||||
print self.database_files
|
print self.database_files
|
||||||
|
|
||||||
def progress(self, text):
|
def progress(self, text):
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from openlp.core.utils import ConfigHelper
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
class MigrateFiles():
|
class MigrateFiles():
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
@ -36,14 +36,19 @@ class MigrateFiles():
|
|||||||
|
|
||||||
def _initial_setup(self):
|
def _initial_setup(self):
|
||||||
self.display.output(u'Initial Setup started')
|
self.display.output(u'Initial Setup started')
|
||||||
ConfigHelper.get_data_path()
|
data_path = AppLocation.get_data_path()
|
||||||
|
print data_path
|
||||||
self.display.sub_output(u'Config created')
|
self.display.sub_output(u'Config created')
|
||||||
ConfigHelper.get_config(u'bible', u'data path')
|
bibles_path = AppLocation.get_section_data_path(u'bibles')
|
||||||
|
print bibles_path
|
||||||
self.display.sub_output(u'Config created')
|
self.display.sub_output(u'Config created')
|
||||||
ConfigHelper.get_config(u'videos', u'data path')
|
# Media doesn't use a directory like the other plugins.
|
||||||
self.display.sub_output(u'videos created')
|
#media_path = AppLocation.get_section_data_path(u'media')
|
||||||
ConfigHelper.get_config(u'images', u'data path')
|
#self.display.sub_output(u'videos created')
|
||||||
|
images_path = AppLocation.get_section_data_path(u'images')
|
||||||
|
print images_path
|
||||||
self.display.sub_output(u'images created')
|
self.display.sub_output(u'images created')
|
||||||
ConfigHelper.get_config(u'presentations', u'data path')
|
presentations_path = AppLocation.get_section_data_path(u'presentations')
|
||||||
|
print presentations_path
|
||||||
self.display.sub_output(u'presentations created')
|
self.display.sub_output(u'presentations created')
|
||||||
self.display.output(u'Initial Setup finished')
|
self.display.output(u'Initial Setup finished')
|
||||||
|
@ -31,7 +31,8 @@ from sqlalchemy import *
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation
|
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation
|
||||||
|
|
||||||
from openlp.core.lib import PluginConfig
|
from openlp.core.lib import SettingsManager
|
||||||
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.songs.lib.models import metadata, songs_table, Song, \
|
from openlp.plugins.songs.lib.models import metadata, songs_table, Song, \
|
||||||
Author, Topic, Book
|
Author, Topic, Book
|
||||||
from openlp.plugins.songs.lib.tables import *
|
from openlp.plugins.songs.lib.tables import *
|
||||||
@ -111,9 +112,8 @@ class TSongAuthor(BaseModel):
|
|||||||
class MigrateSongs():
|
class MigrateSongs():
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
self.display = display
|
self.display = display
|
||||||
self.config = PluginConfig(u'Songs')
|
self.data_path = AppLocation.get_section_data_path(u'songs')
|
||||||
self.data_path = self.config.get_data_path()
|
self.database_files = SettingsManager.get_files(u'songs', u'.sqlite')
|
||||||
self.database_files = self.config.get_files(u'sqlite')
|
|
||||||
print self.database_files
|
print self.database_files
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
|
@ -35,6 +35,7 @@ if os.name == u'nt':
|
|||||||
import win32con
|
import win32con
|
||||||
from win32com.client import Dispatch
|
from win32com.client import Dispatch
|
||||||
|
|
||||||
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.migration.display import *
|
from openlp.migration.display import *
|
||||||
from openlp.migration.migratefiles import *
|
from openlp.migration.migratefiles import *
|
||||||
from openlp.migration.migratebibles import *
|
from openlp.migration.migratebibles import *
|
||||||
@ -103,8 +104,10 @@ class Migration(object):
|
|||||||
def convert_sqlite2_to_3(self, olddb, newdb):
|
def convert_sqlite2_to_3(self, olddb, newdb):
|
||||||
print u'Converting sqlite2 ' + olddb + ' to sqlite3 ' + newdb
|
print u'Converting sqlite2 ' + olddb + ' to sqlite3 ' + newdb
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
# we can't make this a raw unicode string as the \U within it causes much confusion
|
# we can't make this a raw unicode string as the \U within it
|
||||||
hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, u'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SQLite ODBC Driver')
|
# causes much confusion
|
||||||
|
hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE,
|
||||||
|
u'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SQLite ODBC Driver')
|
||||||
value, type = win32api.RegQueryValueEx (hKey, u'UninstallString')
|
value, type = win32api.RegQueryValueEx (hKey, u'UninstallString')
|
||||||
sqlitepath, temp = os.path.split(value)
|
sqlitepath, temp = os.path.split(value)
|
||||||
sqliteexe = os.path.join(sqlitepath, u'sqlite.exe')
|
sqliteexe = os.path.join(sqlitepath, u'sqlite.exe')
|
||||||
@ -133,10 +136,8 @@ class Migration(object):
|
|||||||
|
|
||||||
if __name__ == u'__main__':
|
if __name__ == u'__main__':
|
||||||
mig = Migration()
|
mig = Migration()
|
||||||
songconfig = PluginConfig(u'Songs')
|
newsongpath = AppLocation.get_section_data_path(u'songs')
|
||||||
newsongpath = songconfig.get_data_path()
|
newbiblepath = AppLocation.get_section_data_path(u'bibles')
|
||||||
bibleconfig = PluginConfig(u'Bibles')
|
|
||||||
newbiblepath = bibleconfig.get_data_path()
|
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
if not os.path.isdir(newsongpath):
|
if not os.path.isdir(newsongpath):
|
||||||
os.makedirs(newsongpath)
|
os.makedirs(newsongpath)
|
||||||
|
Loading…
Reference in New Issue
Block a user