Commit 0e0158fc authored by Robert Loehning's avatar Robert Loehning Committed by Robert Löhning

Squish: Cleaned for-loops

Change-Id: Ide5313c8838aa7ad9ad74cbaed12872ce0a35413
Reviewed-by: default avatarBill King <bill.king@nokia.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent e48e185d
......@@ -30,12 +30,7 @@ def __addSignalHandlerDict__(lazySignalHandlerFunction):
lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), [handlerFunctionName])
else:
alreadyInstalled = False
for h in handlers:
if (h == handlerFunctionName):
alreadyInstalled = True
break
if not alreadyInstalled:
if not handlerFunctionName in handlers:
lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
handlers.append(handlerFunctionName)
installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers)
......@@ -148,13 +143,12 @@ def createTasksFile(list):
def iterateBuildConfigs(targetCount, currentTarget, filter = ""):
switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
configs = []
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model()
prog = re.compile(filter)
for row in range(model.rowCount()):
configName = str(model.index(row, 0).data())
if prog.match(configName):
configs += [configName]
# for each row in the model, write its data to a list
configNames = [str(model.index(row, 0).data()) for row in range(model.rowCount())]
# pick only those configuration names which pass the filter
configs = [config for config in configNames if prog.match(config)]
switchViewTo(ViewConstants.EDIT)
return configs
......
......@@ -56,9 +56,7 @@ class QtQuickConstants:
if not isinstance(targets, (tuple,list)):
test.fatal("Wrong usage... This function handles only tuples or lists.")
return None
result = []
for target in targets:
result.append(QtQuickConstants.getStringForTarget(target))
result = map(QtQuickConstants.getStringForTarget, targets)
if None in result:
test.fatal("You've passed at least one unknown target!")
return result
......
......@@ -239,13 +239,11 @@ def __configureCustomExecutable__(projectName, port, mkspec, qmakeVersion):
# occur more than once - but could easily be found by using a compound object
# (e.g. search for Utils::PathChooser instead of Utils::BaseValidatingLineEdit and get the child)
def getChildByClass(parent, classToSearchFor, occurence=1):
counter = 0
for child in object.children(parent):
if className(child) == classToSearchFor:
counter = counter + 1
if counter == occurence:
return child
children = [child for child in object.children(parent) if className(child) == classToSearchFor]
if len(children) < occurence:
return None
else:
return children[occurence - 1]
# helper that tries to get the mkspec entry of the QtVersion ToolTip
def __getMkspec__(qtToolTip):
......
......@@ -294,3 +294,10 @@ def getCorrectlyConfiguredTargets():
result.update({target:[version]})
clickButton(waitForObject(":Options.OK_QPushButton"))
return result
def visibleCheckBoxExists(text):
try:
findObject("{type='QCheckBox' text='%s' visible='1'}" % text)
return True
except:
return False
......@@ -69,14 +69,8 @@ def main():
clickButton(waitForObject(":Next_QPushButton"))
except LookupError:
pass
availableCheckboxes = []
waitForObject("{type='QLabel' unnamed='1' visible='1' text='Target Setup'}")
for current in QtQuickConstants.getAllTargetStrings():
try:
findObject("{type='QCheckBox' text='%s' visible='1'}" % current)
availableCheckboxes.append(current)
except:
pass
availableCheckboxes = filter(visibleCheckBoxExists, QtQuickConstants.getAllTargetStrings())
JIRA.performWorkaroundIfStillOpen(6967, JIRA.Bug.CREATOR, template, displayedPlatforms)
# verification whether expected, found and configured match
for t in targets:
......
......@@ -36,18 +36,15 @@ def prepareQmlFile():
return False
markText(editor, start, end)
type(editor, "<Ctrl+C>")
for i in range(10):
for j in range(10):
type(editor, "<Ctrl+V>")
global originalText
# assume the current editor content to be indented correctly
originalText = "%s" % editor.plainText
indented = editor.plainText
unindented = ""
lines = str(indented).splitlines()
test.log("Using %d lines..." % len(lines))
for line in lines:
unindented += line.lstrip()+"\n"
editor.plainText = unindented
editor.plainText = "\n".join([line.lstrip() for line in lines]) + "\n"
return True
def handleTextChanged(object):
......
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