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