forked from openlp/openlp
removed toString(), toPyObject()
This commit is contained in:
parent
b124481ea2
commit
a085694be1
@ -27,9 +27,15 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import sip
|
import sip
|
||||||
|
sip.setapi(u'QDate', 2)
|
||||||
|
sip.setapi(u'QDateTime', 2)
|
||||||
sip.setapi(u'QString', 2)
|
sip.setapi(u'QString', 2)
|
||||||
|
sip.setapi(u'QTextStream', 2)
|
||||||
|
sip.setapi(u'QTime', 2)
|
||||||
|
sip.setapi(u'QUrl', 2)
|
||||||
sip.setapi(u'QVariant', 2)
|
sip.setapi(u'QVariant', 2)
|
||||||
|
|
||||||
|
|
||||||
from openlp.core import main
|
from openlp.core import main
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,19 +92,18 @@ class Settings(QtCore.QSettings):
|
|||||||
**Note**, this method only converts a few types and might need to be
|
**Note**, this method only converts a few types and might need to be
|
||||||
extended if a certain type is missing!
|
extended if a certain type is missing!
|
||||||
"""
|
"""
|
||||||
# FIXME
|
|
||||||
if key == u'recent files':
|
|
||||||
return []
|
|
||||||
setting = super(Settings, self).value(key, defaultValue)
|
setting = super(Settings, self).value(key, defaultValue)
|
||||||
|
# An empty list saved to the settings results ins a None type being
|
||||||
|
# returned.
|
||||||
|
if setting is None:
|
||||||
|
return []
|
||||||
# Convert the setting to the correct type.
|
# Convert the setting to the correct type.
|
||||||
if isinstance(defaultValue, bool):
|
if isinstance(defaultValue, bool):
|
||||||
return bool(setting)
|
return setting == u'true'
|
||||||
# Enumerations are also taken care of.
|
|
||||||
if isinstance(defaultValue, int):
|
if isinstance(defaultValue, int):
|
||||||
return int(setting)
|
return int(setting)
|
||||||
return setting
|
return setting
|
||||||
|
|
||||||
|
|
||||||
def translate(context, text, comment=None,
|
def translate(context, text, comment=None,
|
||||||
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||||
translate=QtCore.QCoreApplication.translate):
|
translate=QtCore.QCoreApplication.translate):
|
||||||
|
@ -380,7 +380,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
for count in range(self.listView.count()):
|
for count in range(self.listView.count()):
|
||||||
names.append(self.listView.item(count).text())
|
names.append(self.listView.item(count).text())
|
||||||
fullList.append(self.listView.item(count).
|
fullList.append(self.listView.item(count).
|
||||||
data(QtCore.Qt.UserRole).toString())
|
data(QtCore.Qt.UserRole))
|
||||||
duplicatesFound = False
|
duplicatesFound = False
|
||||||
filesAdded = False
|
filesAdded = False
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -420,7 +420,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
filelist = []
|
filelist = []
|
||||||
while count < self.listView.count():
|
while count < self.listView.count():
|
||||||
bitem = self.listView.item(count)
|
bitem = self.listView.item(count)
|
||||||
filename = bitem.data(QtCore.Qt.UserRole).toString()
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
filelist.append(filename)
|
filelist.append(filename)
|
||||||
count += 1
|
count += 1
|
||||||
return filelist
|
return filelist
|
||||||
|
@ -133,7 +133,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
language = unicode(self.config.get(
|
language = unicode(self.config.get(
|
||||||
u'bibles_%s' % lang, u'title'), u'utf8')
|
u'bibles_%s' % lang, u'title'), u'utf8')
|
||||||
langItem = QtGui.QTreeWidgetItem(
|
langItem = QtGui.QTreeWidgetItem(
|
||||||
self.biblesTreeWidget, language)
|
self.biblesTreeWidget, [language])
|
||||||
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
|
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
|
||||||
bibles = bibles.split(u',')
|
bibles = bibles.split(u',')
|
||||||
for bible in bibles:
|
for bible in bibles:
|
||||||
@ -141,7 +141,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
u'bible_%s' % bible, u'title'), u'utf8')
|
u'bible_%s' % bible, u'title'), u'utf8')
|
||||||
filename = unicode(self.config.get(
|
filename = unicode(self.config.get(
|
||||||
u'bible_%s' % bible, u'filename'))
|
u'bible_%s' % bible, u'filename'))
|
||||||
item = QtGui.QTreeWidgetItem(langItem, title)
|
item = QtGui.QTreeWidgetItem(langItem, [title])
|
||||||
item.setData(0, QtCore.Qt.UserRole, filename)
|
item.setData(0, QtCore.Qt.UserRole, filename)
|
||||||
item.setCheckState(0, QtCore.Qt.Unchecked)
|
item.setCheckState(0, QtCore.Qt.Unchecked)
|
||||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||||
@ -332,7 +332,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
for i in xrange(self.songsListWidget.count()):
|
for i in xrange(self.songsListWidget.count()):
|
||||||
item = self.songsListWidget.item(i)
|
item = self.songsListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||||
self.max_progress += size
|
self.max_progress += size
|
||||||
# Loop through the Bibles list and increase for each selected item
|
# Loop through the Bibles list and increase for each selected item
|
||||||
@ -340,7 +340,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
while iterator.value():
|
while iterator.value():
|
||||||
item = iterator.value()
|
item = iterator.value()
|
||||||
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
||||||
filename = item.data(0, QtCore.Qt.UserRole).toString()
|
filename = item.data(0, QtCore.Qt.UserRole)
|
||||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||||
self.max_progress += size
|
self.max_progress += size
|
||||||
iterator += 1
|
iterator += 1
|
||||||
@ -348,7 +348,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
for i in xrange(self.themesListWidget.count()):
|
for i in xrange(self.themesListWidget.count()):
|
||||||
item = self.themesListWidget.item(i)
|
item = self.themesListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||||
self.max_progress += size
|
self.max_progress += size
|
||||||
if self.max_progress:
|
if self.max_progress:
|
||||||
@ -421,7 +421,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
for i in xrange(self.songsListWidget.count()):
|
for i in xrange(self.songsListWidget.count()):
|
||||||
item = self.songsListWidget.item(i)
|
item = self.songsListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
self._incrementProgressBar(self.downloading % filename, 0)
|
self._incrementProgressBar(self.downloading % filename, 0)
|
||||||
self.previous_size = 0
|
self.previous_size = 0
|
||||||
destination = os.path.join(songs_destination,
|
destination = os.path.join(songs_destination,
|
||||||
@ -433,7 +433,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
while bibles_iterator.value():
|
while bibles_iterator.value():
|
||||||
item = bibles_iterator.value()
|
item = bibles_iterator.value()
|
||||||
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
||||||
bible = item.data(0, QtCore.Qt.UserRole).toString()
|
bible = item.data(0, QtCore.Qt.UserRole)
|
||||||
self._incrementProgressBar(self.downloading % bible, 0)
|
self._incrementProgressBar(self.downloading % bible, 0)
|
||||||
self.previous_size = 0
|
self.previous_size = 0
|
||||||
self.urlGetFile(u'%s%s' % (self.web, bible),
|
self.urlGetFile(u'%s%s' % (self.web, bible),
|
||||||
@ -443,7 +443,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
for i in xrange(self.themesListWidget.count()):
|
for i in xrange(self.themesListWidget.count()):
|
||||||
item = self.themesListWidget.item(i)
|
item = self.themesListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
theme = item.data(QtCore.Qt.UserRole).toString()
|
theme = item.data(QtCore.Qt.UserRole)
|
||||||
self._incrementProgressBar(self.downloading % theme, 0)
|
self._incrementProgressBar(self.downloading % theme, 0)
|
||||||
self.previous_size = 0
|
self.previous_size = 0
|
||||||
self.urlGetFile(u'%s%s' % (self.web, theme),
|
self.urlGetFile(u'%s%s' % (self.web, theme),
|
||||||
|
@ -257,7 +257,7 @@ class MainDisplay(Display):
|
|||||||
height = self.frame.evaluateJavaScript(js)
|
height = self.frame.evaluateJavaScript(js)
|
||||||
if shrink:
|
if shrink:
|
||||||
if text:
|
if text:
|
||||||
alert_height = int(height.toString())
|
alert_height = int(height)
|
||||||
self.resize(self.width(), alert_height)
|
self.resize(self.width(), alert_height)
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
if location == AlertLocation.Middle:
|
if location == AlertLocation.Middle:
|
||||||
@ -335,7 +335,7 @@ class MainDisplay(Display):
|
|||||||
if self.serviceItem.themedata and \
|
if self.serviceItem.themedata and \
|
||||||
self.serviceItem.themedata.display_slide_transition:
|
self.serviceItem.themedata.display_slide_transition:
|
||||||
while self.frame.evaluateJavaScript(u'show_text_complete()') \
|
while self.frame.evaluateJavaScript(u'show_text_complete()') \
|
||||||
.toString() == u'false':
|
== u'false':
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
# Wait for the webview to update before getting the preview.
|
# Wait for the webview to update before getting the preview.
|
||||||
# Important otherwise first preview will miss the background !
|
# Important otherwise first preview will miss the background !
|
||||||
|
@ -1308,7 +1308,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
settings.remove(u'custom slide')
|
settings.remove(u'custom slide')
|
||||||
settings.remove(u'service')
|
settings.remove(u'service')
|
||||||
settings.beginGroup(self.generalSettingsSection)
|
settings.beginGroup(self.generalSettingsSection)
|
||||||
self.recentFiles = settings.value(u'recent files', list())
|
self.recentFiles = settings.value(u'recent files', self.recentFiles)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
settings.beginGroup(self.uiSettingsSection)
|
settings.beginGroup(self.uiSettingsSection)
|
||||||
self.move(settings.value(u'main window position', QtCore.QPoint(0, 0)))
|
self.move(settings.value(u'main window position', QtCore.QPoint(0, 0)))
|
||||||
@ -1334,8 +1334,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
log.debug(u'Saving QSettings')
|
log.debug(u'Saving QSettings')
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(self.generalSettingsSection)
|
settings.beginGroup(self.generalSettingsSection)
|
||||||
settings.setValue(
|
settings.setValue(u'recent files', self.recentFiles)
|
||||||
u'recent files', self.recentFiles if self.recentFiles else list())
|
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
settings.beginGroup(self.uiSettingsSection)
|
settings.beginGroup(self.uiSettingsSection)
|
||||||
settings.setValue(u'main window position', self.pos())
|
settings.setValue(u'main window position', self.pos())
|
||||||
|
@ -412,7 +412,7 @@ class WebkitPlayer(MediaPlayer):
|
|||||||
u'show_flash("length");')
|
u'show_flash("length");')
|
||||||
else:
|
else:
|
||||||
if display.frame.evaluateJavaScript( \
|
if display.frame.evaluateJavaScript( \
|
||||||
u'show_video("isEnded");').toString() == 'true':
|
u'show_video("isEnded");') == 'true':
|
||||||
self.stop(display)
|
self.stop(display)
|
||||||
(currentTime, ok) = display.frame.evaluateJavaScript( \
|
(currentTime, ok) = display.frame.evaluateJavaScript( \
|
||||||
u'show_video("currentTime");').toFloat()
|
u'show_video("currentTime");').toFloat()
|
||||||
|
@ -89,7 +89,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
||||||
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
||||||
return
|
return
|
||||||
key_string = QtGui.QKeySequence(key).toString()
|
key_string = QtGui.QKeySequence(key)
|
||||||
if event.modifiers() & QtCore.Qt.ControlModifier == \
|
if event.modifiers() & QtCore.Qt.ControlModifier == \
|
||||||
QtCore.Qt.ControlModifier:
|
QtCore.Qt.ControlModifier:
|
||||||
key_string = u'Ctrl+' + key_string
|
key_string = u'Ctrl+' + key_string
|
||||||
@ -105,10 +105,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
||||||
if self.primaryPushButton.isChecked():
|
if self.primaryPushButton.isChecked():
|
||||||
self._adjustButton(self.primaryPushButton,
|
self._adjustButton(self.primaryPushButton,
|
||||||
False, text=key_sequence.toString())
|
False, text=key_sequence)
|
||||||
elif self.alternatePushButton.isChecked():
|
elif self.alternatePushButton.isChecked():
|
||||||
self._adjustButton(self.alternatePushButton,
|
self._adjustButton(self.alternatePushButton,
|
||||||
False, text=key_sequence.toString())
|
False, text=key_sequence)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
self.changedActions = {}
|
self.changedActions = {}
|
||||||
@ -154,11 +154,11 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
item.setText(1, u'')
|
item.setText(1, u'')
|
||||||
item.setText(2, u'')
|
item.setText(2, u'')
|
||||||
elif len(shortcuts) == 1:
|
elif len(shortcuts) == 1:
|
||||||
item.setText(1, shortcuts[0].toString())
|
item.setText(1, shortcuts[0])
|
||||||
item.setText(2, u'')
|
item.setText(2, u'')
|
||||||
else:
|
else:
|
||||||
item.setText(1, shortcuts[0].toString())
|
item.setText(1, shortcuts[0])
|
||||||
item.setText(2, shortcuts[1].toString())
|
item.setText(2, shortcuts[1])
|
||||||
self.onCurrentItemChanged()
|
self.onCurrentItemChanged()
|
||||||
|
|
||||||
def onPrimaryPushButtonClicked(self, toggled):
|
def onPrimaryPushButtonClicked(self, toggled):
|
||||||
@ -241,9 +241,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.alternatePushButton.setChecked(False)
|
self.alternatePushButton.setChecked(False)
|
||||||
else:
|
else:
|
||||||
if action.defaultShortcuts:
|
if action.defaultShortcuts:
|
||||||
primary_label_text = action.defaultShortcuts[0].toString()
|
primary_label_text = action.defaultShortcuts[0]
|
||||||
if len(action.defaultShortcuts) == 2:
|
if len(action.defaultShortcuts) == 2:
|
||||||
alternate_label_text = action.defaultShortcuts[1].toString()
|
alternate_label_text = action.defaultShortcuts[1]
|
||||||
shortcuts = self._actionShortcuts(action)
|
shortcuts = self._actionShortcuts(action)
|
||||||
# We do not want to loose pending changes, that is why we have to
|
# We do not want to loose pending changes, that is why we have to
|
||||||
# keep the text when, this function has not been triggered by a
|
# keep the text when, this function has not been triggered by a
|
||||||
@ -252,10 +252,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
primary_text = self.primaryPushButton.text()
|
primary_text = self.primaryPushButton.text()
|
||||||
alternate_text = self.alternatePushButton.text()
|
alternate_text = self.alternatePushButton.text()
|
||||||
elif len(shortcuts) == 1:
|
elif len(shortcuts) == 1:
|
||||||
primary_text = shortcuts[0].toString()
|
primary_text = shortcuts[0]
|
||||||
elif len(shortcuts) == 2:
|
elif len(shortcuts) == 2:
|
||||||
primary_text = shortcuts[0].toString()
|
primary_text = shortcuts[0]
|
||||||
alternate_text = shortcuts[1].toString()
|
alternate_text = shortcuts[1]
|
||||||
# When we are capturing a new shortcut, we do not want, the buttons to
|
# When we are capturing a new shortcut, we do not want, the buttons to
|
||||||
# display the current shortcut.
|
# display the current shortcut.
|
||||||
if self.primaryPushButton.isChecked():
|
if self.primaryPushButton.isChecked():
|
||||||
@ -313,9 +313,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
primary_button_text = u''
|
primary_button_text = u''
|
||||||
alternate_button_text = u''
|
alternate_button_text = u''
|
||||||
if temp_shortcuts:
|
if temp_shortcuts:
|
||||||
primary_button_text = temp_shortcuts[0].toString()
|
primary_button_text = temp_shortcuts[0]
|
||||||
if len(temp_shortcuts) == 2:
|
if len(temp_shortcuts) == 2:
|
||||||
alternate_button_text = temp_shortcuts[1].toString()
|
alternate_button_text = temp_shortcuts[1]
|
||||||
self.primaryPushButton.setText(primary_button_text)
|
self.primaryPushButton.setText(primary_button_text)
|
||||||
self.alternatePushButton.setText(alternate_button_text)
|
self.alternatePushButton.setText(alternate_button_text)
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
'Duplicate Shortcut'),
|
'Duplicate Shortcut'),
|
||||||
u'message': translate('OpenLP.ShortcutListDialog',
|
u'message': translate('OpenLP.ShortcutListDialog',
|
||||||
'The shortcut "%s" is already assigned to another action, '
|
'The shortcut "%s" is already assigned to another action, '
|
||||||
'please use a different shortcut.') % key_sequence.toString()
|
'please use a different shortcut.') % key_sequence
|
||||||
})
|
})
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
item = self.treeWidget.currentItem()
|
item = self.treeWidget.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
return
|
return
|
||||||
return item.data(0, QtCore.Qt.UserRole).toPyObject()
|
return item.data(0, QtCore.Qt.UserRole)
|
||||||
|
|
||||||
def _adjustButton(self, button, checked=None, enabled=None, text=None):
|
def _adjustButton(self, button, checked=None, enabled=None, text=None):
|
||||||
"""
|
"""
|
||||||
|
@ -555,10 +555,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
self.theme.font_main_line_adjustment = self.field(u'lineSpacingSpinBox')
|
self.theme.font_main_line_adjustment = self.field(u'lineSpacingSpinBox')
|
||||||
self.theme.font_main_outline_size = self.field(u'outlineSizeSpinBox')
|
self.theme.font_main_outline_size = self.field(u'outlineSizeSpinBox')
|
||||||
self.theme.font_main_shadow_size = self.field(u'shadowSizeSpinBox')
|
self.theme.font_main_shadow_size = self.field(u'shadowSizeSpinBox')
|
||||||
self.theme.font_main_bold = self.field(u'mainBoldCheckBox').toBool()
|
self.theme.font_main_bold = self.field(u'mainBoldCheckBox')
|
||||||
# FIXME ?
|
# FIXME ?
|
||||||
self.theme.font_main_italics = \
|
self.theme.font_main_italics = \
|
||||||
self.field(u'mainItalicsCheckBox').toBool()
|
self.field(u'mainItalicsCheckBox')
|
||||||
# footer page
|
# footer page
|
||||||
self.theme.font_footer_name = \
|
self.theme.font_footer_name = \
|
||||||
self.footerFontComboBox.currentFont().family()
|
self.footerFontComboBox.currentFont().family()
|
||||||
@ -578,14 +578,14 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
self.horizontalComboBox.currentIndex()
|
self.horizontalComboBox.currentIndex()
|
||||||
self.theme.display_vertical_align = self.verticalComboBox.currentIndex()
|
self.theme.display_vertical_align = self.verticalComboBox.currentIndex()
|
||||||
# TODO Check
|
# TODO Check
|
||||||
self.theme.display_slide_transition = self.field(u'slideTransition').toBool()
|
self.theme.display_slide_transition = self.field(u'slideTransition')
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
"""
|
"""
|
||||||
Lets save the theme as Finish has been triggered
|
Lets save the theme as Finish has been triggered
|
||||||
"""
|
"""
|
||||||
# Save the theme name
|
# Save the theme name
|
||||||
self.theme.theme_name = self.field(u'name').toString()
|
self.theme.theme_name = self.field(u'name')
|
||||||
if not self.theme.theme_name:
|
if not self.theme.theme_name:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
||||||
|
@ -173,7 +173,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
if item is None:
|
if item is None:
|
||||||
return
|
return
|
||||||
real_theme_name = item.data(QtCore.Qt.UserRole).toString()
|
real_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
theme_name = item.text()
|
theme_name = item.text()
|
||||||
# If default theme restrict actions
|
# If default theme restrict actions
|
||||||
if real_theme_name == theme_name:
|
if real_theme_name == theme_name:
|
||||||
@ -189,7 +189,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
item = self.themeListWidget.itemAt(point)
|
item = self.themeListWidget.itemAt(point)
|
||||||
if item is None:
|
if item is None:
|
||||||
return
|
return
|
||||||
real_theme_name = item.data(QtCore.Qt.UserRole).toString()
|
real_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
theme_name = item.text()
|
theme_name = item.text()
|
||||||
self.deleteAction.setVisible(False)
|
self.deleteAction.setVisible(False)
|
||||||
self.renameAction.setVisible(False)
|
self.renameAction.setVisible(False)
|
||||||
@ -211,7 +211,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
# reset the old name
|
# reset the old name
|
||||||
item = self.themeListWidget.item(count)
|
item = self.themeListWidget.item(count)
|
||||||
old_name = item.text()
|
old_name = item.text()
|
||||||
new_name = item.data(QtCore.Qt.UserRole).toString()
|
new_name = item.data(QtCore.Qt.UserRole)
|
||||||
if old_name != new_name:
|
if old_name != new_name:
|
||||||
self.themeListWidget.item(count).setText(new_name)
|
self.themeListWidget.item(count).setText(new_name)
|
||||||
# Set the new name
|
# Set the new name
|
||||||
@ -233,9 +233,9 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
item = self.themeListWidget.item(count)
|
item = self.themeListWidget.item(count)
|
||||||
old_name = item.text()
|
old_name = item.text()
|
||||||
# reset the old name
|
# reset the old name
|
||||||
if old_name != item.data(QtCore.Qt.UserRole).toString():
|
if old_name != item.data(QtCore.Qt.UserRole):
|
||||||
self.themeListWidget.item(count).setText(
|
self.themeListWidget.item(count).setText(
|
||||||
item.data(QtCore.Qt.UserRole).toString())
|
item.data(QtCore.Qt.UserRole))
|
||||||
# Set the new name
|
# Set the new name
|
||||||
if count == selected_row:
|
if count == selected_row:
|
||||||
self.global_theme = self.themeListWidget.item(count).text()
|
self.global_theme = self.themeListWidget.item(count).text()
|
||||||
@ -267,7 +267,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
translate('OpenLP.ThemeManager', 'Rename %s theme?'),
|
translate('OpenLP.ThemeManager', 'Rename %s theme?'),
|
||||||
False, False):
|
False, False):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
old_theme_name = item.data(QtCore.Qt.UserRole).toString()
|
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
self.fileRenameForm.fileNameEdit.setText(old_theme_name)
|
self.fileRenameForm.fileNameEdit.setText(old_theme_name)
|
||||||
if self.fileRenameForm.exec_():
|
if self.fileRenameForm.exec_():
|
||||||
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
||||||
@ -287,7 +287,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
Copies an existing theme to a new name
|
Copies an existing theme to a new name
|
||||||
"""
|
"""
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
old_theme_name = item.data(QtCore.Qt.UserRole).toString()
|
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||||
self.fileRenameForm.fileNameEdit.setText(
|
self.fileRenameForm.fileNameEdit.setText(
|
||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
|
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
|
||||||
@ -321,7 +321,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'You must select a theme to edit.')):
|
'You must select a theme to edit.')):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
theme = self.getThemeData(item.data(QtCore.Qt.UserRole).toString())
|
theme = self.getThemeData(item.data(QtCore.Qt.UserRole))
|
||||||
if theme.background_type == u'image':
|
if theme.background_type == u'image':
|
||||||
self.old_background_image = theme.background_filename
|
self.old_background_image = theme.background_filename
|
||||||
self.themeForm.theme = theme
|
self.themeForm.theme = theme
|
||||||
@ -371,7 +371,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
critical_error_message_box(message=translate('OpenLP.ThemeManager',
|
critical_error_message_box(message=translate('OpenLP.ThemeManager',
|
||||||
'You have not selected a theme.'))
|
'You have not selected a theme.'))
|
||||||
return
|
return
|
||||||
theme = item.data(QtCore.Qt.UserRole).toString()
|
theme = item.data(QtCore.Qt.UserRole)
|
||||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
|
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
|
||||||
SettingsManager.get_last_dir(self.settingsSection, 1))
|
SettingsManager.get_last_dir(self.settingsSection, 1))
|
||||||
@ -775,7 +775,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
return False
|
return False
|
||||||
# should be the same unless default
|
# should be the same unless default
|
||||||
if theme != item.data(QtCore.Qt.UserRole).toString():
|
if theme != item.data(QtCore.Qt.UserRole):
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
message=translate('OpenLP.ThemeManager',
|
message=translate('OpenLP.ThemeManager',
|
||||||
'You are unable to delete the default theme.'))
|
'You are unable to delete the default theme.'))
|
||||||
|
@ -29,6 +29,7 @@ The :mod:`languagemanager` module provides all the translation settings and
|
|||||||
language file loading for OpenLP.
|
language file loading for OpenLP.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
@ -104,13 +105,12 @@ class LanguageManager(object):
|
|||||||
"""
|
"""
|
||||||
Retrieve a saved language to use from settings
|
Retrieve a saved language to use from settings
|
||||||
"""
|
"""
|
||||||
settings = Settings()
|
language = Settings().value(u'general/language', u'[en]')
|
||||||
language = settings.value(u'general/language', u'[en]')
|
language = str(language)
|
||||||
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
|
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
|
||||||
reg_ex = QtCore.QRegExp("^\[(.*)\]")
|
if re.match(r'[[].*[]]', language):
|
||||||
if reg_ex.exactMatch(language):
|
|
||||||
LanguageManager.auto_language = True
|
LanguageManager.auto_language = True
|
||||||
language = reg_ex.cap(1)
|
language = re.sub(r'[\[\]]', '', language)
|
||||||
return language
|
return language
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -433,20 +433,20 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
if self.field(u'source_format') == BibleFormat.OSIS:
|
if self.field(u'source_format') == BibleFormat.OSIS:
|
||||||
if not self.field(u'osis_location').toString():
|
if not self.field(u'osis_location'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||||
self.osisFileEdit.setFocus()
|
self.osisFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format') == BibleFormat.CSV:
|
elif self.field(u'source_format') == BibleFormat.CSV:
|
||||||
if not self.field(u'csv_booksfile').toString():
|
if not self.field(u'csv_booksfile'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a file with books of '
|
'You need to specify a file with books of '
|
||||||
'the Bible to use in the import.'))
|
'the Bible to use in the import.'))
|
||||||
self.csvBooksEdit.setFocus()
|
self.csvBooksEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field(u'csv_versefile').toString():
|
elif not self.field(u'csv_versefile'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a file of Bible '
|
'You need to specify a file of Bible '
|
||||||
@ -455,7 +455,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif self.field(u'source_format') == \
|
elif self.field(u'source_format') == \
|
||||||
BibleFormat.OpenSong:
|
BibleFormat.OpenSong:
|
||||||
if not self.field(u'opensong_file').toString():
|
if not self.field(u'opensong_file'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
self.openSongFileEdit.setFocus()
|
self.openSongFileEdit.setFocus()
|
||||||
@ -466,15 +466,15 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.webTranslationComboBox.currentText())
|
self.webTranslationComboBox.currentText())
|
||||||
return True
|
return True
|
||||||
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
||||||
if not self.field(u'openlp1_location').toString():
|
if not self.field(u'openlp1_location'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
||||||
self.openlp1FileEdit.setFocus()
|
self.openlp1FileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.licenseDetailsPage:
|
elif self.currentPage() == self.licenseDetailsPage:
|
||||||
license_version = self.field(u'license_version').toString()
|
license_version = self.field(u'license_version')
|
||||||
license_copyright = self.field(u'license_copyright').toString()
|
license_copyright = self.field(u'license_copyright')
|
||||||
path = AppLocation.get_section_data_path(u'bibles')
|
path = AppLocation.get_section_data_path(u'bibles')
|
||||||
if not license_version:
|
if not license_version:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
@ -657,28 +657,28 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
Perform the actual import.
|
Perform the actual import.
|
||||||
"""
|
"""
|
||||||
bible_type = self.field(u'source_format')
|
bible_type = self.field(u'source_format')
|
||||||
license_version = self.field(u'license_version').toString()
|
license_version = self.field(u'license_version')
|
||||||
license_copyright = self.field(u'license_copyright').toString()
|
license_copyright = self.field(u'license_copyright')
|
||||||
license_permissions = self.field(u'license_permissions').toString()
|
license_permissions = self.field(u'license_permissions')
|
||||||
importer = None
|
importer = None
|
||||||
if bible_type == BibleFormat.OSIS:
|
if bible_type == BibleFormat.OSIS:
|
||||||
# Import an OSIS bible.
|
# Import an OSIS bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.OSIS,
|
importer = self.manager.import_bible(BibleFormat.OSIS,
|
||||||
name=license_version,
|
name=license_version,
|
||||||
filename=self.field(u'osis_location').toString()
|
filename=self.field(u'osis_location')
|
||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.CSV:
|
elif bible_type == BibleFormat.CSV:
|
||||||
# Import a CSV bible.
|
# Import a CSV bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.CSV,
|
importer = self.manager.import_bible(BibleFormat.CSV,
|
||||||
name=license_version,
|
name=license_version,
|
||||||
booksfile=self.field(u'csv_booksfile').toString(),
|
booksfile=self.field(u'csv_booksfile'),
|
||||||
versefile=self.field(u'csv_versefile').toString()
|
versefile=self.field(u'csv_versefile')
|
||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.OpenSong:
|
elif bible_type == BibleFormat.OpenSong:
|
||||||
# Import an OpenSong bible.
|
# Import an OpenSong bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.OpenSong,
|
importer = self.manager.import_bible(BibleFormat.OpenSong,
|
||||||
name=license_version,
|
name=license_version,
|
||||||
filename=self.field(u'opensong_file').toString()
|
filename=self.field(u'opensong_file')
|
||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.WebDownload:
|
elif bible_type == BibleFormat.WebDownload:
|
||||||
# Import a bible from the web.
|
# Import a bible from the web.
|
||||||
@ -690,15 +690,15 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
BibleFormat.WebDownload, name=license_version,
|
BibleFormat.WebDownload, name=license_version,
|
||||||
download_source=WebDownload.Names[download_location],
|
download_source=WebDownload.Names[download_location],
|
||||||
download_name=bible,
|
download_name=bible,
|
||||||
proxy_server=self.field(u'proxy_server').toString(),
|
proxy_server=self.field(u'proxy_server'),
|
||||||
proxy_username=self.field(u'proxy_username').toString(),
|
proxy_username=self.field(u'proxy_username'),
|
||||||
proxy_password=self.field(u'proxy_password').toString()
|
proxy_password=self.field(u'proxy_password')
|
||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.OpenLP1:
|
elif bible_type == BibleFormat.OpenLP1:
|
||||||
# Import an openlp.org 1.x bible.
|
# Import an openlp.org 1.x bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.OpenLP1,
|
importer = self.manager.import_bible(BibleFormat.OpenLP1,
|
||||||
name=license_version,
|
name=license_version,
|
||||||
filename=self.field(u'openlp1_location').toString()
|
filename=self.field(u'openlp1_location')
|
||||||
)
|
)
|
||||||
if importer.do_import(license_version):
|
if importer.do_import(license_version):
|
||||||
self.manager.save_meta_data(license_version, license_version,
|
self.manager.save_meta_data(license_version, license_version,
|
||||||
|
@ -99,11 +99,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def _decodeQtObject(self, bitem, key):
|
def _decodeQtObject(self, bitem, key):
|
||||||
reference = bitem.data(QtCore.Qt.UserRole)
|
reference = bitem.data(QtCore.Qt.UserRole)
|
||||||
if isinstance(reference, QtCore.QVariant):
|
|
||||||
reference = reference.toPyObject()
|
|
||||||
obj = reference[unicode(key)]
|
obj = reference[unicode(key)]
|
||||||
if isinstance(obj, QtCore.QVariant):
|
|
||||||
obj = obj.toPyObject()
|
|
||||||
return unicode(obj).strip()
|
return unicode(obj).strip()
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
@ -624,7 +620,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.initialiseChapterVerse(
|
self.initialiseChapterVerse(
|
||||||
self.advancedVersionComboBox.currentText(),
|
self.advancedVersionComboBox.currentText(),
|
||||||
self.advancedBookComboBox.currentText(),
|
self.advancedBookComboBox.currentText(),
|
||||||
self.advancedBookComboBox.itemData(item).toString())
|
self.advancedBookComboBox.itemData(item))
|
||||||
|
|
||||||
def onAdvancedFromVerse(self):
|
def onAdvancedFromVerse(self):
|
||||||
chapter_from = int(self.advancedFromChapter.currentText())
|
chapter_from = int(self.advancedFromChapter.currentText())
|
||||||
@ -632,7 +628,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if chapter_from == chapter_to:
|
if chapter_from == chapter_to:
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(
|
||||||
int(self.advancedBookComboBox.currentIndex())).toString()
|
int(self.advancedBookComboBox.currentIndex()))
|
||||||
verse_from = int(self.advancedFromVerse.currentText())
|
verse_from = int(self.advancedFromVerse.currentText())
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
|
||||||
bible, book_ref_id, chapter_to)
|
bible, book_ref_id, chapter_to)
|
||||||
@ -642,7 +638,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def onAdvancedToChapter(self):
|
def onAdvancedToChapter(self):
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(
|
||||||
int(self.advancedBookComboBox.currentIndex())).toString()
|
int(self.advancedBookComboBox.currentIndex()))
|
||||||
chapter_from = int(self.advancedFromChapter.currentText())
|
chapter_from = int(self.advancedFromChapter.currentText())
|
||||||
chapter_to = int(self.advancedToChapter.currentText())
|
chapter_to = int(self.advancedToChapter.currentText())
|
||||||
verse_from = int(self.advancedFromVerse.currentText())
|
verse_from = int(self.advancedFromVerse.currentText())
|
||||||
@ -657,7 +653,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def onAdvancedFromChapter(self):
|
def onAdvancedFromChapter(self):
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(
|
||||||
int(self.advancedBookComboBox.currentIndex())).toString()
|
int(self.advancedBookComboBox.currentIndex()))
|
||||||
chapter_from = int(self.advancedFromChapter.currentText())
|
chapter_from = int(self.advancedFromChapter.currentText())
|
||||||
chapter_to = int(self.advancedToChapter.currentText())
|
chapter_to = int(self.advancedToChapter.currentText())
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
||||||
@ -711,7 +707,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
second_bible = self.advancedSecondComboBox.currentText()
|
second_bible = self.advancedSecondComboBox.currentText()
|
||||||
book = self.advancedBookComboBox.currentText()
|
book = self.advancedBookComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(
|
||||||
int(self.advancedBookComboBox.currentIndex())).toString()
|
int(self.advancedBookComboBox.currentIndex()))
|
||||||
chapter_from = self.advancedFromChapter.currentText()
|
chapter_from = self.advancedFromChapter.currentText()
|
||||||
chapter_to = self.advancedToChapter.currentText()
|
chapter_to = self.advancedToChapter.currentText()
|
||||||
verse_from = self.advancedFromVerse.currentText()
|
verse_from = self.advancedFromVerse.currentText()
|
||||||
|
@ -168,7 +168,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
missing_items = []
|
missing_items = []
|
||||||
missing_items_filenames = []
|
missing_items_filenames = []
|
||||||
for bitem in items:
|
for bitem in items:
|
||||||
filename = bitem.data(QtCore.Qt.UserRole).toString()
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
missing_items.append(bitem)
|
missing_items.append(bitem)
|
||||||
missing_items_filenames.append(filename)
|
missing_items_filenames.append(filename)
|
||||||
@ -194,7 +194,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
return False
|
return False
|
||||||
# Continue with the existing images.
|
# Continue with the existing images.
|
||||||
for bitem in items:
|
for bitem in items:
|
||||||
filename = bitem.data(QtCore.Qt.UserRole).toString()
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
name = os.path.split(filename)[1]
|
name = os.path.split(filename)[1]
|
||||||
service_item.add_from_image(filename, name, background)
|
service_item.add_from_image(filename, name, background)
|
||||||
return True
|
return True
|
||||||
@ -223,7 +223,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.settingsSection + u'/background color', u'#000000'))
|
self.settingsSection + u'/background color', u'#000000'))
|
||||||
item = self.listView.selectedIndexes()[0]
|
item = self.listView.selectedIndexes()[0]
|
||||||
bitem = self.listView.item(item.row())
|
bitem = self.listView.item(item.row())
|
||||||
filename = bitem.data(QtCore.Qt.UserRole).toString()
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
name = os.path.split(filename)[1]
|
name = os.path.split(filename)[1]
|
||||||
if self.plugin.liveController.display.directImage(name,
|
if self.plugin.liveController.display.directImage(name,
|
||||||
|
@ -170,7 +170,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem',
|
||||||
'You must select a media file to replace the background with.')):
|
'You must select a media file to replace the background with.')):
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
if self.plugin.liveController.mediaController.video( \
|
if self.plugin.liveController.mediaController.video( \
|
||||||
self.plugin.liveController, filename, True, True):
|
self.plugin.liveController, filename, True, True):
|
||||||
@ -191,7 +191,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
if not remote:
|
if not remote:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
|
@ -133,7 +133,7 @@ class MediaPlugin(Plugin):
|
|||||||
log.info(u'Found old Phonon setting')
|
log.info(u'Found old Phonon setting')
|
||||||
players = self.mediaController.mediaPlayers.keys()
|
players = self.mediaController.mediaPlayers.keys()
|
||||||
has_phonon = u'phonon' in players
|
has_phonon = u'phonon' in players
|
||||||
if settings.value(u'use phonon').toBool() and has_phonon:
|
if settings.value(u'use phonon') and has_phonon:
|
||||||
log.debug(u'Converting old setting to new setting')
|
log.debug(u'Converting old setting to new setting')
|
||||||
new_players = []
|
new_players = []
|
||||||
if players:
|
if players:
|
||||||
|
@ -231,8 +231,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
self.plugin.formParent.displayProgressBar(len(row_list))
|
self.plugin.formParent.displayProgressBar(len(row_list))
|
||||||
for item in items:
|
for item in items:
|
||||||
filepath = unicode(item.data(
|
filepath = unicode(item.data(QtCore.Qt.UserRole))
|
||||||
QtCore.Qt.UserRole).toString())
|
|
||||||
for cidx in self.controllers:
|
for cidx in self.controllers:
|
||||||
doc = self.controllers[cidx].add_document(filepath)
|
doc = self.controllers[cidx].add_document(filepath)
|
||||||
doc.presentation_deleted()
|
doc.presentation_deleted()
|
||||||
@ -266,7 +265,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if not shortname:
|
if not shortname:
|
||||||
return False
|
return False
|
||||||
for bitem in items:
|
for bitem in items:
|
||||||
filename = bitem.data(QtCore.Qt.UserRole).toString()
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
if shortname == self.Automatic:
|
if shortname == self.Automatic:
|
||||||
service_item.shortname = self.findControllerByType(filename)
|
service_item.shortname = self.findControllerByType(filename)
|
||||||
|
@ -233,7 +233,7 @@ class HttpConnection(object):
|
|||||||
Initialise the http connection. Listen out for socket signals.
|
Initialise the http connection. Listen out for socket signals.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Initialise HttpConnection: %s' %
|
log.debug(u'Initialise HttpConnection: %s' %
|
||||||
socket.peerAddress().toString())
|
socket.peerAddress())
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.routes = [
|
self.routes = [
|
||||||
|
@ -138,7 +138,7 @@ class RemoteTab(SettingsTab):
|
|||||||
ip = addr.ip()
|
ip = addr.ip()
|
||||||
if ip.protocol() == 0 and \
|
if ip.protocol() == 0 and \
|
||||||
ip != QtNetwork.QHostAddress.LocalHost:
|
ip != QtNetwork.QHostAddress.LocalHost:
|
||||||
ipAddress = ip.toString()
|
ipAddress = ip
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
ipAddress = self.addressEdit.text()
|
ipAddress = self.addressEdit.text()
|
||||||
@ -149,11 +149,9 @@ class RemoteTab(SettingsTab):
|
|||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
self.portSpinBox.setValue(
|
self.portSpinBox.setValue(
|
||||||
Settings().value(self.settingsSection + u'/port',
|
Settings().value(self.settingsSection + u'/port', 4316))
|
||||||
4316))
|
|
||||||
self.addressEdit.setText(
|
self.addressEdit.setText(
|
||||||
Settings().value(self.settingsSection + u'/ip address',
|
Settings().value(self.settingsSection + u'/ip address', ZERO_URL))
|
||||||
ZERO_URL))
|
|
||||||
self.twelveHour = Settings().value(
|
self.twelveHour = Settings().value(
|
||||||
self.settingsSection + u'/twelve hour', True)
|
self.settingsSection + u'/twelve hour', True)
|
||||||
self.twelveHourCheckBox.setChecked(self.twelveHour)
|
self.twelveHourCheckBox.setChecked(self.twelveHour)
|
||||||
@ -161,10 +159,9 @@ class RemoteTab(SettingsTab):
|
|||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
changed = False
|
changed = False
|
||||||
if Settings().value(self.settingsSection + u'/ip address',
|
if Settings().value(self.settingsSection + u'/ip address', ZERO_URL !=
|
||||||
ZERO_URL != self.addressEdit.text() or
|
self.addressEdit.text() or Settings().value(self.settingsSection +
|
||||||
Settings().value(self.settingsSection + u'/port',
|
u'/port', 4316) != self.portSpinBox.value()):
|
||||||
4316) != self.portSpinBox.value()):
|
|
||||||
changed = True
|
changed = True
|
||||||
Settings().setValue(self.settingsSection + u'/port',
|
Settings().setValue(self.settingsSection + u'/port',
|
||||||
self.portSpinBox.value())
|
self.portSpinBox.value())
|
||||||
|
@ -336,7 +336,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
row_label = []
|
row_label = []
|
||||||
for row in range(self.verseListWidget.rowCount()):
|
for row in range(self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(row, 0)
|
item = self.verseListWidget.item(row, 0)
|
||||||
verse_def = item.data(QtCore.Qt.UserRole).toString()
|
verse_def = item.data(QtCore.Qt.UserRole)
|
||||||
verse_tag = VerseType.translated_tag(verse_def[0])
|
verse_tag = VerseType.translated_tag(verse_def[0])
|
||||||
row_def = u'%s%s' % (verse_tag, verse_def[1:])
|
row_def = u'%s%s' % (verse_tag, verse_def[1:])
|
||||||
row_label.append(row_def)
|
row_label.append(row_def)
|
||||||
@ -479,7 +479,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
item = self.verseListWidget.currentItem()
|
item = self.verseListWidget.currentItem()
|
||||||
if item:
|
if item:
|
||||||
tempText = item.text()
|
tempText = item.text()
|
||||||
verseId = item.data(QtCore.Qt.UserRole).toString()
|
verseId = item.data(QtCore.Qt.UserRole)
|
||||||
self.verseForm.setVerse(tempText, True, verseId)
|
self.verseForm.setVerse(tempText, True, verseId)
|
||||||
if self.verseForm.exec_():
|
if self.verseForm.exec_():
|
||||||
after_text, verse_tag, verse_num = self.verseForm.getVerse()
|
after_text, verse_tag, verse_num = self.verseForm.getVerse()
|
||||||
@ -509,7 +509,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
if self.verseListWidget.rowCount() > 0:
|
if self.verseListWidget.rowCount() > 0:
|
||||||
for row in range(self.verseListWidget.rowCount()):
|
for row in range(self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(row, 0)
|
item = self.verseListWidget.item(row, 0)
|
||||||
field = item.data(QtCore.Qt.UserRole).toString()
|
field = item.data(QtCore.Qt.UserRole)
|
||||||
verse_tag = VerseType.translated_name(field[0])
|
verse_tag = VerseType.translated_name(field[0])
|
||||||
verse_num = field[1:]
|
verse_num = field[1:]
|
||||||
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
|
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
|
||||||
@ -576,7 +576,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
order = self.__extractVerseOrder(text)
|
order = self.__extractVerseOrder(text)
|
||||||
for index in range(self.verseListWidget.rowCount()):
|
for index in range(self.verseListWidget.rowCount()):
|
||||||
verse = self.verseListWidget.item(index, 0)
|
verse = self.verseListWidget.item(index, 0)
|
||||||
verse = verse.data(QtCore.Qt.UserRole).toString()
|
verse = verse.data(QtCore.Qt.UserRole)
|
||||||
if verse not in verse_names:
|
if verse not in verse_names:
|
||||||
verses.append(verse)
|
verses.append(verse)
|
||||||
verse_names.append(u'%s%s' % (
|
verse_names.append(u'%s%s' % (
|
||||||
@ -617,7 +617,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
order = self.__extractVerseOrder(verse_order)
|
order = self.__extractVerseOrder(verse_order)
|
||||||
for index in range(verse_count):
|
for index in range(verse_count):
|
||||||
verse = self.verseListWidget.item(index, 0)
|
verse = self.verseListWidget.item(index, 0)
|
||||||
verse = verse.data(QtCore.Qt.UserRole).toString()
|
verse = verse.data(QtCore.Qt.UserRole)
|
||||||
if verse not in verse_names:
|
if verse not in verse_names:
|
||||||
verses.append(verse)
|
verses.append(verse)
|
||||||
verse_names.append(u'%s%s' % (
|
verse_names.append(u'%s%s' % (
|
||||||
@ -879,7 +879,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
files = []
|
files = []
|
||||||
for row in xrange(self.audioListWidget.count()):
|
for row in xrange(self.audioListWidget.count()):
|
||||||
item = self.audioListWidget.item(row)
|
item = self.audioListWidget.item(row)
|
||||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
if not filename.startswith(save_path):
|
if not filename.startswith(save_path):
|
||||||
oldfile, filename = filename, os.path.join(save_path,
|
oldfile, filename = filename, os.path.join(save_path,
|
||||||
os.path.split(filename)[1])
|
os.path.split(filename)[1])
|
||||||
@ -916,7 +916,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
multiple = []
|
multiple = []
|
||||||
for i in range(self.verseListWidget.rowCount()):
|
for i in range(self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(i, 0)
|
item = self.verseListWidget.item(i, 0)
|
||||||
verseId = item.data(QtCore.Qt.UserRole).toString()
|
verseId = item.data(QtCore.Qt.UserRole)
|
||||||
verse_tag = verseId[0]
|
verse_tag = verseId[0]
|
||||||
verse_num = verseId[1:]
|
verse_num = verseId[1:]
|
||||||
sxml.add_verse_to_lyrics(verse_tag, verse_num, item.text())
|
sxml.add_verse_to_lyrics(verse_tag, verse_num, item.text())
|
||||||
|
@ -180,19 +180,19 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
|
|
||||||
def getVerseAll(self):
|
def getVerseAll(self):
|
||||||
text = self.verseTextEdit.toPlainText()
|
text = self.verseTextEdit.toPlainText()
|
||||||
if not text.startsWith(u'---['):
|
if not text.startswith(u'---['):
|
||||||
text = u'---[%s:1]---\n%s' % \
|
text = u'---[%s:1]---\n%s' % \
|
||||||
(VerseType.TranslatedNames[VerseType.Verse], text)
|
(VerseType.TranslatedNames[VerseType.Verse], text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.hasSingleVerse:
|
if self.hasSingleVerse:
|
||||||
value = unicode(self.getVerse()[0])
|
value = self.getVerse()[0]
|
||||||
else:
|
else:
|
||||||
log.debug(unicode(self.getVerse()[0]).split(u'\n'))
|
log.debug(self.getVerse()[0].split(u'\n'))
|
||||||
value = unicode(self.getVerse()[0]).split(u'\n')[1]
|
value = self.getVerse()[0].split(u'\n')[1]
|
||||||
if not value:
|
if not value:
|
||||||
lines = unicode(self.getVerse()[0]).split(u'\n')
|
lines = self.getVerse()[0].split(u'\n')
|
||||||
index = 2
|
index = 2
|
||||||
while index < len(lines) and not value:
|
while index < len(lines) and not value:
|
||||||
value = lines[index]
|
value = lines[index]
|
||||||
|
@ -52,6 +52,6 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
|
|||||||
self.fileListWidget.addItem(item)
|
self.fileListWidget.addItem(item)
|
||||||
|
|
||||||
def getSelectedFiles(self):
|
def getSelectedFiles(self):
|
||||||
return map(lambda item: item.data(QtCore.Qt.UserRole).toString(),
|
return map(lambda item: item.data(QtCore.Qt.UserRole),
|
||||||
self.fileListWidget.selectedItems())
|
self.fileListWidget.selectedItems())
|
||||||
|
|
||||||
|
@ -218,8 +218,7 @@ class SongExportForm(OpenLPWizard):
|
|||||||
# Add the songs to the list of selected songs.
|
# Add the songs to the list of selected songs.
|
||||||
for item in items:
|
for item in items:
|
||||||
song = QtGui.QListWidgetItem(item.text())
|
song = QtGui.QListWidgetItem(item.text())
|
||||||
song.setData(QtCore.Qt.UserRole,
|
song.setData(QtCore.Qt.UserRole, item.data(QtCore.Qt.UserRole))
|
||||||
item.data(QtCore.Qt.UserRole).toPyObject())
|
|
||||||
song.setFlags(QtCore.Qt.ItemIsEnabled)
|
song.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||||
self.selectedListWidget.addItem(song)
|
self.selectedListWidget.addItem(song)
|
||||||
return True
|
return True
|
||||||
@ -282,7 +281,7 @@ class SongExportForm(OpenLPWizard):
|
|||||||
and calls the *do_export* method.
|
and calls the *do_export* method.
|
||||||
"""
|
"""
|
||||||
songs = [
|
songs = [
|
||||||
song.data(QtCore.Qt.UserRole).toPyObject()
|
song.data(QtCore.Qt.UserRole)
|
||||||
for song in self._findListWidgetItems(self.selectedListWidget)
|
for song in self._findListWidgetItems(self.selectedListWidget)
|
||||||
]
|
]
|
||||||
exporter = OpenLyricsExport(self, songs, self.directoryLineEdit.text())
|
exporter = OpenLyricsExport(self, songs, self.directoryLineEdit.text())
|
||||||
|
Loading…
Reference in New Issue
Block a user