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

char-count goal implement & fix translation using weblate (Japanese) #1013

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified i18n/manuskript_ja.qm
Binary file not shown.
738 changes: 381 additions & 357 deletions i18n/manuskript_ja.ts

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion manuskript/functions/spellchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ def _saveCustomDict(self):
with gzip.open(customPath, "wt") as f:
f.write(json.dumps(list(self._customDict)))


class EnchantDictionary(BasicDictionary):

def __init__(self, name):
Expand Down
4 changes: 3 additions & 1 deletion manuskript/models/outlineItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ def updateWordCount(self):
goal += F.toInt(c.data(self.enum.goal))
self._data[self.enum.goal] = goal

if goal:
if goal and not settings.countCharMode:
self.setData(self.enum.goalPercentage, wc / float(goal))
elif goal and settings.countCharMode:
self.setData(self.enum.goalPercentage, cc / float(goal))
else:
self.setData(self.enum.goalPercentage, "")

Expand Down
1 change: 1 addition & 0 deletions manuskript/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
openIndexes = [""]
progressChars = False
countSpaces = True
countCharMode = False
autoSave = False
autoSaveDelay = 5
autoSaveNoChanges = True
Expand Down
9 changes: 8 additions & 1 deletion manuskript/settingsWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ def __init__(self, mainWindow):
lambda v: self.lblTreeIconSize.setText("{}x{}".format(v, v)))
self.sldTreeIconSize.setValue(settings.viewSettings["Tree"]["iconSize"])

self.chkCountSpaces.setChecked(settings.countSpaces);
self.chkCountSpaces.setChecked(settings.countSpaces)
self.chkCountSpaces.stateChanged.connect(self.countSpacesChanged)
self.chkCountCharMode.setChecked(settings.countCharMode)
self.chkCountCharMode.stateChanged.connect(self.countCharModeChanged)

self.rdoCorkOldStyle.setChecked(settings.corkStyle == "old")
self.rdoCorkNewStyle.setChecked(settings.corkStyle == "new")
Expand Down Expand Up @@ -470,6 +472,11 @@ def countSpacesChanged(self):

self.mw.mainEditor.updateStats()

def countCharModeChanged(self):
settings.countCharMode = True if self.chkCountCharMode.checkState() else False

self.mw.mainEditor.updateStats()

def setCorkColor(self):
color = QColor(settings.corkBackground["color"])
self.colorDialog = QColorDialog(color, self)
Expand Down
27 changes: 25 additions & 2 deletions manuskript/ui/editors/mainEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def updateStats(self):
if not wc:
wc = 0

if goal:
if goal and not settings.countCharMode:
self.lblRedacProgress.show()
rect = self.lblRedacProgress.geometry()
rect = QRect(QPoint(0, 0), rect.size())
Expand All @@ -345,8 +345,31 @@ def updateStats(self):
self.lblRedacWC.setText(self.tr("{} words / {} ").format(
locale.format("%d", wc, grouping=True),
locale.format("%d", goal, grouping=True)))
self.lblRedacWC.setToolTip(self.tr("{} chars").format(
self.lblRedacWC.setToolTip(self.tr("{} chars ").format(
locale.format("%d", cc, grouping=True)))
elif goal and settings.countCharMode:
self.lblRedacProgress.show()
rect = self.lblRedacProgress.geometry()
rect = QRect(QPoint(0, 0), rect.size())
self.px = QPixmap(rect.size())
self.px.fill(Qt.transparent)
p = QPainter(self.px)
drawProgress(p, rect, progress, 2)
del p
self.lblRedacProgress.setPixmap(self.px)

if settings.progressChars:
self.lblRedacWC.setText(self.tr("({} words) {} chars / {} ").format(
locale.format("%d", wc, grouping=True),
locale.format("%d", cc, grouping=True),
locale.format("%d", goal, grouping=True)))
self.lblRedacWC.setToolTip("")
else:
self.lblRedacWC.setText(self.tr("{} chars / {} ").format(
locale.format("%d", cc, grouping=True),
locale.format("%d", goal, grouping=True)))
self.lblRedacWC.setToolTip(self.tr("{} words").format(
locale.format("%d", wc, grouping=True)))
else:
self.lblRedacProgress.hide()

Expand Down
Loading