eric6/Helpviewer/OpenSearch/OpenSearchEditDialog.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7226
babe80d84a3e
parent 7285
1ff497f33f31
child 7287
1c17f2191bdd
equal deleted inserted replaced
7226:babe80d84a3e 7286:7eb04391adf7
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2009 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to edit the data of a search engine.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog
13
14 from .Ui_OpenSearchEditDialog import Ui_OpenSearchEditDialog
15
16
17 class OpenSearchEditDialog(QDialog, Ui_OpenSearchEditDialog):
18 """
19 Class implementing a dialog to edit the data of a search engine.
20 """
21 def __init__(self, engine, parent=None):
22 """
23 Constructor
24
25 @param engine reference to the search engine (OpenSearchEngine)
26 @param parent reference to the parent object (QWidget)
27 """
28 super(OpenSearchEditDialog, self).__init__(parent)
29 self.setupUi(self)
30
31 self.__engine = engine
32
33 self.nameEdit.setText(engine.name())
34 self.descriptionEdit.setText(engine.description())
35 self.imageEdit.setText(engine.imageUrl())
36 self.searchEdit.setText(engine.searchUrlTemplate())
37 self.suggestionsEdit.setText(engine.suggestionsUrlTemplate())
38
39 msh = self.minimumSizeHint()
40 self.resize(max(self.width(), msh.width()), msh.height())
41
42 def accept(self):
43 """
44 Public slot to accept the data entered.
45 """
46 self.__engine.setName(self.nameEdit.text())
47 self.__engine.setDescription(self.descriptionEdit.text())
48 self.__engine.setImageUrlAndLoad(self.imageEdit.text())
49 self.__engine.setSearchUrlTemplate(self.searchEdit.text())
50 self.__engine.setSuggestionsUrlTemplate(self.suggestionsEdit.text())
51
52 super(OpenSearchEditDialog, self).accept()

eric ide

mercurial