Merge lp:~raoul-snyman/openlp/pluginlist into lp:openlp
- pluginlist
- Merge into trunk
Proposed by
Raoul Snyman
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~raoul-snyman/openlp/pluginlist |
Merge into: | lp:openlp |
Diff against target: |
703 lines 7 files modified
openlp/core/lib/plugin.py (+4/-0) openlp/core/ui/__init__.py (+1/-1) openlp/core/ui/mainwindow.py (+1/-1) openlp/core/ui/plugindialog.py (+117/-0) openlp/core/ui/plugindialoglistform.py (+0/-138) openlp/core/ui/pluginform.py (+118/-0) resources/forms/plugindialoglistform.ui (+123/-120) |
To merge this branch: | bzr merge lp:~raoul-snyman/openlp/pluginlist |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | 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)
Raoul Snyman (raoul-snyman) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) wrote : | # |
Approved from a patch point of view
YOU HAVE A MERGE PROBLEM WHICH WILL NEED TO BE FIXED.
review:
Approve
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-07 05:09:35 +0000 |
3 | +++ openlp/core/lib/plugin.py 2009-10-08 20:05:22 +0000 |
4 | @@ -168,7 +168,11 @@ |
5 | |
6 | Returns True or False. |
7 | """ |
8 | +<<<<<<< TREE |
9 | return self.status == PluginStatus.Active |
10 | +======= |
11 | + return int(self.status) == PluginStatus.Active |
12 | +>>>>>>> MERGE-SOURCE |
13 | |
14 | def get_media_manager_item(self): |
15 | """ |
16 | |
17 | === modified file 'openlp/core/ui/__init__.py' |
18 | --- openlp/core/ui/__init__.py 2009-10-07 05:09:35 +0000 |
19 | +++ openlp/core/ui/__init__.py 2009-10-08 20:05:23 +0000 |
20 | @@ -32,7 +32,7 @@ |
21 | from themestab import ThemesTab |
22 | from about import AboutForm |
23 | from alertform import AlertForm |
24 | -from plugindialoglistform import PluginForm |
25 | +from pluginform import PluginForm |
26 | from settingsform import SettingsForm |
27 | from mediadockmanager import MediaDockManager |
28 | from servicemanager import ServiceManager |
29 | |
30 | === modified file 'openlp/core/ui/mainwindow.py' |
31 | --- openlp/core/ui/mainwindow.py 2009-10-07 05:09:35 +0000 |
32 | +++ openlp/core/ui/mainwindow.py 2009-10-08 20:05:23 +0000 |
33 | @@ -421,7 +421,6 @@ |
34 | self.mainDisplay = MainDisplay(self, screens) |
35 | self.generalConfig = PluginConfig(u'General') |
36 | self.alertForm = AlertForm(self) |
37 | - self.pluginForm = PluginForm(self) |
38 | self.aboutForm = AboutForm(self) |
39 | self.settingsForm = SettingsForm(self.screenList, self) |
40 | # Set up the path with plugins |
41 | @@ -432,6 +431,7 @@ |
42 | self.plugin_helpers = {} |
43 | # Set up the interface |
44 | self.setupUi(self) |
45 | + self.pluginForm = PluginForm(self) |
46 | # Set up signals and slots |
47 | QtCore.QObject.connect(self.ImportThemeItem, |
48 | QtCore.SIGNAL(u'triggered()'), |
49 | |
50 | === added file 'openlp/core/ui/plugindialog.py' |
51 | --- openlp/core/ui/plugindialog.py 1970-01-01 00:00:00 +0000 |
52 | +++ openlp/core/ui/plugindialog.py 2009-10-08 20:05:23 +0000 |
53 | @@ -0,0 +1,117 @@ |
54 | +# -*- coding: utf-8 -*- |
55 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
56 | + |
57 | +############################################################################### |
58 | +# OpenLP - Open Source Lyrics Projection # |
59 | +# --------------------------------------------------------------------------- # |
60 | +# Copyright (c) 2008-2009 Raoul Snyman # |
61 | +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # |
62 | +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # |
63 | +# --------------------------------------------------------------------------- # |
64 | +# This program is free software; you can redistribute it and/or modify it # |
65 | +# under the terms of the GNU General Public License as published by the Free # |
66 | +# Software Foundation; version 2 of the License. # |
67 | +# # |
68 | +# This program is distributed in the hope that it will be useful, but WITHOUT # |
69 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
70 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
71 | +# more details. # |
72 | +# # |
73 | +# You should have received a copy of the GNU General Public License along # |
74 | +# with this program; if not, write to the Free Software Foundation, Inc., 59 # |
75 | +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
76 | +############################################################################### |
77 | + |
78 | +from PyQt4 import QtCore, QtGui |
79 | +from openlp.core.lib import translate |
80 | + |
81 | +class Ui_PluginViewDialog(object): |
82 | + def setupUi(self, PluginViewDialog): |
83 | + PluginViewDialog.setObjectName(u'PluginViewDialog') |
84 | + PluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal) |
85 | + PluginViewDialog.resize(554, 344) |
86 | + self.PluginLayout = QtGui.QVBoxLayout(PluginViewDialog) |
87 | + self.PluginLayout.setSpacing(8) |
88 | + self.PluginLayout.setMargin(8) |
89 | + self.PluginLayout.setObjectName(u'PluginLayout') |
90 | + self.ListLayout = QtGui.QHBoxLayout() |
91 | + self.ListLayout.setSpacing(8) |
92 | + self.ListLayout.setObjectName(u'ListLayout') |
93 | + self.PluginListWidget = QtGui.QListWidget(PluginViewDialog) |
94 | + sizePolicy = QtGui.QSizePolicy( |
95 | + QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) |
96 | + sizePolicy.setHorizontalStretch(0) |
97 | + sizePolicy.setVerticalStretch(0) |
98 | + sizePolicy.setHeightForWidth( |
99 | + self.PluginListWidget.sizePolicy().hasHeightForWidth()) |
100 | + self.PluginListWidget.setSizePolicy(sizePolicy) |
101 | + self.PluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215)) |
102 | + self.PluginListWidget.setObjectName(u'PluginListWidget') |
103 | + self.ListLayout.addWidget(self.PluginListWidget) |
104 | + self.PluginInfoGroupBox = QtGui.QGroupBox(PluginViewDialog) |
105 | + self.PluginInfoGroupBox.setAlignment( |
106 | + QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
107 | + self.PluginInfoGroupBox.setFlat(False) |
108 | + self.PluginInfoGroupBox.setObjectName(u'PluginInfoGroupBox') |
109 | + self.PluginInfoLayout = QtGui.QFormLayout(self.PluginInfoGroupBox) |
110 | + self.PluginInfoLayout.setMargin(8) |
111 | + self.PluginInfoLayout.setSpacing(8) |
112 | + self.PluginInfoLayout.setObjectName(u'PluginInfoLayout') |
113 | + self.VersionLabel = QtGui.QLabel(self.PluginInfoGroupBox) |
114 | + self.VersionLabel.setObjectName(u'VersionLabel') |
115 | + self.PluginInfoLayout.setWidget( |
116 | + 1, QtGui.QFormLayout.LabelRole, self.VersionLabel) |
117 | + self.VersionNumberLabel = QtGui.QLabel(self.PluginInfoGroupBox) |
118 | + self.VersionNumberLabel.setObjectName(u'VersionNumberLabel') |
119 | + self.PluginInfoLayout.setWidget( |
120 | + 1, QtGui.QFormLayout.FieldRole, self.VersionNumberLabel) |
121 | + self.AboutLabel = QtGui.QLabel(self.PluginInfoGroupBox) |
122 | + self.AboutLabel.setObjectName(u'AboutLabel') |
123 | + self.PluginInfoLayout.setWidget( |
124 | + 2, QtGui.QFormLayout.LabelRole, self.AboutLabel) |
125 | + self.StatusLabel = QtGui.QLabel(self.PluginInfoGroupBox) |
126 | + self.StatusLabel.setObjectName(u'StatusLabel') |
127 | + self.PluginInfoLayout.setWidget( |
128 | + 0, QtGui.QFormLayout.LabelRole, self.StatusLabel) |
129 | + self.StatusComboBox = QtGui.QComboBox(self.PluginInfoGroupBox) |
130 | + self.StatusComboBox.setObjectName(u'StatusComboBox') |
131 | + self.StatusComboBox.addItem(QtCore.QString()) |
132 | + self.StatusComboBox.addItem(QtCore.QString()) |
133 | + self.PluginInfoLayout.setWidget( |
134 | + 0, QtGui.QFormLayout.FieldRole, self.StatusComboBox) |
135 | + self.AboutTextBrowser = QtGui.QTextBrowser(self.PluginInfoGroupBox) |
136 | + self.AboutTextBrowser.setTextInteractionFlags( |
137 | + QtCore.Qt.LinksAccessibleByMouse) |
138 | + self.AboutTextBrowser.setObjectName(u'AboutTextBrowser') |
139 | + self.PluginInfoLayout.setWidget( |
140 | + 2, QtGui.QFormLayout.FieldRole, self.AboutTextBrowser) |
141 | + self.ListLayout.addWidget(self.PluginInfoGroupBox) |
142 | + self.PluginLayout.addLayout(self.ListLayout) |
143 | + self.PluginListButtonBox = QtGui.QDialogButtonBox(PluginViewDialog) |
144 | + self.PluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) |
145 | + self.PluginListButtonBox.setObjectName(u'PluginListButtonBox') |
146 | + self.PluginLayout.addWidget(self.PluginListButtonBox) |
147 | + |
148 | + self.retranslateUi(PluginViewDialog) |
149 | + QtCore.QObject.connect( |
150 | + self.PluginListButtonBox, |
151 | + QtCore.SIGNAL(u'accepted()'), |
152 | + PluginViewDialog.close) |
153 | + QtCore.QMetaObject.connectSlotsByName(PluginViewDialog) |
154 | + |
155 | + def retranslateUi(self, PluginViewDialog): |
156 | + PluginViewDialog.setWindowTitle( |
157 | + translate(u'PluginViewDialog', u'Plugin List')) |
158 | + self.PluginInfoGroupBox.setTitle( |
159 | + translate(u'PluginViewDialog', u'Plugin Details')) |
160 | + self.VersionLabel.setText( |
161 | + translate(u'PluginViewDialog', u'Version:')) |
162 | + self.VersionNumberLabel.setText( |
163 | + translate(u'PluginViewDialog', u'TextLabel')) |
164 | + self.AboutLabel.setText(translate(u'PluginViewDialog', u'About:')) |
165 | + self.StatusLabel.setText(translate(u'PluginViewDialog', u'Status:')) |
166 | + self.StatusComboBox.setItemText( |
167 | + 0, translate(u'PluginViewDialog', u'Active')) |
168 | + self.StatusComboBox.setItemText( |
169 | + 1, translate(u'PluginViewDialog', u'Inactive')) |
170 | + |
171 | |
172 | === removed file 'openlp/core/ui/plugindialoglistform.py' |
173 | --- openlp/core/ui/plugindialoglistform.py 2009-10-03 18:39:44 +0000 |
174 | +++ openlp/core/ui/plugindialoglistform.py 1970-01-01 00:00:00 +0000 |
175 | @@ -1,138 +0,0 @@ |
176 | -# -*- coding: utf-8 -*- |
177 | - |
178 | -# Form implementation generated from reading ui file 'plugindialoglistform.ui' |
179 | -# |
180 | -# Created: Thu Aug 13 05:52:06 2009 |
181 | -# by: PyQt4 UI code generator 4.5.4 |
182 | -# |
183 | -# WARNING! All changes made in this file will be lost! |
184 | - |
185 | -import logging |
186 | -from PyQt4 import QtCore, QtGui |
187 | -from openlp.core.lib import translate, PluginStatus, buildIcon |
188 | - |
189 | -class PluginCombo(QtGui.QComboBox): |
190 | - """ |
191 | - Customised version of QTableWidget which can respond to keyboard |
192 | - events. |
193 | - """ |
194 | - def __init__(self, parent=None, plugin=None): |
195 | - QtGui.QComboBox.__init__(self, parent) |
196 | - self.parent = parent |
197 | - self.plugin = plugin |
198 | - |
199 | - def enterEvent(self, event): |
200 | - self.parent.activePlugin = self.plugin |
201 | - event.ignore() |
202 | - |
203 | -class PluginForm(QtGui.QDialog): |
204 | - global log |
205 | - log = logging.getLogger(u'PluginForm') |
206 | - |
207 | - def __init__(self, parent=None): |
208 | - QtGui.QDialog.__init__(self, parent) |
209 | - self.parent = parent |
210 | - self.activePlugin = None |
211 | - self.setupUi(self) |
212 | - log.debug(u'Defined') |
213 | - |
214 | - def setupUi(self, PluginForm): |
215 | - PluginForm.setObjectName(u'PluginForm') |
216 | - PluginForm.resize(400, 568) |
217 | - icon = buildIcon(u':/icon/openlp-logo-16x16.png') |
218 | - PluginForm.setWindowIcon(icon) |
219 | - self.PluginViewList = QtGui.QTableWidget(PluginForm) |
220 | - self.PluginViewList.setGeometry(QtCore.QRect(20, 10, 371, 261)) |
221 | - self.PluginViewList.setObjectName(u'PluginViewList') |
222 | - self.PluginViewList.setShowGrid(False) |
223 | - self.PluginViewList.setGridStyle(QtCore.Qt.SolidLine) |
224 | - self.PluginViewList.setSortingEnabled(False) |
225 | - self.PluginViewList.setColumnCount(3) |
226 | - item = QtGui.QTableWidgetItem() |
227 | - self.PluginViewList.setHorizontalHeaderItem(0, item) |
228 | - item = QtGui.QTableWidgetItem() |
229 | - self.PluginViewList.setHorizontalHeaderItem(1, item) |
230 | - item = QtGui.QTableWidgetItem() |
231 | - self.PluginViewList.setHorizontalHeaderItem(2, item) |
232 | - self.PluginViewList.horizontalHeader().setVisible(True) |
233 | - self.PluginViewList.horizontalHeader().setStretchLastSection(True) |
234 | - self.PluginViewList.verticalHeader().setVisible(False) |
235 | - self.ButtonBox = QtGui.QDialogButtonBox(PluginForm) |
236 | - self.ButtonBox.setGeometry(QtCore.QRect(220, 530, 170, 25)) |
237 | - self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) |
238 | - self.ButtonBox.setObjectName(u'ButtonBox') |
239 | - self.PluginInfoGroupBox = QtGui.QGroupBox(PluginForm) |
240 | - self.PluginInfoGroupBox.setGeometry(QtCore.QRect(20, 270, 371, 241)) |
241 | - self.PluginInfoGroupBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) |
242 | - self.PluginInfoGroupBox.setFlat(False) |
243 | - self.PluginInfoGroupBox.setObjectName("PluginInfoGroupBox") |
244 | - self.AboutTextLabel = QtGui.QLabel(self.PluginInfoGroupBox) |
245 | - self.AboutTextLabel.setGeometry(QtCore.QRect(10, 30, 351, 191)) |
246 | - self.AboutTextLabel.setAlignment(QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) |
247 | - self.AboutTextLabel.setWordWrap(True) |
248 | - self.AboutTextLabel.setObjectName("AboutTextLabel") |
249 | - |
250 | - self.retranslateUi(PluginForm) |
251 | - QtCore.QObject.connect(self.ButtonBox, |
252 | - QtCore.SIGNAL(u'accepted()'), PluginForm.close) |
253 | - QtCore.QMetaObject.connectSlotsByName(PluginForm) |
254 | - QtCore.QObject.connect(self.PluginViewList, |
255 | - QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'), self.displayAbout) |
256 | - |
257 | - def retranslateUi(self, PluginForm): |
258 | - PluginForm.setWindowTitle(translate(u'PluginForm', u'Plugin list')) |
259 | - self.PluginInfoGroupBox.setTitle(translate("PluginForm", "Selected Plugin Information")) |
260 | - self.PluginViewList.horizontalHeaderItem(0).setText( |
261 | - translate(u'PluginForm', u'Name')) |
262 | - self.PluginViewList.horizontalHeaderItem(1).setText( |
263 | - translate(u'PluginForm', u'Version')) |
264 | - self.PluginViewList.horizontalHeaderItem(2).setText( |
265 | - translate(u'PluginForm', u'Status')) |
266 | - |
267 | - def load(self): |
268 | - """ |
269 | - Load the plugin details into the screen |
270 | - """ |
271 | - self.PluginViewList.setRowCount(0) |
272 | - for plugin in self.parent.plugin_manager.plugins: |
273 | - row = self.PluginViewList.rowCount() |
274 | - self.PluginViewList.setRowCount(row + 1) |
275 | - item1 = QtGui.QTableWidgetItem(plugin.name) |
276 | - item1.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) |
277 | - item1.setTextAlignment(QtCore.Qt.AlignVCenter) |
278 | - item2 = QtGui.QTableWidgetItem(plugin.version) |
279 | - item2.setTextAlignment(QtCore.Qt.AlignVCenter) |
280 | - item2.setFlags(QtCore.Qt.ItemIsSelectable) |
281 | - self.PluginViewList.setItem(row, 0, item1) |
282 | - self.PluginViewList.setItem(row, 1, item2) |
283 | - if plugin.can_be_disabled(): |
284 | - combo = PluginCombo(self, plugin) |
285 | - self.PluginViewList.setCellWidget(row, 2, combo) |
286 | - combo.addItem(translate(u'PluginForm', u'Active')) |
287 | - combo.addItem(translate(u'PluginForm', u'Inactive')) |
288 | - combo.setCurrentIndex(int(plugin.status)) |
289 | - QtCore.QObject.connect(combo, |
290 | - QtCore.SIGNAL(u'currentIndexChanged(int)'), self.statusComboChanged) |
291 | - else: |
292 | - item3 = QtGui.QTableWidgetItem( |
293 | - translate(u'PluginForm', u'Active')) |
294 | - item3.setTextAlignment(QtCore.Qt.AlignVCenter) |
295 | - item3.setFlags(QtCore.Qt.ItemIsSelectable) |
296 | - self.PluginViewList.setItem(row, 2, item3) |
297 | - self.PluginViewList.setRowHeight(row, 25) |
298 | - |
299 | - def displayAbout(self, item): |
300 | - if item is None: |
301 | - return False |
302 | - row = self.PluginViewList.row(item) |
303 | - text = self.parent.plugin_manager.plugins[row].about() |
304 | - if text is not None: |
305 | - self.AboutTextLabel.setText(translate(u'PluginList', text)) |
306 | - |
307 | - def statusComboChanged(self, status): |
308 | - log.debug(u'Combo status changed %s for plugin %s' %(status, self.activePlugin.name)) |
309 | - self.activePlugin.toggle_status(status) |
310 | - if status == PluginStatus.Active: |
311 | - self.activePlugin.initialise() |
312 | - else: |
313 | - self.activePlugin.finalise() |
314 | |
315 | === added file 'openlp/core/ui/pluginform.py' |
316 | --- openlp/core/ui/pluginform.py 1970-01-01 00:00:00 +0000 |
317 | +++ openlp/core/ui/pluginform.py 2009-10-08 20:05:23 +0000 |
318 | @@ -0,0 +1,118 @@ |
319 | +# -*- coding: utf-8 -*- |
320 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
321 | + |
322 | +############################################################################### |
323 | +# OpenLP - Open Source Lyrics Projection # |
324 | +# --------------------------------------------------------------------------- # |
325 | +# Copyright (c) 2008-2009 Raoul Snyman # |
326 | +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # |
327 | +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # |
328 | +# --------------------------------------------------------------------------- # |
329 | +# This program is free software; you can redistribute it and/or modify it # |
330 | +# under the terms of the GNU General Public License as published by the Free # |
331 | +# Software Foundation; version 2 of the License. # |
332 | +# # |
333 | +# This program is distributed in the hope that it will be useful, but WITHOUT # |
334 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
335 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
336 | +# more details. # |
337 | +# # |
338 | +# You should have received a copy of the GNU General Public License along # |
339 | +# with this program; if not, write to the Free Software Foundation, Inc., 59 # |
340 | +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
341 | +############################################################################### |
342 | + |
343 | +import logging |
344 | + |
345 | +from PyQt4 import QtCore, QtGui |
346 | + |
347 | +from openlp.core.lib.plugin import PluginStatus |
348 | +from plugindialog import Ui_PluginViewDialog |
349 | + |
350 | +class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): |
351 | + global log |
352 | + log = logging.getLogger(u'PluginForm') |
353 | + |
354 | + def __init__(self, parent=None): |
355 | + QtGui.QDialog.__init__(self, parent) |
356 | + self.parent = parent |
357 | + self.activePlugin = None |
358 | + self.setupUi(self) |
359 | + self.load() |
360 | + self._clearDetails() |
361 | + # Right, now let's put some signals and slots together! |
362 | + QtCore.QObject.connect( |
363 | + self.PluginListWidget, |
364 | + QtCore.SIGNAL(u'itemSelectionChanged()'), |
365 | + self.onPluginListWidgetSelectionChanged) |
366 | + QtCore.QObject.connect( |
367 | + self.StatusComboBox, |
368 | + QtCore.SIGNAL(u'currentIndexChanged(int)'), |
369 | + self.onStatusComboBoxChanged) |
370 | + |
371 | + def load(self): |
372 | + """ |
373 | + Load the plugin details into the screen |
374 | + """ |
375 | + self.PluginListWidget.clear() |
376 | + for plugin in self.parent.plugin_manager.plugins: |
377 | + item = QtGui.QListWidgetItem(self.PluginListWidget) |
378 | + # We do this just to make 100% sure the status is an integer as |
379 | + # sometimes when it's loaded from the config, it isn't cast to int. |
380 | + plugin.status = int(plugin.status) |
381 | + # Set the little status text in brackets next to the plugin name. |
382 | + status_text = 'Inactive' |
383 | + if plugin.status == PluginStatus.Active: |
384 | + status_text = 'Active' |
385 | + elif plugin.status == PluginStatus.Inactive: |
386 | + status_text = 'Inactive' |
387 | + elif plugin.status == PluginStatus.Disabled: |
388 | + status_text = 'Disabled' |
389 | + item.setText(u'%s (%s)' % (plugin.name, status_text)) |
390 | + # If the plugin has an icon, set it! |
391 | + if plugin.icon is not None: |
392 | + item.setIcon(plugin.icon) |
393 | + self.PluginListWidget.addItem(item) |
394 | + |
395 | + def _clearDetails(self): |
396 | + self.StatusComboBox.setCurrentIndex(-1) |
397 | + self.VersionNumberLabel.setText(u'') |
398 | + self.AboutTextBrowser.setHtml(u'') |
399 | + |
400 | + def _setDetails(self): |
401 | + log.debug('PluginStatus: %s', str(self.activePlugin.status)) |
402 | + self.VersionNumberLabel.setText(self.activePlugin.version) |
403 | + self.AboutTextBrowser.setHtml(self.activePlugin.about()) |
404 | + self.StatusComboBox.setCurrentIndex(int(self.activePlugin.status)) |
405 | + |
406 | + def onPluginListWidgetSelectionChanged(self): |
407 | + if self.PluginListWidget.currentItem() is None: |
408 | + self._clearDetails() |
409 | + return |
410 | + plugin_name = self.PluginListWidget.currentItem().text().split(u' ')[0] |
411 | + self.activePlugin = None |
412 | + for plugin in self.parent.plugin_manager.plugins: |
413 | + if plugin.name == plugin_name: |
414 | + self.activePlugin = plugin |
415 | + break |
416 | + if self.activePlugin is not None: |
417 | + self._setDetails() |
418 | + else: |
419 | + self._clearDetails() |
420 | + |
421 | + def onStatusComboBoxChanged(self, status): |
422 | + self.activePlugin.toggle_status(status) |
423 | + if status == PluginStatus.Active: |
424 | + self.activePlugin.initialise() |
425 | + else: |
426 | + self.activePlugin.finalise() |
427 | + status_text = 'Inactive' |
428 | + if self.activePlugin.status == PluginStatus.Active: |
429 | + status_text = 'Active' |
430 | + elif self.activePlugin.status == PluginStatus.Inactive: |
431 | + status_text = 'Inactive' |
432 | + elif self.activePlugin.status == PluginStatus.Disabled: |
433 | + status_text = 'Disabled' |
434 | + self.PluginListWidget.currentItem().setText( |
435 | + u'%s (%s)' % (self.activePlugin.name, status_text)) |
436 | + |
437 | |
438 | === modified file 'resources/forms/plugindialoglistform.ui' |
439 | --- resources/forms/plugindialoglistform.ui 2009-10-02 12:16:54 +0000 |
440 | +++ resources/forms/plugindialoglistform.ui 2009-10-08 20:05:23 +0000 |
441 | @@ -1,139 +1,142 @@ |
442 | <?xml version="1.0" encoding="UTF-8"?> |
443 | <ui version="4.0"> |
444 | <class>PluginViewDialog</class> |
445 | - <widget class="QWidget" name="PluginViewDialog"> |
446 | + <widget class="QDialog" name="PluginViewDialog"> |
447 | + <property name="windowModality"> |
448 | + <enum>Qt::ApplicationModal</enum> |
449 | + </property> |
450 | <property name="geometry"> |
451 | <rect> |
452 | <x>0</x> |
453 | <y>0</y> |
454 | - <width>400</width> |
455 | - <height>568</height> |
456 | + <width>554</width> |
457 | + <height>344</height> |
458 | </rect> |
459 | </property> |
460 | <property name="windowTitle"> |
461 | <string>Plugin list</string> |
462 | </property> |
463 | - <widget class="QTableWidget" name="PluginViewList"> |
464 | - <property name="geometry"> |
465 | - <rect> |
466 | - <x>20</x> |
467 | - <y>10</y> |
468 | - <width>371</width> |
469 | - <height>261</height> |
470 | - </rect> |
471 | - </property> |
472 | - <property name="showGrid"> |
473 | - <bool>false</bool> |
474 | - </property> |
475 | - <property name="gridStyle"> |
476 | - <enum>Qt::SolidLine</enum> |
477 | - </property> |
478 | - <property name="rowCount"> |
479 | - <number>1</number> |
480 | - </property> |
481 | - <attribute name="horizontalHeaderVisible"> |
482 | - <bool>true</bool> |
483 | - </attribute> |
484 | - <attribute name="horizontalHeaderCascadingSectionResizes"> |
485 | - <bool>false</bool> |
486 | - </attribute> |
487 | - <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> |
488 | - <bool>true</bool> |
489 | - </attribute> |
490 | - <attribute name="horizontalHeaderStretchLastSection"> |
491 | - <bool>true</bool> |
492 | - </attribute> |
493 | - <attribute name="verticalHeaderVisible"> |
494 | - <bool>false</bool> |
495 | - </attribute> |
496 | - <attribute name="horizontalHeaderStretchLastSection"> |
497 | - <bool>true</bool> |
498 | - </attribute> |
499 | - <attribute name="horizontalHeaderCascadingSectionResizes"> |
500 | - <bool>false</bool> |
501 | - </attribute> |
502 | - <row/> |
503 | - <column> |
504 | - <property name="text"> |
505 | - <string>Name</string> |
506 | - </property> |
507 | - </column> |
508 | - <column> |
509 | - <property name="text"> |
510 | - <string>Version</string> |
511 | - </property> |
512 | - </column> |
513 | - <column> |
514 | - <property name="text"> |
515 | - <string>Status</string> |
516 | - </property> |
517 | - </column> |
518 | - <item row="0" column="0"> |
519 | - <property name="text"> |
520 | - <string>qqq</string> |
521 | - </property> |
522 | - </item> |
523 | - <item row="0" column="1"> |
524 | - <property name="text"> |
525 | - <string>aaa</string> |
526 | - </property> |
527 | - </item> |
528 | - <item row="0" column="2"> |
529 | - <property name="text"> |
530 | - <string>ccc</string> |
531 | - </property> |
532 | - </item> |
533 | - </widget> |
534 | - <widget class="QDialogButtonBox" name="ButtonBox"> |
535 | - <property name="geometry"> |
536 | - <rect> |
537 | - <x>220</x> |
538 | - <y>530</y> |
539 | - <width>170</width> |
540 | - <height>25</height> |
541 | - </rect> |
542 | - </property> |
543 | - <property name="standardButtons"> |
544 | - <set>QDialogButtonBox::Ok</set> |
545 | - </property> |
546 | - </widget> |
547 | - <widget class="QGroupBox" name="PluginInfoGroupBox"> |
548 | - <property name="geometry"> |
549 | - <rect> |
550 | - <x>20</x> |
551 | - <y>270</y> |
552 | - <width>371</width> |
553 | - <height>241</height> |
554 | - </rect> |
555 | - </property> |
556 | - <property name="title"> |
557 | - <string>GroupBox</string> |
558 | - </property> |
559 | - <property name="alignment"> |
560 | - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
561 | - </property> |
562 | - <property name="flat"> |
563 | - <bool>false</bool> |
564 | - </property> |
565 | - <widget class="QLabel" name="AboutTextLabel"> |
566 | - <property name="geometry"> |
567 | - <rect> |
568 | - <x>10</x> |
569 | - <y>30</y> |
570 | - <width>351</width> |
571 | - <height>191</height> |
572 | - </rect> |
573 | - </property> |
574 | - <property name="text"> |
575 | - <string>TextLabel</string> |
576 | - </property> |
577 | - </widget> |
578 | - </widget> |
579 | + <layout class="QVBoxLayout" name="PluginLayout"> |
580 | + <property name="spacing"> |
581 | + <number>8</number> |
582 | + </property> |
583 | + <property name="margin"> |
584 | + <number>8</number> |
585 | + </property> |
586 | + <item> |
587 | + <layout class="QHBoxLayout" name="ListLayout"> |
588 | + <property name="spacing"> |
589 | + <number>8</number> |
590 | + </property> |
591 | + <item> |
592 | + <widget class="QListWidget" name="PluginListWidget"> |
593 | + <property name="sizePolicy"> |
594 | + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> |
595 | + <horstretch>0</horstretch> |
596 | + <verstretch>0</verstretch> |
597 | + </sizepolicy> |
598 | + </property> |
599 | + <property name="maximumSize"> |
600 | + <size> |
601 | + <width>192</width> |
602 | + <height>16777215</height> |
603 | + </size> |
604 | + </property> |
605 | + </widget> |
606 | + </item> |
607 | + <item> |
608 | + <widget class="QGroupBox" name="PluginInfoGroupBox"> |
609 | + <property name="title"> |
610 | + <string>Plugin Details</string> |
611 | + </property> |
612 | + <property name="alignment"> |
613 | + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
614 | + </property> |
615 | + <property name="flat"> |
616 | + <bool>false</bool> |
617 | + </property> |
618 | + <layout class="QFormLayout" name="PluginInfoLayout"> |
619 | + <property name="horizontalSpacing"> |
620 | + <number>8</number> |
621 | + </property> |
622 | + <property name="verticalSpacing"> |
623 | + <number>8</number> |
624 | + </property> |
625 | + <property name="margin"> |
626 | + <number>8</number> |
627 | + </property> |
628 | + <item row="1" column="0"> |
629 | + <widget class="QLabel" name="VersionLabel"> |
630 | + <property name="text"> |
631 | + <string>Version:</string> |
632 | + </property> |
633 | + </widget> |
634 | + </item> |
635 | + <item row="1" column="1"> |
636 | + <widget class="QLabel" name="VersionNumberLabel"> |
637 | + <property name="text"> |
638 | + <string>TextLabel</string> |
639 | + </property> |
640 | + </widget> |
641 | + </item> |
642 | + <item row="2" column="0"> |
643 | + <widget class="QLabel" name="AboutLabel"> |
644 | + <property name="text"> |
645 | + <string>About:</string> |
646 | + </property> |
647 | + </widget> |
648 | + </item> |
649 | + <item row="0" column="0"> |
650 | + <widget class="QLabel" name="StatusLabel"> |
651 | + <property name="text"> |
652 | + <string>Status:</string> |
653 | + </property> |
654 | + </widget> |
655 | + </item> |
656 | + <item row="0" column="1"> |
657 | + <widget class="QComboBox" name="comboBox"> |
658 | + <item> |
659 | + <property name="text"> |
660 | + <string>Disabled</string> |
661 | + </property> |
662 | + </item> |
663 | + <item> |
664 | + <property name="text"> |
665 | + <string>Inactive</string> |
666 | + </property> |
667 | + </item> |
668 | + <item> |
669 | + <property name="text"> |
670 | + <string>Active</string> |
671 | + </property> |
672 | + </item> |
673 | + </widget> |
674 | + </item> |
675 | + <item row="2" column="1"> |
676 | + <widget class="QTextBrowser" name="AboutTextBrowser"> |
677 | + <property name="textInteractionFlags"> |
678 | + <set>Qt::LinksAccessibleByMouse</set> |
679 | + </property> |
680 | + </widget> |
681 | + </item> |
682 | + </layout> |
683 | + </widget> |
684 | + </item> |
685 | + </layout> |
686 | + </item> |
687 | + <item> |
688 | + <widget class="QDialogButtonBox" name="PluginListButtonBox"> |
689 | + <property name="standardButtons"> |
690 | + <set>QDialogButtonBox::Ok</set> |
691 | + </property> |
692 | + </widget> |
693 | + </item> |
694 | + </layout> |
695 | </widget> |
696 | <resources/> |
697 | <connections> |
698 | <connection> |
699 | - <sender>ButtonBox</sender> |
700 | + <sender>PluginListButtonBox</sender> |
701 | <signal>accepted()</signal> |
702 | <receiver>PluginViewDialog</receiver> |
703 | <slot>close()</slot> |
Pretty plugin window!