forked from openlp/openlp
more cleanups
This commit is contained in:
parent
fdfb2b1294
commit
80e818bd15
@ -523,9 +523,9 @@ class AdvancedTab(SettingsTab):
|
||||
"""
|
||||
old_root_path = str(self.data_directory_label.text())
|
||||
# Get the new directory location.
|
||||
new_data_path = QtGui.QFileDialog.getExistingDirectory(
|
||||
self, translate('OpenLP.AdvancedTab', 'Select Data Directory Location'), old_root_path,
|
||||
options=QtGui.QFileDialog.ShowDirsOnly)
|
||||
new_data_path = QtGui.QFileDialog.getExistingDirectory(self, translate('OpenLP.AdvancedTab',
|
||||
'Select Data Directory Location'),
|
||||
old_root_path, options=QtGui.QFileDialog.ShowDirsOnly)
|
||||
# Set the new data path.
|
||||
if new_data_path:
|
||||
new_data_path = os.path.normpath(new_data_path)
|
||||
@ -535,12 +535,13 @@ class AdvancedTab(SettingsTab):
|
||||
else:
|
||||
return
|
||||
# Make sure they want to change the data.
|
||||
answer = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to:\n\n%s\n\n '
|
||||
'The data directory will be changed when OpenLP is closed.').replace('%s', new_data_path),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
|
||||
'location of the OpenLP data directory to:\n\n%s\n\nThe data directory '
|
||||
'will be changed when OpenLP is closed.').replace('%s', new_data_path),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
if answer != QtGui.QMessageBox.Yes:
|
||||
return
|
||||
# Check if data already exists here.
|
||||
@ -558,11 +559,13 @@ class AdvancedTab(SettingsTab):
|
||||
if self.current_data_path.lower() != new_data_path.lower():
|
||||
# Make sure they want to change the data location back to the
|
||||
# default.
|
||||
answer = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to the default location?\n\nThis location will be used after OpenLP is closed.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
|
||||
'location of the OpenLP data directory to the default location?\n\nThis'
|
||||
' location will be used after OpenLP is closed.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
if answer != QtGui.QMessageBox.Yes:
|
||||
return
|
||||
self.check_data_overwrite(new_data_path)
|
||||
@ -595,11 +598,15 @@ class AdvancedTab(SettingsTab):
|
||||
self.data_exists = True
|
||||
# Check is they want to replace existing data.
|
||||
answer = QtGui.QMessageBox.warning(self,
|
||||
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
|
||||
translate('OpenLP.AdvancedTab', 'WARNING: \n\nThe location you have selected \n\n%s\n\n'
|
||||
'appears to contain OpenLP data files. Do you wish to replace these files with the current data files?'
|
||||
).replace('%s', os.path.abspath(data_path,)),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
|
||||
'appears to contain OpenLP data files. Do you wish to '
|
||||
'replace these files with the current data files?').replace
|
||||
('%s', os.path.abspath(data_path,)),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.Yes:
|
||||
self.data_directory_copy_check_box.setChecked(True)
|
||||
self.new_data_directory_has_files_label.show()
|
||||
@ -637,9 +644,9 @@ class AdvancedTab(SettingsTab):
|
||||
``checked``
|
||||
The state of the check box (boolean).
|
||||
"""
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('OpenLP.AdvancedTab', 'Restart Required'),
|
||||
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP has been restarted.'))
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
|
||||
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP '
|
||||
'has been restarted.'))
|
||||
|
||||
def on_end_slide_button_clicked(self):
|
||||
"""
|
||||
|
@ -75,13 +75,17 @@ class Ui_ExceptionDialog(object):
|
||||
self.exception_text_edit.setObjectName('exception_text_edit')
|
||||
self.exception_layout.addWidget(self.exception_text_edit)
|
||||
self.send_report_button = create_button(exception_dialog, 'send_report_button',
|
||||
icon=':/general/general_email.png', click=self.on_send_report_button_clicked)
|
||||
icon=':/general/general_email.png',
|
||||
click=self.on_send_report_button_clicked)
|
||||
self.save_report_button = create_button(exception_dialog, 'save_report_button',
|
||||
icon=':/general/general_save.png', click=self.on_save_report_button_clicked)
|
||||
icon=':/general/general_save.png',
|
||||
click=self.on_save_report_button_clicked)
|
||||
self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
|
||||
icon=':/general/general_open.png', click=self.on_attach_file_button_clicked)
|
||||
icon=':/general/general_open.png',
|
||||
click=self.on_attach_file_button_clicked)
|
||||
self.button_box = create_button_box(exception_dialog, 'button_box',
|
||||
['close'], [self.send_report_button, self.save_report_button, self.attach_tile_button])
|
||||
['close'], [self.send_report_button,
|
||||
self.save_report_button, self.attach_tile_button])
|
||||
self.exception_layout.addWidget(self.button_box)
|
||||
|
||||
self.retranslateUi(exception_dialog)
|
||||
@ -93,14 +97,14 @@ class Ui_ExceptionDialog(object):
|
||||
"""
|
||||
exception_dialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
|
||||
self.description_explanation.setText(translate('OpenLP.ExceptionDialog',
|
||||
'Please enter a description of what you were doing to cause this '
|
||||
'error \n(Minimum 20 characters)'))
|
||||
'Please enter a description of what you were doing to cause this error '
|
||||
'\n(Minimum 20 characters)'))
|
||||
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.'))
|
||||
'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.'))
|
||||
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'))
|
||||
|
@ -144,19 +144,19 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
||||
system += 'Desktop: GNOME\n'
|
||||
elif os.environ.get('DESKTOP_SESSION') == 'xfce':
|
||||
system += 'Desktop: Xfce\n'
|
||||
return (openlp_version, description, traceback, system, libraries)
|
||||
return openlp_version, description, traceback, system, libraries
|
||||
|
||||
def on_save_report_button_clicked(self):
|
||||
"""
|
||||
Saving exception log and system information to a file.
|
||||
"""
|
||||
report_text = 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')
|
||||
'**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')
|
||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
||||
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
|
||||
Settings().value(self.settings_section + '/last directory'),
|
||||
@ -202,12 +202,12 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
||||
if ':' in line:
|
||||
exception = line.split('\n')[-1].split(':')[0]
|
||||
subject = 'Bug report: %s in %s' % (exception, source)
|
||||
mailto_url = QtCore.QUrl('mailto:bugs@openlp.org')
|
||||
mailto_url.addQueryItem('subject', subject)
|
||||
mailto_url.addQueryItem('body', body % content)
|
||||
mail_to_url = QtCore.QUrl('mailto:bugs@openlp.org')
|
||||
mail_to_url.addQueryItem('subject', subject)
|
||||
mail_to_url.addQueryItem('body', body % content)
|
||||
if self.file_attachment:
|
||||
mailto_url.addQueryItem('attach', self.file_attachment)
|
||||
QtGui.QDesktopServices.openUrl(mailto_url)
|
||||
mail_to_url.addQueryItem('attach', self.file_attachment)
|
||||
QtGui.QDesktopServices.openUrl(mail_to_url)
|
||||
|
||||
def on_description_updated(self):
|
||||
"""
|
||||
@ -226,9 +226,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
||||
"""
|
||||
Attache files to the bug report e-mail.
|
||||
"""
|
||||
files = QtGui.QFileDialog.getOpenFileName(
|
||||
self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
|
||||
Settings().value(self.settings_section + '/last directory'), '%s (*.*) (*)' % UiStrings().AllFiles)
|
||||
files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
|
||||
Settings().value(self.settings_section + '/last directory'),
|
||||
'%s (*.*) (*)' % UiStrings().AllFiles)
|
||||
log.info('New files(s) %s', str(files))
|
||||
if files:
|
||||
self.file_attachment = str(files)
|
||||
|
Loading…
Reference in New Issue
Block a user