fullscreen: Add a auto-show/hide progress setting.

Realizing that the show/hide progress was being ignored if we navigate to a
scene without a goal set. Also, if we go fullscreen on a scene without a goal
then navigate to a scene with one, the progress wouldn't get shown. Adding the
"Auto Show/Hide" setting fixes the issue with all use cases.
This commit is contained in:
Youness Alaoui 2019-03-29 17:04:22 -04:00 committed by Curtis Gedak
parent 8900a0ed3f
commit 156e2d0067

View file

@ -165,6 +165,7 @@ class fullScreenEditor(QWidget):
self.bottomPanel.addDisplay(self.tr("Theme selector"), 'bottom-theme', (self.lstThemes, themeLabel))
self.bottomPanel.addDisplay(self.tr("Word count"), 'bottom-wc', (self.lblWC, ))
self.bottomPanel.addDisplay(self.tr("Progress"), 'bottom-progress', (self.lblProgress, ))
self.bottomPanel.addSetting(self.tr("Progress: Auto Show/Hide"), 'progress-auto-show', True)
self.bottomPanel.addDisplay(self.tr("Clock"), 'bottom-clock', (self.lblClock, ))
self.bottomPanel.addSetting(self.tr("Clock: Show Seconds"), 'clock-show-seconds', True)
self.bottomPanel.setAutoHideVariable('autohide-bottom')
@ -357,18 +358,22 @@ class fullScreenEditor(QWidget):
pg = item.data(Outline.goalPercentage)
if goal:
rect = self.lblProgress.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, pg, 2)
p.end()
self.lblProgress.setPixmap(self.px)
if settings.fullscreenSettings.get("progress-auto-show", True):
self.lblProgress.show()
self.lblWC.setText(self.tr("{} words / {}").format(wc, goal))
else:
self.lblProgress.hide()
if settings.fullscreenSettings.get("progress-auto-show", True):
self.lblProgress.hide()
self.lblWC.setText(self.tr("{} words").format(wc))
pg = 0
rect = self.lblProgress.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, pg, 2)
p.end()
self.lblProgress.setPixmap(self.px)
self.locker.setWordCount(wc)
# If there's a goal, then we update the locker target's number of word accordingly