More code cleanups and bug fixes from previous cleanups

bzr-revno: 2218
This commit is contained in:
Tim Bentley 2013-03-26 07:48:38 +00:00
commit b3d453c9b8
18 changed files with 103 additions and 99 deletions

View File

@ -156,8 +156,7 @@ class OpenLP(QtGui.QApplication):
def is_already_running(self): def is_already_running(self):
""" """
Look to see if OpenLP is already running and ask if a 2nd copy Look to see if OpenLP is already running and ask if a 2nd instance is to be started.
is to be started.
""" """
self.shared_memory = QtCore.QSharedMemory('OpenLP') self.shared_memory = QtCore.QSharedMemory('OpenLP')
if self.shared_memory.attach(): if self.shared_memory.attach():

View File

@ -38,6 +38,7 @@ from PyQt4 import QtCore, QtGui, Qt
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class ServiceItemContext(object): class ServiceItemContext(object):
""" """
The context in which a Service Item is being generated The context in which a Service Item is being generated

View File

@ -94,7 +94,7 @@ class MediaManagerItem(QtGui.QWidget):
self.remote_triggered = None self.remote_triggered = None
self.single_service_item = True self.single_service_item = True
self.quick_preview_allowed = False self.quick_preview_allowed = False
self.hasSearch = False self.has_search = False
self.page_layout = QtGui.QVBoxLayout(self) self.page_layout = QtGui.QVBoxLayout(self)
self.page_layout.setSpacing(0) self.page_layout.setSpacing(0)
self.page_layout.setMargin(0) self.page_layout.setMargin(0)

View File

@ -48,7 +48,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
self.mimeDataText = name self.mimeDataText = name
self.allow_internal_dnd = False self.allow_internal_dnd = False
self.header().close() self.header().close()
self.defaultIndentation = self.indentation() self.default_indentation = self.indentation()
self.setIndentation(0) self.setIndentation(0)
self.setAnimated(True) self.setAnimated(True)
assert(self.mimeDataText) assert(self.mimeDataText)
@ -125,13 +125,13 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
event.accept() event.accept()
files = [] files = []
for url in event.mimeData().urls(): for url in event.mimeData().urls():
localFile = url.toLocalFile() local_file = url.toLocalFile()
if os.path.isfile(localFile): if os.path.isfile(local_file):
files.append(localFile) files.append(local_file)
elif os.path.isdir(localFile): elif os.path.isdir(local_file):
listing = os.listdir(localFile) listing = os.listdir(local_file)
for file_name in listing: for file_name in listing:
files.append(os.path.join(localFile, file_name)) files.append(os.path.join(local_file, file_name))
Registry().execute(u'%s_dnd' % self.mimeDataText, {'files': files, 'target': self.itemAt(event.pos())}) Registry().execute(u'%s_dnd' % self.mimeDataText, {'files': files, 'target': self.itemAt(event.pos())})
elif self.allow_internal_dnd: elif self.allow_internal_dnd:
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)

View File

