openlp/openlp/core/ui/exceptiondialog.py

107 lines
6.3 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2012-12-29 09:35:24 +00:00
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2012-12-29 20:56:56 +00:00
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
2012-11-11 21:16:14 +00:00
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
2012-10-21 13:16:22 +00:00
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
2013-02-01 19:58:18 +00:00
"""
The GUI widgets of the exception dialog.
"""
from PyQt4 import QtCore, QtGui
2012-12-30 08:33:42 +00:00
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button, create_button_box
2013-02-01 19:58:18 +00:00
class Ui_ExceptionDialog(object):
2013-02-01 19:58:18 +00:00
"""
The GUI widgets of the exception dialog.
"""
2013-03-05 14:02:56 +00:00
def setupUi(self, exception_dialog):
2013-02-01 19:58:18 +00:00
"""
Set up the UI.
"""
2013-03-05 14:02:56 +00:00
exception_dialog.setObjectName(u'exception_dialog')
self.exception_layout = QtGui.QVBoxLayout(exception_dialog)
self.exception_layout.setObjectName(u'exception_layout')
self.message_layout = QtGui.QHBoxLayout()
self.message_layout.setObjectName(u'messageLayout')
self.message_layout.addSpacing(12)
self.bug_label = QtGui.QLabel(exception_dialog)
self.bug_label.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
self.bug_label.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.bug_label.setObjectName(u'bug_label')
self.message_layout.addWidget(self.bug_label)
self.message_layout.addSpacing(12)
self.message_label = QtGui.QLabel(exception_dialog)
self.message_label.setWordWrap(True)
self.message_label.setObjectName(u'message_label')
self.message_layout.addWidget(self.message_label)
self.exception_layout.addLayout(self.message_layout)
self.description_explanation = QtGui.QLabel(exception_dialog)
self.description_explanation.setObjectName(u'description_explanation')
self.exception_layout.addWidget(self.description_explanation)
self.description_text_edit = QtGui.QPlainTextEdit(exception_dialog)
self.description_text_edit.setObjectName(u'description_text_edit')
self.exception_layout.addWidget(self.description_text_edit)
self.description_word_count = QtGui.QLabel(exception_dialog)
self.description_word_count.setObjectName(u'description_word_count')
self.exception_layout.addWidget(self.description_word_count)
self.exception_text_edit = QtGui.QPlainTextEdit(exception_dialog)
self.exception_text_edit.setReadOnly(True)
self.exception_text_edit.setObjectName(u'exception_text_edit')
self.exception_layout.addWidget(self.exception_text_edit)
self.send_report_button = create_button(exception_dialog, u'send_report_button',
2013-03-05 14:14:37 +00:00
icon=u':/general/general_email.png', click=self.on_send_report_button_clicked)
2013-03-05 14:02:56 +00:00
self.save_report_button = create_button(exception_dialog, u'save_report_button',
2013-03-05 14:14:37 +00:00
icon=u':/general/general_save.png', click=self.on_save_report_button_clicked)
2013-03-05 14:02:56 +00:00
self.attach_tile_button = create_button(exception_dialog, u'attach_tile_button',
2013-03-05 14:14:37 +00:00
icon=u':/general/general_open.png', click=self.on_attach_file_button_clicked)
2013-03-05 14:02:56 +00:00
self.button_box = create_button_box(exception_dialog, u'button_box',
[u'close'], [self.send_report_button, self.save_report_button, self.attach_tile_button])
self.exception_layout.addWidget(self.button_box)
2013-03-05 14:02:56 +00:00
self.retranslateUi(exception_dialog)
2013-03-05 14:05:19 +00:00
self.description_text_edit.textChanged.connect(self.on_description_updated)
2013-03-05 14:02:56 +00:00
def retranslateUi(self, exception_dialog):
2013-02-01 19:58:18 +00:00
"""
Translate the widgets on the fly.
"""
2013-03-05 14:02:56 +00:00
exception_dialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
self.description_explanation.setText(translate('OpenLP.ExceptionDialog',
2011-02-03 17:11:20 +00:00
'Please enter a description of what you were doing to cause this '
2011-02-04 16:49:30 +00:00
'error \n(Minimum 20 characters)'))
2013-03-05 14:02:56 +00:00
self.message_label.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 '
'developers, so please e-mail it to bugs@openlp.org, along with a '
'detailed description of what you were doing when the problem '
'occurred.'))
2013-03-05 14:02:56 +00:00
self.send_report_button.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail'))
self.save_report_button.setText(translate('OpenLP.ExceptionDialog', 'Save to File'))
self.attach_tile_button.setText(translate('OpenLP.ExceptionDialog', 'Attach File'))