forked from openlp/openlp
Reset the clipselector on each load.
This commit is contained in:
parent
a999e59a4f
commit
87e7310e2b
@ -26,6 +26,8 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
|
|
||||||
@ -129,6 +131,7 @@ class Ui_MediaClipSelector(object):
|
|||||||
self.gridLayout.addWidget(self.audio_track_label, 3, 0, 1, 2)
|
self.gridLayout.addWidget(self.audio_track_label, 3, 0, 1, 2)
|
||||||
self.media_position_timeedit = QtGui.QTimeEdit(self.centralwidget)
|
self.media_position_timeedit = QtGui.QTimeEdit(self.centralwidget)
|
||||||
self.media_position_timeedit.setEnabled(True)
|
self.media_position_timeedit.setEnabled(True)
|
||||||
|
self.media_position_timeedit.setReadOnly(True)
|
||||||
self.media_position_timeedit.setObjectName("media_position_timeedit")
|
self.media_position_timeedit.setObjectName("media_position_timeedit")
|
||||||
self.gridLayout.addWidget(self.media_position_timeedit, 6, 4, 1, 1)
|
self.gridLayout.addWidget(self.media_position_timeedit, 6, 4, 1, 1)
|
||||||
self.media_view_frame = QtGui.QFrame(self.centralwidget)
|
self.media_view_frame = QtGui.QFrame(self.centralwidget)
|
||||||
|
@ -35,7 +35,6 @@ import sys
|
|||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'):
|
||||||
import dbus
|
import dbus
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
@ -62,10 +61,6 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
super(MediaClipSelectorForm, self).__init__(parent)
|
super(MediaClipSelectorForm, self).__init__(parent)
|
||||||
self.media_item = media_item
|
self.media_item = media_item
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.playback_length = 0
|
|
||||||
self.position_horizontalslider.setMinimum(0)
|
|
||||||
self.disable_all()
|
|
||||||
self.toggle_disable_load_media(False)
|
|
||||||
# most actions auto-connect due to the functions name, so only a few left to do
|
# most actions auto-connect due to the functions name, so only a few left to do
|
||||||
self.close_pushbutton.clicked.connect(self.reject)
|
self.close_pushbutton.clicked.connect(self.reject)
|
||||||
# setup play/pause icon
|
# setup play/pause icon
|
||||||
@ -79,16 +74,43 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
Exit Dialog and do not save
|
Exit Dialog and do not save
|
||||||
"""
|
"""
|
||||||
log.debug('MediaClipSelectorForm.reject')
|
log.debug('MediaClipSelectorForm.reject')
|
||||||
|
# Tear down vlc
|
||||||
|
if self.vlc_media_player:
|
||||||
self.vlc_media_player.stop()
|
self.vlc_media_player.stop()
|
||||||
|
self.vlc_media_player.release()
|
||||||
|
self.vlc_media_player = None
|
||||||
|
if self.vlc_instance:
|
||||||
|
self.vlc_instance.release()
|
||||||
|
self.vlc_instance = None
|
||||||
|
if self.vlc_media:
|
||||||
|
self.vlc_media.release()
|
||||||
|
self.vlc_media = None
|
||||||
QtGui.QDialog.reject(self)
|
QtGui.QDialog.reject(self)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
"""
|
"""
|
||||||
Start dialog
|
Start dialog
|
||||||
"""
|
"""
|
||||||
|
self.reset_ui()
|
||||||
self.setup_vlc()
|
self.setup_vlc()
|
||||||
return QtGui.QDialog.exec_(self)
|
return QtGui.QDialog.exec_(self)
|
||||||
|
|
||||||
|
def reset_ui(self):
|
||||||
|
"""
|
||||||
|
Reset the UI to default values
|
||||||
|
"""
|
||||||
|
self.playback_length = 0
|
||||||
|
self.position_horizontalslider.setMinimum(0)
|
||||||
|
self.disable_all()
|
||||||
|
self.toggle_disable_load_media(False)
|
||||||
|
self.subtitle_tracks_combobox.clear()
|
||||||
|
self.audio_tracks_combobox.clear()
|
||||||
|
self.title_combo_box.clear()
|
||||||
|
time = QtCore.QTime()
|
||||||
|
self.start_timeedit.setTime(time)
|
||||||
|
self.end_timeedit.setTime(time)
|
||||||
|
self.media_position_timeedit.setTime(time)
|
||||||
|
|
||||||
def setup_vlc(self):
|
def setup_vlc(self):
|
||||||
"""
|
"""
|
||||||
Setup VLC instance and mediaplayer
|
Setup VLC instance and mediaplayer
|
||||||
@ -286,6 +308,8 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
:param index: The index of the newly chosen title track.
|
:param index: The index of the newly chosen title track.
|
||||||
"""
|
"""
|
||||||
log.debug('in on_title_combo_box_changed, index: %d', index)
|
log.debug('in on_title_combo_box_changed, index: %d', index)
|
||||||
|
if not self.vlc_media_player:
|
||||||
|
return
|
||||||
self.vlc_media_player.set_title(index)
|
self.vlc_media_player.set_title(index)
|
||||||
self.vlc_media_player.set_time(0)
|
self.vlc_media_player.set_time(0)
|
||||||
self.vlc_media_player.play()
|
self.vlc_media_player.play()
|
||||||
@ -323,6 +347,7 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
playback_length_time = time.addMSecs(rounded_vlc_ms_length)
|
playback_length_time = time.addMSecs(rounded_vlc_ms_length)
|
||||||
self.start_timeedit.setMaximumTime(playback_length_time)
|
self.start_timeedit.setMaximumTime(playback_length_time)
|
||||||
self.end_timeedit.setMaximumTime(playback_length_time)
|
self.end_timeedit.setMaximumTime(playback_length_time)
|
||||||
|
self.end_timeedit.setTime(playback_length_time)
|
||||||
# If a title or audio track is available the player is enabled
|
# If a title or audio track is available the player is enabled
|
||||||
if self.title_combo_box.count() > 0 or len(audio_tracks) > 0:
|
if self.title_combo_box.count() > 0 or len(audio_tracks) > 0:
|
||||||
self.toggle_disable_player(False)
|
self.toggle_disable_player(False)
|
||||||
@ -334,6 +359,8 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
|
|
||||||
:param index: The index of the newly chosen audio track.
|
:param index: The index of the newly chosen audio track.
|
||||||
"""
|
"""
|
||||||
|
if not self.vlc_media_player:
|
||||||
|
return
|
||||||
audio_track = self.audio_tracks_combobox.itemData(index)
|
audio_track = self.audio_tracks_combobox.itemData(index)
|
||||||
log.debug('in on_audio_tracks_combobox_currentIndexChanged, index: %d audio_track: %s' % (index, audio_track))
|
log.debug('in on_audio_tracks_combobox_currentIndexChanged, index: %d audio_track: %s' % (index, audio_track))
|
||||||
if audio_track and int(audio_track) > 0:
|
if audio_track and int(audio_track) > 0:
|
||||||
@ -346,6 +373,8 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
|
|||||||
|
|
||||||
:param index: The index of the newly chosen subtitle.
|
:param index: The index of the newly chosen subtitle.
|
||||||
"""
|
"""
|
||||||
|
if not self.vlc_media_player:
|
||||||
|
return
|
||||||
subtitle_track = self.subtitle_tracks_combobox.itemData(index)
|
subtitle_track = self.subtitle_tracks_combobox.itemData(index)
|
||||||
if subtitle_track:
|
if subtitle_track:
|
||||||
self.vlc_media_player.video_set_spu(int(subtitle_track))
|
self.vlc_media_player.video_set_spu(int(subtitle_track))
|
||||||
|
@ -227,6 +227,9 @@
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>HH:mm:ss.z</string>
|
<string>HH:mm:ss.z</string>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user