@ -110,8 +110,8 @@ class MediaController(object):
Registry().register_function(u'playbackPlay', self.media_play_msg) Registry().register_function(u'playbackPlay', self.media_play_msg)
Registry().register_function(u'playbackPause', self.media_pause_msg) Registry().register_function(u'playbackPause', self.media_pause_msg)
Registry().register_function(u'playbackStop', self.media_stop_msg) Registry().register_function(u'playbackStop', self.media_stop_msg)
Registry().register_function(u'seekSlider', self.media_seek_msg) Registry().register_function(u'seek_slider', self.media_seek_msg)
Registry().register_function(u'volumeSlider', self.media_volume_msg) Registry().register_function(u'volume_slider', self.media_volume_msg)
Registry().register_function(u'media_hide', self.media_hide) Registry().register_function(u'media_hide', self.media_hide)
Registry().register_function(u'media_blank', self.media_blank) Registry().register_function(u'media_blank', self.media_blank)
Registry().register_function(u'media_unblank', self.media_unblank) Registry().register_function(u'media_unblank', self.media_unblank)
@ -215,7 +215,7 @@ class MediaController(object):
for source in self.current_media_players.keys(): for source in self.current_media_players.keys():
if self.current_media_players[source].state != MediaState.Paused: if self.current_media_players[source].state != MediaState.Paused:
display = self._define_display(self.display_controllers[source]) display = self._define_display(self.display_controllers[source])
display.controller.seekSlider.setSliderPosition(0) display.controller.seek_slider.setSliderPosition(0)
self.timer.stop() self.timer.stop()
def get_media_display_css(self): def get_media_display_css(self):
@ -277,32 +277,32 @@ class MediaController(object):
controller.mediabar.add_toolbar_action(u'playbackStop', text=u'media_playback_stop', controller.mediabar.add_toolbar_action(u'playbackStop', text=u'media_playback_stop',
icon=u':/slides/media_playback_stop.png', icon=u':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.send_to_plugins) tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.send_to_plugins)
# Build the seekSlider. # Build the seek_slider.
controller.seekSlider = MediaSlider(QtCore.Qt.Horizontal, self, controller) controller.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, controller)
controller.seekSlider.setMaximum(1000) controller.seek_slider.setMaximum(1000)
controller.seekSlider.setTracking(True) controller.seek_slider.setTracking(True)
controller.seekSlider.setMouseTracking(True) controller.seek_slider.setMouseTracking(True)
controller.seekSlider.setToolTip(translate('OpenLP.SlideController', 'Video position.')) controller.seek_slider.setToolTip(translate('OpenLP.SlideController', 'Video position.'))
controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) controller.seek_slider.setGeometry(QtCore.QRect(90, 260, 221, 24))
controller.seekSlider.setObjectName(u'seekSlider') controller.seek_slider.setObjectName(u'seek_slider')
controller.mediabar.add_toolbar_widget(controller.seekSlider) controller.mediabar.add_toolbar_widget(controller.seek_slider)
# Build the volumeSlider. # Build the volume_slider.
controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal) controller.volume_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
controller.volumeSlider.setTickInterval(10) controller.volume_slider.setTickInterval(10)
controller.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove) controller.volume_slider.setTickPosition(QtGui.QSlider.TicksAbove)
controller.volumeSlider.setMinimum(0) controller.volume_slider.setMinimum(0)
controller.volumeSlider.setMaximum(100) controller.volume_slider.setMaximum(100)
controller.volumeSlider.setTracking(True) controller.volume_slider.setTracking(True)
controller.volumeSlider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.')) controller.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.'))
controller.volumeSlider.setValue(controller.media_info.volume) controller.volume_slider.setValue(controller.media_info.volume)
controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24)) controller.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24))
controller.volumeSlider.setObjectName(u'volumeSlider') controller.volume_slider.setObjectName(u'volume_slider')
controller.mediabar.add_toolbar_widget(controller.volumeSlider) controller.mediabar.add_toolbar_widget(controller.volume_slider)
controller.controller_layout.addWidget(controller.mediabar) controller.controller_layout.addWidget(controller.mediabar)
controller.mediabar.setVisible(False) controller.mediabar.setVisible(False)
# Signals # Signals
controller.seekSlider.valueChanged.connect(controller.send_to_plugins) controller.seek_slider.valueChanged.connect(controller.send_to_plugins)
controller.volumeSlider.valueChanged.connect(controller.send_to_plugins) controller.volume_slider.valueChanged.connect(controller.send_to_plugins)
def setup_display(self, display, preview): def setup_display(self, display, preview):
""" """
@ -381,7 +381,7 @@ class MediaController(object):
# stop running videos # stop running videos
self.media_reset(controller) self.media_reset(controller)
controller.media_info = MediaInfo() controller.media_info = MediaInfo()
controller.media_info.volume = controller.volumeSlider.value() controller.media_info.volume = controller.volume_slider.value()
controller.media_info.is_background = video_behind_text controller.media_info.is_background = video_behind_text
controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path()) controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path())
display = self._define_display(controller) display = self._define_display(controller)
@ -465,12 +465,12 @@ class MediaController(object):
``service_item`` ``service_item``
The ServiceItem containing the details to be played. The ServiceItem containing the details to be played.
""" """
usedPlayers = get_media_players()[0] used_players = get_media_players()[0]
if service_item.title != UiStrings().Automatic: if service_item.title != UiStrings().Automatic:
usedPlayers = [service_item.title.lower()] used_players = [service_item.title.lower()]
if controller.media_info.file_info.isFile(): if controller.media_info.file_info.isFile():
suffix = u'*.%s' % controller.media_info.file_info.suffix().lower() suffix = u'*.%s' % controller.media_info.file_info.suffix().lower()
for title in usedPlayers: for title in used_players:
player = self.media_players[title] player = self.media_players[title]
if suffix in player.video_extensions_list: if suffix in player.video_extensions_list:
if not controller.media_info.is_background or controller.media_info.is_background and \ if not controller.media_info.is_background or controller.media_info.is_background and \
@ -486,7 +486,7 @@ class MediaController(object):
controller.media_info.media_type = MediaType.Audio controller.media_info.media_type = MediaType.Audio
return True return True
else: else:
for title in usedPlayers: for title in used_players:
player = self.media_players[title] player = self.media_players[title]
if player.can_folder: if player.can_folder:
self.resize(display, player) self.resize(display, player)
@ -515,12 +515,12 @@ class MediaController(object):
The controller to be played The controller to be played
""" """
log.debug(u'media_play') log.debug(u'media_play')
controller.seekSlider.blockSignals(True) controller.seek_slider.blockSignals(True)
controller.volumeSlider.blockSignals(True) controller.volume_slider.blockSignals(True)
display = self._define_display(controller) display = self._define_display(controller)
if not self.current_media_players[controller.controller_type].play(display): if not self.current_media_players[controller.controller_type].play(display):
controller.seekSlider.blockSignals(False) controller.seek_slider.blockSignals(False)
controller.volumeSlider.blockSignals(False) controller.volume_slider.blockSignals(False)
return False return False
if controller.media_info.is_background: if controller.media_info.is_background:
self.media_volume(controller, 0) self.media_volume(controller, 0)
@ -543,8 +543,8 @@ class MediaController(object):
# Start Timer for ui updates # Start Timer for ui updates
if not self.timer.isActive(): if not self.timer.isActive():
self.timer.start() self.timer.start()
controller.seekSlider.blockSignals(False) controller.seek_slider.blockSignals(False)
controller.volumeSlider.blockSignals(False) controller.volume_slider.blockSignals(False)
return True return True
def media_pause_msg(self, msg): def media_pause_msg(self, msg):
@ -594,7 +594,7 @@ class MediaController(object):
display.frame.evaluateJavaScript(u'show_blank("black");') display.frame.evaluateJavaScript(u'show_blank("black");')
self.current_media_players[controller.controller_type].stop(display) self.current_media_players[controller.controller_type].stop(display)
self.current_media_players[controller.controller_type].set_visible(display, False) self.current_media_players[controller.controller_type].set_visible(display, False)
controller.seekSlider.setSliderPosition(0) controller.seek_slider.setSliderPosition(0)
controller.mediabar.actions[u'playbackPlay'].setVisible(True) controller.mediabar.actions[u'playbackPlay'].setVisible(True)
controller.mediabar.actions[u'playbackStop'].setVisible(False) controller.mediabar.actions[u'playbackStop'].setVisible(False)
controller.mediabar.actions[u'playbackPause'].setVisible(False) controller.mediabar.actions[u'playbackPause'].setVisible(False)
@ -620,32 +620,35 @@ class MediaController(object):
log.debug(u'media_volume %d' % volume) log.debug(u'media_volume %d' % volume)
display = self._define_display(controller) display = self._define_display(controller)
self.current_media_players[controller.controller_type].volume(display, volume) self.current_media_players[controller.controller_type].volume(display, volume)
controller.volumeSlider.setValue(volume) controller.volume_slider.setValue(volume)
def media_seek_msg(self, msg): def media_seek_msg(self, msg):
""" """
Responds to the request to change the seek Slider of a loaded video Responds to the request to change the seek Slider of a loaded video via a message
``msg`` ``msg``
First element is the controller which should be used First element is the controller which should be used
Second element is a list with the seek Value as first element Second element is a list with the seek value as first element
""" """
log.debug(u'media_seek') log.debug(u'media_seek')
controller = msg[0] controller = msg[0]
seekVal = msg[1][0] seek_value = msg[1][0]
self.media_seek(controller, seekVal) self.media_seek(controller, seek_value)
def media_seek(self, controller, seekVal): def media_seek(self, controller, seek_value):
""" """
Responds to the request to change the seek Slider of a loaded video Responds to the request to change the seek Slider of a loaded video
``msg`` ``controller``
First element is the controller which should be used The controller to use.
Second element is a list with the seek Value as first element
``seek_value``
The value to set.
""" """
log.debug(u'media_seek') log.debug(u'media_seek')
display = self._define_display(controller) display = self._define_display(controller)
self.current_media_players[controller.controller_type].seek(display, seekVal) self.current_media_players[controller.controller_type].seek(display, seek_value)
def media_reset(self, controller): def media_reset(self, controller):
""" """

