From 668b5290247944a4c6ce14710963b7f46ca7b1e9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 5 Feb 2011 19:29:49 +0100 Subject: [PATCH 1/7] new bible search box --- openlp/plugins/bibles/lib/mediaitem.py | 30 +++++++++++--------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index c162447b2..99b8a0eaf 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \ ItemCapabilities, translate +from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import add_widget_completer, media_item_combo_box, \ critical_error_message_box from openlp.plugins.bibles.forms import BibleImportForm @@ -93,18 +94,17 @@ class BibleMediaItem(MediaManagerItem): u'quickSecondComboBox') self.quickSecondLabel.setBuddy(self.quickSecondComboBox) self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox) - self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab) - self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel') - self.quickSearchComboBox = media_item_combo_box(self.quickTab, - u'quickSearchComboBox') - self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox) - self.quickLayout.addRow(self.quickSearchTypeLabel, - self.quickSearchComboBox) self.quickSearchLabel = QtGui.QLabel(self.quickTab) self.quickSearchLabel.setObjectName(u'quickSearchLabel') - self.quickSearchEdit = QtGui.QLineEdit(self.quickTab) + self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) + self.quickSearchEdit.setSearchTypes([ + (1, u':/songs/song_topic_edit.png', + translate('BiblesPlugin.MediaItem', 'Verse Search')), + (2, u':/songs/song_search_author.png', + translate('BiblesPlugin.MediaItem', 'Text Search')) + ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) self.quickClearLabel = QtGui.QLabel(self.quickTab) self.quickClearLabel.setObjectName(u'quickClearLabel') @@ -207,8 +207,8 @@ class BibleMediaItem(MediaManagerItem): QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse) QtCore.QObject.connect(self.advancedToChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter) - QtCore.QObject.connect(self.quickSearchComboBox, - QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) + QtCore.QObject.connect(self.quickSearchEdit, + QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter) QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) # Buttons @@ -242,8 +242,6 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Version:')) self.quickSecondLabel.setText( translate('BiblesPlugin.MediaItem', 'Second:')) - self.quickSearchTypeLabel.setText( - translate('BiblesPlugin.MediaItem', 'Search type:')) self.quickSearchLabel.setText( translate('BiblesPlugin.MediaItem', 'Find:')) self.quickSearchButton.setText( @@ -268,10 +266,6 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Results:')) self.advancedSearchButton.setText( translate('BiblesPlugin.MediaItem', 'Search')) - self.quickSearchComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Verse Search')) - self.quickSearchComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Text Search')) self.quickClearComboBox.addItem( translate('BiblesPlugin.MediaItem', 'Clear')) self.quickClearComboBox.addItem( @@ -373,7 +367,7 @@ class BibleMediaItem(MediaManagerItem): """ books = [] # We have to do a 'Verse Search'. - if self.quickSearchComboBox.currentIndex() == 0: + if self.quickSearchEdit.currentSearchType() == 1: bibles = self.parent.manager.get_bibles() bible = unicode(self.quickVersionComboBox.currentText()) if bible: @@ -510,7 +504,7 @@ class BibleMediaItem(MediaManagerItem): bible = unicode(self.quickVersionComboBox.currentText()) second_bible = unicode(self.quickSecondComboBox.currentText()) text = unicode(self.quickSearchEdit.text()) - if self.quickSearchComboBox.currentIndex() == 0: + if self.quickSearchEdit.currentSearchType() == 1: # We are doing a 'Verse Search'. self.search_results = self.parent.manager.get_verses(bible, text) if second_bible and self.search_results: From b10f59c870a424cca49ff44247b12814ee07a090 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 13 Feb 2011 16:51:19 +0100 Subject: [PATCH 2/7] added icons --- openlp/plugins/bibles/lib/mediaitem.py | 14 +++++++------- resources/images/openlp-2.qrc | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index b83e62c57..d4e2d837e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -90,9 +90,9 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickSearchEdit.setSearchTypes([ - (1, u':/songs/song_topic_edit.png', - translate('BiblesPlugin.MediaItem', 'Verse Search')), - (2, u':/songs/song_search_author.png', + (1, u':/bibles/bibles_serach_reference.png', + translate('BiblesPlugin.MediaItem', 'Scripture Reference')), + (2, u':/bibles/bibles_serach_text.png', translate('BiblesPlugin.MediaItem', 'Text Search')) ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) @@ -352,10 +352,10 @@ class BibleMediaItem(MediaManagerItem): """ This updates the bible book completion list for the search field. The completion depends on the bible. It is only updated when we are doing a - verse search, otherwise the auto completion list is removed. + reference search, otherwise the auto completion list is removed. """ books = [] - # We have to do a 'Verse Search'. + # We have to do a 'Reference Search'. if self.quickSearchEdit.currentSearchType() == 1: bibles = self.parent.manager.get_bibles() bible = unicode(self.quickVersionComboBox.currentText()) @@ -485,7 +485,7 @@ class BibleMediaItem(MediaManagerItem): def onQuickSearchButton(self): """ Does a quick search and saves the search results. Quick search can - either be "Verse Search" or "Text Search". + either be "Reference Search" or "Text Search". """ log.debug(u'Quick Search Button pressed') self.quickSearchButton.setEnabled(False) @@ -494,7 +494,7 @@ class BibleMediaItem(MediaManagerItem): second_bible = unicode(self.quickSecondComboBox.currentText()) text = unicode(self.quickSearchEdit.text()) if self.quickSearchEdit.currentSearchType() == 1: - # We are doing a 'Verse Search'. + # We are doing a 'Reference Search'. self.search_results = self.parent.manager.get_verses(bible, text) if second_bible and self.search_results: self.second_search_results = self.parent.manager.get_verses( diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index dd5abd861..929775f78 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -21,6 +21,10 @@ song_topic_edit.png song_book_edit.png + + bibles_serach_text.png + bibles_serach_reference.png + plugin_alerts.png plugin_bibles.png From 4d310f17df0d4c32fd288d9eb42b3af8bea82e9c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 13 Feb 2011 17:31:44 +0100 Subject: [PATCH 3/7] added files, spelling --- openlp/plugins/bibles/lib/mediaitem.py | 4 ++-- resources/images/bibles_search_reference.png | Bin 0 -> 2031 bytes resources/images/bibles_search_text.png | Bin 0 -> 335 bytes resources/images/openlp-2.qrc | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 resources/images/bibles_search_reference.png create mode 100644 resources/images/bibles_search_text.png diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d4e2d837e..5f18beca4 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -90,9 +90,9 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickSearchEdit.setSearchTypes([ - (1, u':/bibles/bibles_serach_reference.png', + (1, u':/bibles/bibles_search_reference.png', translate('BiblesPlugin.MediaItem', 'Scripture Reference')), - (2, u':/bibles/bibles_serach_text.png', + (2, u':/bibles/bibles_search_text.png', translate('BiblesPlugin.MediaItem', 'Text Search')) ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) diff --git a/resources/images/bibles_search_reference.png b/resources/images/bibles_search_reference.png new file mode 100644 index 0000000000000000000000000000000000000000..f64c0ad78ea8c37e0982cc56a93991d776d56faf GIT binary patch literal 2031 zcmV{l`45fF)Sd}nJobU8nr>0%Xr&{P;r+8i|24V%^3U#TJS7W63x!hkkSNJn zIpze}GN{xf>L$>l%JH}C4`Tq{oI9~OQ4aym%;nMmPXD;5TlKaJH--7m)nf3sPdgG= zGDSM=GXJpjp7c!I7Tz9v+Q{{}m0{WPpx$YbJT{Ceph2F$u;1A{=qzr%SixIs<1wv4 z^#MK}s`>l<>%5#5)#@zbNxD(Xlp7A2##z%HXiDqoe9;dOWuH=zcn%mEdDk#>FyY(Y z;g|KV*JkBxv*vF8ENYhL(g0;_xN7n@M!o)TT5qz-KGi6HmyBL(ukrBva(H7m!butm zxCB~6oo(rCC9{wzb&6=uS8o}(S?S1#F7V9Wl)?i5h=~>eq7P6PnauT?NDnZI+48fB zRDiy~8U(F)qYx;{LsuM^MmWvvfp{*|`N`C72XX%0`u7sud|qLz zs;#*5Eo!H{_aKmCzA4x|(^dn9)R1`c48RN;M5h6mL=KP?un0pG7H~!MIQ8LLSxhWZ z#E26U-Q!Y1w|VobfX76JWytW39PcJwk6eP^l=I0zpJ_*@R<))Ww^^ogoBia8QzPp= zPt#pXw#MdpoF_YU)h2JN1z>KIx!4ZSU^){~09(fXz*GT_C60C60UF4(5I@LC$D0<- z_lD%w09En6b2sMBRE_#L3O*R-lXz8pc6>IoUl1m!<9l;kJ8rgL>$q_4xpSzv&*k{% zzHS}PEA4%pXWr*aE2i?8e#a??kh>1hA8?ZH0Z21xCcgl@W9&uV9l)xwKDV~xJN9c< z%B;m2Lz9WM?d4Wn&%N*VtUEMM7$QhwceI3#Q3=jEwJ~DiqIc1|=-C9UL@MGOckN+z zcl+C{TCYN{2VT*qq76oaQXj#kY0WN5hx)0$VoQq!wHCbl+=He zfdxKM-uJu(O}lk-j1879zA&{oDpO{{&gk$zM2+piPW@HW9D6z-Hi>VD0s-@g>8|NG z;3#qIa%2Pi9Rjr=joWN5vjy8uFvYLG(#$X|te&yU>8r}G8%AODwu%^z4i z3U-w|T6WD%{p%6xV7BuA93q*rV7xQ4hx#rLnwLM}7U{P3+2=q5h;qewqGf>Yk?xkR z7GQ;}jP(En7XBsv7|0EB-N^7AyfY43lI_qeukfpj9Il$an*Wkl$ixpUV8n;Shs1|a z>~huRs>@a8f$P_5LW2tsJ4I}rs2&>G|4Oh~|$hcSq+nTE;Q)4mTZ z{-z9_8$i&59`pbti6oIE=01HvpV2lh7Fw8qr9NVb=&7jaa<^V*2rvpAgR1I3#ZLMM zxtl1NqY0h}GE}V($705dUn0_Q&Ce+ zi_f9#f2xjY*9CG606Y=#un`-v5uk0fjkeLlzkSO(HK*r{oJkkxljHlbua~4l^33Dvzm3P1q`6#sWTvdD9h=c0-1n-5vAgzOF39kR3LepX3VSys8B zN+npYRXJ5zm;Ji5E$!27n2<4Uo9tA~(NVp$^0x~hWKuL!1^_>9EpIq>iIDx1h^7~g&L@k=I#SQ%`fYc+ zAj^=i^J{lM<({nQ_tJ~ci(WcEbT^Qn$UIa?{yM66lCXbadKnKaW(>?e@)Gzj2$Uw1 z1OLb*0000YdQ@0+Q*UN;cVTj6004N}D=#nC%goCzPEIUH)ypqR2LLwM23QbN%3J^d N002ovPDHLkV1nG};fw$P literal 0 HcmV?d00001 diff --git a/resources/images/bibles_search_text.png b/resources/images/bibles_search_text.png new file mode 100644 index 0000000000000000000000000000000000000000..1ab7145c6520bc770aedc33259b26d1df59f1361 GIT binary patch literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJbFq_W2nPqp?T7vkfLzW3kH}&M z2FBeW%xLxI@gtz1WQl7;NpOBzNqJ&XDnogBxn5>oc5!lIL8@MUQTpt6Hc~)E9sxcf zuK)l42QsW(4WB}%e<@${og@7nN9H?@3?TWQBjY_sI*9D< z?gpxa10dJu!nw~tzF0|+UoeBTk&%ge1qf7DRoB$k)i*S??EDrrc?M8LxTlL_h=gS8 z!AQO)2L{#+TAvsMkL2$7@2jeJ^3TOh>n+2jc(j*irOC*oWysc)|Il#i*CwBG^$WflIelF{r5}E*( C9&~j8 literal 0 HcmV?d00001 diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 929775f78..9e6ff6543 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -22,8 +22,8 @@ song_book_edit.png - bibles_serach_text.png - bibles_serach_reference.png + bibles_search_text.png + bibles_search_reference.png plugin_alerts.png From e6ed43ae02210b432e068efe2453e7c649011cd7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 14 Feb 2011 15:23:56 +0100 Subject: [PATCH 4/7] added enumeration class --- openlp/plugins/bibles/lib/mediaitem.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 5f18beca4..a6ceba6ac 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -38,6 +38,14 @@ from openlp.plugins.bibles.lib import get_reference_match log = logging.getLogger(__name__) +class BibleSearch(object): + """ + Enumeration class for the different search methods for the "quick search". + """ + Reference = 1 + Text = 2 + + class BibleMediaItem(MediaManagerItem): """ This is the custom media manager item for Bibles. @@ -90,9 +98,9 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickSearchEdit.setSearchTypes([ - (1, u':/bibles/bibles_search_reference.png', + (BibleSearch.Reference, u':/bibles/bibles_search_reference.png', translate('BiblesPlugin.MediaItem', 'Scripture Reference')), - (2, u':/bibles/bibles_search_text.png', + (BibleSearch.Text, u':/bibles/bibles_search_text.png', translate('BiblesPlugin.MediaItem', 'Text Search')) ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) @@ -356,7 +364,7 @@ class BibleMediaItem(MediaManagerItem): """ books = [] # We have to do a 'Reference Search'. - if self.quickSearchEdit.currentSearchType() == 1: + if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: bibles = self.parent.manager.get_bibles() bible = unicode(self.quickVersionComboBox.currentText()) if bible: @@ -493,7 +501,7 @@ class BibleMediaItem(MediaManagerItem): bible = unicode(self.quickVersionComboBox.currentText()) second_bible = unicode(self.quickSecondComboBox.currentText()) text = unicode(self.quickSearchEdit.text()) - if self.quickSearchEdit.currentSearchType() == 1: + if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: # We are doing a 'Reference Search'. self.search_results = self.parent.manager.get_verses(bible, text) if second_bible and self.search_results: From fba2a245fb9e2020d2326658c0ad301912a6cb8d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 17:54:09 +0000 Subject: [PATCH 5/7] Fix Media length calc --- openlp/core/lib/serviceitem.py | 18 ++++++++---------- openlp/core/ui/printserviceorderform.py | 14 +++----------- openlp/plugins/media/lib/mediaitem.py | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1b5261773..e8e1f68f0 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -30,7 +30,6 @@ type and capability of an item. import datetime import logging -import mutagen import os import uuid @@ -110,6 +109,7 @@ class ServiceItem(object): self.edit_id = None self.xml_version = None self.start_time = 0 + self.media_length = 0 self._new_item() def _new_item(self): @@ -263,7 +263,8 @@ class ServiceItem(object): u'search': self.search_string, u'data': self.data_string, u'xml_version': self.xml_version, - u'start_time': self.start_time + u'start_time': self.start_time, + u'media_length': self.media_length } service_data = [] if self.service_item_type == ServiceItemType.Text: @@ -309,6 +310,8 @@ class ServiceItem(object): self.xml_version = header[u'xml_version'] if u'start_time' in header: self.start_time = header[u'start_time'] + if u'media_length' in header: + self.media_length = header[u'media_length'] if self.service_item_type == ServiceItemType.Text: for slide in serviceitem[u'serviceitem'][u'data']: self._raw_frames.append(slide) @@ -439,14 +442,9 @@ class ServiceItem(object): if self.start_time != 0: start = UiStrings.StartTimeCode % \ unicode(datetime.timedelta(seconds=self.start_time)) - path = os.path.join(self.get_frames()[0][u'path'], - self.get_frames()[0][u'title']) - if os.path.isfile(path): - file = mutagen.File(path) - if file is not None: - seconds = int(file.info.length) - end = UiStrings.LengthTime % \ - unicode(datetime.timedelta(seconds=seconds)) + if self.media_length != 0: + end = UiStrings.LengthTime % \ + unicode(datetime.timedelta(seconds=self.media_length)) if not start and not end: return None elif start and not end: diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 3b01f9ac7..70128cb89 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -24,7 +24,6 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### import datetime -import mutagen import os from PyQt4 import QtCore, QtGui @@ -113,16 +112,9 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): item.notes.replace(u'\n', u'
')) # Add play length of media files. if item.is_media() and self.printMetaDataCheckBox.isChecked(): - path = os.path.join(item.get_frames()[0][u'path'], - item.get_frames()[0][u'title']) - if not os.path.isfile(path): - continue - file = mutagen.File(path) - if file is not None: - length = int(file.info.length) - text += u'

