From ffe9b776589ff4004f722d4433fe0fbfa2131ea3 Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 20 Apr 2009 11:07:08 +0000 Subject: [PATCH 1/1] Correct if caluses git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2577 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 4 ++-- wizard/BModulePage.py | 12 ++++++------ wizard/BToolchainPage.py | 2 +- wizard/BVersionPage.py | 2 +- wizard/BWizard.py | 4 ++-- wizard/bertos_utils.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index c105543c..f38ab35c 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -86,9 +86,9 @@ class BCpuPage(BWizardPage): cpu_name = self.projectInfo("CPU_NAME") selected_freq = self.projectInfo("SELECTED_FREQ") self.setupUi() - if not cpu_name is None: + if cpu_name: self.selectItem(cpu_name) - if not selected_freq is None: + if selected_freq: self.setFrequency(selected_freq) self.freq_modified = True QApplication.instance().restoreOverrideCursor() diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index afbe9891..00d9d4bd 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -77,7 +77,7 @@ class BModulePage(BWizardPage): the source tree. """ module = self.currentModule() - if module is not None: + if module: try: supported = bertos_utils.isSupported(self.project(), module=module) except SupportedException, e: @@ -182,9 +182,9 @@ class BModulePage(BWizardPage): Loads the module data. """ # Load the module data only if it isn't already loaded - if self.projectInfo("MODULES") == None \ - and self.projectInfo("LISTS") == None \ - and self.projectInfo("CONFIGURATIONS") == None: + if not self.projectInfo("MODULES") \ + and not self.projectInfo("LISTS") \ + and not self.projectInfo("CONFIGURATIONS"): try: bertos_utils.loadModuleData(self.project()) except ModuleDefineException, e: @@ -199,7 +199,7 @@ class BModulePage(BWizardPage): Fills the module tree with the module entries separated in categories. """ modules = self.projectInfo("MODULES") - if modules is None: + if not modules: return categories = {} for module, information in modules.items(): @@ -300,7 +300,7 @@ class BModulePage(BWizardPage): """ current_module = self.pageContent.moduleTree.currentItem() # return only the child items - if current_module is not None and current_module.parent() is not None: + if current_module and current_module.parent(): return unicode(current_module.text(0)) else: return None diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index be7fc6f1..2587cf20 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -141,7 +141,7 @@ class BToolchainPage(BWizardPage): item = QListWidgetItem(key) item.setData(Qt.UserRole, qvariant_converter.convertStringDict({"path": key})) self.pageContent.toolchainList.addItem(item) - if sel_toolchain is not None and sel_toolchain["path"] == key: + if sel_toolchain and sel_toolchain["path"] == key: self.pageContent.toolchainList.setCurrentItem(item) if value: self.validateToolchain(self.pageContent.toolchainList.row(item)) diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index 0db1bd62..5d891b21 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -157,7 +157,7 @@ class BVersionPage(BWizardPage): selected = self.projectInfo("SOURCES_PATH") for directory in versions: item = self.insertListElement(directory) - if not selected is None and selected == directory: + if selected and selected == directory: self.setCurrentItem(item) def setCurrentItem(self, item): diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 1966d932..a4436623 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -4,7 +4,7 @@ # Copyright 2008 Develer S.r.l. (http://www.develer.com/) # All rights reserved. # -# $Id:$ +# $Id$ # # Author: Lorenzo Berni # @@ -55,7 +55,7 @@ class BWizard(QWizard): method of the next page. """ page = self.page(pageId) - if page is not None: + if page: page.reloadData() def project(self): diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 17794579..bfdcc0ee 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -384,7 +384,7 @@ def loadModuleDefinition(first_comment): return to_be_parsed, module_dict def isSupported(project, module=None, property_id=None): - if module is None and property_id is not None: + if not module and property_id: item = project.info("CONFIGURATIONS")[property_id[0]][property_id[1]]["informations"] else: item = project.info("MODULES")[module] -- 2.25.1