← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/beta1 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/beta1 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #742636 in OpenLP: "Leading spaces in song titles are stripped"
  https://bugs.launchpad.net/openlp/+bug/742636

For more details, see:
https://code.launchpad.net/~trb143/openlp/beta1/+merge/59594

Just an idea to stop issues with image thumbnails.
Sort the loading of duplicate file names! 
-- 
https://code.launchpad.net/~trb143/openlp/beta1/+merge/59594
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/beta1 into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-04-29 08:45:36 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-04-30 17:44:24 +0000
@@ -34,7 +34,7 @@
 from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
     StringContent, build_icon, translate, Receiver, ListWidgetWithDnD
 from openlp.core.lib.ui import UiStrings, context_menu_action, \
-    context_menu_separator
+    context_menu_separator, critical_error_message_box
 
 log = logging.getLogger(__name__)
 
@@ -333,7 +333,21 @@
         log.info(u'New files(s) %s', unicode(files))
         if files:
             Receiver.send_message(u'cursor_busy')
-            self.loadList(files)
+            names = []
+            for count in range(0, self.listView.count()):
+                names.append(self.listView.item(count).text())
+            newFiles = []
+            for file in files:
+                filename = os.path.split(unicode(file))[1]
+                if filename in names:
+                    critical_error_message_box(
+                        UiStrings().Duplicate,
+                        unicode(translate('OpenLP.MediaManagerItem',
+                        'Duplicate file name %s.\nFilename already exists in '
+                        'list')) % filename)
+                else:
+                    newFiles.append(file)
+            self.loadList(newFiles)
             lastDir = os.path.split(unicode(files[0]))[0]
             SettingsManager.set_last_dir(self.settingsSection, lastDir)
             SettingsManager.set_list(self.settingsSection,

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-04-17 11:00:44 +0000
+++ openlp/core/lib/ui.py	2011-04-30 17:44:24 +0000
@@ -67,6 +67,7 @@
         self.Default = unicode(translate('OpenLP.Ui', 'Default'))
         self.Delete = translate('OpenLP.Ui', '&Delete')
         self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
+        self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
         self.Edit = translate('OpenLP.Ui', '&Edit')
         self.EmptyField = translate('OpenLP.Ui', 'Empty Field')
         self.Error = translate('OpenLP.Ui', 'Error')
@@ -124,6 +125,7 @@
         self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
         self.Tools = translate('OpenLP.Ui', 'Tools')
         self.Top = translate('OpenLP.Ui', 'Top')
+        self.UnsupportedFile = translate('OpenLP.Ui', 'Unsupported File')
         self.VersePerSlide = translate('OpenLP.Ui', 'Verse Per Slide')
         self.VersePerLine = translate('OpenLP.Ui', 'Verse Per Line')
         self.Version = translate('OpenLP.Ui', 'Version')

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2011-04-29 08:45:36 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2011-04-30 17:44:24 +0000
@@ -108,7 +108,6 @@
                 self.settingsSection, self.getFileList())
 
     def loadList(self, list, initialLoad=False):
-        Receiver.send_message(u'cursor_busy')
         if not initialLoad:
             self.parent.formparent.displayProgressBar(len(list))
         for imageFile in list:
@@ -127,7 +126,6 @@
             item_name.setIcon(icon)
             item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
             self.listView.addItem(item_name)
-        Receiver.send_message(u'cursor_normal')
         if not initialLoad:
             self.parent.formparent.finishedProgressBar()
 

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-04-30 07:42:20 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-04-30 17:44:24 +0000
@@ -138,10 +138,8 @@
         if not self.mediaStateWait(Phonon.StoppedState):
             # Due to string freeze, borrow a message from presentations
             # This will be corrected in 1.9.6
-            critical_error_message_box(
-                translate('PresentationPlugin.MediaItem', 'Unsupported File'),
-                unicode(translate('PresentationPlugin.MediaItem',
-                'Unsupported File')))
+            critical_error_message_box(UiStrings().UnsupportedFile,
+                    UiStrings().UnsupportedFile)
             return False
         # File too big for processing
         if os.path.getsize(filename) <= 52428800: # 50MiB
@@ -152,15 +150,12 @@
                 # Due to string freeze, borrow a message from presentations
                 # This will be corrected in 1.9.6
                 self.mediaObject.stop()
-                critical_error_message_box(
-                    translate('PresentationPlugin.MediaItem',
-                    'Unsupported File'),
-                    unicode(translate('PresentationPlugin.MediaItem',
-                    'Unsupported File')))
+                critical_error_message_box(UiStrings().UnsupportedFile,
+                        UiStrings().UnsupportedFile)
                 return False
-            self.mediaLength = self.mediaObject.totalTime() / 1000
+            #self.mediaLength = self.mediaObject.totalTime() / 1000
             self.mediaObject.stop()
-            service_item.media_length = self.mediaLength
+            service_item.media_length = self.mediaObject.totalTime() / 1000
             service_item.add_capability(
                 ItemCapabilities.AllowsVariableStartTime)
         service_item.title = unicode(self.plugin.nameStrings[u'singular'])

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2011-04-30 16:11:28 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2011-04-30 17:44:24 +0000
@@ -193,9 +193,7 @@
                 if initialLoad:
                     icon = build_icon(u':/general/general_delete.png')
                 else:
-                    critical_error_message_box(
-                        translate('PresentationPlugin.MediaItem',
-                        'Unsupported File'),
+                    critical_error_message_box(UiStrings().UnsupportedFile,
                         translate('PresentationPlugin.MediaItem',
                         'This type of presentation is not supported.'))
                     continue


Follow ups