use Python methods instead of Qt

This commit is contained in:
M2j 2012-02-26 22:09:22 +01:00
parent 44a5784315
commit 3a6a402b56
4 changed files with 6 additions and 6 deletions

View File

@ -150,7 +150,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
translate('OpenLP.ExceptionForm',
'Text files (*.txt *.log *.text)'))
if filename:
filename = unicode(QtCore.QDir.toNativeSeparators(filename))
filename = unicode(filename).replace(u'/', os.path.sep)
SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
filename))
report_text = report_text % self._createReport()

View File

@ -1378,14 +1378,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
recentFileCount = QtCore.QSettings().value(
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
existingRecentFiles = [recentFile for recentFile in self.recentFiles
if QtCore.QFile.exists(recentFile)]
if os.path.isfile(unicode(recentFile))]
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
self.recentFilesMenu.clear()
for fileId, filename in enumerate(recentFilesToDisplay):
log.debug('Recent file name: %s', filename)
action = base_action(self, u'')
action.setText(u'&%d %s' %
(fileId + 1, QtCore.QFileInfo(filename).fileName()))
action.setText(u'&%d %s' % (fileId + 1,
os.path.splitext(os.path.basename(unicode(filename)))[0]))
action.setData(QtCore.QVariant(filename))
self.connect(action, QtCore.SIGNAL(u'triggered()'),
self.serviceManagerContents.onRecentServiceClicked)

View File

@ -683,7 +683,7 @@ class ServiceManager(QtGui.QWidget):
'File is not a valid service.\n'
'The content encoding is not UTF-8.'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
osfile = ucsfile.replace(u'/', os.path.sep)
if not osfile.startswith(u'audio'):
osfile = os.path.split(osfile)[1]
log.debug(u'Extract file: %s', osfile)

View File

@ -544,7 +544,7 @@ class ThemeManager(QtGui.QWidget):
log.exception(u'Theme file contains non utf-8 filename'
u' "%s"' % name.decode(u'utf-8', u'replace'))
raise Exception(u'validation')
uname = unicode(QtCore.QDir.toNativeSeparators(uname))
uname = uname.replace(u'/', os.path.sep)
splitname = uname.split(os.path.sep)
if splitname[-1] == u'' or len(splitname) == 1:
# is directory or preview file