%s %s

' % (translate( - 'OpenLP.ServiceManager', u'Playing time:'), - unicode(datetime.timedelta(seconds=length))) + text += u'

%s %s

' % (translate( + 'OpenLP.ServiceManager', u'Playing time:'), + unicode(datetime.timedelta(seconds=item.media_length))) if self.customNoteEdit.toPlainText(): text += u'

%s

%s' % (translate('OpenLP.ServiceManager', u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 55b745ec5..47fe44801 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, Receiver from openlp.core.lib.ui import UiStrings, critical_error_message_box +from PyQt4.phonon import Phonon log = logging.getLogger(__name__) @@ -48,9 +49,13 @@ class MediaMediaItem(MediaManagerItem): u':/media/media_video.png').toImage() MediaManagerItem.__init__(self, parent, self, icon) self.singleServiceItem = False + self.mediaObject = Phonon.MediaObject(self) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), + self.videoStart) def retranslateUi(self): self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') @@ -120,6 +125,11 @@ class MediaMediaItem(MediaManagerItem): return False filename = unicode(item.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename): + self.MediaState = None + self.mediaObject.stop() + self.mediaObject.clearQueue() + self.mediaObject.setCurrentSource(Phonon.MediaSource(filename)) + self.mediaObject.play() service_item.title = unicode( translate('MediaPlugin.MediaItem', 'Media')) service_item.add_capability(ItemCapabilities.RequiresMedia) @@ -128,6 +138,9 @@ class MediaMediaItem(MediaManagerItem): service_item.theme = -1 frame = u':/media/image_clapperboard.png' (path, name) = os.path.split(filename) + while not self.MediaState: + Receiver.send_message(u'openlp_process_events') + service_item.media_length = self.mediaLength service_item.add_from_command(path, name, frame) return True else: @@ -165,3 +178,12 @@ class MediaMediaItem(MediaManagerItem): item_name.setIcon(build_icon(img)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) self.listView.addItem(item_name) + + def videoStart(self, newState, oldState): + """ + Start the video at a predetermined point. + """ + if newState == 2: + self.MediaState = newState + self.mediaLength = self.mediaObject.totalTime()/1000 + self.mediaObject.stop() From 329db94fd204d0e9cc7ad2889b42253aa3d09c6f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 18:32:46 +0000 Subject: [PATCH 6/7] Fix indent --- openlp/core/lib/serviceitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index e8e1f68f0..31852709a 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -444,7 +444,7 @@ class ServiceItem(object): unicode(datetime.timedelta(seconds=self.start_time)) if self.media_length != 0: end = UiStrings.LengthTime % \ - unicode(datetime.timedelta(seconds=self.media_length)) + unicode(datetime.timedelta(seconds=self.media_length)) if not start and not end: return None elif start and not end: From 774f9d6cdd4ff97554560ea18a3acfe0a40a69b2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 18:43:37 +0000 Subject: [PATCH 7/7] Fix names --- openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index cc2f2f72d..90042f80b 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -348,7 +348,7 @@ class MainDisplay(DisplayWidget): """ Start the video at a predetermined point. """ - if newState == 2: + if newState == Phonon.PlayingState: self.mediaObject.seek(self.serviceItem.start_time * 1000) def isWebLoaded(self): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 47fe44801..cc126bbef 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -183,7 +183,7 @@ class MediaMediaItem(MediaManagerItem): """ Start the video at a predetermined point. """ - if newState == 2: + if newState == Phonon.PlayingState: self.MediaState = newState self.mediaLength = self.mediaObject.totalTime()/1000 self.mediaObject.stop()