use get_filesystem_encoding

This commit is contained in:
Andreas Preikschat 2012-06-22 22:12:43 +02:00
parent 155e99d307
commit ab8e6ee30a
4 changed files with 16 additions and 11 deletions

View File

@ -40,7 +40,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
check_directory_exists
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
log = logging.getLogger(__name__)
@ -64,7 +64,7 @@ class ThemeScreenshotThread(QtCore.QThread):
filename = config.get(u'theme_%s' % theme, u'filename')
screenshot = config.get(u'theme_%s' % theme, u'screenshot')
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
os.path.join(unicode(gettempdir()), u'openlp', screenshot))
os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', screenshot))
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
item.setCheckState(QtCore.Qt.Unchecked)
@ -114,7 +114,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
Set up display at start of theme edit.
"""
self.restart()
check_directory_exists(os.path.join(unicode(gettempdir()), u'openlp'))
check_directory_exists(os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard.
self.hasRunWizard = Settings().value(
@ -303,8 +304,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
item = self.themesListWidget.item(index)
if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename):
break
item.setIcon(build_icon(
os.path.join(unicode(gettempdir()), u'openlp', screenshot)))
item.setIcon(build_icon(os.path.join(unicode(gettempdir(),
get_filesystem_encoding()), u'openlp', screenshot)))
def _getFileSize(self, url):
site = urllib.urlopen(url)
@ -425,7 +426,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self._setPluginStatus(self.alertCheckBox, u'alerts/status')
if self.webAccess:
# 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')
themes_destination = AppLocation.get_section_data_path(u'themes')
# Download songs

View File

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

View File

@ -38,7 +38,7 @@ from openlp.core.lib import Receiver, SettingsManager, translate, \
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.settings import Settings
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, \
BiblesResourcesDB
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
@ -71,7 +71,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.suffix = u'.sqlite'
self.settingsSection = u'bibles'
self.path = AppLocation.get_section_data_path(self.settingsSection)
self.temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
self.temp_dir = os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
self.files = self.manager.old_bible_databases
self.success = {}
self.newbibles = {}

View File

@ -35,6 +35,7 @@ from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
Receiver
from openlp.core.lib.db import Manager
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.plugins.songs.lib import clean_song, upgrade, SongMediaItem, \
SongsTab
@ -233,7 +234,8 @@ class SongsPlugin(Plugin):
new songs into the database.
"""
self.onToolsReindexItemTriggered()
db_dir = unicode(os.path.join(unicode(gettempdir()), u'openlp'))
db_dir = unicode(os.path.join(
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
if not os.path.exists(db_dir):
return
song_dbs = []