replaced numScreens by screenCount; removed 0 in range()

This commit is contained in:
Andreas Preikschat 2012-05-01 13:00:02 +02:00
parent bab9b33a7f
commit a0225d790a
9 changed files with 22 additions and 22 deletions

View File

@ -373,12 +373,12 @@ class MediaManagerItem(QtGui.QWidget):
Process a list for files either from the File Dialog or from Drag and
Drop
``files``
The files to be loaded
``files``
The files to be loaded.
"""
names = []
fullList = []
for count in range(0, self.listView.count()):
for count in range(self.listView.count()):
names.append(unicode(self.listView.item(count).text()))
fullList.append(unicode(self.listView.item(count).
data(QtCore.Qt.UserRole).toString()))

View File

@ -64,7 +64,7 @@ class MediaDockManager(object):
visible_title = media_item.plugin.getString(StringContent.VisibleName)
log.debug(u'Inserting %s dock' % visible_title[u'title'])
match = False
for dock_index in range(0, self.media_dock.count()):
for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name:
match = True
@ -81,7 +81,7 @@ class MediaDockManager(object):
"""
visible_title = media_item.plugin.getString(StringContent.VisibleName)
log.debug(u'remove %s dock' % visible_title[u'title'])
for dock_index in range(0, self.media_dock.count()):
for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name:

View File

@ -106,13 +106,13 @@ class ScreenList(object):
"""
# Do not log at start up.
if changed_screen != -1:
log.info(u'screen_count_changed %d' % self.desktop.numScreens())
log.info(u'screen_count_changed %d' % self.desktop.screenCount())
# Remove unplugged screens.
for screen in copy.deepcopy(self.screen_list):
if screen[u'number'] == self.desktop.numScreens():
if screen[u'number'] == self.desktop.screenCount():
self.remove_screen(screen[u'number'])
# Add new screens.
for number in xrange(0, self.desktop.numScreens()):
for number in xrange(self.desktop.screenCount()):
if not self.screen_exists(number):
self.add_screen({
u'number': number,

View File

@ -92,7 +92,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
"""
Process the form saving the settings
"""
for tabIndex in range(0, self.stackedLayout.count()):
for tabIndex in range(self.stackedLayout.count()):
self.stackedLayout.widget(tabIndex).save()
# Must go after all settings are save
Receiver.send_message(u'config_updated')
@ -102,7 +102,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
"""
Process the form saving the settings
"""
for tabIndex in range(0, self.stackedLayout.count()):
for tabIndex in range(self.stackedLayout.count()):
self.stackedLayout.widget(tabIndex).cancel()
return QtGui.QDialog.reject(self)

View File

@ -373,7 +373,7 @@ class SlideController(Controller):
u'text': translate('OpenLP.SlideController', 'Go to "Ending"')},
{u'key': u'O', u'configurable': True,
u'text': translate('OpenLP.SlideController', 'Go to "Other"')}]
shortcuts += [{u'key': unicode(number)} for number in range(0, 10)]
shortcuts += [{u'key': unicode(number)} for number in range(10)]
self.previewListWidget.addActions([create_action(self,
u'shortcutAction_%s' % s[u'key'], text=s.get(u'text'),
shortcuts=[QtGui.QKeySequence(s[u'key'])],

View File

@ -127,7 +127,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
sxml.new_document()
sxml.add_lyrics_to_song()
count = 1
for i in range(0, self.slideListView.count()):
for i in range(self.slideListView.count()):
sxml.add_verse_to_lyrics(u'custom', unicode(count),
unicode(self.slideListView.item(i).text()))
count += 1
@ -170,7 +170,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
Edits all slides.
"""
slide_list = u''
for row in range(0, self.slideListView.count()):
for row in range(self.slideListView.count()):
item = self.slideListView.item(row)
slide_list += item.text()
if row != self.slideListView.count() - 1:
@ -206,7 +206,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
old_row = self.slideListView.currentRow()
# Create a list with all (old/unedited) slides.
old_slides = [self.slideListView.item(row).text() for row in \
range(0, self.slideListView.count())]
range(self.slideListView.count())]
self.slideListView.clear()
old_slides.pop(old_row)
# Insert all slides to make the old_slides list complete.

View File

@ -152,7 +152,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'create_thumbnails')
if self.check_thumbnails():
return
for num in range(0, self.presentation.Slides.Count):
for num in range(self.presentation.Slides.Count):
self.presentation.Slides(num + 1).Export(os.path.join(
self.get_thumbnail_folder(), 'slide%d.png' % (num + 1)),
'png', 320, 240)

View File

@ -336,7 +336,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Tag the Song List rows based on the verse list
"""
row_label = []
for row in range(0, self.verseListWidget.rowCount()):
for row in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0)
verse_def = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_tag = VerseType.translated_tag(verse_def[0])
@ -494,7 +494,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(tempText.split(u'\n')) != len(after_text.split(u'\n')):
tempList = {}
tempId = {}
for row in range(0, self.verseListWidget.rowCount()):
for row in range(self.verseListWidget.rowCount()):
tempList[row] = self.verseListWidget.item(row, 0)\
.text()
tempId[row] = self.verseListWidget.item(row, 0)\
@ -511,7 +511,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onVerseEditAllButtonClicked(self):
verse_list = u''
if self.verseListWidget.rowCount() > 0:
for row in range(0, self.verseListWidget.rowCount()):
for row in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0)
field = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_tag = VerseType.translated_name(field[0])
@ -579,7 +579,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verses = []
verse_names = []
order = self.__extractVerseOrder(text)
for index in range(0, self.verseListWidget.rowCount()):
for index in range(self.verseListWidget.rowCount()):
verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names:
@ -620,7 +620,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_names = []
order_names = unicode(verse_order).split()
order = self.__extractVerseOrder(verse_order)
for index in range(0, verse_count):
for index in range(verse_count):
verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names:
@ -920,7 +920,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
try:
sxml = SongXML()
multiple = []
for i in range(0, self.verseListWidget.rowCount()):
for i in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_tag = verseId[0]

View File

@ -185,7 +185,7 @@ class CCLIFileImport(SongImport):
check_first_verse_line = False
field_list = song_fields.split(u'/t')
words_list = song_words.split(u'/t')
for counter in range(0, len(field_list)):
for counter in range(len(field_list)):
if field_list[counter].startswith(u'Ver'):
verse_type = VerseType.Tags[VerseType.Verse]
elif field_list[counter].startswith(u'Ch'):