eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

changeset 8259
2bbec88047dd
parent 8250
4d65b3ec1d31
equal deleted inserted replaced
8258:82b608e352ec 8259:2bbec88047dd
1152 @param fn filename where to determine the line ending 1152 @param fn filename where to determine the line ending
1153 @type str 1153 @type str
1154 @return eol string 1154 @return eol string
1155 @rtype str 1155 @rtype str
1156 """ 1156 """
1157 if self.__project.isOpen() and self.__project.isProjectFile(fn): 1157 eol = (
1158 eol = self.__project.getEolString() 1158 self.__project.getEolString()
1159 else: 1159 if self.__project.isOpen() and self.__project.isProjectFile(fn)
1160 eol = Utilities.linesep() 1160 else Utilities.linesep()
1161 )
1161 return eol 1162 return eol
1162 1163
1163 @pyqtSlot() 1164 @pyqtSlot()
1164 def on_startButton_clicked(self): 1165 def on_startButton_clicked(self):
1165 """ 1166 """
1976 Private method to set the selected status of the future imports. 1977 Private method to set the selected status of the future imports.
1977 1978
1978 @param selectedFutures comma separated list of expected future imports 1979 @param selectedFutures comma separated list of expected future imports
1979 @type str 1980 @type str
1980 """ 1981 """
1981 if selectedFutures: 1982 expectedImports = (
1982 expectedImports = [ 1983 [i.strip() for i in selectedFutures.split(",") if bool(i.strip())]
1983 i.strip() for i in selectedFutures.split(",") 1984 if selectedFutures else
1984 if bool(i.strip())] 1985 []
1985 else: 1986 )
1986 expectedImports = []
1987 for row in range(self.futuresList.count()): 1987 for row in range(self.futuresList.count()):
1988 itm = self.futuresList.item(row) 1988 itm = self.futuresList.item(row)
1989 if itm.text() in expectedImports: 1989 if itm.text() in expectedImports:
1990 itm.setCheckState(Qt.CheckState.Checked) 1990 itm.setCheckState(Qt.CheckState.Checked)
1991 else: 1991 else:
2075 2075
2076 @param enabledCategories comma separated list of enabled checker 2076 @param enabledCategories comma separated list of enabled checker
2077 categories 2077 categories
2078 @type str 2078 @type str
2079 """ 2079 """
2080 if enabledCategories: 2080 enabledCategoriesList = (
2081 enabledCategoriesList = [ 2081 [c.strip() for c in enabledCategories.split(",")
2082 c.strip() for c in enabledCategories.split(",") 2082 if bool(c.strip())]
2083 if bool(c.strip())] 2083 if enabledCategories else
2084 else: 2084 list(CodeStyleCheckerDialog.checkCategories.keys())
2085 enabledCategoriesList = list( 2085 )
2086 CodeStyleCheckerDialog.checkCategories.keys())
2087 for row in range(self.categoriesList.count()): 2086 for row in range(self.categoriesList.count()):
2088 itm = self.categoriesList.item(row) 2087 itm = self.categoriesList.item(row)
2089 if itm.data(Qt.ItemDataRole.UserRole) in enabledCategoriesList: 2088 if itm.data(Qt.ItemDataRole.UserRole) in enabledCategoriesList:
2090 itm.setCheckState(Qt.CheckState.Checked) 2089 itm.setCheckState(Qt.CheckState.Checked)
2091 else: 2090 else:
2235 topItem = self.resultList.topLevelItem(topRow) 2234 topItem = self.resultList.topLevelItem(topRow)
2236 topItem.setExpanded(True) 2235 topItem.setExpanded(True)
2237 visibleChildren = topItem.childCount() 2236 visibleChildren = topItem.childCount()
2238 for childIndex in range(topItem.childCount()): 2237 for childIndex in range(topItem.childCount()):
2239 childItem = topItem.child(childIndex) 2238 childItem = topItem.child(childIndex)
2240 if selectedMessageCode: 2239 hideChild = (
2241 hideChild = ( 2240 childItem.data(0, self.codeRole) != selectedMessageCode
2242 childItem.data(0, self.codeRole) != selectedMessageCode 2241 if selectedMessageCode else
2243 ) 2242 False
2244 else: 2243 )
2245 hideChild = False
2246 childItem.setHidden(hideChild) 2244 childItem.setHidden(hideChild)
2247 if hideChild: 2245 if hideChild:
2248 visibleChildren -= 1 2246 visibleChildren -= 1
2249 topItem.setHidden(visibleChildren == 0) 2247 topItem.setHidden(visibleChildren == 0)

eric ide

mercurial