Fix a problem introduced per ongeluk.

This commit is contained in:
Raoul Snyman 2010-03-15 21:23:07 +02:00
commit 223393e38b
5 changed files with 39 additions and 33 deletions

View File

@ -168,8 +168,7 @@ class MainDisplay(DisplayWidget):
self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
painter.begin(self.blankFrame)
#TODO make black when testing finished
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.red)
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
#build a blank transparent image
self.transparent = QtGui.QPixmap(self.screen[u'size'].width(),
self.screen[u'size'].height())

View File

@ -419,7 +419,7 @@ class Ui_MainWindow(object):
self.LanguageEnglishItem.setText(self.trUtf8('English'))
self.LanguageEnglishItem.setStatusTip(
self.trUtf8('Set the interface language to English'))
self.ToolsAddToolItem.setText(self.trUtf8('&Add Tool...'))
self.ToolsAddToolItem.setText(self.trUtf8('Add &Tool...'))
self.ToolsAddToolItem.setStatusTip(
self.trUtf8('Add an application to the list of tools'))
self.action_Preview_Panel.setText(self.trUtf8('&Preview Pane'))

View File

@ -477,7 +477,8 @@ class ServiceManager(QtGui.QWidget):
log.debug(u'onSaveService')
if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self,
u'Save Service', self.config.get_last_dir())
self.trUtf8(u'Save Service'), self.config.get_last_dir(),
self.trUtf8(u'OpenLP Service Files (*.osz)'))
else:
filename = self.config.get_last_dir()
if filename:
@ -741,12 +742,7 @@ class ServiceManager(QtGui.QWidget):
if item is None:
endpos = len(self.serviceItems)
else:
parentitem = item.parent()
if parentitem is None:
endpos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
endpos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
endpos -= 1
endpos = self._getParentItemData(item) - 1
if endpos < startpos:
newpos = endpos
else:
@ -759,11 +755,7 @@ class ServiceManager(QtGui.QWidget):
if item == None:
self.droppos = len(self.serviceItems)
else:
parentitem = item.parent()
if parentitem is None:
self.droppos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
self.droppos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
self.droppos = self._getParentItemData(item)
Receiver.send_message(u'%s_add_service_item' % plugin)
def updateThemeList(self, theme_list):
@ -798,3 +790,10 @@ class ServiceManager(QtGui.QWidget):
item, count = self.findServiceItem()
self.serviceItems[item][u'service_item'].theme = theme
self.regenerateServiceItems()
def _getParentItemData(self, item):
parentitem = item.parent()
if parentitem is None:
return item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]

View File

@ -64,17 +64,17 @@ class BibleDB(QtCore.QObject):
QtCore.QObject.__init__(self)
if u'path' not in kwargs:
raise KeyError(u'Missing keyword argument "path".')
if u'name' not in kwargs:
raise KeyError(u'Missing keyword argument "name".')
if u'config' not in kwargs:
raise KeyError(u'Missing keyword argument "config".')
if u'name' not in kwargs:
raise KeyError(u'Missing keyword argument "name".')
self.stop_import_flag = False
self.name = kwargs[u'name']
self.filename = self.clean_filename(kwargs[u'name'])
self.config = kwargs[u'config']
self.name = kwargs[u'name']
#self.filename = self.clean_filename(kwargs[u'name'])
self.db_file = os.path.join(kwargs[u'path'],
u'%s.sqlite' % self.filename)
log.debug(u'Load bible %s on path %s', self.filename, self.db_file)
u'%s.sqlite' % self.name)
log.debug(u'Load bible %s on path %s', self.name, self.db_file)
db_type = self.config.get_config(u'db type', u'sqlite')
db_url = u''
if db_type == u'sqlite':

View File

@ -65,6 +65,12 @@ class BibleMediaItem(MediaManagerItem):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
def _decodeQtObject(self, listobj, key):
obj = listobj[QtCore.QString(key)]
if isinstance(obj, QtCore.QVariant):
obj = obj.toPyObject()
return unicode(obj)
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Bible')
@ -452,15 +458,17 @@ class BibleMediaItem(MediaManagerItem):
# Let's loop through the main lot, and assemble our verses
for item in items:
bitem = self.ListView.item(item.row())
reference = bitem.data(QtCore.Qt.UserRole).toPyObject()
bible = unicode(reference[QtCore.QString('bible')].toPyObject())
book = unicode(reference[QtCore.QString('book')].toPyObject())
chapter = unicode(reference[QtCore.QString('chapter')].toPyObject())
verse = unicode(reference[QtCore.QString('verse')].toPyObject())
text = unicode(reference[QtCore.QString('text')].toPyObject())
version = unicode(reference[QtCore.QString('version')].toPyObject())
copyright = unicode(reference[QtCore.QString('copyright')].toPyObject())
permission = unicode(reference[QtCore.QString('permission')].toPyObject())
reference = bitem.data(QtCore.Qt.UserRole)
if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject()
bible = self._decodeQtObject(reference, 'bible')
book = self._decodeQtObject(reference, 'book')
chapter = self._decodeQtObject(reference, 'chapter')
verse = self._decodeQtObject(reference, 'verse')
text = self._decodeQtObject(reference, 'text')
version = self._decodeQtObject(reference, 'version')
copyright = self._decodeQtObject(reference, 'copyright')
permission = self._decodeQtObject(reference, 'permission')
if self.parent.settings_tab.display_style == 1:
verse_text = self.formatVerse(old_chapter, chapter, verse, u'(u', u')')
elif self.parent.settings_tab.display_style == 2: