From c0de5cfd8880c3277be6e2f4ad1255676c5d8e15 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 3 Feb 2011 17:11:20 +0000 Subject: [PATCH 1/8] Fix up exception form --- openlp.pyw | 1 + openlp/core/ui/exceptiondialog.py | 23 ++++ openlp/core/ui/exceptionform.py | 30 ++++- resources/forms/exceptiondialog.ui | 194 ++++++++++++++++++----------- 4 files changed, 170 insertions(+), 78 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 8d20080c9..4704a8740 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -196,6 +196,7 @@ class OpenLP(QtGui.QApplication): self.mainWindow.repaint() update_check = QtCore.QSettings().value( u'general/update check', QtCore.QVariant(True)).toBool() + a=c if update_check: VersionThread(self.mainWindow, app_version).start() return self.exec_() diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 69035dc4d..9e9b558df 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -46,6 +46,15 @@ class Ui_ExceptionDialog(object): self.messageLabel.setObjectName(u'messageLabel') self.messageLayout.addWidget(self.messageLabel) self.exceptionLayout.addLayout(self.messageLayout) + self.descriptionExplanation = QtGui.QLabel(exceptionDialog) + self.descriptionExplanation.setObjectName(u'descriptionExplanation') + self.exceptionLayout.addWidget(self.descriptionExplanation) + self.descriptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog) + self.descriptionTextEdit.setObjectName(u'descriptionTextEdit') + self.exceptionLayout.addWidget(self.descriptionTextEdit) + self.descriptionWordCount = QtGui.QLabel(exceptionDialog) + self.descriptionWordCount.setObjectName(u'descriptionWordCount') + self.exceptionLayout.addWidget(self.descriptionWordCount) self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog) self.exceptionTextEdit.setReadOnly(True) self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') @@ -65,19 +74,31 @@ class Ui_ExceptionDialog(object): self.saveReportButton.setObjectName(u'saveReportButton') self.exceptionButtonBox.addButton(self.saveReportButton, QtGui.QDialogButtonBox.ActionRole) + self.attachFileButton = QtGui.QPushButton(exceptionDialog) + self.attachFileButton.setIcon(build_icon(u':/general/general_open.png')) + self.attachFileButton.setObjectName(u'attachFileButton') + self.exceptionButtonBox.addButton(self.attachFileButton, + QtGui.QDialogButtonBox.ActionRole) self.retranslateUi(exceptionDialog) + QtCore.QObject.connect(self.descriptionTextEdit, + QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated) QtCore.QObject.connect(self.exceptionButtonBox, QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject) QtCore.QObject.connect(self.sendReportButton, QtCore.SIGNAL(u'pressed()'), self.onSendReportButtonPressed) QtCore.QObject.connect(self.saveReportButton, QtCore.SIGNAL(u'pressed()'), self.onSaveReportButtonPressed) + QtCore.QObject.connect(self.attachFileButton, + QtCore.SIGNAL(u'pressed()'), self.onAttachFileButtonPressed) QtCore.QMetaObject.connectSlotsByName(exceptionDialog) def retranslateUi(self, exceptionDialog): exceptionDialog.setWindowTitle( translate('OpenLP.ExceptionDialog', 'Error Occurred')) + self.descriptionExplanation.setText(translate('OpenLP.ExceptionDialog', + 'Please enter a description of what you were doing to cause this ' + 'error')) self.messageLabel.setText(translate('OpenLP.ExceptionDialog', 'Oops! ' 'OpenLP hit a problem, and couldn\'t recover. The text in the box ' 'below contains information that might be helpful to the OpenLP ' @@ -88,3 +109,5 @@ class Ui_ExceptionDialog(object): 'Send E-Mail')) self.saveReportButton.setText(translate('OpenLP.ExceptionDialog', 'Save to File')) + self.attachFileButton.setText(translate('OpenLP.ExceptionDialog', + 'Attach File')) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 347bcf8f1..ff37770d2 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -70,8 +70,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): self.setupUi(self) self.settingsSection = u'crashreport' + def exec_(self): + self.onDescriptionUpdated() + return QtGui.QDialog.exec_(self) + def _createReport(self): openlp_version = self.parent().applicationVersion[u'full'] + description = unicode(self.descriptionTextEdit.toPlainText()) traceback = unicode(self.exceptionTextEdit.toPlainText()) system = unicode(translate('OpenLP.ExceptionForm', 'Platform: %s\n')) % platform.platform() @@ -90,7 +95,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): system = system + u'Desktop: KDE SC\n' elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'): system = system + u'Desktop: GNOME\n' - return (openlp_version, traceback, system, libraries) + return (openlp_version, description, traceback, system, libraries) def onSaveReportButtonPressed(self): """ @@ -99,6 +104,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): report = unicode(translate('OpenLP.ExceptionForm', '**OpenLP Bug Report**\n' 'Version: %s\n\n' + '--- Details of the Exception. ---\n\n%s\n\n ' '--- Exception Traceback ---\n%s\n' '--- System information ---\n%s\n' '--- Library Versions ---\n%s\n')) @@ -129,10 +135,11 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): Opening systems default email client and inserting exception log and system informations. """ + attach = None body = unicode(translate('OpenLP.ExceptionForm', '*OpenLP Bug Report*\n' 'Version: %s\n\n' - '--- Please enter the report below this line. ---\n\n\n' + '--- Details of the Exception. ---\n\n%s\n\n ' '--- Exception Traceback ---\n%s\n' '--- System information ---\n%s\n' '--- Library Versions ---\n%s\n', @@ -145,5 +152,20 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): if u':' in line: exception = line.split(u'\n')[-1].split(u':')[0] subject = u'Bug report: %s in %s' % (exception, source) - mailto(address=u'bugs@openlp.org', subject=subject, - body=body % content) + if attach: + mailto(address=u'bugs@openlp.org', subject=subject, + body=body % content, attach=attach) + else: + mailto(address=u'bugs@openlp.org', subject=subject, + body=body % content) + + def onDescriptionUpdated(self): + count = int(20 - len(self.descriptionTextEdit.toPlainText())) + if count < 0: + count = 0 + self.descriptionWordCount.setText( + unicode(translate('OpenLP.ExceptionDialog', + 'Characters to Enter : %s')) % count ) + + def onAttachFileButtonPressed(self): + print self.descriptionTextEdit.toPlainText() diff --git a/resources/forms/exceptiondialog.ui b/resources/forms/exceptiondialog.ui index f6f15cdc7..9fd138092 100644 --- a/resources/forms/exceptiondialog.ui +++ b/resources/forms/exceptiondialog.ui @@ -13,82 +13,128 @@ Dialog - - - 8 + + + + 8 + 194 + 564 + 171 + - - 8 + + true - - - - 0 - - - 0 - - - 0 - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - - - :/graphics/exception.png - - - Qt::AlignCenter - - - - - - - Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs@openlp.org, along with a detailed description of what you were doing when the problem occurred. - - - true - - - - - - - - - true - - - false - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - + + false + + + + + + 8 + 373 + 83 + 26 + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + 8 + 103 + 561 + 71 + + + + + 0 + 0 + + + + + + + 10 + 170 + 301 + 17 + + + + TextLabel + + + + + + 10 + 80 + 59 + 17 + + + + TextLabel + + + + + + 0 + + + 0 + + + 0 + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + :/graphics/exception.png + + + Qt::AlignCenter + + + + + + + Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs@openlp.org, along with a detailed description of what you were doing when the problem occurred. + + + true + + + + + From ccfc9abc734e416ce1a538fce7109c179fd80a7e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 3 Feb 2011 17:23:24 +0000 Subject: [PATCH 2/8] Fix up exception form - part 2 --- openlp.pyw | 1 + openlp/core/ui/exceptionform.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp.pyw b/openlp.pyw index 4704a8740..695d6e09f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -217,6 +217,7 @@ class OpenLP(QtGui.QApplication): Sets the Busy Cursor for the Application """ self.setOverrideCursor(QtCore.Qt.BusyCursor) + self.processEvents() def setNormalCursor(self): """ diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index ff37770d2..f9a9c59e0 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -146,7 +146,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): 'Please add the information that bug reports are favoured written ' 'in English.')) content = self._createReport() - for line in content[1].split(u'\n'): + for line in content[2].split(u'\n'): if re.search(r'[/\\]openlp[/\\]', line): source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line) if u':' in line: From 2069737e1f00cd2934abc826ecd38b3180950b64 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 3 Feb 2011 18:48:41 +0000 Subject: [PATCH 3/8] remove extra post events --- openlp/core/ui/servicemanager.py | 1 - openlp/plugins/bibles/lib/http.py | 1 - openlp/plugins/songs/forms/songmaintenanceform.py | 1 - 3 files changed, 3 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 4d36f4aec..bddd150b8 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -507,7 +507,6 @@ class ServiceManager(QtGui.QWidget): p_file = filePath if 'p_file' in locals(): Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') fileTo = open(p_file, u'r') items = cPickle.load(fileTo) fileTo.close() diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 8db214140..7cba6facb 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -443,7 +443,6 @@ class HTTPBible(BibleDB): book = db_book.name if BibleDB.get_verse_count(self, book, reference[1]) == 0: Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') search_results = self.get_chapter(book, reference[1]) if search_results and search_results.has_verselist(): ## We have found a book of the bible lets check to see diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 737d63204..2aeb30228 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -372,7 +372,6 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): Utility method to merge two objects to leave one in the database. """ Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') merge(dbObject) reset() Receiver.send_message(u'songs_load_list') From 999f40ffc9ab0b5ca204fe6a5d3c759f8612802e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 3 Feb 2011 19:07:27 +0000 Subject: [PATCH 4/8] Exception Form has attachments --- openlp/core/ui/exceptionform.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index f9a9c59e0..a92967b6c 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -72,6 +72,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): def exec_(self): self.onDescriptionUpdated() + self.fileAttachment = None return QtGui.QDialog.exec_(self) def _createReport(self): @@ -152,9 +153,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): if u':' in line: exception = line.split(u'\n')[-1].split(u':')[0] subject = u'Bug report: %s in %s' % (exception, source) - if attach: + if self.fileAttachment: mailto(address=u'bugs@openlp.org', subject=subject, - body=body % content, attach=attach) + body=body % content, attach=self.fileAttachment) else: mailto(address=u'bugs@openlp.org', subject=subject, body=body % content) @@ -163,9 +164,24 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): count = int(20 - len(self.descriptionTextEdit.toPlainText())) if count < 0: count = 0 + self.__buttonState(True) + else: + self.__buttonState(False) self.descriptionWordCount.setText( unicode(translate('OpenLP.ExceptionDialog', 'Characters to Enter : %s')) % count ) def onAttachFileButtonPressed(self): - print self.descriptionTextEdit.toPlainText() + files = QtGui.QFileDialog.getOpenFileName( + self,translate('ImagePlugin.ExceptionDialog', + 'Select Attachment'), + SettingsManager.get_last_dir(u'exceptions'), + u'%s (*.*) (*)' % + unicode(translate('ImagePlugin.MediaItem', 'All Files'))) + log.info(u'New files(s) %s', unicode(files)) + if files: + self.fileAttachment = unicode(files) + + def __buttonState(self, state): + self.saveReportButton.setEnabled(state) + self.sendReportButton.setEnabled(state) From 90023bb8537266f21b8314b1bfef4691160ebe22 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Feb 2011 16:39:01 +0000 Subject: [PATCH 5/8] For updates --- openlp.pyw | 2 +- openlp/core/ui/exceptiondialog.py | 3 +++ openlp/core/ui/exceptionform.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 695d6e09f..15f2c8788 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -76,7 +76,7 @@ class OpenLP(QtGui.QApplication): """ Load and store current Application Version """ - if u'--dev-version' in sys.argv: + if u'--dev-version' in sys.argv or u'-d' in sys.argv: # If we're running the dev version, let's use bzr to get the version try: # If bzrlib is availble, use it diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 9e9b558df..2279e5272 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -63,17 +63,20 @@ class Ui_ExceptionDialog(object): self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') self.exceptionLayout.addWidget(self.exceptionButtonBox) + self.sendReportButton = QtGui.QPushButton(exceptionDialog) self.sendReportButton.setIcon(build_icon( u':/general/general_email.png')) self.sendReportButton.setObjectName(u'sendReportButton') self.exceptionButtonBox.addButton(self.sendReportButton, QtGui.QDialogButtonBox.ActionRole) + self.saveReportButton = QtGui.QPushButton(exceptionDialog) self.saveReportButton.setIcon(build_icon(u':/general/general_save.png')) self.saveReportButton.setObjectName(u'saveReportButton') self.exceptionButtonBox.addButton(self.saveReportButton, QtGui.QDialogButtonBox.ActionRole) + self.attachFileButton = QtGui.QPushButton(exceptionDialog) self.attachFileButton.setIcon(build_icon(u':/general/general_open.png')) self.attachFileButton.setObjectName(u'attachFileButton') diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index a92967b6c..0a2d7acee 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -169,7 +169,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): self.__buttonState(False) self.descriptionWordCount.setText( unicode(translate('OpenLP.ExceptionDialog', - 'Characters to Enter : %s')) % count ) + 'Description characters to Enter : %s')) % count ) def onAttachFileButtonPressed(self): files = QtGui.QFileDialog.getOpenFileName( From 7369a0391c5282622945448d026cfa771f27a795 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Feb 2011 16:41:02 +0000 Subject: [PATCH 6/8] Fix setup.py --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a435c5496..205688f1e 100755 --- a/setup.py +++ b/setup.py @@ -69,8 +69,7 @@ OpenLP (previously openlp.org) is free church presentation software, or lyrics p url='http://openlp.org/', license='GNU General Public License', packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), - scripts=['openlp.pyw', 'scripts/openlp-1to2-converter.py', - 'scripts/bible-1to2-converter.py','scripts/openlp-remoteclient.py'], + scripts=['openlp.pyw', 'scripts/openlp-remoteclient.py'], include_package_data=True, zip_safe=False, install_requires=[ From 396037c0a3cbe583b38227f2f1ee13152fcf0343 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Feb 2011 16:49:30 +0000 Subject: [PATCH 7/8] Clean up time --- openlp.pyw | 1 - openlp/core/ui/exceptiondialog.py | 5 +---- openlp/core/ui/exceptionform.py | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 15f2c8788..100c3336f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -196,7 +196,6 @@ class OpenLP(QtGui.QApplication): self.mainWindow.repaint() update_check = QtCore.QSettings().value( u'general/update check', QtCore.QVariant(True)).toBool() - a=c if update_check: VersionThread(self.mainWindow, app_version).start() return self.exec_() diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 2279e5272..ba7bab496 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -63,20 +63,17 @@ class Ui_ExceptionDialog(object): self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') self.exceptionLayout.addWidget(self.exceptionButtonBox) - self.sendReportButton = QtGui.QPushButton(exceptionDialog) self.sendReportButton.setIcon(build_icon( u':/general/general_email.png')) self.sendReportButton.setObjectName(u'sendReportButton') self.exceptionButtonBox.addButton(self.sendReportButton, QtGui.QDialogButtonBox.ActionRole) - self.saveReportButton = QtGui.QPushButton(exceptionDialog) self.saveReportButton.setIcon(build_icon(u':/general/general_save.png')) self.saveReportButton.setObjectName(u'saveReportButton') self.exceptionButtonBox.addButton(self.saveReportButton, QtGui.QDialogButtonBox.ActionRole) - self.attachFileButton = QtGui.QPushButton(exceptionDialog) self.attachFileButton.setIcon(build_icon(u':/general/general_open.png')) self.attachFileButton.setObjectName(u'attachFileButton') @@ -101,7 +98,7 @@ class Ui_ExceptionDialog(object): translate('OpenLP.ExceptionDialog', 'Error Occurred')) self.descriptionExplanation.setText(translate('OpenLP.ExceptionDialog', 'Please enter a description of what you were doing to cause this ' - 'error')) + 'error \n(Minimum 20 characters)')) self.messageLabel.setText(translate('OpenLP.ExceptionDialog', 'Oops! ' 'OpenLP hit a problem, and couldn\'t recover. The text in the box ' 'below contains information that might be helpful to the OpenLP ' diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 0a2d7acee..ef3c84f18 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -169,7 +169,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): self.__buttonState(False) self.descriptionWordCount.setText( unicode(translate('OpenLP.ExceptionDialog', - 'Description characters to Enter : %s')) % count ) + 'Description characters to enter : %s')) % count ) def onAttachFileButtonPressed(self): files = QtGui.QFileDialog.getOpenFileName( From 6577f6c25e0803e611545d53d957b868e7b24fea Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Feb 2011 17:15:48 +0000 Subject: [PATCH 8/8] Fixes --- openlp/core/ui/exceptionform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index ef3c84f18..7f9e23c61 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -71,6 +71,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): self.settingsSection = u'crashreport' def exec_(self): + self.descriptionTextEdit.setPlainText(u'') self.onDescriptionUpdated() self.fileAttachment = None return QtGui.QDialog.exec_(self) @@ -136,7 +137,6 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): Opening systems default email client and inserting exception log and system informations. """ - attach = None body = unicode(translate('OpenLP.ExceptionForm', '*OpenLP Bug Report*\n' 'Version: %s\n\n'