View File

@ -103,7 +103,7 @@ class MediaPlayer(object):
""" """
pass pass
def seek(self, display, seekVal): def seek(self, display, seek_value):
""" """
Change playing position of current Media File Change playing position of current Media File
""" """

View File

@ -195,7 +195,7 @@ class PhononPlayer(MediaPlayer):
self.seek(display, controller.media_info.start_time * 1000) self.seek(display, controller.media_info.start_time * 1000)
self.volume(display, controller.media_info.volume) self.volume(display, controller.media_info.volume)
controller.media_info.length = int(display.media_object.totalTime() / 1000) controller.media_info.length = int(display.media_object.totalTime() / 1000)
controller.seekSlider.setMaximum(controller.media_info.length * 1000) controller.seek_slider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing self.state = MediaState.Playing
display.phonon_widget.raise_() display.phonon_widget.raise_()
return True return True
@ -225,11 +225,11 @@ class PhononPlayer(MediaPlayer):
vol = float(vol) / float(100) vol = float(vol) / float(100)
display.audio.setVolume(vol) display.audio.setVolume(vol)
def seek(self, display, seekVal): def seek(self, display, seek_value):
""" """
Go to a particular point in the current media item Go to a particular point in the current media item
""" """
display.media_object.seek(seekVal) display.media_object.seek(seek_value)
def reset(self, display): def reset(self, display):
""" """
@ -259,10 +259,10 @@ class PhononPlayer(MediaPlayer):
if display.media_object.currentTime() > controller.media_info.end_time * 1000: if display.media_object.currentTime() > controller.media_info.end_time * 1000:
self.stop(display) self.stop(display)
self.set_visible(display, False) self.set_visible(display, False)
if not controller.seekSlider.isSliderDown(): if not controller.seek_slider.isSliderDown():
controller.seekSlider.blockSignals(True) controller.seek_slider.blockSignals(True)
controller.seekSlider.setSliderPosition(display.media_object.currentTime()) controller.seek_slider.setSliderPosition(display.media_object.currentTime())
controller.seekSlider.blockSignals(False) controller.seek_slider.blockSignals(False)
def get_media_display_css(self): def get_media_display_css(self):
""" """

