forked from openlp/openlp
r1665
This commit is contained in:
commit
96342548de
|
@ -32,6 +32,7 @@ to wait for the conversion to happen.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import Queue
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
|
@ -42,8 +43,8 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ImageThread(QtCore.QThread):
|
class ImageThread(QtCore.QThread):
|
||||||
"""
|
"""
|
||||||
A special Qt thread class to speed up the display of text based frames.
|
A special Qt thread class to speed up the display of images. This is
|
||||||
This is threaded so it loads the frames in background
|
threaded so it loads the frames and generates byte stream in background.
|
||||||
"""
|
"""
|
||||||
def __init__(self, manager):
|
def __init__(self, manager):
|
||||||
QtCore.QThread.__init__(self, None)
|
QtCore.QThread.__init__(self, None)
|
||||||
|
@ -53,15 +54,75 @@ class ImageThread(QtCore.QThread):
|
||||||
"""
|
"""
|
||||||
Run the thread.
|
Run the thread.
|
||||||
"""
|
"""
|
||||||
self.imageManager.process()
|
self.imageManager._process()
|
||||||
|
|
||||||
|
|
||||||
|
class Priority(object):
|
||||||
|
"""
|
||||||
|
Enumeration class for different priorities.
|
||||||
|
|
||||||
|
``Lowest``
|
||||||
|
Only the image's byte stream has to be generated. But neither the
|
||||||
|
``QImage`` nor the byte stream has been requested yet.
|
||||||
|
|
||||||
|
``Low``
|
||||||
|
Only the image's byte stream has to be generated. Because the image's
|
||||||
|
``QImage`` has been requested previously it is reasonable to assume that
|
||||||
|
the byte stream will be needed before the byte stream of other images
|
||||||
|
whose ``QImage`` were not generated due to a request.
|
||||||
|
|
||||||
|
``Normal``
|
||||||
|
The image's byte stream as well as the image has to be generated.
|
||||||
|
Neither the ``QImage`` nor the byte stream has been requested yet.
|
||||||
|
|
||||||
|
``High``
|
||||||
|
The image's byte stream as well as the image has to be generated. The
|
||||||
|
``QImage`` for this image has been requested.
|
||||||
|
**Note**, this priority is only set when the ``QImage`` has not been
|
||||||
|
generated yet.
|
||||||
|
|
||||||
|
``Urgent``
|
||||||
|
The image's byte stream as well as the image has to be generated. The
|
||||||
|
byte stream for this image has been requested.
|
||||||
|
**Note**, this priority is only set when the byte stream has not been
|
||||||
|
generated yet.
|
||||||
|
"""
|
||||||
|
Lowest = 4
|
||||||
|
Low = 3
|
||||||
|
Normal = 2
|
||||||
|
High = 1
|
||||||
|
Urgent = 0
|
||||||
|
|
||||||
|
|
||||||
class Image(object):
|
class Image(object):
|
||||||
name = ''
|
"""
|
||||||
path = ''
|
This class represents an image. To mark an image as *dirty* set the instance
|
||||||
dirty = True
|
variables ``image`` and ``image_bytes`` to ``None`` and add the image object
|
||||||
image = None
|
to the queue of images to process.
|
||||||
image_bytes = None
|
"""
|
||||||
|
def __init__(self, name='', path=''):
|
||||||
|
self.name = name
|
||||||
|
self.path = path
|
||||||
|
self.image = None
|
||||||
|
self.image_bytes = None
|
||||||
|
self.priority = Priority.Normal
|
||||||
|
|
||||||
|
|
||||||
|
class PriorityQueue(Queue.PriorityQueue):
|
||||||
|
"""
|
||||||
|
Customised ``Queue.PriorityQueue``.
|
||||||
|
"""
|
||||||
|
def remove(self, item):
|
||||||
|
"""
|
||||||
|
Removes the given ``item`` from the queue.
|
||||||
|
|
||||||
|
``item``
|
||||||
|
The item to remove. This should be a tuple::
|
||||||
|
|
||||||
|
``(Priority, Image)``
|
||||||
|
"""
|
||||||
|
if item in self.queue:
|
||||||
|
self.queue.remove(item)
|
||||||
|
|
||||||
|
|
||||||
class ImageManager(QtCore.QObject):
|
class ImageManager(QtCore.QObject):
|
||||||
|
@ -76,96 +137,120 @@ class ImageManager(QtCore.QObject):
|
||||||
self.width = current_screen[u'size'].width()
|
self.width = current_screen[u'size'].width()
|
||||||
self.height = current_screen[u'size'].height()
|
self.height = current_screen[u'size'].height()
|
||||||
self._cache = {}
|
self._cache = {}
|
||||||
self._thread_running = False
|
self._imageThread = ImageThread(self)
|
||||||
self._cache_dirty = False
|
self._conversion_queue = PriorityQueue()
|
||||||
self.image_thread = ImageThread(self)
|
|
||||||
|
|
||||||
def update_display(self):
|
def update_display(self):
|
||||||
"""
|
"""
|
||||||
Screen has changed size so rebuild the cache to new size
|
Screen has changed size so rebuild the cache to new size.
|
||||||
"""
|
"""
|
||||||
log.debug(u'update_display')
|
log.debug(u'update_display')
|
||||||
current_screen = ScreenList.get_instance().current
|
current_screen = ScreenList.get_instance().current
|
||||||
self.width = current_screen[u'size'].width()
|
self.width = current_screen[u'size'].width()
|
||||||
self.height = current_screen[u'size'].height()
|
self.height = current_screen[u'size'].height()
|
||||||
# mark the images as dirty for a rebuild
|
# Mark the images as dirty for a rebuild by setting the image and byte
|
||||||
for key in self._cache.keys():
|
# stream to None.
|
||||||
image = self._cache[key]
|
self._conversion_queue = PriorityQueue()
|
||||||
image.dirty = True
|
for key, image in self._cache.iteritems():
|
||||||
image.image = resize_image(image.path, self.width, self.height)
|
image.priority = Priority.Normal
|
||||||
self._cache_dirty = True
|
image.image = None
|
||||||
# only one thread please
|
image.image_bytes = None
|
||||||
if not self._thread_running:
|
self._conversion_queue.put((image.priority, image))
|
||||||
self.image_thread.start()
|
# We want only one thread.
|
||||||
|
if not self._imageThread.isRunning():
|
||||||
|
self._imageThread.start()
|
||||||
|
|
||||||
def get_image(self, name):
|
def get_image(self, name):
|
||||||
"""
|
"""
|
||||||
Return the Qimage from the cache
|
Return the ``QImage`` from the cache. If not present wait for the
|
||||||
|
background thread to process it.
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_image %s' % name)
|
log.debug(u'get_image %s' % name)
|
||||||
return self._cache[name].image
|
image = self._cache[name]
|
||||||
|
if image.image is None:
|
||||||
|
self._conversion_queue.remove((image.priority, image))
|
||||||
|
image.priority = Priority.High
|
||||||
|
self._conversion_queue.put((image.priority, image))
|
||||||
|
while image.image is None:
|
||||||
|
log.debug(u'get_image - waiting')
|
||||||
|
time.sleep(0.1)
|
||||||
|
return image.image
|
||||||
|
|
||||||
def get_image_bytes(self, name):
|
def get_image_bytes(self, name):
|
||||||
"""
|
"""
|
||||||
Returns the byte string for an image
|
Returns the byte string for an image. If not present wait for the
|
||||||
If not present wait for the background thread to process it.
|
background thread to process it.
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_image_bytes %s' % name)
|
log.debug(u'get_image_bytes %s' % name)
|
||||||
if not self._cache[name].image_bytes:
|
image = self._cache[name]
|
||||||
while self._cache[name].dirty:
|
if image.image_bytes is None:
|
||||||
|
self._conversion_queue.remove((image.priority, image))
|
||||||
|
image.priority = Priority.Urgent
|
||||||
|
self._conversion_queue.put((image.priority, image))
|
||||||
|
while image.image_bytes is None:
|
||||||
log.debug(u'get_image_bytes - waiting')
|
log.debug(u'get_image_bytes - waiting')
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
return self._cache[name].image_bytes
|
return image.image_bytes
|
||||||
|
|
||||||
def del_image(self, name):
|
def del_image(self, name):
|
||||||
"""
|
"""
|
||||||
Delete the Image from the Cache
|
Delete the Image from the cache.
|
||||||
"""
|
"""
|
||||||
log.debug(u'del_image %s' % name)
|
log.debug(u'del_image %s' % name)
|
||||||
if name in self._cache:
|
if name in self._cache:
|
||||||
|
self._conversion_queue.remove(
|
||||||
|
(self._cache[name].priority, self._cache[name]))
|
||||||
del self._cache[name]
|
del self._cache[name]
|
||||||
|
|
||||||
def add_image(self, name, path):
|
def add_image(self, name, path):
|
||||||
"""
|
"""
|
||||||
Add image to cache if it is not already there
|
Add image to cache if it is not already there.
|
||||||
"""
|
"""
|
||||||
log.debug(u'add_image %s:%s' % (name, path))
|
log.debug(u'add_image %s:%s' % (name, path))
|
||||||
if not name in self._cache:
|
if not name in self._cache:
|
||||||
image = Image()
|
image = Image(name, path)
|
||||||
image.name = name
|
|
||||||
image.path = path
|
|
||||||
image.image = resize_image(path, self.width, self.height)
|
|
||||||
self._cache[name] = image
|
self._cache[name] = image
|
||||||
|
self._conversion_queue.put((image.priority, image))
|
||||||
else:
|
else:
|
||||||
log.debug(u'Image in cache %s:%s' % (name, path))
|
log.debug(u'Image in cache %s:%s' % (name, path))
|
||||||
self._cache_dirty = True
|
# We want only one thread.
|
||||||
# only one thread please
|
if not self._imageThread.isRunning():
|
||||||
if not self._thread_running:
|
self._imageThread.start()
|
||||||
self.image_thread.start()
|
|
||||||
|
|
||||||
def process(self):
|
def _process(self):
|
||||||
"""
|
"""
|
||||||
Controls the processing called from a QThread
|
Controls the processing called from a ``QtCore.QThread``.
|
||||||
"""
|
"""
|
||||||
log.debug(u'process - started')
|
log.debug(u'_process - started')
|
||||||
self._thread_running = True
|
while not self._conversion_queue.empty():
|
||||||
self.clean_cache()
|
self._process_cache()
|
||||||
# data loaded since we started ?
|
log.debug(u'_process - ended')
|
||||||
while self._cache_dirty:
|
|
||||||
log.debug(u'process - recycle')
|
|
||||||
self.clean_cache()
|
|
||||||
self._thread_running = False
|
|
||||||
log.debug(u'process - ended')
|
|
||||||
|
|
||||||
def clean_cache(self):
|
def _process_cache(self):
|
||||||
"""
|
"""
|
||||||
Actually does the work.
|
Actually does the work.
|
||||||
"""
|
"""
|
||||||
log.debug(u'clean_cache')
|
log.debug(u'_process_cache')
|
||||||
# we will clean the cache now
|
image = self._conversion_queue.get()[1]
|
||||||
self._cache_dirty = False
|
# Generate the QImage for the image.
|
||||||
for key in self._cache.keys():
|
if image.image is None:
|
||||||
image = self._cache[key]
|
image.image = resize_image(image.path, self.width, self.height)
|
||||||
if image.dirty:
|
# Set the priority to Lowest and stop here as we need to process
|
||||||
image.image_bytes = image_to_byte(image.image)
|
# more important images first.
|
||||||
image.dirty = False
|
if image.priority == Priority.Normal:
|
||||||
|
self._conversion_queue.remove((image.priority, image))
|
||||||
|
image.priority = Priority.Lowest
|
||||||
|
self._conversion_queue.put((image.priority, image))
|
||||||
|
return
|
||||||
|
# For image with high priority we set the priority to Low, as the
|
||||||
|
# byte stream might be needed earlier the byte stream of image with
|
||||||
|
# Normal priority. We stop here as we need to process more important
|
||||||
|
# images first.
|
||||||
|
elif image.priority == Priority.High:
|
||||||
|
self._conversion_queue.remove((image.priority, image))
|
||||||
|
image.priority = Priority.Low
|
||||||
|
self._conversion_queue.put((image.priority, image))
|
||||||
|
return
|
||||||
|
# Generate the byte stream for the image.
|
||||||
|
if image.image_bytes is None:
|
||||||
|
image.image_bytes = image_to_byte(image.image)
|
||||||
|
|
|
@ -178,10 +178,6 @@ class HorizontalType(object):
|
||||||
Center = 2
|
Center = 2
|
||||||
|
|
||||||
Names = [u'left', u'right', u'center']
|
Names = [u'left', u'right', u'center']
|
||||||
TranslatedNames = [
|
|
||||||
translate('OpenLP.ThemeWizard', 'Left'),
|
|
||||||
translate('OpenLP.ThemeWizard', 'Right'),
|
|
||||||
translate('OpenLP.ThemeWizard', 'Center')]
|
|
||||||
|
|
||||||
|
|
||||||
class VerticalType(object):
|
class VerticalType(object):
|
||||||
|
@ -193,7 +189,6 @@ class VerticalType(object):
|
||||||
Bottom = 2
|
Bottom = 2
|
||||||
|
|
||||||
Names = [u'top', u'middle', u'bottom']
|
Names = [u'top', u'middle', u'bottom']
|
||||||
TranslatedNames = [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
|
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
|
||||||
|
|
|
@ -64,6 +64,7 @@ class UiStrings(object):
|
||||||
self.Cancel = translate('OpenLP.Ui', 'Cancel')
|
self.Cancel = translate('OpenLP.Ui', 'Cancel')
|
||||||
self.CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:')
|
self.CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:')
|
||||||
self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
|
self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
|
||||||
|
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
|
||||||
self.Continuous = translate('OpenLP.Ui', 'Continuous')
|
self.Continuous = translate('OpenLP.Ui', 'Continuous')
|
||||||
self.Default = unicode(translate('OpenLP.Ui', 'Default'))
|
self.Default = unicode(translate('OpenLP.Ui', 'Default'))
|
||||||
self.Delete = translate('OpenLP.Ui', '&Delete')
|
self.Delete = translate('OpenLP.Ui', '&Delete')
|
||||||
|
@ -323,8 +324,9 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
|
||||||
if checked is not None:
|
if checked is not None:
|
||||||
action.setCheckable(True)
|
action.setCheckable(True)
|
||||||
action.setChecked(checked)
|
action.setChecked(checked)
|
||||||
action.setShortcuts(shortcuts)
|
if shortcuts:
|
||||||
action.setShortcutContext(context)
|
action.setShortcuts(shortcuts)
|
||||||
|
action.setShortcutContext(context)
|
||||||
action_list = ActionList.get_instance()
|
action_list = ActionList.get_instance()
|
||||||
action_list.add_action(action, category)
|
action_list.add_action(action, category)
|
||||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function)
|
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function)
|
||||||
|
|
|
@ -35,13 +35,10 @@ class Ui_DisplayTagDialog(object):
|
||||||
def setupUi(self, displayTagDialog):
|
def setupUi(self, displayTagDialog):
|
||||||
displayTagDialog.setObjectName(u'displayTagDialog')
|
displayTagDialog.setObjectName(u'displayTagDialog')
|
||||||
displayTagDialog.resize(725, 548)
|
displayTagDialog.resize(725, 548)
|
||||||
self.widget = QtGui.QWidget(displayTagDialog)
|
self.listdataGridLayout = QtGui.QGridLayout(displayTagDialog)
|
||||||
self.widget.setGeometry(QtCore.QRect(10, 10, 701, 521))
|
self.listdataGridLayout.setMargin(8)
|
||||||
self.widget.setObjectName(u'widget')
|
|
||||||
self.listdataGridLayout = QtGui.QGridLayout(self.widget)
|
|
||||||
self.listdataGridLayout.setMargin(0)
|
|
||||||
self.listdataGridLayout.setObjectName(u'listdataGridLayout')
|
self.listdataGridLayout.setObjectName(u'listdataGridLayout')
|
||||||
self.tagTableWidget = QtGui.QTableWidget(self.widget)
|
self.tagTableWidget = QtGui.QTableWidget(displayTagDialog)
|
||||||
self.tagTableWidget.setHorizontalScrollBarPolicy(
|
self.tagTableWidget.setHorizontalScrollBarPolicy(
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.tagTableWidget.setEditTriggers(
|
self.tagTableWidget.setEditTriggers(
|
||||||
|
@ -55,6 +52,7 @@ class Ui_DisplayTagDialog(object):
|
||||||
self.tagTableWidget.setObjectName(u'tagTableWidget')
|
self.tagTableWidget.setObjectName(u'tagTableWidget')
|
||||||
self.tagTableWidget.setColumnCount(4)
|
self.tagTableWidget.setColumnCount(4)
|
||||||
self.tagTableWidget.setRowCount(0)
|
self.tagTableWidget.setRowCount(0)
|
||||||
|
self.tagTableWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
self.tagTableWidget.setHorizontalHeaderItem(0, item)
|
self.tagTableWidget.setHorizontalHeaderItem(0, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
|
@ -69,11 +67,11 @@ class Ui_DisplayTagDialog(object):
|
||||||
spacerItem = QtGui.QSpacerItem(40, 20,
|
spacerItem = QtGui.QSpacerItem(40, 20,
|
||||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||||
self.horizontalLayout.addItem(spacerItem)
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
self.deletePushButton = QtGui.QPushButton(self.widget)
|
self.deletePushButton = QtGui.QPushButton(displayTagDialog)
|
||||||
self.deletePushButton.setObjectName(u'deletePushButton')
|
self.deletePushButton.setObjectName(u'deletePushButton')
|
||||||
self.horizontalLayout.addWidget(self.deletePushButton)
|
self.horizontalLayout.addWidget(self.deletePushButton)
|
||||||
self.listdataGridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
|
self.listdataGridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
|
||||||
self.editGroupBox = QtGui.QGroupBox(self.widget)
|
self.editGroupBox = QtGui.QGroupBox(displayTagDialog)
|
||||||
self.editGroupBox.setObjectName(u'editGroupBox')
|
self.editGroupBox.setObjectName(u'editGroupBox')
|
||||||
self.dataGridLayout = QtGui.QGridLayout(self.editGroupBox)
|
self.dataGridLayout = QtGui.QGridLayout(self.editGroupBox)
|
||||||
self.dataGridLayout.setObjectName(u'dataGridLayout')
|
self.dataGridLayout.setObjectName(u'dataGridLayout')
|
||||||
|
@ -115,9 +113,8 @@ class Ui_DisplayTagDialog(object):
|
||||||
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
|
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
|
||||||
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
|
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
|
||||||
self.buttonBox = QtGui.QDialogButtonBox(displayTagDialog)
|
self.buttonBox = QtGui.QDialogButtonBox(displayTagDialog)
|
||||||
closeButton = QtGui.QDialogButtonBox.Close
|
|
||||||
self.buttonBox.setObjectName('displayTagDialogButtonBox')
|
self.buttonBox.setObjectName('displayTagDialogButtonBox')
|
||||||
self.buttonBox.setStandardButtons(closeButton)
|
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
|
||||||
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
|
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(displayTagDialog)
|
self.retranslateUi(displayTagDialog)
|
||||||
|
@ -148,6 +145,5 @@ class Ui_DisplayTagDialog(object):
|
||||||
self.tagTableWidget.horizontalHeaderItem(3).setText(
|
self.tagTableWidget.horizontalHeaderItem(3).setText(
|
||||||
translate('OpenLP.DisplayTagDialog', 'End HTML'))
|
translate('OpenLP.DisplayTagDialog', 'End HTML'))
|
||||||
self.tagTableWidget.setColumnWidth(0, 120)
|
self.tagTableWidget.setColumnWidth(0, 120)
|
||||||
self.tagTableWidget.setColumnWidth(1, 40)
|
self.tagTableWidget.setColumnWidth(1, 80)
|
||||||
self.tagTableWidget.setColumnWidth(2, 240)
|
self.tagTableWidget.setColumnWidth(2, 330)
|
||||||
self.tagTableWidget.setColumnWidth(3, 240)
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog):
|
||||||
# Highlight new row
|
# Highlight new row
|
||||||
self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
|
self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
|
||||||
self.onRowSelected()
|
self.onRowSelected()
|
||||||
|
self.tagTableWidget.scrollToBottom()
|
||||||
|
|
||||||
def onDeletePushed(self):
|
def onDeletePushed(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -93,6 +93,8 @@ class Ui_MainWindow(object):
|
||||||
self.previewController.panel.setVisible(previewVisible)
|
self.previewController.panel.setVisible(previewVisible)
|
||||||
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
||||||
QtCore.QVariant(True)).toBool()
|
QtCore.QVariant(True)).toBool()
|
||||||
|
panelLocked = QtCore.QSettings().value(u'user interface/lock panel',
|
||||||
|
QtCore.QVariant(False)).toBool()
|
||||||
self.liveController.panel.setVisible(liveVisible)
|
self.liveController.panel.setVisible(liveVisible)
|
||||||
# Create menu
|
# Create menu
|
||||||
self.menuBar = QtGui.QMenuBar(mainWindow)
|
self.menuBar = QtGui.QMenuBar(mainWindow)
|
||||||
|
@ -213,11 +215,15 @@ class Ui_MainWindow(object):
|
||||||
self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
|
self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
|
||||||
[QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
|
[QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
|
||||||
checked=liveVisible, category=UiStrings().View)
|
checked=liveVisible, category=UiStrings().View)
|
||||||
action_list.add_category(UiStrings().ViewMode, CategoryOrder.standardMenu)
|
self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
|
||||||
|
None, self.setLockPanel,
|
||||||
|
checked=panelLocked, category=None)
|
||||||
|
action_list.add_category(UiStrings().ViewMode,
|
||||||
|
CategoryOrder.standardMenu)
|
||||||
self.modeDefaultItem = checkable_action(
|
self.modeDefaultItem = checkable_action(
|
||||||
mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
|
mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
|
||||||
self.modeSetupItem = checkable_action(
|
self.modeSetupItem = checkable_action(
|
||||||
mainWindow, u'modeLiveItem', category=UiStrings().ViewMode)
|
mainWindow, u'modeSetupItem', category=UiStrings().ViewMode)
|
||||||
self.modeLiveItem = checkable_action(
|
self.modeLiveItem = checkable_action(
|
||||||
mainWindow, u'modeLiveItem', True, UiStrings().ViewMode)
|
mainWindow, u'modeLiveItem', True, UiStrings().ViewMode)
|
||||||
self.modeGroup = QtGui.QActionGroup(mainWindow)
|
self.modeGroup = QtGui.QActionGroup(mainWindow)
|
||||||
|
@ -233,7 +239,8 @@ class Ui_MainWindow(object):
|
||||||
category=UiStrings().Tools)
|
category=UiStrings().Tools)
|
||||||
self.updateThemeImages = base_action(mainWindow,
|
self.updateThemeImages = base_action(mainWindow,
|
||||||
u'updateThemeImages', category=UiStrings().Tools)
|
u'updateThemeImages', category=UiStrings().Tools)
|
||||||
action_list.add_category(UiStrings().Settings, CategoryOrder.standardMenu)
|
action_list.add_category(UiStrings().Settings,
|
||||||
|
CategoryOrder.standardMenu)
|
||||||
self.settingsPluginListItem = shortcut_action(mainWindow,
|
self.settingsPluginListItem = shortcut_action(mainWindow,
|
||||||
u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
|
u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
|
||||||
self.onPluginItemClicked, u':/system/settings_plugin_list.png',
|
self.onPluginItemClicked, u':/system/settings_plugin_list.png',
|
||||||
|
@ -288,7 +295,7 @@ class Ui_MainWindow(object):
|
||||||
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
|
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
|
||||||
None, self.viewMediaManagerItem, self.viewServiceManagerItem,
|
None, self.viewMediaManagerItem, self.viewServiceManagerItem,
|
||||||
self.viewThemeManagerItem, None, self.viewPreviewPanel,
|
self.viewThemeManagerItem, None, self.viewPreviewPanel,
|
||||||
self.viewLivePanel))
|
self.viewLivePanel, None, self.lockPanel))
|
||||||
# i18n add Language Actions
|
# i18n add Language Actions
|
||||||
add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None))
|
add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None))
|
||||||
add_actions(self.settingsLanguageMenu, self.languageGroup.actions())
|
add_actions(self.settingsLanguageMenu, self.languageGroup.actions())
|
||||||
|
@ -325,6 +332,7 @@ class Ui_MainWindow(object):
|
||||||
self.importLanguageItem.setVisible(False)
|
self.importLanguageItem.setVisible(False)
|
||||||
self.exportLanguageItem.setVisible(False)
|
self.exportLanguageItem.setVisible(False)
|
||||||
self.helpDocumentationItem.setVisible(False)
|
self.helpDocumentationItem.setVisible(False)
|
||||||
|
self.setLockPanel(panelLocked)
|
||||||
|
|
||||||
def retranslateUi(self, mainWindow):
|
def retranslateUi(self, mainWindow):
|
||||||
"""
|
"""
|
||||||
|
@ -414,6 +422,10 @@ class Ui_MainWindow(object):
|
||||||
translate('OpenLP.MainWindow', '&Live Panel'))
|
translate('OpenLP.MainWindow', '&Live Panel'))
|
||||||
self.viewLivePanel.setToolTip(
|
self.viewLivePanel.setToolTip(
|
||||||
translate('OpenLP.MainWindow', 'Toggle Live Panel'))
|
translate('OpenLP.MainWindow', 'Toggle Live Panel'))
|
||||||
|
self.lockPanel.setText(
|
||||||
|
translate('OpenLP.MainWindow', 'L&ock Panels'))
|
||||||
|
self.lockPanel.setStatusTip(
|
||||||
|
translate('OpenLP.MainWindow', 'Prevent the panels being moved.'))
|
||||||
self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
|
self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
|
||||||
'Toggle the visibility of the live panel.'))
|
'Toggle the visibility of the live panel.'))
|
||||||
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
|
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
|
||||||
|
@ -653,7 +665,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
QtCore.QVariant(False)).toBool():
|
QtCore.QVariant(False)).toBool():
|
||||||
self.serviceManagerContents.loadLastFile()
|
self.serviceManagerContents.loadLastFile()
|
||||||
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
|
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
|
||||||
self.generalSettingsSection, u'default')
|
self.generalSettingsSection, u'default').toString()
|
||||||
if view_mode == u'default':
|
if view_mode == u'default':
|
||||||
self.modeDefaultItem.setChecked(True)
|
self.modeDefaultItem.setChecked(True)
|
||||||
elif view_mode == u'setup':
|
elif view_mode == u'setup':
|
||||||
|
@ -936,7 +948,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
|
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
|
||||||
|
|
||||||
def toggleServiceManager(self):
|
def toggleServiceManager(self):
|
||||||
self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible())
|
self.serviceManagerDock.setVisible(
|
||||||
|
not self.serviceManagerDock.isVisible())
|
||||||
|
|
||||||
def toggleThemeManager(self):
|
def toggleThemeManager(self):
|
||||||
self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
|
self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
|
||||||
|
@ -956,6 +969,37 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
QtCore.QVariant(visible))
|
QtCore.QVariant(visible))
|
||||||
self.viewPreviewPanel.setChecked(visible)
|
self.viewPreviewPanel.setChecked(visible)
|
||||||
|
|
||||||
|
def setLockPanel(self, lock):
|
||||||
|
"""
|
||||||
|
Sets the ability to stop the toolbars being changed.
|
||||||
|
"""
|
||||||
|
if lock:
|
||||||
|
self.themeManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.NoDockWidgetFeatures)
|
||||||
|
self.serviceManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.NoDockWidgetFeatures)
|
||||||
|
self.mediaManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.NoDockWidgetFeatures)
|
||||||
|
self.viewMediaManagerItem.setEnabled(False)
|
||||||
|
self.viewServiceManagerItem.setEnabled(False)
|
||||||
|
self.viewThemeManagerItem.setEnabled(False)
|
||||||
|
self.viewPreviewPanel.setEnabled(False)
|
||||||
|
self.viewLivePanel.setEnabled(False)
|
||||||
|
else:
|
||||||
|
self.themeManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.AllDockWidgetFeatures)
|
||||||
|
self.serviceManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.AllDockWidgetFeatures)
|
||||||
|
self.mediaManagerDock.setFeatures(
|
||||||
|
QtGui.QDockWidget.AllDockWidgetFeatures)
|
||||||
|
self.viewMediaManagerItem.setEnabled(True)
|
||||||
|
self.viewServiceManagerItem.setEnabled(True)
|
||||||
|
self.viewThemeManagerItem.setEnabled(True)
|
||||||
|
self.viewPreviewPanel.setEnabled(True)
|
||||||
|
self.viewLivePanel.setEnabled(True)
|
||||||
|
QtCore.QSettings().setValue(u'user interface/lock panel',
|
||||||
|
QtCore.QVariant(lock))
|
||||||
|
|
||||||
def setLivePanelVisibility(self, visible):
|
def setLivePanelVisibility(self, visible):
|
||||||
"""
|
"""
|
||||||
Sets the visibility of the live panel including saving the setting and
|
Sets the visibility of the live panel including saving the setting and
|
||||||
|
|
|
@ -41,11 +41,6 @@ class ZoomSize(object):
|
||||||
Fifty = 4
|
Fifty = 4
|
||||||
TwentyFive = 5
|
TwentyFive = 5
|
||||||
|
|
||||||
Sizes = [
|
|
||||||
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
|
|
||||||
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
|
|
||||||
u'100%', u'75%', u'50%', u'25%']
|
|
||||||
|
|
||||||
|
|
||||||
class Ui_PrintServiceDialog(object):
|
class Ui_PrintServiceDialog(object):
|
||||||
def setupUi(self, printServiceDialog):
|
def setupUi(self, printServiceDialog):
|
||||||
|
@ -59,18 +54,14 @@ class Ui_PrintServiceDialog(object):
|
||||||
self.toolbar.setIconSize(QtCore.QSize(22, 22))
|
self.toolbar.setIconSize(QtCore.QSize(22, 22))
|
||||||
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
self.printButton = self.toolbar.addAction(
|
self.printButton = self.toolbar.addAction(
|
||||||
build_icon(u':/general/general_print.png'), 'Print')
|
build_icon(u':/general/general_print.png'),
|
||||||
|
translate('OpenLP.PrintServiceForm', 'Print'))
|
||||||
self.optionsButton = QtGui.QToolButton(self.toolbar)
|
self.optionsButton = QtGui.QToolButton(self.toolbar)
|
||||||
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
|
|
||||||
'Options'))
|
|
||||||
self.optionsButton.setToolButtonStyle(
|
self.optionsButton.setToolButtonStyle(
|
||||||
QtCore.Qt.ToolButtonTextBesideIcon)
|
QtCore.Qt.ToolButtonTextBesideIcon)
|
||||||
self.optionsButton.setIcon(build_icon(u':/system/system_configure.png'))
|
self.optionsButton.setIcon(build_icon(u':/system/system_configure.png'))
|
||||||
self.optionsButton.setCheckable(True)
|
self.optionsButton.setCheckable(True)
|
||||||
self.toolbar.addWidget(self.optionsButton)
|
self.toolbar.addWidget(self.optionsButton)
|
||||||
self.closeButton = self.toolbar.addAction(
|
|
||||||
build_icon(u':/system/system_close.png'),
|
|
||||||
translate('OpenLP.PrintServiceForm', 'Close'))
|
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.plainCopy = self.toolbar.addAction(
|
self.plainCopy = self.toolbar.addAction(
|
||||||
build_icon(u':/system/system_edit_copy.png'),
|
build_icon(u':/system/system_edit_copy.png'),
|
||||||
|
@ -81,24 +72,18 @@ class Ui_PrintServiceDialog(object):
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.zoomInButton = QtGui.QToolButton(self.toolbar)
|
self.zoomInButton = QtGui.QToolButton(self.toolbar)
|
||||||
self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
|
self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
|
||||||
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
|
||||||
'Zoom In'))
|
|
||||||
self.zoomInButton.setObjectName(u'zoomInButton')
|
self.zoomInButton.setObjectName(u'zoomInButton')
|
||||||
self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
|
self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
|
||||||
self.toolbar.addWidget(self.zoomInButton)
|
self.toolbar.addWidget(self.zoomInButton)
|
||||||
self.zoomOutButton = QtGui.QToolButton(self.toolbar)
|
self.zoomOutButton = QtGui.QToolButton(self.toolbar)
|
||||||
self.zoomOutButton.setIcon(
|
self.zoomOutButton.setIcon(
|
||||||
build_icon(u':/general/general_zoom_out.png'))
|
build_icon(u':/general/general_zoom_out.png'))
|
||||||
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
|
||||||
'Zoom Out'))
|
|
||||||
self.zoomOutButton.setObjectName(u'zoomOutButton')
|
self.zoomOutButton.setObjectName(u'zoomOutButton')
|
||||||
self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
|
self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
|
||||||
self.toolbar.addWidget(self.zoomOutButton)
|
self.toolbar.addWidget(self.zoomOutButton)
|
||||||
self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
|
self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
|
||||||
self.zoomOriginalButton.setIcon(
|
self.zoomOriginalButton.setIcon(
|
||||||
build_icon(u':/general/general_zoom_original.png'))
|
build_icon(u':/general/general_zoom_original.png'))
|
||||||
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
|
||||||
'Zoom Original'))
|
|
||||||
self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
|
self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
|
||||||
self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
|
self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
|
||||||
self.toolbar.addWidget(self.zoomOriginalButton)
|
self.toolbar.addWidget(self.zoomOriginalButton)
|
||||||
|
@ -116,20 +101,17 @@ class Ui_PrintServiceDialog(object):
|
||||||
self.optionsLayout.setContentsMargins(8, 8, 8, 8)
|
self.optionsLayout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.titleLabel = QtGui.QLabel(self.optionsWidget)
|
self.titleLabel = QtGui.QLabel(self.optionsWidget)
|
||||||
self.titleLabel.setObjectName(u'titleLabel')
|
self.titleLabel.setObjectName(u'titleLabel')
|
||||||
self.titleLabel.setText(u'Title:')
|
|
||||||
self.optionsLayout.addWidget(self.titleLabel)
|
self.optionsLayout.addWidget(self.titleLabel)
|
||||||
self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget)
|
self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget)
|
||||||
self.titleLineEdit.setObjectName(u'titleLineEdit')
|
self.titleLineEdit.setObjectName(u'titleLineEdit')
|
||||||
self.optionsLayout.addWidget(self.titleLineEdit)
|
self.optionsLayout.addWidget(self.titleLineEdit)
|
||||||
self.footerLabel = QtGui.QLabel(self.optionsWidget)
|
self.footerLabel = QtGui.QLabel(self.optionsWidget)
|
||||||
self.footerLabel.setObjectName(u'footerLabel')
|
self.footerLabel.setObjectName(u'footerLabel')
|
||||||
self.footerLabel.setText(u'Custom Footer Text:')
|
|
||||||
self.optionsLayout.addWidget(self.footerLabel)
|
self.optionsLayout.addWidget(self.footerLabel)
|
||||||
self.footerTextEdit = SpellTextEdit(self.optionsWidget)
|
self.footerTextEdit = SpellTextEdit(self.optionsWidget)
|
||||||
self.footerTextEdit.setObjectName(u'footerTextEdit')
|
self.footerTextEdit.setObjectName(u'footerTextEdit')
|
||||||
self.optionsLayout.addWidget(self.footerTextEdit)
|
self.optionsLayout.addWidget(self.footerTextEdit)
|
||||||
self.optionsGroupBox = QtGui.QGroupBox(
|
self.optionsGroupBox = QtGui.QGroupBox()
|
||||||
translate('OpenLP.PrintServiceForm','Other Options'))
|
|
||||||
self.groupLayout = QtGui.QVBoxLayout()
|
self.groupLayout = QtGui.QVBoxLayout()
|
||||||
self.slideTextCheckBox = QtGui.QCheckBox()
|
self.slideTextCheckBox = QtGui.QCheckBox()
|
||||||
self.groupLayout.addWidget(self.slideTextCheckBox)
|
self.groupLayout.addWidget(self.slideTextCheckBox)
|
||||||
|
@ -150,6 +132,19 @@ class Ui_PrintServiceDialog(object):
|
||||||
|
|
||||||
def retranslateUi(self, printServiceDialog):
|
def retranslateUi(self, printServiceDialog):
|
||||||
printServiceDialog.setWindowTitle(UiStrings().PrintService)
|
printServiceDialog.setWindowTitle(UiStrings().PrintService)
|
||||||
|
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||||
|
'Zoom Out'))
|
||||||
|
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||||
|
'Zoom Original'))
|
||||||
|
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||||
|
'Zoom In'))
|
||||||
|
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
|
||||||
|
'Options'))
|
||||||
|
self.titleLabel.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
|
||||||
|
self.footerLabel.setText(translate('OpenLP.PrintServiceForm',
|
||||||
|
'Custom Footer Text:'))
|
||||||
|
self.optionsGroupBox.setTitle(
|
||||||
|
translate('OpenLP.PrintServiceForm','Other Options'))
|
||||||
self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm',
|
self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm',
|
||||||
'Include slide text if available'))
|
'Include slide text if available'))
|
||||||
self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm',
|
self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm',
|
||||||
|
@ -160,10 +155,13 @@ class Ui_PrintServiceDialog(object):
|
||||||
'Include play length of media items'))
|
'Include play length of media items'))
|
||||||
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm',
|
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm',
|
||||||
'Service Sheet'))
|
'Service Sheet'))
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page])
|
# Do not change the order.
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width])
|
self.zoomComboBox.addItems([
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred])
|
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive])
|
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty])
|
u'100%',
|
||||||
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive])
|
u'75%',
|
||||||
|
u'50%',
|
||||||
|
u'25%']
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,6 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||||
# Signals
|
# Signals
|
||||||
QtCore.QObject.connect(self.printButton,
|
QtCore.QObject.connect(self.printButton,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
|
QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
|
||||||
QtCore.QObject.connect(self.closeButton,
|
|
||||||
QtCore.SIGNAL(u'triggered()'), self.accept)
|
|
||||||
QtCore.QObject.connect(self.zoomOutButton,
|
QtCore.QObject.connect(self.zoomOutButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
|
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
|
||||||
QtCore.QObject.connect(self.zoomInButton,
|
QtCore.QObject.connect(self.zoomInButton,
|
||||||
|
@ -326,8 +324,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||||
"""
|
"""
|
||||||
Copies the display text to the clipboard as plain text
|
Copies the display text to the clipboard as plain text
|
||||||
"""
|
"""
|
||||||
self.mainWindow.clipboard.setText(
|
self.mainWindow.clipboard.setText(self.document.toPlainText())
|
||||||
self.document.toPlainText())
|
|
||||||
|
|
||||||
def copyHtmlText(self):
|
def copyHtmlText(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -298,7 +298,10 @@ 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()
|
||||||
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
oldThemeName = unicode(
|
||||||
|
translate('OpenLP.ThemeManager', 'Copy of %s',
|
||||||
|
'Copy of <theme name>')) % unicode(
|
||||||
|
item.data(QtCore.Qt.UserRole).toString())
|
||||||
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
||||||
if self.fileRenameForm.exec_(True):
|
if self.fileRenameForm.exec_(True):
|
||||||
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
|
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
|
||||||
|
|
|
@ -200,6 +200,17 @@ class CustomMediaItem(MediaManagerItem):
|
||||||
Remove a custom item from the list and database
|
Remove a custom item from the list and database
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView, UiStrings().SelectDelete):
|
if check_item_selected(self.listView, UiStrings().SelectDelete):
|
||||||
|
items = self.listView.selectedIndexes()
|
||||||
|
if QtGui.QMessageBox.question(self,
|
||||||
|
UiStrings().ConfirmDelete,
|
||||||
|
translate('CustomPlugin.MediaItem',
|
||||||
|
'Are you sure you want to delete the %n selected custom'
|
||||||
|
' slides(s)?', '',
|
||||||
|
QtCore.QCoreApplication.CodecForTr, len(items)),
|
||||||
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
|
QtGui.QMessageBox.No),
|
||||||
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||||
|
return
|
||||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
|
|
@ -353,13 +353,13 @@ class SongMediaItem(MediaManagerItem):
|
||||||
if check_item_selected(self.listView, UiStrings().SelectDelete):
|
if check_item_selected(self.listView, UiStrings().SelectDelete):
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
if QtGui.QMessageBox.question(self,
|
if QtGui.QMessageBox.question(self,
|
||||||
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
|
UiStrings().ConfirmDelete,
|
||||||
translate('SongsPlugin.MediaItem',
|
translate('SongsPlugin.MediaItem',
|
||||||
'Are you sure you want to delete the %n selected song(s)?', '',
|
'Are you sure you want to delete the %n selected song(s)?', '',
|
||||||
QtCore.QCoreApplication.CodecForTr, len(items)),
|
QtCore.QCoreApplication.CodecForTr, len(items)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.Cancel),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
for item in items:
|
for item in items:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
|
Loading…
Reference in New Issue