Fixed flake8 W and F errors
This commit is contained in:
@@ -964,7 +964,6 @@ class GuiBuildNovelDocView(QTextBrowser):
|
||||
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||
|
||||
fPx = int(1.1*self.theTheme.fontPixelSize)
|
||||
mPx = self.mainConf.pxInt(4)
|
||||
|
||||
self.theTitle = QLabel("<b>Build Time:</b> Unknown", self)
|
||||
self.theTitle.setIndent(0)
|
||||
|
||||
@@ -1372,7 +1372,6 @@ class GuiDocEditSearch(QFrame):
|
||||
self.doMatchCap = self.mainConf.searchMatchCap
|
||||
|
||||
mPx = self.mainConf.pxInt(6)
|
||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||
tPx = int(0.8*self.theTheme.fontPixelSize)
|
||||
boxFont = self.theTheme.guiFont
|
||||
boxFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||
@@ -1892,7 +1891,6 @@ class GuiDocEditFooter(QWidget):
|
||||
self.sPx = int(round(0.9*self.theTheme.baseIconSize))
|
||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||
bSp = self.mainConf.pxInt(4)
|
||||
hSp = self.mainConf.pxInt(8)
|
||||
|
||||
lblFont = self.font()
|
||||
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||
@@ -1902,11 +1900,6 @@ class GuiDocEditFooter(QWidget):
|
||||
self.setAutoFillBackground(True)
|
||||
self.setPalette(self.thePalette)
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.theTheme.colText)
|
||||
|
||||
# Status
|
||||
self.statusIcon = QLabel("")
|
||||
self.statusIcon.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -366,7 +366,6 @@ class GuiDocViewer(QTextBrowser):
|
||||
"}}\n"
|
||||
).format(
|
||||
textSize = self.mainConf.textSize,
|
||||
preSize = self.mainConf.textSize*0.9,
|
||||
tColR = self.theTheme.colText[0],
|
||||
tColG = self.theTheme.colText[1],
|
||||
tColB = self.theTheme.colText[2],
|
||||
@@ -701,7 +700,6 @@ class GuiDocViewDetails(QScrollArea):
|
||||
self.refList.setScaledContents(True)
|
||||
self.refList.linkActivated.connect(self._linkClicked)
|
||||
|
||||
hCol = self.palette().highlight().color()
|
||||
self.linkStyle = "style='color: rgb({0},{1},{2})'".format(
|
||||
*self.theTheme.colLink
|
||||
)
|
||||
|
||||
@@ -374,7 +374,6 @@ class GuiOutline(QTreeWidget):
|
||||
continue
|
||||
|
||||
tLevel = self.theIndex.novelIndex[tHandle][sTitle]["level"]
|
||||
tTime = self.theIndex.novelIndex[tHandle][sTitle]["updated"]
|
||||
tItem = self._createTreeItem(tHandle, sTitle, tLevel)
|
||||
self.treeMap[titleKey] = tItem
|
||||
|
||||
|
||||
@@ -30,8 +30,7 @@ import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import (
|
||||
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel,
|
||||
QSizePolicy
|
||||
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel
|
||||
)
|
||||
|
||||
from nw.constants import nwLabels, nwKeyWords
|
||||
|
||||
@@ -720,7 +720,6 @@ class GuiConfigEditEditingTab(QWidget):
|
||||
def _disableComboItem(self, theList, theValue):
|
||||
"""Disable a list item in the combo box.
|
||||
"""
|
||||
theIdx = theList.findData(theValue)
|
||||
theModel = theList.model()
|
||||
anItem = theModel.item(1)
|
||||
anItem.setFlags(anItem.flags() ^ Qt.ItemIsEnabled)
|
||||
|
||||
@@ -422,7 +422,6 @@ class GuiProjectEditStatus(QWidget):
|
||||
"""
|
||||
logger.verbose("Save item button clicked")
|
||||
selItem = self._getSelectedItem()
|
||||
iRow = self.listBox.row(selItem)
|
||||
if selItem is not None:
|
||||
selIdx = selItem.data(Qt.UserRole)
|
||||
self.colData[selIdx] = (
|
||||
|
||||
+1
-3
@@ -475,7 +475,6 @@ class GuiProjectTree(QTreeWidget):
|
||||
tName = nwItem.itemName
|
||||
tClass = nwItem.itemClass
|
||||
tHandle = nwItem.itemHandle
|
||||
pHandle = nwItem.parHandle
|
||||
|
||||
expIcon = QIcon()
|
||||
|
||||
@@ -670,7 +669,6 @@ class GuiProjectTree(QTreeWidget):
|
||||
isNote = snItem.itemLayout == nwItemLayout.NOTE
|
||||
onFile = dnItem.itemType == nwItemType.FILE
|
||||
isRoot = snItem.itemType == nwItemType.ROOT
|
||||
onRoot = dnItem.itemType == nwItemType.ROOT
|
||||
isOnTop = self.dropIndicatorPosition() == QAbstractItemView.OnItem
|
||||
if (isSame or isNone or isNote) and not (onFile and isOnTop) and not isRoot:
|
||||
logger.debug("Drag'n'drop of item %s accepted" % sHandle)
|
||||
@@ -758,7 +756,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
byIndex = self.theMap[pHandle].indexOfChild(self.theMap[nHandle])
|
||||
except Exception:
|
||||
logger.error("Failed to get index of item with handle %s" % nHandle)
|
||||
if byIndex >= 0:
|
||||
if byIndex >= 0:
|
||||
self.theMap[pHandle].insertChild(byIndex+1, newItem)
|
||||
else:
|
||||
self.theMap[pHandle].addChild(newItem)
|
||||
|
||||
@@ -35,7 +35,6 @@ from PyQt5.QtGui import QColor, QPainter
|
||||
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
|
||||
|
||||
from nw.core import NWSpellCheck
|
||||
from nw.common import formatInt
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
+5
-1
@@ -33,7 +33,7 @@ import nw
|
||||
from os import path, listdir
|
||||
from math import ceil
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import QStyle, qApp
|
||||
from PyQt5.QtGui import (
|
||||
@@ -260,6 +260,7 @@ class GuiTheme:
|
||||
cssData = inFile.read()
|
||||
except Exception as e:
|
||||
logger.error("Could not load theme css file")
|
||||
logger.error(str(e))
|
||||
return False
|
||||
|
||||
# Config File
|
||||
@@ -269,6 +270,7 @@ class GuiTheme:
|
||||
confParser.read_file(inFile)
|
||||
except Exception as e:
|
||||
logger.error("Could not load theme settings from: %s" % self.confFile)
|
||||
logger.error(str(e))
|
||||
return False
|
||||
|
||||
## Main
|
||||
@@ -324,6 +326,7 @@ class GuiTheme:
|
||||
confParser.read_file(inFile)
|
||||
except Exception as e:
|
||||
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
|
||||
logger.error(str(e))
|
||||
return False
|
||||
|
||||
## Main
|
||||
@@ -615,6 +618,7 @@ class GuiIcons:
|
||||
confParser.read_file(inFile)
|
||||
except Exception as e:
|
||||
logger.error("Could not load icon theme settings from: %s" % self.confFile)
|
||||
logger.error(str(e))
|
||||
return False
|
||||
|
||||
## Main
|
||||
|
||||
Reference in New Issue
Block a user