From 86efc5629ca20185be3035b0e57d98ba1ed3ae46 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 6 Mar 2013 23:32:59 +0100 Subject: [PATCH] fixed formattigtagsform/dialog --- openlp/core/ui/formattingtagdialog.py | 16 ++++---- openlp/core/ui/formattingtagform.py | 54 +++++++++++++-------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/openlp/core/ui/formattingtagdialog.py b/openlp/core/ui/formattingtagdialog.py index b2cc35cd1..ef45777d7 100644 --- a/openlp/core/ui/formattingtagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -94,18 +94,18 @@ class Ui_FormattingTagDialog(object): self.tag_label.setAlignment(QtCore.Qt.AlignCenter) self.tag_label.setObjectName(u'tag_label') self.data_grid_layout.addWidget(self.tag_label, 2, 0, 1, 1) - self.tagLineEdit = QtGui.QLineEdit(self.edit_group_box) - self.tagLineEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.tagLineEdit.setMaxLength(5) - self.tagLineEdit.setObjectName(u'tagLineEdit') - self.data_grid_layout.addWidget(self.tagLineEdit, 2, 1, 1, 1) + self.tag_line_edit = QtGui.QLineEdit(self.edit_group_box) + self.tag_line_edit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.tag_line_edit.setMaxLength(5) + self.tag_line_edit.setObjectName(u'tag_line_edit') + self.data_grid_layout.addWidget(self.tag_line_edit, 2, 1, 1, 1) self.start_tag_label = QtGui.QLabel(self.edit_group_box) self.start_tag_label.setAlignment(QtCore.Qt.AlignCenter) self.start_tag_label.setObjectName(u'start_tag_label') self.data_grid_layout.addWidget(self.start_tag_label, 3, 0, 1, 1) - self.startTagLineEdit = QtGui.QLineEdit(self.edit_group_box) - self.startTagLineEdit.setObjectName(u'startTagLineEdit') - self.data_grid_layout.addWidget(self.startTagLineEdit, 3, 1, 1, 1) + self.start_tag_line_edit = QtGui.QLineEdit(self.edit_group_box) + self.start_tag_line_edit.setObjectName(u'start_tag_line_edit') + self.data_grid_layout.addWidget(self.start_tag_line_edit, 3, 1, 1, 1) self.end_tag_label = QtGui.QLabel(self.edit_group_box) self.end_tag_label.setAlignment(QtCore.Qt.AlignCenter) self.end_tag_label.setObjectName(u'end_tag_label') diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index e325e8cd2..3d8261b03 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -48,15 +48,15 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - QtCore.QObject.connect(self.tag_table_widget, QtCore.SIGNAL(u'itemSelectionChanged()'), self.onRowSelected) - QtCore.QObject.connect(self.new_push_button, QtCore.SIGNAL(u'clicked()'), self.onNewClicked) - QtCore.QObject.connect(self.save_push_button, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked) - QtCore.QObject.connect(self.delete_push_button, QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked) - QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'rejected()'), self.close) - QtCore.QObject.connect(self.description_line_edit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited) - QtCore.QObject.connect(self.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited) - QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited) - QtCore.QObject.connect(self.end_tag_line_edit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited) + self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected) + self.new_push_button.clicked.connect(self.on_new_clicked) + self.save_push_button.clicked.connect(self.on_saved_clicked) + self.delete_push_button.clicked.connect(self.on_delete_clicked) + self.button_boxrejected.connect(self.close) + self.description_line_edit.textEdited.connect(self.on_text_edited) + self.tag_line_edit.textEdited.connect(self.on_text_edited) + self.start_tag_line_edit.textEdited.connect(self.on_text_edited) + self.end_tag_line_edit.textEdited.connect(self.on_text_edited) # Forces reloading of tags from openlp configuration. FormattingTags.load_tags() @@ -69,7 +69,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self.selected = -1 return QtGui.QDialog.exec_(self) - def onRowSelected(self): + def on_row_selected(self): """ Table Row selected so display items and set field state. """ @@ -77,30 +77,30 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self.selected = self.tag_table_widget.currentRow() html = FormattingTags.get_html_tags()[self.selected] self.description_line_edit.setText(html[u'desc']) - self.tagLineEdit.setText(self._strip(html[u'start tag'])) - self.startTagLineEdit.setText(html[u'start html']) + self.tag_line_edit.setText(self._strip(html[u'start tag'])) + self.start_tag_line_edit.setText(html[u'start html']) self.end_tag_line_edit.setText(html[u'end html']) if html[u'protected']: self.description_line_edit.setEnabled(False) - self.tagLineEdit.setEnabled(False) - self.startTagLineEdit.setEnabled(False) + self.tag_line_edit.setEnabled(False) + self.start_tag_line_edit.setEnabled(False) self.end_tag_line_edit.setEnabled(False) self.delete_push_button.setEnabled(False) else: self.description_line_edit.setEnabled(True) - self.tagLineEdit.setEnabled(True) - self.startTagLineEdit.setEnabled(True) + self.tag_line_edit.setEnabled(True) + self.start_tag_line_edit.setEnabled(True) self.end_tag_line_edit.setEnabled(True) self.delete_push_button.setEnabled(True) - def onTextEdited(self, text): + def on_text_edited(self, text): """ Enable the ``save_push_button`` when any of the selected tag's properties has been changed. """ self.save_push_button.setEnabled(True) - def onNewClicked(self): + def on_new_clicked(self): """ Add a new tag to list only if it is not a duplicate. """ @@ -125,10 +125,10 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self._reloadTable() # Highlight new row self.tag_table_widget.selectRow(self.tag_table_widget.rowCount() - 1) - self.onRowSelected() + self.on_row_selected() self.tag_table_widget.scrollToBottom() - def onDeleteClicked(self): + def on_delete_clicked(self): """ Delete selected custom tag. """ @@ -141,14 +141,14 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): FormattingTags.save_html_tags() self._reloadTable() - def onSavedClicked(self): + def on_saved_clicked(self): """ Update Custom Tag details if not duplicate and save the data. """ html_expands = FormattingTags.get_html_tags() if self.selected != -1: html = html_expands[self.selected] - tag = self.tagLineEdit.text() + tag = self.tag_line_edit.text() for linenumber, html1 in enumerate(html_expands): if self._strip(html1[u'start tag']) == tag and linenumber != self.selected: critical_error_message_box( @@ -156,7 +156,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag) return html[u'desc'] = self.description_line_edit.text() - html[u'start html'] = self.startTagLineEdit.text() + html[u'start html'] = self.start_tag_line_edit.text() html[u'end html'] = self.end_tag_line_edit.text() html[u'start tag'] = u'{%s}' % tag html[u'end tag'] = u'{/%s}' % tag @@ -186,12 +186,12 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): html[u'temporary'] = False self.tag_table_widget.resizeRowsToContents() self.description_line_edit.setText(u'') - self.tagLineEdit.setText(u'') - self.startTagLineEdit.setText(u'') + self.tag_line_edit.setText(u'') + self.start_tag_line_edit.setText(u'') self.end_tag_line_edit.setText(u'') self.description_line_edit.setEnabled(False) - self.tagLineEdit.setEnabled(False) - self.startTagLineEdit.setEnabled(False) + self.tag_line_edit.setEnabled(False) + self.start_tag_line_edit.setEnabled(False) self.end_tag_line_edit.setEnabled(False) def _strip(self, tag):