View File

@ -177,13 +177,13 @@ class VlcPlayer(MediaPlayer):
controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000) controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
return True return True
def media_state_wait(self, display, mediaState): def media_state_wait(self, display, media_state):
""" """
Wait for the video to change its state Wait for the video to change its state
Wait no longer than 60 seconds. (loading an iso file needs a long time) Wait no longer than 60 seconds. (loading an iso file needs a long time)
""" """
start = datetime.now() start = datetime.now()
while not mediaState == display.vlcMedia.get_state(): while not media_state == display.vlcMedia.get_state():
if display.vlcMedia.get_state() == vlc.State.Error: if display.vlcMedia.get_state() == vlc.State.Error:
return False return False
self.application.process_events() self.application.process_events()
@ -212,7 +212,7 @@ class VlcPlayer(MediaPlayer):
if start_time > 0: if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000) self.seek(display, controller.media_info.start_time * 1000)
controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000) controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
controller.seekSlider.setMaximum(controller.media_info.length * 1000) controller.seek_slider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing self.state = MediaState.Playing
display.vlcWidget.raise_() display.vlcWidget.raise_()
return True return True
@ -241,12 +241,12 @@ class VlcPlayer(MediaPlayer):
if display.has_audio: if display.has_audio:
display.vlcMediaPlayer.audio_set_volume(vol) display.vlcMediaPlayer.audio_set_volume(vol)
def seek(self, display, seekVal): def seek(self, display, seek_value):
""" """
Go to a particular position Go to a particular position
""" """
if display.vlcMediaPlayer.is_seekable(): if display.vlcMediaPlayer.is_seekable():
display.vlcMediaPlayer.set_time(seekVal) display.vlcMediaPlayer.set_time(seek_value)
def reset(self, display): def reset(self, display):
""" """
@ -275,10 +275,10 @@ class VlcPlayer(MediaPlayer):
if display.vlcMediaPlayer.get_time() > controller.media_info.end_time * 1000: if display.vlcMediaPlayer.get_time() > controller.media_info.end_time * 1000:
self.stop(display) self.stop(display)
self.set_visible(display, False) self.set_visible(display, False)
if not controller.seekSlider.isSliderDown(): if not controller.seek_slider.isSliderDown():
controller.seekSlider.blockSignals(True) controller.seek_slider.blockSignals(True)
controller.seekSlider.setSliderPosition(display.vlcMediaPlayer.get_time()) controller.seek_slider.setSliderPosition(display.vlcMediaPlayer.get_time())
controller.seekSlider.blockSignals(False) controller.seek_slider.blockSignals(False)
def get_info(self): def get_info(self):
""" """

View File

@ -393,27 +393,27 @@ class WebkitPlayer(MediaPlayer):
display.frame.evaluateJavaScript(u'show_video("stop");') display.frame.evaluateJavaScript(u'show_video("stop");')
self.state = MediaState.Stopped self.state = MediaState.Stopped
def volume(self, display, vol): def volume(self, display, volume):
""" """
Set the volume Set the volume
""" """
controller = display.controller controller = display.controller
# 1.0 is the highest value # 1.0 is the highest value
if display.has_audio: if display.has_audio:
vol = float(vol) / float(100) vol = float(volume) / float(100)
if not controller.media_info.is_flash: if not controller.media_info.is_flash:
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol)) display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol))
def seek(self, display, seekVal): def seek(self, display, seek_value):
""" """
Go to a position in the video Go to a position in the video
""" """
controller = display.controller controller = display.controller
if controller.media_info.is_flash: if controller.media_info.is_flash:
seek = seekVal seek = seek_value
display.frame.evaluateJavaScript(u'show_flash("seek", null, null, "%s");' % (seek)) display.frame.evaluateJavaScript(u'show_flash("seek", null, null, "%s");' % (seek))
else: else:
seek = float(seekVal) / 1000 seek = float(seek_value) / 1000
display.frame.evaluateJavaScript(u'show_video("seek", null, null, null, "%f");' % (seek)) display.frame.evaluateJavaScript(u'show_video("seek", null, null, null, "%f");' % (seek))
def reset(self, display): def reset(self, display):
@ -462,11 +462,11 @@ class WebkitPlayer(MediaPlayer):
length = int(length * 1000) length = int(length * 1000)
if currentTime > 0: if currentTime > 0:
controller.media_info.length = length controller.media_info.length = length
controller.seekSlider.setMaximum(length) controller.seek_slider.setMaximum(length)
if not controller.seekSlider.isSliderDown(): if not controller.seek_slider.isSliderDown():
controller.seekSlider.blockSignals(True) controller.seek_slider.blockSignals(True)
controller.seekSlider.setSliderPosition(currentTime) controller.seek_slider.setSliderPosition(currentTime)
controller.seekSlider.blockSignals(False) controller.seek_slider.blockSignals(False)
def get_info(self): def get_info(self):
""" """

