def __init__(self, parser, parent=None): QtGui.QWidget.__init__(self, parent) self.parser = parser label = QtGui.QLabel(parser.detailed_label_text) self.xml_editor = XMLEditor() layout = QtGui.QVBoxLayout(self) layout.addWidget(label) layout.addWidget(self.xml_editor)
def load_phrasebooks(self): self.loading = True while self.tab_widget.count(): self.tab_widget.removeTab(0) for editor in self.text_editors: editor.setParent(None) self.text_editors = [] for book in PHRASEBOOKS.get_all_books(): editor = XMLEditor(self) editor.editor_settings() editor.setText(book.xml) editor.db_index = book.ix editor.textChanged.connect(self.text_changed) editor.cursorPositionChanged.connect(self.cursor_position_changed) if book.ix == 0: title = _("Global Phrasebook") else: title = localsettings.ops[book.ix] self.text_editors.append(editor) self.tab_widget.addTab(editor, title) self.loading = False