Set plain text to prevent xml from being rendered

Julien LepillerFri Apr 09 17:14:17+0200 2021

063b7f8

Set plain text to prevent xml from being rendered

offlate/ui/editor.py

224224
    def copy(self):
225225
        if self.msgstr.__class__.__name__ == "SpellCheckEdit":
226226
            text = self.msgid.document().toRawText()
227-
            self.msgstr.setText(text)
227+
            self.msgstr.setPlainText(text)
228228
        else:
229229
            text = self.msgid.currentWidget().document().toRawText()
230-
            self.msgstr.currentWidget().setText(text)
230+
            self.msgstr.currentWidget().setPlainText(text)
231231
232232
    def copyTag(self, tag):
233233
        tag = tag.toDisplayString()[1:]

263263
                edit = TagClickEdit()
264264
                edit.setFont(QFont(font))
265265
                edit.setReadOnly(True)
266-
                edit.setText(data.msgids[k])
266+
                edit.setPlainText(data.msgids[k])
267267
                edit.createLinks()
268268
                edit.anchorClicked.connect(self.copyTag)
269269
                self.msgid.addTab(edit, self.tr(k))

271271
            for k in data.msgstrs:
272272
                form = SpellCheckEdit(self.project.lang)
273273
                form.setFont(QFont(font))
274-
                form.setText(data.msgstrs[k])
274+
                form.setPlainText(data.msgstrs[k])
275275
                form.textChanged.connect(self.modify)
276276
                self.msgstr.addTab(form, self.tr(k))
277277
                if i == 0:

283283
            singular = TagClickEdit()
284284
            singular.setFont(QFont(font))
285285
            singular.setReadOnly(True)
286-
            singular.setText(data.msgids[0])
286+
            singular.setPlainText(data.msgids[0])
287287
            singular.createLinks()
288288
            singular.anchorClicked.connect(self.copyTag)
289289
            plural = TagClickEdit()
290290
            plural.setFont(QFont(font))
291291
            plural.setReadOnly(True)
292-
            plural.setText(data.msgids[1])
292+
            plural.setPlainText(data.msgids[1])
293293
            plural.createLinks()
294294
            plural.anchorClicked.connect(self.copyTag)
295295
            self.msgid.addTab(singular, self.tr("Singular"))

298298
            for msgstr in data.msgstrs:
299299
                form = SpellCheckEdit(self.project.lang)
300300
                form.setFont(QFont(font))
301-
                form.setText(msgstr)
301+
                form.setPlainText(msgstr)
302302
                form.textChanged.connect(self.modify)
303303
                self.msgstr.addTab(form, str(i))
304304
                if i == 0:

312312
                edit = TagClickEdit()
313313
                edit.setFont(QFont(font))
314314
                edit.setReadOnly(True)
315-
                edit.setText(msgid)
315+
                edit.setPlainText(msgid)
316316
                edit.createLinks()
317317
                edit.anchorClicked.connect(self.copyTag)
318318
                self.msgid.addTab(edit, str(i))

321321
            for msgstr in data.msgstrs:
322322
                form = SpellCheckEdit(self.project.lang)
323323
                form.setFont(QFont(font))
324-
                form.setText(msgstr)
324+
                form.setPlainText(msgstr)
325325
                form.textChanged.connect(self.modify)
326326
                self.msgstr.addTab(form, str(i))
327327
                if i == 0:

331331
            self.msgid = TagClickEdit()
332332
            self.msgid.setFont(QFont(font))
333333
            self.msgid.setReadOnly(True)
334-
            self.msgid.setText(data.msgids[0])
334+
            self.msgid.setPlainText(data.msgids[0])
335335
            self.msgid.createLinks()
336336
            self.msgid.anchorClicked.connect(self.copyTag)
337337
            self.msgstr = SpellCheckEdit(self.project.lang)
338338
            self.msgstr.setFont(QFont(font))
339-
            self.msgstr.setText(data.msgstrs[0])
339+
            self.msgstr.setPlainText(data.msgstrs[0])
340340
            self.msgstr.textChanged.connect(self.modify)
341341
            focuser = self.msgstr
342342
        self.hbox.addWidget(self.msgid)