View File

@ -98,8 +98,9 @@ class SlideController(DisplayController):
u'loop_separator', u'loop_separator',
u'delay_spin_box' u'delay_spin_box'
] ]
# audioPauseItem is also in Settings so any changes need to be paired
self.audio_list = [ self.audio_list = [
u'audio_pause_item', u'audioPauseItem',
u'audio_time_label' u'audio_time_label'
] ]
self.wide_menu = [ self.wide_menu = [

View File

@ -87,11 +87,11 @@ class AlertsManager(QtCore.QObject):
if not self.alert_list: if not self.alert_list:
return return
text = self.alert_list.pop(0) text = self.alert_list.pop(0)
alertTab = self.parent().settingsTab alert_tab = self.parent().settings_tab
self.live_controller.display.alert(text, alertTab.location) self.live_controller.display.alert(text, alert_tab.location)
# Check to see if we have a timer running. # Check to see if we have a timer running.
if self.timer_id == 0: if self.timer_id == 0:
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000) self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000)
def timerEvent(self, event): def timerEvent(self, event):
""" """
@ -103,7 +103,7 @@ class AlertsManager(QtCore.QObject):
""" """
log.debug(u'timer event') log.debug(u'timer event')
if event.timerId() == self.timer_id: if event.timerId() == self.timer_id:
alertTab = self.parent().settingsTab alertTab = self.parent().settings_tab
self.live_controller.display.alert(u'', alertTab.location) self.live_controller.display.alert(u'', alertTab.location)
self.killTimer(self.timer_id) self.killTimer(self.timer_id)
self.timer_id = 0 self.timer_id = 0

View File

@ -67,7 +67,7 @@ class BibleMediaItem(MediaManagerItem):
# Place to store the search results for both bibles. # Place to store the search results for both bibles.
self.settings = self.plugin.settings_tab self.settings = self.plugin.settings_tab
self.quick_preview_allowed = True self.quick_preview_allowed = True
self.hasSearch = True self.has_search = True
self.search_results = {} self.search_results = {}
self.second_search_results = {} self.second_search_results = {}
self.check_search_result() self.check_search_result()

View File

@ -60,7 +60,7 @@ class CustomMediaItem(MediaManagerItem):
self.edit_custom_form = EditCustomForm(self, self.main_window, self.plugin.manager) self.edit_custom_form = EditCustomForm(self, self.main_window, self.plugin.manager)
self.single_service_item = False self.single_service_item = False
self.quick_preview_allowed = True self.quick_preview_allowed = True
self.hasSearch = True self.has_search = True
# Holds information about whether the edit is remotely triggered and # Holds information about whether the edit is remotely triggered and
# which Custom is required. # which Custom is required.
self.remoteCustom = -1 self.remoteCustom = -1

View File

