Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when setting word Goal on new Text (scene) in Outline pane #609

Merged
merged 1 commit into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion manuskript/functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def drawProgress(painter, rect, progress, radius=0):
painter.setBrush(QBrush(colorFromProgress(progress)))

r2 = QRect(rect)
r2.setWidth(r2.width() * min(progress, 1))
r2.setWidth(r2.width() * min(toInt(progress), 1))
# ^^^^^ Avoid crash - issue #561
painter.drawRoundedRect(r2, radius, radius)


Expand Down
5 changes: 3 additions & 2 deletions manuskript/ui/editors/mainEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from manuskript import settings
from manuskript.enums import Outline
from manuskript.functions import AUC, mainWindow, drawProgress, appPath
from manuskript.functions import AUC, mainWindow, drawProgress, appPath, toInt
from manuskript.ui import style
from manuskript.ui.editors.editorWidget import editorWidget
from manuskript.ui.editors.fullScreenEditor import fullScreenEditor
Expand Down Expand Up @@ -319,7 +319,8 @@ def updateStats(self):
self.lblRedacProgress.setPixmap(self.px)
self.lblRedacWC.setText(self.tr("{} words / {} ").format(
locale.format_string("%d", wc, grouping=True),
locale.format_string("%d", goal, grouping=True)))
locale.format_string("%d", toInt(goal), grouping=True)))
# ^^^^^ Avoid crash - issue #561
else:
self.lblRedacProgress.hide()
self.lblRedacWC.setText(self.tr("{} words ").format(
Expand Down