← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/trivial2 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/trivial2 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/trivial2/+merge/112947

Hello,

- variable fixes

NOTE: there is another code change as well (as it has been suggested in another proposal by gushie(?)).
-- 
https://code.launchpad.net/~googol/openlp/trivial2/+merge/112947
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/trivial2 into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2012-06-22 14:14:53 +0000
+++ openlp/core/lib/mediamanageritem.py	2012-07-01 19:25:24 +0000
@@ -352,24 +352,23 @@
         ``files``
             The list of files to be loaded
         """
-        #FIXME: change local variables to words_separated_by_underscores.
-        newFiles = []
-        errorShown = False
+        new_files = []
+        error_shown = False
         for file in files:
             type = file.split(u'.')[-1]
             if type.lower() not in self.onNewFileMasks:
-                if not errorShown:
+                if not error_shown:
                     critical_error_message_box(
                         translate('OpenLP.MediaManagerItem',
                         'Invalid File Type'),
                         unicode(translate('OpenLP.MediaManagerItem',
                         'Invalid File %s.\nSuffix not supported'))
                         % file)
-                    errorShown = True
+                    error_shown = True
             else:
-                newFiles.append(file)
-        if files:
-            self.validateAndLoad(newFiles)
+                new_files.append(file)
+        if new_files:
+            self.validateAndLoad(new_files)
 
     def validateAndLoad(self, files):
         """
@@ -379,30 +378,29 @@
         ``files``
             The files to be loaded.
         """
-        #FIXME: change local variables to words_separated_by_underscores.
         names = []
-        fullList = []
+        full_list = []
         for count in range(self.listView.count()):
             names.append(unicode(self.listView.item(count).text()))
-            fullList.append(unicode(self.listView.item(count).
+            full_list.append(unicode(self.listView.item(count).
                 data(QtCore.Qt.UserRole).toString()))
-        duplicatesFound = False
-        filesAdded = False
+        duplicates_found = False
+        files_added = False
         for file in files:
             filename = os.path.split(unicode(file))[1]
             if filename in names:
-                duplicatesFound = True
+                duplicates_found = True
             else:
-                filesAdded = True
-                fullList.append(file)
-        if fullList and filesAdded:
+                files_added = True
+                full_list.append(file)
+        if full_list and files_added:
             self.listView.clear()
-            self.loadList(fullList)
-            lastDir = os.path.split(unicode(files[0]))[0]
-            SettingsManager.set_last_dir(self.settingsSection, lastDir)
+            self.loadList(full_list)
+            last_dir = os.path.split(unicode(files[0]))[0]
+            SettingsManager.set_last_dir(self.settingsSection, last_dir)
             SettingsManager.set_list(self.settingsSection,
                 self.settingsSection, self.getFileList())
-        if duplicatesFound:
+        if duplicates_found:
             critical_error_message_box(
                 UiStrings().Duplicate,
                 unicode(translate('OpenLP.MediaManagerItem',
@@ -422,13 +420,13 @@
         Return the current list of files
         """
         count = 0
-        filelist = []
+        file_list = []
         while count < self.listView.count():
             bitem = self.listView.item(count)
             filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
-            filelist.append(filename)
+            file_list.append(filename)
             count += 1
-        return filelist
+        return file_list
 
     def loadList(self, list):
         raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
@@ -477,9 +475,8 @@
         Allows the change of current item in the list to be actioned
         """
         if Settings().value(u'advanced/single click preview',
-            QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
-            and self.listView.selectedIndexes() \
-            and self.autoSelectId == -1:
+            QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed and \
+            self.listView.selectedIndexes() and self.autoSelectId == -1:
             self.onPreviewClick(True)
 
     def onPreviewClick(self, keepFocus=False):


Follow ups