@ -53,7 +53,7 @@ class ImageMediaItem(MediaManagerItem):
self.icon_path = u'images/image' self.icon_path = u'images/image'
MediaManagerItem.__init__(self, parent, plugin) MediaManagerItem.__init__(self, parent, plugin)
self.quick_preview_allowed = True self.quick_preview_allowed = True
self.hasSearch = True self.has_search = True
self.manager = plugin.manager self.manager = plugin.manager
self.choose_group_form = ChooseGroupForm(self) self.choose_group_form = ChooseGroupForm(self)
self.add_group_form = AddGroupForm(self) self.add_group_form = AddGroupForm(self)
@ -89,7 +89,7 @@ class ImageMediaItem(MediaManagerItem):
log.debug(u'initialise') log.debug(u'initialise')
self.list_view.clear() self.list_view.clear()
self.list_view.setIconSize(QtCore.QSize(88, 50)) self.list_view.setIconSize(QtCore.QSize(88, 50))
self.list_view.setIndentation(self.list_view.defaultIndentation) self.list_view.setIndentation(self.list_view.default_indentation)
self.list_view.allow_internal_dnd = True self.list_view.allow_internal_dnd = True
self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails') self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails')
check_directory_exists(self.servicePath) check_directory_exists(self.servicePath)

View File

@ -59,7 +59,7 @@ class MediaMediaItem(MediaManagerItem):
self.automatic = u'' self.automatic = u''
MediaManagerItem.__init__(self, parent, plugin) MediaManagerItem.__init__(self, parent, plugin)
self.single_service_item = False self.single_service_item = False
self.hasSearch = True self.has_search = True
self.media_object = None self.media_object = None
self.display_controller = DisplayController(parent) self.display_controller = DisplayController(parent)
self.display_controller.controller_layout = QtGui.QVBoxLayout() self.display_controller.controller_layout = QtGui.QVBoxLayout()

View File

@ -58,7 +58,7 @@ class PresentationMediaItem(MediaManagerItem):
self.Automatic = u'' self.Automatic = u''
MediaManagerItem.__init__(self, parent, plugin) MediaManagerItem.__init__(self, parent, plugin)
self.message_listener = MessageListener(self) self.message_listener = MessageListener(self)
self.hasSearch = True self.has_search = True
self.single_service_item = False self.single_service_item = False
Registry().register_function(u'mediaitem_presentation_rebuild', self.populate_display_types) Registry().register_function(u'mediaitem_presentation_rebuild', self.populate_display_types)
Registry().register_function(u'mediaitem_suffixes', self.build_file_mask_string) Registry().register_function(u'mediaitem_suffixes', self.build_file_mask_string)

View File

@ -492,7 +492,7 @@ class HttpConnection(object):
if action == u'search': if action == u'search':
searches = [] searches = []
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.status == PluginStatus.Active and plugin.media_item and plugin.mediaItem.hasSearch: if plugin.status == PluginStatus.Active and plugin.media_item and plugin.media_item.has_search:
searches.append([plugin.name, unicode(plugin.textStrings[StringContent.Name][u'plural'])]) searches.append([plugin.name, unicode(plugin.textStrings[StringContent.Name][u'plural'])])
return HttpResponse(json.dumps({u'results': {u'items': searches}}), {u'Content-Type': u'application/json'}) return HttpResponse(json.dumps({u'results': {u'items': searches}}), {u'Content-Type': u'application/json'})
@ -509,7 +509,7 @@ class HttpConnection(object):
return HttpResponse(code=u'400 Bad Request') return HttpResponse(code=u'400 Bad Request')
text = urllib.unquote(text) text = urllib.unquote(text)
plugin = self.plugin_manager.get_plugin_by_name(plugin_name) plugin = self.plugin_manager.get_plugin_by_name(plugin_name)
if plugin.status == PluginStatus.Active and plugin.media_item and plugin.mediaItem.hasSearch: if plugin.status == PluginStatus.Active and plugin.media_item and plugin.media_item.has_search:
results = plugin.media_item.search(text, False) results = plugin.media_item.search(text, False)
else: else:
results = [] results = []

View File

@ -81,7 +81,7 @@ class SongMediaItem(MediaManagerItem):
self.remoteSong = -1 self.remoteSong = -1
self.editItem = None self.editItem = None
self.quick_preview_allowed = True self.quick_preview_allowed = True
self.hasSearch = True self.has_search = True
def _updateBackgroundAudio(self, song, item): def _updateBackgroundAudio(self, song, item):
song.media_files = [] song.media_files = []