forked from openlp/openlp
use Python methods instead of Qt
This commit is contained in:
parent
44a5784315
commit
3a6a402b56
@ -150,7 +150,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
translate('OpenLP.ExceptionForm',
|
translate('OpenLP.ExceptionForm',
|
||||||
'Text files (*.txt *.log *.text)'))
|
'Text files (*.txt *.log *.text)'))
|
||||||
if filename:
|
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(
|
SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
|
||||||
filename))
|
filename))
|
||||||
report_text = report_text % self._createReport()
|
report_text = report_text % self._createReport()
|
||||||
|
@ -1378,14 +1378,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
recentFileCount = QtCore.QSettings().value(
|
recentFileCount = QtCore.QSettings().value(
|
||||||
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
|
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
|
||||||
existingRecentFiles = [recentFile for recentFile in self.recentFiles
|
existingRecentFiles = [recentFile for recentFile in self.recentFiles
|
||||||
if QtCore.QFile.exists(recentFile)]
|
if os.path.isfile(unicode(recentFile))]
|
||||||
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
|
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
|
||||||
self.recentFilesMenu.clear()
|
self.recentFilesMenu.clear()
|
||||||
for fileId, filename in enumerate(recentFilesToDisplay):
|
for fileId, filename in enumerate(recentFilesToDisplay):
|
||||||
log.debug('Recent file name: %s', filename)
|
log.debug('Recent file name: %s', filename)
|
||||||
action = base_action(self, u'')
|
action = base_action(self, u'')
|
||||||
action.setText(u'&%d %s' %
|
action.setText(u'&%d %s' % (fileId + 1,
|
||||||
(fileId + 1, QtCore.QFileInfo(filename).fileName()))
|
os.path.splitext(os.path.basename(unicode(filename)))[0]))
|
||||||
action.setData(QtCore.QVariant(filename))
|
action.setData(QtCore.QVariant(filename))
|
||||||
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.serviceManagerContents.onRecentServiceClicked)
|
self.serviceManagerContents.onRecentServiceClicked)
|
||||||
|
@ -683,7 +683,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
'File is not a valid service.\n'
|
'File is not a valid service.\n'
|
||||||
'The content encoding is not UTF-8.'))
|
'The content encoding is not UTF-8.'))
|
||||||
continue
|
continue
|
||||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
osfile = ucsfile.replace(u'/', os.path.sep)
|
||||||
if not osfile.startswith(u'audio'):
|
if not osfile.startswith(u'audio'):
|
||||||
osfile = os.path.split(osfile)[1]
|
osfile = os.path.split(osfile)[1]
|
||||||
log.debug(u'Extract file: %s', osfile)
|
log.debug(u'Extract file: %s', osfile)
|
||||||
|
@ -544,7 +544,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
log.exception(u'Theme file contains non utf-8 filename'
|
log.exception(u'Theme file contains non utf-8 filename'
|
||||||
u' "%s"' % name.decode(u'utf-8', u'replace'))
|
u' "%s"' % name.decode(u'utf-8', u'replace'))
|
||||||
raise Exception(u'validation')
|
raise Exception(u'validation')
|
||||||
uname = unicode(QtCore.QDir.toNativeSeparators(uname))
|
uname = uname.replace(u'/', os.path.sep)
|
||||||
splitname = uname.split(os.path.sep)
|
splitname = uname.split(os.path.sep)
|
||||||
if splitname[-1] == u'' or len(splitname) == 1:
|
if splitname[-1] == u'' or len(splitname) == 1:
|
||||||
# is directory or preview file
|
# is directory or preview file
|
||||||
|
Loading…
Reference in New Issue
Block a user