forked from openlp/openlp
r1106
This commit is contained in:
commit
a205b5e292
@ -117,6 +117,7 @@ class Manager(object):
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(plugin_name)
|
||||
self.db_url = u''
|
||||
self.is_dirty = False
|
||||
db_type = unicode(
|
||||
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
|
||||
if db_type == u'sqlite':
|
||||
@ -150,6 +151,7 @@ class Manager(object):
|
||||
self.session.add(object_instance)
|
||||
if commit:
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
@ -220,6 +222,7 @@ class Manager(object):
|
||||
try:
|
||||
self.session.delete(object_instance)
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
@ -241,6 +244,7 @@ class Manager(object):
|
||||
query = query.filter(filter_clause)
|
||||
query.delete(synchronize_session=False)
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
@ -251,5 +255,6 @@ class Manager(object):
|
||||
"""
|
||||
VACUUM the database on exit.
|
||||
"""
|
||||
if self.is_dirty:
|
||||
engine = create_engine(self.db_url)
|
||||
engine.execute("vacuum")
|
||||
|
@ -408,6 +408,9 @@ class ThemeXML(object):
|
||||
elif field in integer_list:
|
||||
setattr(self, master + field, int(value))
|
||||
else:
|
||||
# None means an empty string so lets have one.
|
||||
if value == u'None':
|
||||
value = u''
|
||||
setattr(self, master + field, unicode(value))
|
||||
|
||||
def __str__(self):
|
||||
|
@ -73,6 +73,7 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setSizePolicy(sizePolicy)
|
||||
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
||||
MainWindow.setWindowIcon(MainIcon)
|
||||
self.setDockNestingEnabled(True)
|
||||
# Set up the main container, which contains all the other form widgets
|
||||
self.MainContent = QtGui.QWidget(MainWindow)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
||||
|
@ -434,8 +434,12 @@ class SlideController(QtGui.QWidget):
|
||||
request = unicode(self.sender().text())
|
||||
slideno = self.slideList[request]
|
||||
if slideno > self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
self.PreviewListWidget.selectRow(
|
||||
self.PreviewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.onSlideSelected()
|
||||
|
||||
@ -527,6 +531,9 @@ class SlideController(QtGui.QWidget):
|
||||
log.debug(u'addServiceManagerItem live = %s' % self.isLive)
|
||||
# If service item is the same as the current on only change slide
|
||||
if item.__eq__(self.serviceItem):
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.onSlideSelected()
|
||||
return
|
||||
@ -608,8 +615,12 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.setColumnWidth(0,
|
||||
self.PreviewListWidget.viewport().size().width())
|
||||
if slideno > self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
self.PreviewListWidget.selectRow(
|
||||
self.PreviewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.enableToolBar(serviceItem)
|
||||
# Pass to display for viewing
|
||||
@ -668,6 +679,9 @@ class SlideController(QtGui.QWidget):
|
||||
[self.serviceItem, self.isLive, index])
|
||||
self.updatePreview()
|
||||
else:
|
||||
if index + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(index + 1, 0))
|
||||
self.PreviewListWidget.selectRow(index)
|
||||
self.onSlideSelected()
|
||||
|
||||
@ -799,6 +813,9 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
The slide has been changed. Update the slidecontroller accordingly
|
||||
"""
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.updatePreview()
|
||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||
@ -844,6 +861,9 @@ class SlideController(QtGui.QWidget):
|
||||
else:
|
||||
Receiver.send_message('servicemanager_next_item')
|
||||
return
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.onSlideSelected()
|
||||
|
||||
@ -867,6 +887,9 @@ class SlideController(QtGui.QWidget):
|
||||
row = self.PreviewListWidget.rowCount() - 1
|
||||
else:
|
||||
row = 0
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.onSlideSelected()
|
||||
|
||||
|
@ -162,12 +162,10 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
sxml.add_verse_to_lyrics(u'custom', unicode(count),
|
||||
unicode(self.slideListView.item(i).text()))
|
||||
count += 1
|
||||
self.customSlide.title = unicode(self.titleEdit.displayText(), u'utf-8')
|
||||
self.customSlide.title = unicode(self.titleEdit.text())
|
||||
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
|
||||
self.customSlide.credits = unicode(self.creditEdit.displayText(),
|
||||
u'utf-8')
|
||||
self.customSlide.theme_name = unicode(self.themeComboBox.currentText(),
|
||||
u'utf-8')
|
||||
self.customSlide.credits = unicode(self.creditEdit.text())
|
||||
self.customSlide.theme_name = unicode(self.themeComboBox.currentText())
|
||||
return self.manager.save_object(self.customSlide)
|
||||
|
||||
def onUpButtonPressed(self):
|
||||
|
@ -56,7 +56,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.singleServiceItem = False
|
||||
self.serviceItemIconName = u':/media/media_video.png'
|
||||
self.serviceItemIconName = u':/media/image_clapperboard.png'
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||
|
Loading…
Reference in New Issue
Block a user