From 4213dad51c25746fd5b04d4bd5f171d484a970c0 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 7 Jun 2011 21:37:07 -0400 Subject: [PATCH 01/21] Confirm delete of Custom item --- openlp/plugins/custom/lib/customtab.py | 33 +++++++++++++++++++++++--- openlp/plugins/custom/lib/mediaitem.py | 14 +++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index fb83fab81..7aabe7dda 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -47,17 +47,32 @@ class CustomTab(SettingsTab): self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') self.customModeLayout.addRow(self.displayFooterCheckBox) self.leftLayout.addWidget(self.customModeGroupBox) - self.leftLayout.addStretch() - self.rightLayout.addStretch() QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayFooterCheckBoxChanged) - + self.customUIGroupBox = QtGui.QGroupBox(self.leftColumn) + self.customUIGroupBox.setObjectName(u'customUIGroupBox') + self.customUILayout = QtGui.QFormLayout(self.customUIGroupBox) + self.customUILayout.setObjectName(u'customUILayout') + self.confirmDeleteCheckBox = QtGui.QCheckBox(self.customUIGroupBox) + self.confirmDeleteCheckBox.setObjectName(u'confirmDeleteCheckBox') + self.customUILayout.addRow(self.confirmDeleteCheckBox) + self.leftLayout.addWidget(self.customUIGroupBox) + QtCore.QObject.connect(self.confirmDeleteCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onConfirmDeleteCheckBoxChanged) + self.leftLayout.addStretch() + self.rightLayout.addStretch() + def retranslateUi(self): self.customModeGroupBox.setTitle(translate('CustomPlugin.CustomTab', 'Custom Display')) self.displayFooterCheckBox.setText( translate('CustomPlugin.CustomTab', 'Display footer')) + self.customUIGroupBox.setTitle(translate('CustomPlugin.CustomTab', + 'UI Settings')) + self.confirmDeleteCheckBox.setText( + translate('CustomPlugin.CustomTab', 'Confirm delete')) def onDisplayFooterCheckBoxChanged(self, check_state): self.displayFooter = False @@ -65,12 +80,24 @@ class CustomTab(SettingsTab): if check_state == QtCore.Qt.Checked: self.displayFooter = True + def onConfirmDeleteCheckBoxChanged(self, check_state): + self.confirmDelete = False + # we have a set value convert to True/False + if check_state == QtCore.Qt.Checked: + self.confirmDelete = True + def load(self): self.displayFooter = QtCore.QSettings().value( self.settingsSection + u'/display footer', QtCore.QVariant(True)).toBool() self.displayFooterCheckBox.setChecked(self.displayFooter) + self.confirmDelete = QtCore.QSettings().value( + self.settingsSection + u'/confirm delete', + QtCore.QVariant(True)).toBool() + self.confirmDeleteCheckBox.setChecked(self.confirmDelete) def save(self): QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QVariant(self.displayFooter)) + QtCore.QSettings().setValue(self.settingsSection + u'/confirm delete', + QtCore.QVariant(self.confirmDelete)) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 94ee6d94e..fec660360 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -200,6 +200,20 @@ class CustomMediaItem(MediaManagerItem): Remove a custom item from the list and database """ if check_item_selected(self.listView, UiStrings().SelectDelete): + self.confirmDelete = QtCore.QSettings().value( + self.settingsSection + u'/confirm delete', + QtCore.QVariant(u'False')).toBool() + items = self.listView.selectedIndexes() + if self.confirmDelete: + if QtGui.QMessageBox.question(self, + translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'), + translate('CustomPlugin.MediaItem', + 'Are you sure you want to delete the %n selected custom(s)?', '', + QtCore.QCoreApplication.CodecForTr, len(items)), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | + QtGui.QMessageBox.Cancel), + QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel: + return row_list = [item.row() for item in self.listView.selectedIndexes()] row_list.sort(reverse=True) id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0] From 30b56d6fee78b2d205033f779249d4d6377a424b Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 11 Jun 2011 08:48:11 -0400 Subject: [PATCH 02/21] Moved signals to end of SetupUI --- openlp/plugins/custom/lib/customtab.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 7aabe7dda..12acabd0b 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -47,9 +47,6 @@ class CustomTab(SettingsTab): self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') self.customModeLayout.addRow(self.displayFooterCheckBox) self.leftLayout.addWidget(self.customModeGroupBox) - QtCore.QObject.connect(self.displayFooterCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onDisplayFooterCheckBoxChanged) self.customUIGroupBox = QtGui.QGroupBox(self.leftColumn) self.customUIGroupBox.setObjectName(u'customUIGroupBox') self.customUILayout = QtGui.QFormLayout(self.customUIGroupBox) @@ -58,12 +55,15 @@ class CustomTab(SettingsTab): self.confirmDeleteCheckBox.setObjectName(u'confirmDeleteCheckBox') self.customUILayout.addRow(self.confirmDeleteCheckBox) self.leftLayout.addWidget(self.customUIGroupBox) + self.leftLayout.addStretch() + self.rightLayout.addStretch() + QtCore.QObject.connect(self.displayFooterCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onDisplayFooterCheckBoxChanged) QtCore.QObject.connect(self.confirmDeleteCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onConfirmDeleteCheckBoxChanged) - self.leftLayout.addStretch() - self.rightLayout.addStretch() - + def retranslateUi(self): self.customModeGroupBox.setTitle(translate('CustomPlugin.CustomTab', 'Custom Display')) From 1550239f5e37d75cbfbe0226a9292bd067af72dd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 12 Jun 2011 15:19:32 +0100 Subject: [PATCH 03/21] Add Lock Toolbar feature - Beta 3 --- openlp/core/lib/ui.py | 5 ++-- openlp/core/ui/mainwindow.py | 54 ++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c784a7b2b..69a4e51d1 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -323,8 +323,9 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None, if checked is not None: action.setCheckable(True) action.setChecked(checked) - action.setShortcuts(shortcuts) - action.setShortcutContext(context) + if shortcuts: + action.setShortcuts(shortcuts) + action.setShortcutContext(context) action_list = ActionList.get_instance() action_list.add_action(action, category) QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0dd4872fe..b7d63ae58 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -92,6 +92,8 @@ class Ui_MainWindow(object): self.previewController.panel.setVisible(previewVisible) liveVisible = QtCore.QSettings().value(u'user interface/live panel', QtCore.QVariant(True)).toBool() + panelLocked = QtCore.QSettings().value(u'user interface/lock panel', + QtCore.QVariant(False)).toBool() self.liveController.panel.setVisible(liveVisible) # Create menu self.menuBar = QtGui.QMenuBar(mainWindow) @@ -212,7 +214,11 @@ class Ui_MainWindow(object): self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel', [QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility, 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( mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode) self.modeSetupItem = checkable_action( @@ -232,7 +238,8 @@ class Ui_MainWindow(object): category=UiStrings().Tools) self.updateThemeImages = base_action(mainWindow, 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, u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')], self.onPluginItemClicked, u':/system/settings_plugin_list.png', @@ -287,7 +294,7 @@ class Ui_MainWindow(object): add_actions(self.viewMenu, (self.viewModeMenu.menuAction(), None, self.viewMediaManagerItem, self.viewServiceManagerItem, self.viewThemeManagerItem, None, self.viewPreviewPanel, - self.viewLivePanel)) + self.viewLivePanel, None, self.lockPanel)) # i18n add Language Actions add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None)) add_actions(self.settingsLanguageMenu, self.languageGroup.actions()) @@ -316,6 +323,7 @@ class Ui_MainWindow(object): self.importLanguageItem.setVisible(False) self.exportLanguageItem.setVisible(False) self.helpDocumentationItem.setVisible(False) + self.setLockPanel(panelLocked) def retranslateUi(self, mainWindow): """ @@ -405,6 +413,10 @@ class Ui_MainWindow(object): translate('OpenLP.MainWindow', '&Live Panel')) self.viewLivePanel.setToolTip( translate('OpenLP.MainWindow', 'Toggle Live Panel')) + self.lockPanel.setText( + translate('OpenLP.MainWindow', 'L&ock Panels')) + self.lockPanel.setToolTip( + translate('OpenLP.MainWindow', 'Prevent Panels changing')) self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow', 'Toggle the visibility of the live panel.')) self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', @@ -644,7 +656,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QVariant(False)).toBool(): self.serviceManagerContents.loadLastFile() view_mode = QtCore.QSettings().value(u'%s/view mode' % \ - self.generalSettingsSection, u'default') + self.generalSettingsSection, u'default').toString() if view_mode == u'default': self.modeDefaultItem.setChecked(True) elif view_mode == u'setup': @@ -927,7 +939,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible()) def toggleServiceManager(self): - self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible()) + self.serviceManagerDock.setVisible( + not self.serviceManagerDock.isVisible()) def toggleThemeManager(self): self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible()) @@ -947,6 +960,37 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QVariant(visible)) self.viewPreviewPanel.setChecked(visible) + def setLockPanel(self, lock): + """ + Sets the ability to stiop 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): """ Sets the visibility of the live panel including saving the setting and From 356ea8fff80cb2f9836a717b1c6712575b413cd9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 06:42:49 +0200 Subject: [PATCH 04/21] - added an 'intelligent' image queue with priorities - resize image in the thread - change instances variables (based on qt) --- openlp/core/lib/imagemanager.py | 170 +++++++++++++++++++++----------- 1 file changed, 114 insertions(+), 56 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index d89cefccc..bab9748d0 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -32,6 +32,7 @@ to wait for the conversion to happen. """ import logging import time +import Queue from PyQt4 import QtCore @@ -53,15 +54,59 @@ class ImageThread(QtCore.QThread): """ Run the thread. """ - self.imageManager.process() + self.imageManager._process() + + +class Priority(object): + """ + Enumeration class for different priorities. + + ``Low`` + Only the image's byte stream has to be generated. Neither the QImage nor + the byte stream has been requested yet. + + ``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. + + ``Urgent`` + The image's byte stream as well as the image has to be generated. The + byte stream for this image has been requested. + """ + Low = 3 + Normal = 2 + High = 1 + Urgent = 0 class Image(object): - name = '' - path = '' - dirty = True - image = None - 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): @@ -76,50 +121,64 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._thread_running = False - self._cache_dirty = False - self.image_thread = ImageThread(self) + self._imageThread = ImageThread(self) + self._clean_queue = PriorityQueue() 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') current_screen = ScreenList.get_instance().current self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() - # mark the images as dirty for a rebuild - for key in self._cache.keys(): - image = self._cache[key] - image.dirty = True - image.image = resize_image(image.path, self.width, self.height) - self._cache_dirty = True - # only one thread please - if not self._thread_running: - self.image_thread.start() + # Mark the images as dirty for a rebuild by setting the image and byte + # stream to None. + self._clean_queue = PriorityQueue() + for key, image in self._cache.iteritems(): + image.priority = Priority.Normal + image.image = None + image.image_bytes = None + self._clean_queue.put((image.priority, image)) + # We want only one thread. + if not self._imageThread.isRunning(): + self._imageThread.start() 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) - return self._cache[name].image + image = self._cache[name] + if image.image is None: + self._clean_queue.remove((image.priority, image)) + image.priority = Priority.High + self._clean_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): """ - Returns the byte string for an image - If not present wait for the background thread to process it. + Returns the byte string for an image. If not present wait for the + background thread to process it. """ log.debug(u'get_image_bytes %s' % name) - if not self._cache[name].image_bytes: - while self._cache[name].dirty: + image = self._cache[name] + if image.image_bytes is None: + self._clean_queue.remove((image.priority, image)) + image.priority = Priority.Urgent + self._clean_queue.put((image.priority, image)) + while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) - return self._cache[name].image_bytes + return image.image_bytes def del_image(self, name): """ - Delete the Image from the Cache + Delete the Image from the cache. """ log.debug(u'del_image %s' % name) if name in self._cache: @@ -127,45 +186,44 @@ class ImageManager(QtCore.QObject): 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)) if not name in self._cache: - image = Image() - image.name = name - image.path = path - image.image = resize_image(path, self.width, self.height) + image = Image(name, path) self._cache[name] = image + self._clean_queue.put((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) - self._cache_dirty = True - # only one thread please - if not self._thread_running: - self.image_thread.start() + # We want only one thread. + if not self._imageThread.isRunning(): + self._imageThread.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') - self._thread_running = True - self.clean_cache() - # data loaded since we started ? - while self._cache_dirty: - log.debug(u'process - recycle') - self.clean_cache() - self._thread_running = False - log.debug(u'process - ended') + log.debug(u'_process - started') + while not self._clean_queue.empty(): + self._clean_cache() + log.debug(u'_process - ended') - def clean_cache(self): + def _clean_cache(self): """ Actually does the work. """ - log.debug(u'clean_cache') - # we will clean the cache now - self._cache_dirty = False - for key in self._cache.keys(): - image = self._cache[key] - if image.dirty: - image.image_bytes = image_to_byte(image.image) - image.dirty = False + log.debug(u'_clean_cache') + image = self._clean_queue.get()[1] + # Generate the QImage for the image. + if image.image is None: + image.image = resize_image(image.path, self.width, self.height) + # If the priority is not urgent, then set the priority to low and + # do not start to generate the byte stream. + if image.priority != Priority.Urgent: + self._clean_queue.remove((image.priority, image)) + image.priority = Priority.Low + self._clean_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) From 1730f5a99f8c84b8aca73ca05ab4cdcff72f622d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 07:34:07 +0200 Subject: [PATCH 05/21] added new priority and fixed comments --- openlp/core/lib/imagemanager.py | 43 ++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index bab9748d0..d445545a7 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -43,8 +43,8 @@ log = logging.getLogger(__name__) class ImageThread(QtCore.QThread): """ - A special Qt thread class to speed up the display of text based frames. - This is threaded so it loads the frames in background + A special Qt thread class to speed up the display of images. This is + threaded so it loads the frames and generates byte stream in background. """ def __init__(self, manager): QtCore.QThread.__init__(self, None) @@ -61,22 +61,33 @@ 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. Neither the QImage nor - the byte stream has been requested yet. + 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 + which ``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. + 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. + ``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 @@ -84,6 +95,11 @@ class Priority(object): class Image(object): + """ + This class represents an image. To mark an image as *dirty* set the instance + variables ``image`` and ``image_bytes`` to ``None`` and add the image object + to the queue of images to process. + """ def __init__(self, name='', path=''): self.name = name self.path = path @@ -217,9 +233,18 @@ class ImageManager(QtCore.QObject): # Generate the QImage for the image. if image.image is None: image.image = resize_image(image.path, self.width, self.height) - # If the priority is not urgent, then set the priority to low and - # do not start to generate the byte stream. - if image.priority != Priority.Urgent: + # Set the priority to Lowest and stop here as we need to process + # more important images first. + if image.priority == Priority.Normal: + self._clean_queue.remove((image.priority, image)) + image.priority = Priority.Lowest + self._clean_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._clean_queue.remove((image.priority, image)) image.priority = Priority.Low self._clean_queue.put((image.priority, image)) From b1b29e9abfa8148c2eb5861a119fdd5b8a7fd5d9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 08:20:02 +0200 Subject: [PATCH 06/21] comment fix --- openlp/core/lib/imagemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index d445545a7..3eace2a6a 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -69,7 +69,7 @@ class Priority(object): 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 - which ``QImage`` were not generated due to a request. + whose ``QImage`` were not generated due to a request. ``Normal`` The image's byte stream as well as the image has to be generated. From f9792337877274f48a838978a5985e7478f32620 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 21:37:23 +0200 Subject: [PATCH 07/21] renamed method --- openlp/core/lib/imagemanager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 3eace2a6a..ea8295f23 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -221,14 +221,14 @@ class ImageManager(QtCore.QObject): """ log.debug(u'_process - started') while not self._clean_queue.empty(): - self._clean_cache() + self._process_cache() log.debug(u'_process - ended') - def _clean_cache(self): + def _process_cache(self): """ Actually does the work. """ - log.debug(u'_clean_cache') + log.debug(u'_process_cache') image = self._clean_queue.get()[1] # Generate the QImage for the image. if image.image is None: From a077d830008f781f3ec7086c8f050d1c5bc8cf99 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 07:58:29 +0200 Subject: [PATCH 08/21] fixed saving 'Setup' mode shortcut --- openlp/core/ui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0210da52d..2f002e3a8 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -217,7 +217,7 @@ class Ui_MainWindow(object): self.modeDefaultItem = checkable_action( mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode) self.modeSetupItem = checkable_action( - mainWindow, u'modeLiveItem', category=UiStrings().ViewMode) + mainWindow, u'modeSetupItem', category=UiStrings().ViewMode) self.modeLiveItem = checkable_action( mainWindow, u'modeLiveItem', True, UiStrings().ViewMode) self.modeGroup = QtGui.QActionGroup(mainWindow) From 217510281c902c26cfa68829dd63d55e80215fcc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 26 Jun 2011 07:49:10 +0100 Subject: [PATCH 09/21] Fix comments --- openlp/core/ui/mainwindow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 11467cded..12b59763d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -424,8 +424,8 @@ class Ui_MainWindow(object): translate('OpenLP.MainWindow', 'Toggle Live Panel')) self.lockPanel.setText( translate('OpenLP.MainWindow', 'L&ock Panels')) - self.lockPanel.setToolTip( - translate('OpenLP.MainWindow', 'Prevent Panels changing')) + self.lockPanel.setStatusTip( + translate('OpenLP.MainWindow', 'Prevent the Panels being moved.')) self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow', 'Toggle the visibility of the live panel.')) self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', @@ -971,7 +971,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def setLockPanel(self, lock): """ - Sets the ability to stiop the toolbars being changed. + Sets the ability to stop the toolbars being changed. """ if lock: self.themeManagerDock.setFeatures( From cd3798573a83da69f93619190eebb987d0ba2393 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 16:12:19 +0200 Subject: [PATCH 10/21] improved display tag dialog resizing --- openlp/core/ui/displaytagdialog.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py index fcef1b782..579b37cd0 100644 --- a/openlp/core/ui/displaytagdialog.py +++ b/openlp/core/ui/displaytagdialog.py @@ -35,13 +35,10 @@ class Ui_DisplayTagDialog(object): def setupUi(self, displayTagDialog): displayTagDialog.setObjectName(u'displayTagDialog') displayTagDialog.resize(725, 548) - self.widget = QtGui.QWidget(displayTagDialog) - self.widget.setGeometry(QtCore.QRect(10, 10, 701, 521)) - self.widget.setObjectName(u'widget') - self.listdataGridLayout = QtGui.QGridLayout(self.widget) + self.listdataGridLayout = QtGui.QGridLayout(displayTagDialog) self.listdataGridLayout.setMargin(0) self.listdataGridLayout.setObjectName(u'listdataGridLayout') - self.tagTableWidget = QtGui.QTableWidget(self.widget) + self.tagTableWidget = QtGui.QTableWidget(displayTagDialog) self.tagTableWidget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.tagTableWidget.setEditTriggers( @@ -55,6 +52,7 @@ class Ui_DisplayTagDialog(object): self.tagTableWidget.setObjectName(u'tagTableWidget') self.tagTableWidget.setColumnCount(4) self.tagTableWidget.setRowCount(0) + self.tagTableWidget.horizontalHeader().setStretchLastSection(True) item = QtGui.QTableWidgetItem() self.tagTableWidget.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() @@ -69,11 +67,11 @@ class Ui_DisplayTagDialog(object): spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) - self.deletePushButton = QtGui.QPushButton(self.widget) + self.deletePushButton = QtGui.QPushButton(displayTagDialog) self.deletePushButton.setObjectName(u'deletePushButton') self.horizontalLayout.addWidget(self.deletePushButton) 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.dataGridLayout = QtGui.QGridLayout(self.editGroupBox) self.dataGridLayout.setObjectName(u'dataGridLayout') @@ -115,9 +113,8 @@ class Ui_DisplayTagDialog(object): self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1) self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(displayTagDialog) - closeButton = QtGui.QDialogButtonBox.Close self.buttonBox.setObjectName('displayTagDialogButtonBox') - self.buttonBox.setStandardButtons(closeButton) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1) self.retranslateUi(displayTagDialog) @@ -148,6 +145,5 @@ class Ui_DisplayTagDialog(object): self.tagTableWidget.horizontalHeaderItem(3).setText( translate('OpenLP.DisplayTagDialog', 'End HTML')) self.tagTableWidget.setColumnWidth(0, 120) - self.tagTableWidget.setColumnWidth(1, 40) - self.tagTableWidget.setColumnWidth(2, 240) - self.tagTableWidget.setColumnWidth(3, 240) + self.tagTableWidget.setColumnWidth(1, 80) + self.tagTableWidget.setColumnWidth(2, 330) From ee985fde7d6ac5f840fd9eea62ae96f4d0b05130 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 16:37:38 +0200 Subject: [PATCH 11/21] fixed margin; scroll to the bottom when adding a new tag --- openlp/core/ui/displaytagdialog.py | 2 +- openlp/core/ui/displaytagform.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py index 579b37cd0..65e900bbb 100644 --- a/openlp/core/ui/displaytagdialog.py +++ b/openlp/core/ui/displaytagdialog.py @@ -36,7 +36,7 @@ class Ui_DisplayTagDialog(object): displayTagDialog.setObjectName(u'displayTagDialog') displayTagDialog.resize(725, 548) self.listdataGridLayout = QtGui.QGridLayout(displayTagDialog) - self.listdataGridLayout.setMargin(0) + self.listdataGridLayout.setMargin(8) self.listdataGridLayout.setObjectName(u'listdataGridLayout') self.tagTableWidget = QtGui.QTableWidget(displayTagDialog) self.tagTableWidget.setHorizontalScrollBarPolicy( diff --git a/openlp/core/ui/displaytagform.py b/openlp/core/ui/displaytagform.py index 8ec4d59ae..22ac38f06 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/displaytagform.py @@ -138,6 +138,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): # Highlight new row self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1) self.onRowSelected() + self.tagTableWidget.scrollToBottom() def onDeletePushed(self): """ From a05d9098ef55776765add83f8eec44444b7ae9dc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 18:15:13 +0200 Subject: [PATCH 12/21] - removed not needed code - some translation fixes - remove close button on print dialog --- openlp/core/lib/theme.py | 5 --- openlp/core/ui/printservicedialog.py | 52 +++++++++++++--------------- openlp/core/ui/printserviceform.py | 5 +-- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index cc9c055c5..7ad50490d 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -178,10 +178,6 @@ class HorizontalType(object): Center = 2 Names = [u'left', u'right', u'center'] - TranslatedNames = [ - translate('OpenLP.ThemeWizard', 'Left'), - translate('OpenLP.ThemeWizard', 'Right'), - translate('OpenLP.ThemeWizard', 'Center')] class VerticalType(object): @@ -193,7 +189,6 @@ class VerticalType(object): Bottom = 2 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', diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 1d80eaa07..b0065df99 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -41,11 +41,6 @@ class ZoomSize(object): Fifty = 4 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): def setupUi(self, printServiceDialog): @@ -59,18 +54,14 @@ class Ui_PrintServiceDialog(object): self.toolbar.setIconSize(QtCore.QSize(22, 22)) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) 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.setText(translate('OpenLP.PrintServiceForm', - 'Options')) self.optionsButton.setToolButtonStyle( QtCore.Qt.ToolButtonTextBesideIcon) self.optionsButton.setIcon(build_icon(u':/system/system_configure.png')) self.optionsButton.setCheckable(True) 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.plainCopy = self.toolbar.addAction( build_icon(u':/system/system_edit_copy.png'), @@ -81,24 +72,18 @@ class Ui_PrintServiceDialog(object): self.toolbar.addSeparator() self.zoomInButton = QtGui.QToolButton(self.toolbar) 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.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomInButton) self.zoomOutButton = QtGui.QToolButton(self.toolbar) self.zoomOutButton.setIcon( build_icon(u':/general/general_zoom_out.png')) - self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm', - 'Zoom Out')) self.zoomOutButton.setObjectName(u'zoomOutButton') self.zoomOutButton.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomOutButton) self.zoomOriginalButton = QtGui.QToolButton(self.toolbar) self.zoomOriginalButton.setIcon( build_icon(u':/general/general_zoom_original.png')) - self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm', - 'Zoom Original')) self.zoomOriginalButton.setObjectName(u'zoomOriginalButton') self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomOriginalButton) @@ -116,20 +101,17 @@ class Ui_PrintServiceDialog(object): self.optionsLayout.setContentsMargins(8, 8, 8, 8) self.titleLabel = QtGui.QLabel(self.optionsWidget) self.titleLabel.setObjectName(u'titleLabel') - self.titleLabel.setText(u'Title:') self.optionsLayout.addWidget(self.titleLabel) self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget) self.titleLineEdit.setObjectName(u'titleLineEdit') self.optionsLayout.addWidget(self.titleLineEdit) self.footerLabel = QtGui.QLabel(self.optionsWidget) self.footerLabel.setObjectName(u'footerLabel') - self.footerLabel.setText(u'Custom Footer Text:') self.optionsLayout.addWidget(self.footerLabel) self.footerTextEdit = SpellTextEdit(self.optionsWidget) self.footerTextEdit.setObjectName(u'footerTextEdit') self.optionsLayout.addWidget(self.footerTextEdit) - self.optionsGroupBox = QtGui.QGroupBox( - translate('OpenLP.PrintServiceForm','Other Options')) + self.optionsGroupBox = QtGui.QGroupBox() self.groupLayout = QtGui.QVBoxLayout() self.slideTextCheckBox = QtGui.QCheckBox() self.groupLayout.addWidget(self.slideTextCheckBox) @@ -150,6 +132,19 @@ class Ui_PrintServiceDialog(object): def retranslateUi(self, printServiceDialog): 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', 'Include slide text if available')) self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm', @@ -160,10 +155,13 @@ class Ui_PrintServiceDialog(object): 'Include play length of media items')) self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm', 'Service Sheet')) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page]) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width]) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred]) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive]) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty]) - self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive]) + # Do not change the order. + self.zoomComboBox.addItems([ + translate('OpenLP.PrintServiceDialog', 'Fit Page'), + translate('OpenLP.PrintServiceDialog', 'Fit Width'), + u'100%', + u'75%', + u'50%', + u'25%'] + ) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 0c8d53466..2bbf2ab56 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -137,8 +137,6 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): # Signals QtCore.QObject.connect(self.printButton, QtCore.SIGNAL(u'triggered()'), self.printServiceOrder) - QtCore.QObject.connect(self.closeButton, - QtCore.SIGNAL(u'triggered()'), self.accept) QtCore.QObject.connect(self.zoomOutButton, QtCore.SIGNAL(u'clicked()'), self.zoomOut) 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 """ - self.mainWindow.clipboard.setText( - self.document.toPlainText()) + self.mainWindow.clipboard.setText(self.document.toPlainText()) def copyHtmlText(self): """ From f2a243cfb4bc06d1421d77a3d300a10f6c0171ab Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 19:33:22 +0200 Subject: [PATCH 13/21] change theme name to 'Copy of ' when copying a theme --- openlp/core/ui/thememanager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 3a309cfd0..6ac8b3831 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -299,6 +299,9 @@ class ThemeManager(QtGui.QWidget): """ item = self.themeListWidget.currentItem() oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) + oldThemeName = unicode( + translate('OpenLP.ThemeManager', 'Copy of %s', + 'Copy of ')) % oldThemeName self.fileRenameForm.fileNameEdit.setText(oldThemeName) if self.fileRenameForm.exec_(True): newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) From 943f2e1cb2825eb1aa1a06672adfd974a32362b8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 26 Jun 2011 21:34:01 +0200 Subject: [PATCH 14/21] rearranged lines --- openlp/core/ui/thememanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 6ac8b3831..d84fe7e1f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -298,10 +298,10 @@ class ThemeManager(QtGui.QWidget): Copies an existing theme to a new name """ item = self.themeListWidget.currentItem() - oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) oldThemeName = unicode( translate('OpenLP.ThemeManager', 'Copy of %s', - 'Copy of ')) % oldThemeName + 'Copy of ')) % unicode( + item.data(QtCore.Qt.UserRole).toString()) self.fileRenameForm.fileNameEdit.setText(oldThemeName) if self.fileRenameForm.exec_(True): newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) From e50ca971d657988005a3b973fe62495b79eb0faf Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 27 Jun 2011 13:28:58 +0200 Subject: [PATCH 15/21] change queue name; remove image from queue when deleted from cache --- openlp/core/lib/imagemanager.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index ea8295f23..5970efd4f 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -138,7 +138,7 @@ class ImageManager(QtCore.QObject): self.height = current_screen[u'size'].height() self._cache = {} self._imageThread = ImageThread(self) - self._clean_queue = PriorityQueue() + self._conversion_queue = PriorityQueue() def update_display(self): """ @@ -150,12 +150,12 @@ class ImageManager(QtCore.QObject): self.height = current_screen[u'size'].height() # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. - self._clean_queue = PriorityQueue() + self._conversion_queue = PriorityQueue() for key, image in self._cache.iteritems(): image.priority = Priority.Normal image.image = None image.image_bytes = None - self._clean_queue.put((image.priority, image)) + self._conversion_queue.put((image.priority, image)) # We want only one thread. if not self._imageThread.isRunning(): self._imageThread.start() @@ -168,9 +168,9 @@ class ImageManager(QtCore.QObject): log.debug(u'get_image %s' % name) image = self._cache[name] if image.image is None: - self._clean_queue.remove((image.priority, image)) + self._conversion_queue.remove((image.priority, image)) image.priority = Priority.High - self._clean_queue.put((image.priority, image)) + self._conversion_queue.put((image.priority, image)) while image.image is None: log.debug(u'get_image - waiting') time.sleep(0.1) @@ -184,9 +184,9 @@ class ImageManager(QtCore.QObject): log.debug(u'get_image_bytes %s' % name) image = self._cache[name] if image.image_bytes is None: - self._clean_queue.remove((image.priority, image)) + self._conversion_queue.remove((image.priority, image)) image.priority = Priority.Urgent - self._clean_queue.put((image.priority, image)) + self._conversion_queue.put((image.priority, image)) while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) @@ -198,6 +198,8 @@ class ImageManager(QtCore.QObject): """ log.debug(u'del_image %s' % name) if name in self._cache: + self._conversion_queue.remove( + (self._cache[name].priority, self._cache[name])) del self._cache[name] def add_image(self, name, path): @@ -208,7 +210,7 @@ class ImageManager(QtCore.QObject): if not name in self._cache: image = Image(name, path) self._cache[name] = image - self._clean_queue.put((image.priority, image)) + self._conversion_queue.put((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) # We want only one thread. @@ -220,7 +222,7 @@ class ImageManager(QtCore.QObject): Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - while not self._clean_queue.empty(): + while not self._conversion_queue.empty(): self._process_cache() log.debug(u'_process - ended') @@ -229,25 +231,25 @@ class ImageManager(QtCore.QObject): Actually does the work. """ log.debug(u'_process_cache') - image = self._clean_queue.get()[1] + image = self._conversion_queue.get()[1] # Generate the QImage for the image. if image.image is None: image.image = resize_image(image.path, self.width, self.height) # Set the priority to Lowest and stop here as we need to process # more important images first. if image.priority == Priority.Normal: - self._clean_queue.remove((image.priority, image)) + self._conversion_queue.remove((image.priority, image)) image.priority = Priority.Lowest - self._clean_queue.put((image.priority, image)) + 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._clean_queue.remove((image.priority, image)) + self._conversion_queue.remove((image.priority, image)) image.priority = Priority.Low - self._clean_queue.put((image.priority, image)) + self._conversion_queue.put((image.priority, image)) return # Generate the byte stream for the image. if image.image_bytes is None: From 2d60f3842ac7107521afe4543a4c6853e65d4406 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 27 Jun 2011 16:56:48 +0100 Subject: [PATCH 16/21] review comment --- openlp/core/ui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 191b26998..e73ea5b80 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -425,7 +425,7 @@ class Ui_MainWindow(object): self.lockPanel.setText( translate('OpenLP.MainWindow', 'L&ock Panels')) self.lockPanel.setStatusTip( - translate('OpenLP.MainWindow', 'Prevent the Panels being moved.')) + translate('OpenLP.MainWindow', 'Prevent the panels being moved.')) self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow', 'Toggle the visibility of the live panel.')) self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', From 231c47db531ac054d8320a3035e0108225f1cfb0 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 28 Jun 2011 00:52:46 -0400 Subject: [PATCH 17/21] Remove settings for confirm delete --- openlp/plugins/custom/lib/customtab.py | 29 +------------------------- openlp/plugins/custom/lib/mediaitem.py | 22 ++++++++----------- 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 12acabd0b..b16746f8b 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -47,57 +47,30 @@ class CustomTab(SettingsTab): self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') self.customModeLayout.addRow(self.displayFooterCheckBox) self.leftLayout.addWidget(self.customModeGroupBox) - self.customUIGroupBox = QtGui.QGroupBox(self.leftColumn) - self.customUIGroupBox.setObjectName(u'customUIGroupBox') - self.customUILayout = QtGui.QFormLayout(self.customUIGroupBox) - self.customUILayout.setObjectName(u'customUILayout') - self.confirmDeleteCheckBox = QtGui.QCheckBox(self.customUIGroupBox) - self.confirmDeleteCheckBox.setObjectName(u'confirmDeleteCheckBox') - self.customUILayout.addRow(self.confirmDeleteCheckBox) - self.leftLayout.addWidget(self.customUIGroupBox) self.leftLayout.addStretch() self.rightLayout.addStretch() QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayFooterCheckBoxChanged) - QtCore.QObject.connect(self.confirmDeleteCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onConfirmDeleteCheckBoxChanged) def retranslateUi(self): self.customModeGroupBox.setTitle(translate('CustomPlugin.CustomTab', 'Custom Display')) self.displayFooterCheckBox.setText( translate('CustomPlugin.CustomTab', 'Display footer')) - self.customUIGroupBox.setTitle(translate('CustomPlugin.CustomTab', - 'UI Settings')) - self.confirmDeleteCheckBox.setText( - translate('CustomPlugin.CustomTab', 'Confirm delete')) def onDisplayFooterCheckBoxChanged(self, check_state): self.displayFooter = False # we have a set value convert to True/False if check_state == QtCore.Qt.Checked: - self.displayFooter = True - - def onConfirmDeleteCheckBoxChanged(self, check_state): - self.confirmDelete = False - # we have a set value convert to True/False - if check_state == QtCore.Qt.Checked: - self.confirmDelete = True + self.displayFooter = True def load(self): self.displayFooter = QtCore.QSettings().value( self.settingsSection + u'/display footer', QtCore.QVariant(True)).toBool() self.displayFooterCheckBox.setChecked(self.displayFooter) - self.confirmDelete = QtCore.QSettings().value( - self.settingsSection + u'/confirm delete', - QtCore.QVariant(True)).toBool() - self.confirmDeleteCheckBox.setChecked(self.confirmDelete) def save(self): QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QVariant(self.displayFooter)) - QtCore.QSettings().setValue(self.settingsSection + u'/confirm delete', - QtCore.QVariant(self.confirmDelete)) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index fec660360..41accef27 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -200,20 +200,16 @@ class CustomMediaItem(MediaManagerItem): Remove a custom item from the list and database """ if check_item_selected(self.listView, UiStrings().SelectDelete): - self.confirmDelete = QtCore.QSettings().value( - self.settingsSection + u'/confirm delete', - QtCore.QVariant(u'False')).toBool() items = self.listView.selectedIndexes() - if self.confirmDelete: - if QtGui.QMessageBox.question(self, - translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'), - translate('CustomPlugin.MediaItem', - 'Are you sure you want to delete the %n selected custom(s)?', '', - QtCore.QCoreApplication.CodecForTr, len(items)), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | - QtGui.QMessageBox.Cancel), - QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel: - return + if QtGui.QMessageBox.question(self, + translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'), + translate('CustomPlugin.MediaItem', + 'Are you sure you want to delete the %n selected custom(s)?', '', + QtCore.QCoreApplication.CodecForTr, len(items)), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | + QtGui.QMessageBox.Cancel), + QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel: + return row_list = [item.row() for item in self.listView.selectedIndexes()] row_list.sort(reverse=True) id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0] From c3631659251d8b76febed523f7fd553cf375e5fc Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 28 Jun 2011 00:59:26 -0400 Subject: [PATCH 18/21] Removed some whitespace --- openlp/plugins/custom/lib/customtab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index b16746f8b..fb83fab81 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -63,7 +63,7 @@ class CustomTab(SettingsTab): self.displayFooter = False # we have a set value convert to True/False if check_state == QtCore.Qt.Checked: - self.displayFooter = True + self.displayFooter = True def load(self): self.displayFooter = QtCore.QSettings().value( From f14fa780812839e53e531643e854f58bee97e443 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 28 Jun 2011 09:29:36 -0400 Subject: [PATCH 19/21] Modified delete message and dialog buttons --- openlp/plugins/custom/lib/mediaitem.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 41accef27..8babfc245 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -204,11 +204,12 @@ class CustomMediaItem(MediaManagerItem): if QtGui.QMessageBox.question(self, translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'), translate('CustomPlugin.MediaItem', - 'Are you sure you want to delete the %n selected custom(s)?', '', + 'Are you sure you want to delete the %n selected custom' \ + ' slides(s)?', '', QtCore.QCoreApplication.CodecForTr, len(items)), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | - QtGui.QMessageBox.Cancel), - QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel: + 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.sort(reverse=True) From 334bf4ab444559b5063a4baf54f2dd56bb4047fb Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 28 Jun 2011 15:05:05 -0400 Subject: [PATCH 20/21] Changed dialog heading. Changed Songs delete confirm to match Custom Slides --- openlp/plugins/custom/lib/mediaitem.py | 6 +++--- openlp/plugins/songs/lib/mediaitem.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 8babfc245..23094a98e 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -202,10 +202,10 @@ class CustomMediaItem(MediaManagerItem): if check_item_selected(self.listView, UiStrings().SelectDelete): items = self.listView.selectedIndexes() if QtGui.QMessageBox.question(self, - translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'), + translate('CustomPlugin.MediaItem', 'Confirm Delete'), translate('CustomPlugin.MediaItem', - 'Are you sure you want to delete the %n selected custom' \ - ' slides(s)?', '', + '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), diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 61bdc32c0..badb5cde9 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -353,13 +353,13 @@ class SongMediaItem(MediaManagerItem): if check_item_selected(self.listView, UiStrings().SelectDelete): items = self.listView.selectedIndexes() if QtGui.QMessageBox.question(self, - translate('SongsPlugin.MediaItem', 'Delete Song(s)?'), + translate('SongsPlugin.MediaItem', 'Confirm Delete'), translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '', QtCore.QCoreApplication.CodecForTr, len(items)), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | - QtGui.QMessageBox.Cancel), - QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel: + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: return for item in items: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] From da45d09e48df447d40c8e89a6fb3a2f587e44ca1 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 28 Jun 2011 16:35:28 -0400 Subject: [PATCH 21/21] Moved delete dialog heading translate to ui.py --- openlp/core/lib/ui.py | 1 + openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 5055bb619..558c8ba52 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -64,6 +64,7 @@ class UiStrings(object): self.Cancel = translate('OpenLP.Ui', 'Cancel') self.CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:') self.CreateService = translate('OpenLP.Ui', 'Create a new service.') + self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete') self.Continuous = translate('OpenLP.Ui', 'Continuous') self.Default = unicode(translate('OpenLP.Ui', 'Default')) self.Delete = translate('OpenLP.Ui', '&Delete') diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 23094a98e..60f25ee0c 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -202,7 +202,7 @@ class CustomMediaItem(MediaManagerItem): if check_item_selected(self.listView, UiStrings().SelectDelete): items = self.listView.selectedIndexes() if QtGui.QMessageBox.question(self, - translate('CustomPlugin.MediaItem', 'Confirm Delete'), + UiStrings().ConfirmDelete, translate('CustomPlugin.MediaItem', 'Are you sure you want to delete the %n selected custom' ' slides(s)?', '', diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index badb5cde9..e0634d5cc 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -353,7 +353,7 @@ class SongMediaItem(MediaManagerItem): if check_item_selected(self.listView, UiStrings().SelectDelete): items = self.listView.selectedIndexes() if QtGui.QMessageBox.question(self, - translate('SongsPlugin.MediaItem', 'Confirm Delete'), + UiStrings().ConfirmDelete, translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '', QtCore.QCoreApplication.CodecForTr, len(items)),