Set the value in the verse number spinbox to the next expected verse number to be inserted.

This commit is contained in:
Erik Lundin 2012-09-09 23:07:07 +02:00
commit b186a4f4ed
5 changed files with 48 additions and 72 deletions

View File

@ -365,7 +365,7 @@ class Renderer(object):
The theme information The theme information
""" """
if not theme_data.font_main_override: if not theme_data.font_main_override:
return QtCore.QRect(10, 0, self.width, self.footer_start) return QtCore.QRect(10, 0, self.width - 20, self.footer_start)
else: else:
return QtCore.QRect(theme_data.font_main_x, theme_data.font_main_y, return QtCore.QRect(theme_data.font_main_x, theme_data.font_main_y,
theme_data.font_main_width - 1, theme_data.font_main_height - 1) theme_data.font_main_width - 1, theme_data.font_main_height - 1)

View File

@ -287,7 +287,7 @@ class MediaController(object):
""" """
player.resize(display) player.resize(display)
def video(self, controller, file, muted, isBackground): def video(self, controller, file, muted, isBackground, hidden=False):
""" """
Loads and starts a video to run with the option of sound Loads and starts a video to run with the option of sound
""" """
@ -333,11 +333,19 @@ class MediaController(object):
if controller.isLive and not controller.media_info.is_background: if controller.isLive and not controller.media_info.is_background:
display.frame.evaluateJavaScript(u'show_video( \ display.frame.evaluateJavaScript(u'show_video( \
"setBackBoard", null, null, null,"visible");') "setBackBoard", null, null, null,"visible");')
# now start playing # now start playing - Preview is autoplay!
if controller.isLive and \ autoplay = False
(Settings().value(u'general/auto unblank', # Preview requested
QtCore.QVariant(False)).toBool() or \ if not controller.isLive:
controller.media_info.is_background) or not controller.isLive: autoplay = True
# Visible or background requested
elif not hidden or controller.media_info.is_background:
autoplay = True
# Unblank on load set
elif Settings().value(u'general/auto unblank',
QtCore.QVariant(False)).toBool():
autoplay = True
if autoplay:
if not self.video_play([controller]): if not self.video_play([controller]):
critical_error_message_box( critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'), translate('MediaPlugin.MediaItem', 'Unsupported File'),

View File

@ -63,37 +63,32 @@ if VLC_AVAILABLE:
VLC_AVAILABLE = False VLC_AVAILABLE = False
log.debug(u'VLC could not be loaded: %s' % version) log.debug(u'VLC could not be loaded: %s' % version)
AUDIO_EXT = [ AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg']
u'*.mp3'
, u'*.wav'
, u'*.wma'
, u'*.ogg'
]
VIDEO_EXT = [ VIDEO_EXT = [
u'*.3gp' u'*.3gp',
, u'*.asf', u'*.wmv' u'*.asf', u'*.wmv',
, u'*.au' u'*.au',
, u'*.avi' u'*.avi',
, u'*.flv' u'*.flv',
, u'*.mov' u'*.mov',
, u'*.mp4' u'*.mp4',
, u'*.ogm' u'*.ogm', u'*.ogv',
, u'*.mkv', u'*.mka' u'*.mkv', u'*.mka',
, u'*.ts', u'*.mpg' u'*.ts', u'*.mpg',
, u'*.mpg', u'*.mp2' u'*.mpg', u'*.mp2',
, u'*.nsc' u'*.nsc',
, u'*.nsv' u'*.nsv',
, u'*.nut' u'*.nut',
, u'*.ra', u'*.ram', u'*.rm', u'*.rv' ,u'*.rmbv' u'*.ra', u'*.ram', u'*.rm', u'*.rv' ,u'*.rmbv',
, u'*.a52', u'*.dts', u'*.aac', u'*.flac' ,u'*.dv', u'*.vid' u'*.a52', u'*.dts', u'*.aac', u'*.flac' ,u'*.dv', u'*.vid',
, u'*.tta', u'*.tac' u'*.tta', u'*.tac',
, u'*.ty' u'*.ty',
, u'*.dts' u'*.dts',
, u'*.xa' u'*.xa',
, u'*.iso' u'*.iso',
, u'*.vob' u'*.vob'
] ]
class VlcPlayer(MediaPlayer): class VlcPlayer(MediaPlayer):

View File

@ -1347,7 +1347,7 @@ class SlideController(Controller):
""" """
log.debug(u'SlideController onMediaStart') log.debug(u'SlideController onMediaStart')
file = os.path.join(item.get_frame_path(), item.get_frame_title()) file = os.path.join(item.get_frame_path(), item.get_frame_title())
self.mediaController.video(self, file, False, False) self.mediaController.video(self, file, False, False, self.hideMode())
if not self.isLive or self.mediaController.withLivePreview: if not self.isLive or self.mediaController.withLivePreview:
self.previewDisplay.show() self.previewDisplay.show()
self.slidePreview.hide() self.slidePreview.hide()

View File

@ -92,6 +92,12 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
self.verseNumberBox.value()) self.verseNumberBox.value())
def onVerseTypeComboBoxChanged(self): def onVerseTypeComboBoxChanged(self):
self.updateSuggestedVerseNumber()
def onCursorPositionChanged(self):
self.updateSuggestedVerseNumber()
def updateSuggestedVerseNumber(self):
""" """
Adjusts the verse number SpinBox in regard to the selected verse type Adjusts the verse number SpinBox in regard to the selected verse type
and the cursor's position. and the cursor's position.
@ -115,43 +121,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if match: if match:
verse_tag = match.group(1) verse_tag = match.group(1)
try: try:
verse_num = int(match.group(2)) verse_num = int(match.group(2)) + 1
except ValueError: except ValueError:
verse_num = 1 verse_num = 1
if VerseType.from_loose_input(verse_tag, False): self.verseNumberBox.setValue(verse_num)
self.verseNumberBox.setValue(verse_num)
def onCursorPositionChanged(self):
"""
Determines the previous verse type and number in regard to the cursor's
position and adjusts the ComboBox and SpinBox to these values.
"""
position = self.verseTextEdit.textCursor().position()
text = unicode(self.verseTextEdit.toPlainText())
if not text:
return
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \
text.find(u']', position) < text.find(u'[', position):
return
position = text.rfind(u'---[', 0, position)
if position == -1:
return
text = text[position:]
position = text.find(u']---')
if position == -1:
return
text = text[:position + 4]
match = VERSE_REGEX.match(text)
if match:
verse_type = match.group(1)
verse_type_index = VerseType.from_loose_input(verse_type, None)
try:
verse_number = int(match.group(2))
except ValueError:
verse_number = 1
if verse_type_index is not None:
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
self.verseNumberBox.setValue(verse_number)
def setVerse(self, text, single=False, def setVerse(self, text, single=False,
tag=u'%s1' % VerseType.Tags[VerseType.Verse]): tag=u'%s1' % VerseType.Tags[VerseType.Verse]):