Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~trb143/openlp/audit |
Merge into: | lp:openlp |
Diff against target: |
307 lines 7 files modified
openlp/core/lib/plugin.py (+4/-2) openlp/core/lib/pluginmanager.py (+3/-3) openlp/core/ui/mediadockmanager.py (+24/-14) openlp/core/ui/settingsform.py (+16/-12) openlp/plugins/bibles/bibleplugin.py (+1/-1) openlp/plugins/bibles/lib/mediaitem.py (+49/-14) openlp/plugins/custom/customplugin.py (+13/-1) |
To merge this branch: | bzr merge lp:~trb143/openlp/audit |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Raoul Snyman (raoul-snyman) wrote : | # |
Looks fine to me.
TODOs: We should look at also changing this to a log.exception
log.
modulename, path, e.args[0])
review:
Approve
lp:~trb143/openlp/audit
updated
- 629. By Tim Bentley
-
Latest Version checking added
- 630. By Tim Bentley
-
Correct Theme name for Export if default
- 631. By Tim Bentley
-
Quick code cleanup and fix test for version checking
- 632. By Tim Bentley
-
Servie Manager DnD part 1
- 633. By Tim Bentley
-
Servie Manager DnD part 2
- 634. By Tim Bentley
-
Audit Cleanup - part 1
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/lib/plugin.py' |
2 | --- openlp/core/lib/plugin.py 2009-10-10 12:10:05 +0000 |
3 | +++ openlp/core/lib/plugin.py 2009-10-10 19:05:21 +0000 |
4 | @@ -257,5 +257,7 @@ |
5 | """ |
6 | Called by plugin to replace toolbar |
7 | """ |
8 | - self.mediadock.insertDock(self.name) |
9 | - self.settings.insertTab(self.name) |
10 | + if self.media_item is not None: |
11 | + self.mediadock.insertDock(self.media_item, self.icon, self.weight) |
12 | + if self.settings_tab is not None: |
13 | + self.settings.insertTab(self.settings_tab, self.weight) |
14 | |
15 | === modified file 'openlp/core/lib/pluginmanager.py' |
16 | --- openlp/core/lib/pluginmanager.py 2009-10-07 05:09:35 +0000 |
17 | +++ openlp/core/lib/pluginmanager.py 2009-10-10 19:05:21 +0000 |
18 | @@ -90,7 +90,8 @@ |
19 | try: |
20 | __import__(modulename, globals(), locals(), []) |
21 | except ImportError, e: |
22 | - log.error(u'Failed to import module %s on path %s for reason %s', modulename, path, e.args[0]) |
23 | + log.error(u'Failed to import module %s on path %s for reason %s', |
24 | + modulename, path, e.args[0]) |
25 | plugin_classes = Plugin.__subclasses__() |
26 | self.plugins = [] |
27 | plugin_objects = [] |
28 | @@ -139,8 +140,7 @@ |
29 | if plugin.media_item is not None: |
30 | log.debug(u'Inserting media manager item from %s' % \ |
31 | plugin.name) |
32 | - mediadock.addDock(plugin.name, |
33 | - plugin.media_item, plugin.icon) |
34 | + mediadock.addDock(plugin.media_item, plugin.icon, plugin.weight) |
35 | |
36 | def hook_settings_tabs(self, settingsform=None): |
37 | """ |
38 | |
39 | === modified file 'openlp/core/ui/mediadockmanager.py' |
40 | --- openlp/core/ui/mediadockmanager.py 2009-10-08 05:02:39 +0000 |
41 | +++ openlp/core/ui/mediadockmanager.py 2009-10-10 19:05:21 +0000 |
42 | @@ -31,21 +31,31 @@ |
43 | def __init__(self, mediaDock): |
44 | self.mediaDock = mediaDock |
45 | |
46 | - def addDock(self, name, media_item, icon): |
47 | - log.info(u'Adding %s dock' % name) |
48 | + def addDock(self, media_item, icon, weight): |
49 | + log.info(u'Adding %s dock' % media_item.title) |
50 | id = self.mediaDock.addItem( |
51 | - media_item, icon, media_item.title) |
52 | - |
53 | - def insertDock(self, name): |
54 | - log.debug(u'Inserting %s dock' % name) |
55 | - for tab_index in range(0, self.mediaDock.count()): |
56 | - #print self.mediaDock.widget(tab_index).ConfigSection, name |
57 | - if self.mediaDock.widget(tab_index).ConfigSection == name.lower(): |
58 | - self.mediaDock.setItemEnabled(tab_index, True) |
59 | + media_item, icon, media_item.title) |
60 | + |
61 | + def insertDock(self, media_item, icon, weight): |
62 | + """ |
63 | + This should insert a dock item at a given location |
64 | + This does not work as it gives a Segmentation error. |
65 | + For now add at end of stack if not present |
66 | + """ |
67 | + log.debug(u'Inserting %s dock' % media_item.title) |
68 | + match = False |
69 | + for dock_index in range(0, self.mediaDock.count()): |
70 | + if self.mediaDock.widget(dock_index).ConfigSection == media_item.title.lower(): |
71 | + match = True |
72 | + break |
73 | + if not match: |
74 | + self.mediaDock.addItem(media_item, icon, media_item.title) |
75 | + |
76 | |
77 | def removeDock(self, name): |
78 | log.debug(u'remove %s dock' % name) |
79 | - for tab_index in range(0, self.mediaDock.count()): |
80 | - #print "rd", self.mediaDock.widget(tab_index).ConfigSection, name |
81 | - if self.mediaDock.widget(tab_index).ConfigSection == name.lower(): |
82 | - self.mediaDock.setItemEnabled(tab_index, False) |
83 | + for dock_index in range(0, self.mediaDock.count()): |
84 | + if self.mediaDock.widget(dock_index) is not None: |
85 | + if self.mediaDock.widget(dock_index).ConfigSection == name.lower(): |
86 | + self.mediaDock.widget(dock_index).hide() |
87 | + self.mediaDock.removeItem(dock_index) |
88 | |
89 | === modified file 'openlp/core/ui/settingsform.py' |
90 | --- openlp/core/ui/settingsform.py 2009-10-08 05:02:39 +0000 |
91 | +++ openlp/core/ui/settingsform.py 2009-10-10 19:05:21 +0000 |
92 | @@ -48,16 +48,18 @@ |
93 | |
94 | def addTab(self, name, tab): |
95 | log.info(u'Adding %s tab' % tab.title()) |
96 | - id = self.SettingsTabWidget.addTab(tab, tab.title()) |
97 | + self.SettingsTabWidget.addTab(tab, tab.title()) |
98 | |
99 | - def insertTab(self, name): |
100 | - log.debug(u'Inserting %s tab' % name) |
101 | - for tab_index in range(0, self.SettingsTabWidget.count()): |
102 | + def insertTab(self, tab, location): |
103 | + log.debug(u'Inserting %s tab' % tab.title()) |
104 | + self.SettingsTabWidget.insertTab(location + 13, tab, tab.title()) |
105 | + #for tab_index in range(0, self.SettingsTabWidget.count()): |
106 | #print self.SettingsTabWidget.widget(tab_index).title() |
107 | - if self.SettingsTabWidget.widget(tab_index).title() == name: |
108 | + #if self.SettingsTabWidget.widget(tab_index).title() == name: |
109 | #print "Insert match" |
110 | #print self.SettingsTabWidget.widget(tab_index).isVisible() |
111 | - self.SettingsTabWidget.setTabEnabled(tab_index, True) |
112 | + #self.SettingsTabWidget.setTabEnabled(tab_index, True) |
113 | + #self.SettingsTabWidget.removeTab(tab_index) |
114 | #print self.SettingsTabWidget.widget(tab_index).isVisible() |
115 | |
116 | |
117 | @@ -65,12 +67,14 @@ |
118 | log.debug(u'remove %s tab' % name) |
119 | #print ">>>>>>>>>>> remove settings" |
120 | for tab_index in range(0, self.SettingsTabWidget.count()): |
121 | - #print "rt", self.SettingsTabWidget.widget(tab_index).title(), name |
122 | - if self.SettingsTabWidget.widget(tab_index).title() == name: |
123 | - #print "remove match" |
124 | - #print self.SettingsTabWidget.widget(tab_index).isVisible() |
125 | - self.SettingsTabWidget.setTabEnabled(tab_index, False) |
126 | - #print self.SettingsTabWidget.widget(tab_index).isVisible() |
127 | + if self.SettingsTabWidget.widget(tab_index) is not None: |
128 | + #print "rt", self.SettingsTabWidget.widget(tab_index).title(), name |
129 | + if self.SettingsTabWidget.widget(tab_index).title() == name: |
130 | + #print "remove match" |
131 | + #print self.SettingsTabWidget.widget(tab_index).isVisible() |
132 | + #self.SettingsTabWidget.setTabEnabled(tab_index, False) |
133 | + self.SettingsTabWidget.removeTab(tab_index) |
134 | + #print self.SettingsTabWidget.widget(tab_index).isVisible() |
135 | |
136 | def accept(self): |
137 | for tab_index in range(0, self.SettingsTabWidget.count()): |
138 | |
139 | === modified file 'openlp/plugins/bibles/bibleplugin.py' |
140 | --- openlp/plugins/bibles/bibleplugin.py 2009-10-08 05:02:39 +0000 |
141 | +++ openlp/plugins/bibles/bibleplugin.py 2009-10-10 19:05:21 +0000 |
142 | @@ -67,7 +67,7 @@ |
143 | |
144 | def get_media_manager_item(self): |
145 | # Create the BibleManagerItem object |
146 | - return BibleMediaItem(self, self.icon, u'Bible Verses') |
147 | + return BibleMediaItem(self, self.icon, u'Bibles') |
148 | |
149 | def add_import_menu_item(self, import_menu): |
150 | self.ImportBibleItem = QtGui.QAction(import_menu) |
151 | |
152 | === modified file 'openlp/plugins/bibles/lib/mediaitem.py' |
153 | --- openlp/plugins/bibles/lib/mediaitem.py 2009-10-09 22:46:35 +0000 |
154 | +++ openlp/plugins/bibles/lib/mediaitem.py 2009-10-10 19:05:21 +0000 |
155 | @@ -110,17 +110,22 @@ |
156 | self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox') |
157 | self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 1, 1, 1) |
158 | self.QuickVerticalLayout.addLayout(self.QuickLayout) |
159 | + self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab) |
160 | + self.QuickSecondBibleComboBox.setObjectName(u'SecondBible') |
161 | + self.QuickVerticalLayout.addWidget(self.QuickSecondBibleComboBox) |
162 | self.QuickMessage = QtGui.QLabel(self.QuickTab) |
163 | self.QuickMessage.setObjectName(u'QuickMessage') |
164 | self.QuickVerticalLayout.addWidget(self.QuickMessage) |
165 | self.SearchTabWidget.addTab(self.QuickTab, 'Quick') |
166 | - QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, |
167 | + QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum, |
168 | QtGui.QSizePolicy.Expanding) |
169 | self.QuickLayout.addItem(QuickSpacerItem, 4, 2, 1, 1) |
170 | # Add the Advanced Search tab |
171 | self.AdvancedTab = QtGui.QWidget() |
172 | self.AdvancedTab.setObjectName(u'AdvancedTab') |
173 | - self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) |
174 | + self.AdvancedVerticalLayout = QtGui.QVBoxLayout(self.AdvancedTab) |
175 | + self.AdvancedVerticalLayout.setObjectName("verticalLayout") |
176 | + self.AdvancedLayout = QtGui.QGridLayout() |
177 | self.AdvancedLayout.setMargin(5) |
178 | self.AdvancedLayout.setSpacing(4) |
179 | self.AdvancedLayout.setObjectName(u'AdvancedLayout') |
180 | @@ -171,6 +176,10 @@ |
181 | self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) |
182 | self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') |
183 | self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 5, 3, 1, 1) |
184 | + self.AdvancedVerticalLayout.addLayout(self.AdvancedLayout) |
185 | + self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) |
186 | + self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible') |
187 | + self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox) |
188 | self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') |
189 | # Add the search tab widget to the page layout |
190 | self.PageLayout.addWidget(self.SearchTabWidget) |
191 | @@ -240,17 +249,23 @@ |
192 | def loadBibles(self): |
193 | log.debug(u'Loading Bibles') |
194 | self.QuickVersionComboBox.clear() |
195 | + self.QuickSecondBibleComboBox.clear() |
196 | self.AdvancedVersionComboBox.clear() |
197 | + self.AdvancedSecondBibleComboBox.clear() |
198 | + self.QuickSecondBibleComboBox.addItem(u'') |
199 | + self.AdvancedSecondBibleComboBox.addItem(u'') |
200 | bibles = self.parent.biblemanager.get_bibles(BibleMode.Full) |
201 | # load bibles into the combo boxes |
202 | for bible in bibles: |
203 | self.QuickVersionComboBox.addItem(bible) |
204 | + self.QuickSecondBibleComboBox.addItem(bible) |
205 | # Without HTTP |
206 | bibles = self.parent.biblemanager.get_bibles(BibleMode.Partial) |
207 | first = True |
208 | # load bibles into the combo boxes |
209 | for bible in bibles: |
210 | self.AdvancedVersionComboBox.addItem(bible) |
211 | + self.AdvancedSecondBibleComboBox.addItem(bible) |
212 | if first: |
213 | first = False |
214 | # use the first bible as the trigger |
215 | @@ -337,16 +352,13 @@ |
216 | for item in items: |
217 | bitem = self.ListView.item(item.row()) |
218 | text = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) |
219 | - verse = text[:text.find(u'(')] |
220 | + search_verse = text[:text.find(u'(')] |
221 | bible = text[text.find(u'(') + 1:-1] |
222 | - self.searchByReference(bible, verse) |
223 | + self.searchByReference(bible, search_verse) |
224 | book = self.search_results[0].book.name |
225 | chapter = unicode(self.search_results[0].chapter) |
226 | verse = unicode(self.search_results[0].verse) |
227 | text = self.search_results[0].text |
228 | - #Paragraph style force new line per verse |
229 | - if self.parent.settings_tab.layout_style == 1: |
230 | - text = text + u'\n\n' |
231 | if self.parent.settings_tab.display_style == 1: |
232 | loc = self.formatVerse(old_chapter, chapter, verse, u'(u', u')') |
233 | elif self.parent.settings_tab.display_style == 2: |
234 | @@ -356,18 +368,41 @@ |
235 | else: |
236 | loc = self.formatVerse(old_chapter, chapter, verse, u'', u'') |
237 | old_chapter = chapter |
238 | - bible_text = bible_text + u' '+ loc + u' '+ text |
239 | - #if we are verse per slide then create slide |
240 | - if self.parent.settings_tab.layout_style == 0: |
241 | - raw_slides.append(bible_text) |
242 | - bible_text = u'' |
243 | - service_item.title = book + u' ' + loc |
244 | - footer = book + u' (' + self.version + u' ' + self.copyright +u')' |
245 | + footer = u'%s (%s %s)' % (book, self.version, self.copyright) |
246 | #If not found throws and error so add.s |
247 | try: |
248 | raw_footer.index(footer) |
249 | except: |
250 | raw_footer.append(footer) |
251 | + #If we want to use a 2nd translation / version |
252 | + bible2 = u'' |
253 | + if self.SearchTabWidget.currentIndex() == 0: |
254 | + bible2 = unicode(self.QuickSecondBibleComboBox.currentText()) |
255 | + else: |
256 | + bible2 = unicode(self.AdvancedSecondBibleComboBox.currentText()) |
257 | + if len(bible2) > 0: |
258 | + self.searchByReference(bible2, search_verse) |
259 | + footer = u'%s (%s %s)' % (book, self.version, self.copyright) |
260 | + #If not found throws and error so add.s |
261 | + try: |
262 | + raw_footer.index(footer) |
263 | + except: |
264 | + raw_footer.append(footer) |
265 | + bible_text = u'%s %s \n\n\n %s %s)' % \ |
266 | + (loc, text, loc, self.search_results[0].text) |
267 | + raw_slides.append(bible_text) |
268 | + bible_text = u'' |
269 | + else: |
270 | + #Paragraph style force new line per verse |
271 | + if self.parent.settings_tab.layout_style == 1: |
272 | + text = text + u'\n\n' |
273 | + bible_text = u'%s %s %s' % (bible_text, loc, text) |
274 | + #if we are verse per slide then create slide |
275 | + if self.parent.settings_tab.layout_style == 0: |
276 | + raw_slides.append(bible_text) |
277 | + bible_text = u'' |
278 | + service_item.title = u'%s %s' % (book, loc) |
279 | + |
280 | if len(self.parent.settings_tab.bible_theme) == 0: |
281 | service_item.theme = None |
282 | else: |
283 | |
284 | === modified file 'openlp/plugins/custom/customplugin.py' |
285 | --- openlp/plugins/custom/customplugin.py 2009-10-03 13:08:18 +0000 |
286 | +++ openlp/plugins/custom/customplugin.py 2009-10-10 19:05:21 +0000 |
287 | @@ -54,7 +54,19 @@ |
288 | |
289 | def get_media_manager_item(self): |
290 | # Create the CustomManagerItem object |
291 | - return CustomMediaItem(self, self.icon, u'Custom Slides') |
292 | + return CustomMediaItem(self, self.icon, u'Custom') |
293 | + |
294 | + def can_be_disabled(self): |
295 | + return True |
296 | + |
297 | + def initialise(self): |
298 | + log.info(u'Plugin Initialising') |
299 | + Plugin.initialise(self) |
300 | + self.insert_toolbox_item() |
301 | + |
302 | + def finalise(self): |
303 | + log.info(u'Plugin Finalise') |
304 | + self.remove_toolbox_item() |
305 | |
306 | def about(self): |
307 | return u'<b>Custom Plugin</b> <br>This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.<br><br>This is a core plugin and cannot be made inactive</b>' |
Got hiding code working so here it is
Also added Bible code to allow two translations on same slide. This works well apart from Esther 8:9 but that is impossible!!!!!