exception form: code standards

This commit is contained in:
Andreas Preikschat 2013-03-05 15:14:37 +01:00
parent 8fed2230d3
commit 11db599cb1
2 changed files with 12 additions and 12 deletions

View File

@ -75,11 +75,11 @@ class Ui_ExceptionDialog(object):
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',
icon=u':/general/general_email.png', click=self.onSendReportButtonClicked)
icon=u':/general/general_email.png', click=self.on_send_report_button_clicked)
self.save_report_button = create_button(exception_dialog, u'save_report_button',
icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
icon=u':/general/general_save.png', click=self.on_save_report_button_clicked)
self.attach_tile_button = create_button(exception_dialog, u'attach_tile_button',
icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked)
icon=u':/general/general_open.png', click=self.on_attach_file_button_clicked)
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)

View File

@ -117,7 +117,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
self.file_attachment = None
return QtGui.QDialog.exec_(self)
def _createReport(self):
def _create_report(self):
"""
Create an exception report.
"""
@ -146,7 +146,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
system += u'Desktop: GNOME\n'
return (openlp_version, description, traceback, system, libraries)
def onSaveReportButtonClicked(self):
def on_save_report_button_clicked(self):
"""
Saving exception log and system information to a file.
"""
@ -164,7 +164,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
if filename:
filename = unicode(filename).replace(u'/', os.path.sep)
Settings().setValue(self.settings_section + u'/last directory', os.path.dirname(filename))
report_text = report_text % self._createReport()
report_text = report_text % self._create_report()
try:
report_file = open(filename, u'w')
try:
@ -180,7 +180,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
finally:
report_file.close()
def onSendReportButtonClicked(self):
def on_send_report_button_clicked(self):
"""
Opening systems default email client and inserting exception log and
system informations.
@ -194,7 +194,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
'in English.')
content = self._createReport()
content = self._create_report()
source = u''
exception = u''
for line in content[2].split(u'\n'):
@ -217,13 +217,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
count = int(20 - len(self.description_text_edit.toPlainText()))
if count < 0:
count = 0
self.__buttonState(True)
self.__button_state(True)
else:
self.__buttonState(False)
self.__button_state(False)
self.description_word_count.setText(
translate('OpenLP.ExceptionDialog', 'Description characters to enter : %s') % count)
def onAttachFileButtonClicked(self):
def on_attach_file_button_clicked(self):
"""
Attache files to the bug report e-mail.
"""
@ -234,7 +234,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
if files:
self.file_attachment = unicode(files)
def __buttonState(self, state):
def __button_state(self, state):
"""
Toggle the button state.
"""