Skip to content

Commit

Permalink
added a few OSD msgs where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ozmartian committed May 28, 2017
1 parent c8629c9 commit 00bb064
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions vidcutter/videocutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(self, parent: QWidget):
# noinspection PyArgumentList
self.osdButton = QPushButton(icon=self.osdIcon, flat=True, iconSize=QSize(16, 16), checkable=True,
statusTip='Toggle on-screen-display', cursor=Qt.PointingHandCursor,
objectName='osdButton')
toggled=self.toggleOSD, objectName='osdButton')
if self.enableOSD:
self.osdButton.setChecked(True)

Expand Down Expand Up @@ -325,8 +325,8 @@ def initMPV(self) -> None:
osc=False,
osd_font='Futura LT',
osd_level=0,
osd_align_x='center',
osd_align_y='center',
osd_align_x='left',
osd_align_y='top',
cursor_autohide=False,
input_cursor=False,
input_default_bindings=False,
Expand Down Expand Up @@ -803,8 +803,8 @@ def playMedia(self) -> None:
self.frameCounter.clearFocus()
self.mediaPlayer.pause = not self.mediaPlayer.pause

def showText(self, text: str, duration: int = 3) -> None:
if not self.osdButton.isChecked():
def showText(self, text: str, duration: int = 3, override: bool = False) -> None:
if not self.osdButton.isChecked() and not override:
return
if len(text.strip()) and self.mediaAvailable:
self.mediaPlayer.show_text(text, duration * 1000, 0)
Expand Down Expand Up @@ -858,9 +858,11 @@ def positionAtClip(self, item: QListWidgetItem) -> None:

def muteAudio(self) -> None:
if self.mediaPlayer.mute:
self.showText('Audio enabled')
self.muteButton.setIcon(self.unmuteIcon)
self.muteButton.setToolTip('Mute')
else:
self.showText('Audio disabled')
self.muteButton.setIcon(self.muteIcon)
self.muteButton.setToolTip('Unmute')
self.mediaPlayer.mute = not self.mediaPlayer.mute
Expand Down Expand Up @@ -1258,6 +1260,9 @@ def toggleMaximised(self) -> None:
else:
self.parent.showMaximized()

def toggleOSD(self, checked: bool) -> None:
self.showText('On screen display %s' % ('enabled' if checked else 'disabled'), override=True)

def mouseDoubleClickEvent(self, event: QMouseEvent) -> None:
self.toggleMaximised()
event.accept()
Expand Down
2 changes: 2 additions & 0 deletions vidcutter/videoslider.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ def clearRegions(self) -> None:

def toggleThumbnails(self, checked: bool) -> None:
if self._showThumbs and self._thumbnailsOn and not checked:
self.parent.showText('Timeline thumbnails disabled')
self.removeThumbs()
self.initStyle()
elif self.parent.currentMedia is not None:
self.parent.showText('Timeline thumbnails enabled')
self.timeline(self.parent.currentMedia)
self._showThumbs = checked

Expand Down

0 comments on commit 00bb064

Please sign in to comment.