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