eric6/Project/IdlCompilerDefineNameDialog.py

Sun, 29 Nov 2020 14:10:18 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Nov 2020 14:10:18 +0100
changeset 7844
cb108454eda7
parent 7780
41420f82c0ac
child 7923
91e843545d9a
permissions
-rw-r--r--

WebBrowserWindow: removed the use of QTextCodec to prepare the Qt6 migration.

6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
3 # Copyright (c) 2018 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
4 #
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
5
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
7 Module implementing a dialog to enter the name-value pair to define a variable
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
8 for the IDL compiler.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtCore import pyqtSlot
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_IdlCompilerDefineNameDialog import Ui_IdlCompilerDefineNameDialog
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class IdlCompilerDefineNameDialog(QDialog, Ui_IdlCompilerDefineNameDialog):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
19 Class implementing a dialog to enter the name-value pair to define a
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
20 variable for the IDL compiler.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
22 def __init__(self, name="", value="", parent=None):
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
26 @param name name of the variable
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
27 @type str
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
28 @param value value of the variable
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
29 @type str
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @type QWidget
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 super(IdlCompilerDefineNameDialog, self).__init__(parent)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setupUi(self)
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
35
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
36 self.nameEdit.setText(name)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
37 self.valueEdit.setText(value)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
38
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
39 msh = self.minimumSizeHint()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
40 self.resize(max(self.width(), msh.width()), msh.height())
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
41
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
42 self.__updateOkButton()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
43
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
44 def __updateOkButton(self):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
45 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
46 Private slot to update the enable state of the OK button.
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
47 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
48 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
49 bool(self.nameEdit.text()))
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @pyqtSlot(str)
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
52 def on_nameEdit_textChanged(self, txt):
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
54 Private slot to handle changes of the name.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
56 @param txt current text of the name edit
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @type str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
59 self.__updateOkButton()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
60
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
61 def getData(self):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
62 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
63 Public method to get the entered data.
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
64
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
65 @return tuple containing the variable name and value
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
66 @rtype tuple of (str, str)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
67 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
68 return (
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
69 self.nameEdit.text().strip(),
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
70 self.valueEdit.text().strip(),
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
71 )

eric ide

mercurial