fixed 1014684 (OpenLP doesn't start on Windows XP)

bzr-revno: 2005
This commit is contained in:
Andreas Preikschat 2012-06-26 17:14:42 +01:00 committed by Tim Bentley
commit 894c6c2868
4 changed files with 17 additions and 11 deletions

View File

@ -41,7 +41,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \ from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
check_directory_exists check_directory_exists
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.utils import get_web_page, AppLocation from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -65,7 +65,8 @@ class ThemeScreenshotThread(QtCore.QThread):
filename = config.get(u'theme_%s' % theme, u'filename') filename = config.get(u'theme_%s' % theme, u'filename')
screenshot = config.get(u'theme_%s' % theme, u'screenshot') screenshot = config.get(u'theme_%s' % theme, u'screenshot')
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot), urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
os.path.join(gettempdir(), u'openlp', screenshot)) os.path.join(unicode(gettempdir(), get_filesystem_encoding()),
u'openlp', screenshot))
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget) item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
item.setCheckState(QtCore.Qt.Unchecked) item.setCheckState(QtCore.Qt.Unchecked)
@ -115,7 +116,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
Set up display at start of theme edit. Set up display at start of theme edit.
""" """
self.restart() self.restart()
check_directory_exists(os.path.join(gettempdir(), u'openlp')) check_directory_exists(os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
self.noInternetFinishButton.setVisible(False) self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard. # Check if this is a re-run of the wizard.
self.hasRunWizard = Settings().value( self.hasRunWizard = Settings().value(
@ -304,8 +306,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
item = self.themesListWidget.item(index) item = self.themesListWidget.item(index)
if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename): if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename):
break break
item.setIcon(build_icon( item.setIcon(build_icon(os.path.join(unicode(gettempdir(),
os.path.join(gettempdir(), u'openlp', screenshot))) get_filesystem_encoding()), u'openlp', screenshot)))
def _getFileSize(self, url): def _getFileSize(self, url):
site = urllib.urlopen(url) site = urllib.urlopen(url)
@ -426,7 +428,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self._setPluginStatus(self.alertCheckBox, u'alerts/status') self._setPluginStatus(self.alertCheckBox, u'alerts/status')
if self.webAccess: if self.webAccess:
# Build directories for downloads # Build directories for downloads
songs_destination = os.path.join(unicode(gettempdir()), u'openlp') songs_destination = os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
bibles_destination = AppLocation.get_section_data_path(u'bibles') bibles_destination = AppLocation.get_section_data_path(u'bibles')
themes_destination = AppLocation.get_section_data_path(u'themes') themes_destination = AppLocation.get_section_data_path(u'themes')
# Download songs # Download songs

View File

@ -1035,8 +1035,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Make sure it's a .conf file. # Make sure it's a .conf file.
if not export_file_name.endswith(u'conf'): if not export_file_name.endswith(u'conf'):
export_file_name = export_file_name + u'.conf' export_file_name = export_file_name + u'.conf'
temp_file = os.path.join(unicode(gettempdir()), temp_file = os.path.join(unicode(gettempdir(),
u'openlp', u'exportConf.tmp') get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
self.saveSettings() self.saveSettings()
setting_sections = [] setting_sections = []
# Add main sections. # Add main sections.

View File

@ -40,7 +40,7 @@ from openlp.core.lib import Receiver, SettingsManager, translate, \
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, delete_file from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \ from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
BiblesResourcesDB BiblesResourcesDB
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
@ -73,7 +73,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.suffix = u'.sqlite' self.suffix = u'.sqlite'
self.settingsSection = u'bibles' self.settingsSection = u'bibles'
self.path = AppLocation.get_section_data_path(self.settingsSection) self.path = AppLocation.get_section_data_path(self.settingsSection)
self.temp_dir = os.path.join(gettempdir(), u'openlp') self.temp_dir = os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
self.files = self.manager.old_bible_databases self.files = self.manager.old_bible_databases
self.success = {} self.success = {}
self.newbibles = {} self.newbibles = {}

View File

@ -36,6 +36,7 @@ from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
Receiver Receiver
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.core.lib.ui import UiStrings, create_action from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.utils import get_filesystem_encoding
from openlp.core.utils.actions import ActionList from openlp.core.utils.actions import ActionList
from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, \ from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, \
SongsTab SongsTab
@ -234,7 +235,8 @@ class SongsPlugin(Plugin):
new songs into the database. new songs into the database.
""" """
self.onToolsReindexItemTriggered() self.onToolsReindexItemTriggered()
db_dir = unicode(os.path.join(gettempdir(), u'openlp')) db_dir = unicode(os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
if not os.path.exists(db_dir): if not os.path.exists(db_dir):
return return
song_dbs = [] song_dbs = []