Merge branch 'main' into dialogue_highlight

This commit is contained in:
Veronica Berglyd Olsen
2024-06-09 00:10:14 +02:00
committed by GitHub
11 changed files with 115 additions and 108 deletions
+2 -2
View File
@@ -64,7 +64,7 @@ from novelwriter.text.counting import standardCounter
from novelwriter.tools.lipsum import GuiLipsum
from novelwriter.types import (
QtAlignCenterTop, QtAlignJustify, QtAlignLeft, QtAlignLeftTop,
QtAlignRight, QtKeepAnchor, QtModCtrl, QtModeNone, QtModShift, QtMouseLeft,
QtAlignRight, QtKeepAnchor, QtModCtrl, QtModNone, QtModShift, QtMouseLeft,
QtMoveAnchor, QtMoveLeft, QtMoveRight
)
@@ -956,7 +956,7 @@ class GuiDocEditor(QPlainTextEdit):
super().keyPressEvent(event)
nPos = self.cursorRect().topLeft().y()
kMod = event.modifiers()
okMod = kMod in (QtModeNone, QtModShift)
okMod = kMod in (QtModNone, QtModShift)
okKey = event.key() not in self.MOVE_KEYS
if nPos != cPos and okMod and okKey:
mPos = CONFIG.autoScrollPos*0.01 * self.viewport().height()
+1 -1
View File
@@ -422,7 +422,7 @@ class GuiMainMenu(QMenuBar):
self.aInsMSApos = self.mInsQuotes.addAction(self.tr("Alternative Apostrophe"))
self.aInsMSApos.setShortcut("Ctrl+K, '")
self.aInsMSApos.triggered.connect(
lambda: self.requestDocInsertText.emit(nwUnicode.U_MAPOSS)
lambda: self.requestDocInsertText.emit(nwUnicode.U_MAPOS)
)
# Insert > Symbols
+9 -16
View File
@@ -239,9 +239,7 @@ class GuiMainStatus(QStatusBar):
"""
import tracemalloc
from collections import Counter
widgets = QApplication.allWidgets()
count = len(QApplication.allWidgets())
if not self._debugInfo:
if tracemalloc.is_tracing():
self._traceMallocRef = "Total"
@@ -249,19 +247,14 @@ class GuiMainStatus(QStatusBar):
self._traceMallocRef = "Relative"
tracemalloc.start()
self._debugInfo = True
self._wCounts = Counter([type(x).__name__ for x in widgets])
if hasattr(self, "_wCounts"):
diff = Counter([type(x).__name__ for x in widgets]) - self._wCounts
for name, count in diff.items():
logger.debug("Widget '%s': +%d", name, count)
mem = tracemalloc.get_traced_memory()
current, peak = tracemalloc.get_traced_memory()
stamp = datetime.now().strftime("%H:%M:%S")
self.showMessage((
f"Debug [{stamp}]"
f" \u2013 Widgets: {len(widgets)}"
f" \u2013 {self._traceMallocRef} Memory: {mem[0]:n}"
f" \u2013 Peak: {mem[1]:n}"
), 6000)
message = (
f"Widgets: {count} \u2013 "
f"{self._traceMallocRef} Memory: {current/1024:,.2f} kiB \u2013 "
f"Peak: {peak/1024:,.2f} kiB"
)
self.showMessage(f"Debug [{stamp}] {message}", 6000)
logger.debug("[MEMINFO] %s", message)
return