Commit e2de42a7 authored by Robert Loehning's avatar Robert Loehning

Squish: Replacing some usages of len()

Change-Id: Icaf029043fed149bff6e15861fdcc6d640a2ecfc
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent f1fb669b
......@@ -406,7 +406,7 @@ def replaceLine(fileSpec, oldLine, newLine):
if openDocumentPlaceCursor(fileSpec, oldLine) == None:
return False
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
for i in range(len(oldLine)):
for _ in oldLine:
type(editor, "<Backspace>")
type(editor, newLine)
return True
......@@ -79,7 +79,7 @@ class Tree:
def countChildOccurrences(self, name):
if not self.__children__:
return 0
return len(filter(lambda x: x.getName() == name, self.__children__))
return map(lambda x: x.getName(), self.__children__).count(name)
# internal functions
def __repr__(self):
......
......@@ -53,23 +53,25 @@ def main():
if isQt4Build and platform.system() == 'Darwin':
# avoid QTCREATORBUG-9197
filtered = [filenames[0]]
for i in range(1, len(filenames)):
if filenames[i].lower() != filtered[-1].lower():
filtered.append(filenames[i])
for filename in filenames[1:]:
if filename.lower() != filtered[-1].lower():
filtered.append(filename)
filenames = filtered
for i in range(len(filenames)):
previous = filenames[-1]
for filename in filenames:
tempFiletype = filetype
if filetype == "QML" and filenames[i - 1][-4:] != ".qml":
if filetype == "QML" and previous[-4:] != ".qml":
tempFiletype = "Other files"
# following is necessary due to QTCREATORBUG-10179
# will be fixed when Qt5's MIME type database can be used
if ((filenames[-1] in ("main.cpp", "utility.cpp") and filenames[i - 1][-4:] != ".cpp")
or (filenames[-1] == "utility.h" and filenames[i - 1][-2:].lower() != ".h")
or (filetype == "Resources" and filenames[i - 1][-4:] != ".qrc")):
if ((filenames[-1] in ("main.cpp", "utility.cpp") and previous[-4:] != ".cpp")
or (filenames[-1] == "utility.h" and previous[-2:].lower() != ".h")
or (filetype == "Resources" and previous[-4:] != ".qrc")):
tempFiletype = "Other files"
# end of handling QTCREATORBUG-10179
renameFile(templateDir, usedProFile, projectName + "." + tempFiletype,
filenames[i - 1], filenames[i])
previous, filename)
previous = filename
invokeMenuItem("File", "Exit")
def renameFile(projectDir, proFile, branch, oldname, newname):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment