Update linting for main code
This commit is contained in:
@@ -20,7 +20,7 @@ General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
""" # noqa
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
@@ -41,6 +41,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GuiMainStatus(QStatusBar):
|
||||
"""GUI: Main Window Status Bar."""
|
||||
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
@@ -112,8 +113,6 @@ class GuiMainStatus(QStatusBar):
|
||||
self.updateTheme()
|
||||
self.clearStatus()
|
||||
|
||||
return
|
||||
|
||||
def initSettings(self) -> None:
|
||||
"""Apply user settings."""
|
||||
if CONFIG.useCharCount:
|
||||
@@ -122,7 +121,6 @@ class GuiMainStatus(QStatusBar):
|
||||
else:
|
||||
self._trStatsCount = trStats(nwLabels.STATS_DISPLAY[nwStats.WORDS])
|
||||
self._trStatsTip = self.tr("Total word count (session change)")
|
||||
return
|
||||
|
||||
def clearStatus(self) -> None:
|
||||
"""Reset all widgets on the status bar to default values."""
|
||||
@@ -132,7 +130,6 @@ class GuiMainStatus(QStatusBar):
|
||||
self.setProjectStatus(None)
|
||||
self.setDocumentStatus(None)
|
||||
self.updateTime()
|
||||
return
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
@@ -149,8 +146,6 @@ class GuiMainStatus(QStatusBar):
|
||||
self.docIcon.setColors(colNone, colSaved, colUnsaved)
|
||||
self.projIcon.setColors(colNone, colSaved, colUnsaved)
|
||||
|
||||
return
|
||||
|
||||
##
|
||||
# Setters
|
||||
##
|
||||
@@ -158,17 +153,14 @@ class GuiMainStatus(QStatusBar):
|
||||
def setRefTime(self, refTime: float) -> None:
|
||||
"""Set the reference time for the status bar clock."""
|
||||
self._refTime = refTime
|
||||
return
|
||||
|
||||
def setProjectStatus(self, state: bool | None) -> None:
|
||||
"""Set the project status colour icon."""
|
||||
self.projIcon.setState(state)
|
||||
return
|
||||
|
||||
def setDocumentStatus(self, state: bool | None) -> None:
|
||||
"""Set the document status colour icon."""
|
||||
self.docIcon.setState(state)
|
||||
return
|
||||
|
||||
def setUserIdle(self, idle: bool) -> None:
|
||||
"""Change the idle status icon."""
|
||||
@@ -180,13 +172,11 @@ class GuiMainStatus(QStatusBar):
|
||||
else:
|
||||
self.timeIcon.setPixmap(self.timePixmap)
|
||||
self._userIdle = idle
|
||||
return
|
||||
|
||||
def setProjectStats(self, pWC: int, sWC: int) -> None:
|
||||
"""Update the current project statistics."""
|
||||
self.statsText.setText(self._trStatsCount.format(f"{pWC:n}", f"{sWC:+n}"))
|
||||
self.statsText.setToolTip(self._trStatsTip)
|
||||
return
|
||||
|
||||
def updateTime(self, idleTime: float = 0.0) -> None:
|
||||
"""Update the session clock."""
|
||||
@@ -198,7 +188,6 @@ class GuiMainStatus(QStatusBar):
|
||||
else:
|
||||
sessTime = round(time() - self._refTime)
|
||||
self.timeText.setText(formatTime(sessTime))
|
||||
return
|
||||
|
||||
##
|
||||
# Public Slots
|
||||
@@ -209,7 +198,6 @@ class GuiMainStatus(QStatusBar):
|
||||
"""Set the status bar message to display."""
|
||||
self.showMessage(message, nwConst.STATUS_MSG_TIMEOUT)
|
||||
QApplication.processEvents()
|
||||
return
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def setLanguage(self, language: str, provider: str) -> None:
|
||||
@@ -220,19 +208,16 @@ class GuiMainStatus(QStatusBar):
|
||||
else:
|
||||
self.langText.setText(QLocale(language).nativeLanguageName().title())
|
||||
self.langText.setToolTip(f"{language} ({provider})" if provider else language)
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def updateProjectStatus(self, status: bool) -> None:
|
||||
"""Update the project status."""
|
||||
self.setProjectStatus(not status)
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def updateDocumentStatus(self, status: bool) -> None:
|
||||
"""Update the document status."""
|
||||
self.setDocumentStatus(not status)
|
||||
return
|
||||
|
||||
##
|
||||
# Private Slots
|
||||
@@ -244,7 +229,6 @@ class GuiMainStatus(QStatusBar):
|
||||
state = not CONFIG.showSessionTime
|
||||
self.timeText.setVisible(state)
|
||||
CONFIG.showSessionTime = state
|
||||
return
|
||||
|
||||
##
|
||||
# Debug
|
||||
@@ -279,4 +263,3 @@ class GuiMainStatus(QStatusBar):
|
||||
)
|
||||
self.showMessage(f"Debug [{stamp}] {message}", 6000)
|
||||
logger.debug("[MEMINFO] %s", message)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user