top_level.append(cpu_title)
toolchain_title = QTreeWidgetItem(QStringList([self.tr("Toolchain")]))
toolchain_info = self.projectInfo("TOOLCHAIN")
- if "target" in toolchain_info.keys():
+ if "target" in toolchain_info:
toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([self.tr("target: " + toolchain_info["target"])]))
version = ""
- if "version" in toolchain_info.keys():
+ if "version" in toolchain_info:
version += "version: " + "GCC " + toolchain_info["version"] + " "
- if "build" in toolchain_info.keys():
+ if "build" in toolchain_info:
version += "(" + toolchain_info["build"] + ")"
- if "version" in toolchain_info.keys():
+ if "version" in toolchain_info:
toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([version]))
toolchain_path = QTreeWidgetItem(toolchain_title, QStringList([self.tr("path: " + os.path.normpath(toolchain_info["path"]))]))
top_level.append(toolchain_title)
module_categories = {}
for module, information in self.projectInfo("MODULES").items():
if information["enabled"]:
- if information["category"] not in module_categories.keys():
+ if information["category"] not in module_categories:
module_categories[information["category"]] = []
moduleItem = QTreeWidgetItem(QStringList([module + " - " + information["description"]]))
module_categories[information["category"]].append(moduleItem)
item = QTableWidgetItem(configurations[property]["brief"])
item.setData(Qt.UserRole, qvariant_converter.convertString(property))
self.pageContent.propertyTable.setItem(index, 0, item)
- if "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "boolean":
+ if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "boolean":
self.insertCheckBox(index, configurations[property]["value"])
- elif "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "enum":
+ elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "enum":
self.insertComboBox(index, configurations[property]["value"], configurations[property]["informations"]["value_list"])
elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "int":
self.insertSpinBox(index, configurations[property]["value"], configurations[property]["informations"])
"""
self.resetPropertyDescription()
configurations = self.currentModuleConfigurations()
- if self.currentProperty() in configurations.keys():
+ if self.currentProperty() in configurations:
description = configurations[self.currentProperty()]["brief"]
name = self.currentProperty()
self.currentPropertyItem().setText(description + "\n" + name)
property = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
configuration = self.projectInfo("MODULES")[self.currentModule()]["configuration"]
configurations = self.projectInfo("CONFIGURATIONS")
- if "type" not in configurations[configuration][property]["informations"].keys() or configurations[configuration][property]["informations"]["type"] == "int":
+ if "type" not in configurations[configuration][property]["informations"] or configurations[configuration][property]["informations"]["type"] == "int":
configurations[configuration][property]["value"] = str(int(self.pageContent.propertyTable.cellWidget(index, 1).value()))
elif configurations[configuration][property]["informations"]["type"] == "enum":
configurations[configuration][property]["value"] = unicode(self.pageContent.propertyTable.cellWidget(index, 1).currentText())
return
categories = {}
for module, information in modules.items():
- if information["category"] not in categories.keys():
+ if information["category"] not in categories:
categories[information["category"]] = []
categories[information["category"]].append(module)
for category, module_list in categories.items():
minimum = 0
maximum = 4294967295
suff = "UL"
- if "min" in informations.keys():
+ if "min" in informations:
minimum = int(informations["min"])
- if "max" in informations.keys():
+ if "max" in informations:
maximum = int(informations["max"])
spin_box.setRange(minimum, maximum)
spin_box.setSuffix(suff)
for index in range(self.pageContent.propertyTable.rowCount()):
property_name = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
# Awful solution! Needed because if the user change the module, the selection changed...
- if property_name not in self.currentModuleConfigurations().keys():
+ if property_name not in self.currentModuleConfigurations():
break
self.pageContent.propertyTable.item(index, 0).setText(self.currentModuleConfigurations()[property_name]['brief'])
# Copyright 2008 Develer S.r.l. (http://www.develer.com/)
# All rights reserved.
#
-# $Id:$
+# $Id$
#
# Author: Lorenzo Berni <duplo@develer.com>
#
"""
Retrieve the value associated with the name key.
"""
- if key in self.infos.keys():
+ if key in self.infos:
return self.infos[key]
return None
toolchain_list = bertos_utils.findToolchains(dir_list)
stored_toolchains = self.toolchains()
for element in toolchain_list:
- if not element in stored_toolchains.keys():
+ if not element in stored_toolchains:
item = QListWidgetItem(element)
item.setData(Qt.UserRole, qvariant_converter.convertStringDict({"path": element}))
self.pageContent.toolchainList.addItem(item)
new_data.update(infos)
item.setData(Qt.UserRole, qvariant_converter.convertStringDict(new_data))
needed = self.projectInfo("CPU_INFOS")
- if "target" in infos.keys() and infos["target"].find(needed["TOOLCHAIN"]) != -1:
+ if "target" in infos and infos["target"].find(needed["TOOLCHAIN"]) != -1:
item.setIcon(QIcon(":/images/ok.png"))
else:
item.setIcon(QIcon(":/images/warning.png"))
- if "version" in infos.keys() and "target" in infos.keys():
+ if "version" in infos and "target" in infos:
item.setText("GCC " + infos["version"] + " - " + infos["target"].strip())
def _invalidItem(self, index):
if self._validation_process.waitForFinished(200):
description = str(self._validation_process.readAllStandardError())
info = bertos_utils.getToolchainInfo(description)
- if len(info.keys()) >= 4:
+ if len(info) >= 4:
valid = True
else:
self._validation_process.kill()
for start, parameter in information["paramlist"]:
infos = information[parameter]
value = infos["value"]
- if "unsigned" in infos["informations"].keys() and infos["informations"]["unsigned"]:
+ if "unsigned" in infos["informations"] and infos["informations"]["unsigned"]:
value += "U"
- if "long" in infos["informations"].keys() and infos["informations"]["long"]:
+ if "long" in infos["informations"] and infos["informations"]["long"]:
value += "L"
string = sub(string, parameter, value)
f = open(cfgdir + "/" + os.path.basename(configuration), "w")
elif line.find("\\brief") != -1:
module_definition["module_description"] = line[line.find("\\brief") + len("\\brief "):]
module_dict = {}
- if "module_name" in module_definition.keys():
+ if "module_name" in module_definition:
module_name = module_definition[const.MODULE_DEFINITION["module_name"]]
del module_definition[const.MODULE_DEFINITION["module_name"]]
module_dict[module_name] = {}
- if const.MODULE_DEFINITION["module_depends"] in module_definition.keys():
+ if const.MODULE_DEFINITION["module_depends"] in module_definition:
depends = module_definition[const.MODULE_DEFINITION["module_depends"]]
del module_definition[const.MODULE_DEFINITION["module_depends"]]
if type(depends) == str:
module_dict[module_name]["depends"] = depends
else:
module_dict[module_name]["depends"] = ()
- if const.MODULE_DEFINITION["module_configuration"] in module_definition.keys():
+ if const.MODULE_DEFINITION["module_configuration"] in module_definition:
module_dict[module_name]["configuration"] = module_definition[const.MODULE_DEFINITION["module_configuration"]]
del module_definition[const.MODULE_DEFINITION["module_configuration"]]
else:
module_dict[module_name]["configuration"] = ""
- if "module_description" in module_definition.keys():
+ if "module_description" in module_definition:
module_dict[module_name]["description"] = module_definition["module_description"]
del module_definition["module_description"]
- if const.MODULE_DEFINITION["module_harvard"] in module_definition.keys():
+ if const.MODULE_DEFINITION["module_harvard"] in module_definition:
harvard = module_definition[const.MODULE_DEFINITION["module_harvard"]]
if harvard == "both" or harvard == "pgm_memory":
module_dict[module_name]["harvard"] = harvard
del module_definition[const.MODULE_DEFINITION["module_harvard"]]
- if const.MODULE_DEFINITION["module_hw"] in module_definition.keys():
+ if const.MODULE_DEFINITION["module_hw"] in module_definition:
hw = module_definition[const.MODULE_DEFINITION["module_hw"]]
del module_definition[const.MODULE_DEFINITION["module_hw"]]
if type(hw) == str:
module_dict[module_name]["hw"] = hw
else:
module_dict[module_name]["hw"] = ()
- if const.MODULE_DEFINITION["module_supports"] in module_definition.keys():
+ if const.MODULE_DEFINITION["module_supports"] in module_definition:
supports = module_definition[const.MODULE_DEFINITION["module_supports"]]
del module_definition[const.MODULE_DEFINITION["module_supports"]]
module_dict[module_name]["supports"] = supports
information["depends"] = ()
information["depends"] += (filename.split(".")[0],)
information["category"] = os.path.basename(path)
- if "configuration" in information.keys() and len(information["configuration"]):
+ if "configuration" in information and len(information["configuration"]):
configuration = module_dict[module]["configuration"]
try:
configuration_info[configuration] = loadConfigurationInfos(project.info("SOURCES_PATH") + "/" + configuration)
configuration_infos[name]["informations"] = informations
if not "type" in configuration_infos[name]["informations"]:
configuration_infos[name]["informations"]["type"] = findParameterType(configuration_infos[name])
- if ("type" in configuration_infos[name]["informations"].keys() and
+ if ("type" in configuration_infos[name]["informations"] and
configuration_infos[name]["informations"]["type"] == "int" and
configuration_infos[name]["value"].find("L") != -1):
configuration_infos[name]["informations"]["long"] = True
configuration_infos[name]["value"] = configuration_infos[name]["value"].replace("L", "")
- if ("type" in configuration_infos[name]["informations"].keys() and
+ if ("type" in configuration_infos[name]["informations"] and
configuration_infos[name]["informations"]["type"] == "int" and
configuration_infos[name]["value"].find("U") != -1):
configuration_infos[name]["informations"]["unsigned"] = True
"""
Return True if the value is a simple int.
"""
- if ("long" not in informatios.keys() or not informations["long"]) and ("unsigned" not in informations.keys() or informations["unsigned"]):
+ if ("long" not in informatios or not informations["long"]) and ("unsigned" not in informations or informations["unsigned"]):
return True
else:
return False
"""
Return True if the value is a long.
"""
- if "long" in informations.keys() and informations["long"] and "unsigned" not in informations.keys():
+ if "long" in informations and informations["long"] and "unsigned" not in informations:
return True
else:
return False
"""
Return True if the value is an unsigned.
"""
- if "unsigned" in informations.keys() and informations["unsigned"] and "long" not in informations.keys():
+ if "unsigned" in informations and informations["unsigned"] and "long" not in informations:
return True
else:
return False
"""
Return True if the value is an unsigned long.
"""
- if "unsigned" in informations.keys() and "long" in informations.keys() and informations["unsigned"] and informations["long"]:
+ if "unsigned" in informations and "long" in informations and informations["unsigned"] and informations["long"]:
return True
else:
return False