eric7/Project/IdlCompilerOptionsDialog.py

Sat, 22 May 2021 19:58:24 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 22 May 2021 19:58:24 +0200
branch
eric7
changeset 8358
144a6b854f70
parent 8356
68ec9c3d4de5
child 8881
54e42bc2437a
permissions
-rw-r--r--

Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2018 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter some IDL compiler options.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
10 from PyQt6.QtCore import pyqtSlot, Qt
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
11 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem, QInputDialog
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_IdlCompilerOptionsDialog import Ui_IdlCompilerOptionsDialog
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import UI.PixmapCache
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
8358
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
17 from EricWidgets import EricPathPickerDialog
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
18 from EricWidgets.EricPathPicker import EricPathPickerModes
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
20 from .IdlCompilerDefineNameDialog import IdlCompilerDefineNameDialog
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
21
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 class IdlCompilerOptionsDialog(QDialog, Ui_IdlCompilerOptionsDialog):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Class implementing a dialog to enter some IDL compiler options.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 def __init__(self, includeDirectories, definedNames, undefinedNames,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 project=None, parent=None):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param includeDirectories list of include directories
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @type list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @param definedNames list of defined variables with name and value
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 separated by '='
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @type list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param undefinedNames list of undefined names
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @type list of str
6466
dac80ad0de75 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6445
diff changeset
39 @param project reference to the project object
dac80ad0de75 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6445
diff changeset
40 @type Project
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 @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
42 @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
43 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
44 super().__init__(parent)
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.setupUi(self)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__project = project
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
49 self.idAddButton.setIcon(UI.PixmapCache.getIcon("plus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
50 self.idDeleteButton.setIcon(UI.PixmapCache.getIcon("minus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
51 self.idEditButton.setIcon(UI.PixmapCache.getIcon("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
52
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
53 self.dnAddButton.setIcon(UI.PixmapCache.getIcon("plus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
54 self.dnDeleteButton.setIcon(UI.PixmapCache.getIcon("minus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
55 self.dnEditButton.setIcon(UI.PixmapCache.getIcon("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
56
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
57 self.unAddButton.setIcon(UI.PixmapCache.getIcon("plus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
58 self.unDeleteButton.setIcon(UI.PixmapCache.getIcon("minus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
59 self.unEditButton.setIcon(UI.PixmapCache.getIcon("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
60
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.__populateIncludeDirectoriesList(includeDirectories)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.__populateDefineNamesList(definedNames)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.unList.addItems(undefinedNames)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.__updateIncludeDirectoryButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.__updateDefineNameButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.__updateUndefineNameButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 ## Methods implementing the 'Include Directory' option
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 def __updateIncludeDirectoryButtons(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 Private method to set the state of the 'Include Directory' buttons.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 enable = len(self.idList.selectedItems())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.idDeleteButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.idEditButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 def __populateIncludeDirectoriesList(self, includeDirectories):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Private method to populate the 'Include Directories' list.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 @param includeDirectories list of include directories
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @type list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 for directory in includeDirectories:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 if self.__project:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 path = self.__project.getRelativeUniversalPath(directory)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 if not path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 # it is the project directory
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 path = "."
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.idList.addItem(path)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.idList.addItem(directory)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 def __generateIncludeDirectoriesList(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 Private method to prepare the list of 'Include Directories'.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 @return list of 'Include Directories'
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 @rtype list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 return [
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.idList.item(row).text()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 for row in range(self.idList.count())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 ]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 def __includeDirectoriesContain(self, directory):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 Private method to test, if the currently defined 'Include Directories'
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 contain a given one.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @param directory directory name to be tested
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 @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
117 @return flag indicating that the given directory is already included
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @rtype bool
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
120 return len(self.idList.findItems(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
121 directory, Qt.MatchFlag.MatchExactly)) > 0
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 def on_idList_itemSelectionChanged(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 Private slot handling the selection of an 'Include Directory' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.__updateIncludeDirectoryButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 def on_idAddButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 Private slot to add an 'Include Directory'.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 """
8235
78e6d29eb773 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 3).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
135 defaultDirectory = (self.__project.getProjectPath() if self.__project
78e6d29eb773 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 3).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
136 else "")
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8327
diff changeset
137 path, ok = EricPathPickerDialog.getPath(
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 self.tr("Include Directory"),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.tr("Select Include Directory"),
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8327
diff changeset
141 EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE,
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 defaultDirectory=defaultDirectory
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 if ok and path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 if self.__project:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 path = self.__project.getRelativeUniversalPath(path)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 if not path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 path = "."
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 if not self.__includeDirectoriesContain(path):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 self.idList.addItem(path)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 def on_idDeleteButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 Private slot to delete the selected 'Include Directory' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 itm = self.idList.selectedItems()[0]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 row = self.idList.row(itm)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.idList.takeItem(row)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 del itm
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 def on_idEditButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 Private slot to edit the selected 'Include Directory' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 itm = self.idList.selectedItems()[0]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 if self.__project:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 path = self.__project.getAbsoluteUniversalPath(itm.text())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 defaultDirectory = self.__project.getProjectPath()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 path = itm.text()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 defaultDirectory = ""
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8327
diff changeset
174 path, ok = EricPathPickerDialog.getPath(
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 self.tr("Include Directory"),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 self.tr("Select Include Directory"),
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8327
diff changeset
178 EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE,
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 path=path,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 defaultDirectory=defaultDirectory
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 if ok and path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 if self.__project:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 path = self.__project.getRelativeUniversalPath(path)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 if not path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 path = "."
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 if self.__includeDirectoriesContain(path) and itm.text() != path:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 # the entry exists already, delete the edited one
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 row = self.idList.row(itm)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 self.idList.takeItem(row)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 del itm
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 itm.setText(path)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 ## Methods implementing the 'Define Name' option
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 def __updateDefineNameButtons(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 Private method to set the state of the 'Define Name' buttons.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 enable = len(self.dnList.selectedItems())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.dnDeleteButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 self.dnEditButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 def __populateDefineNamesList(self, definedNames):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 Private method to populate the list of defined names.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 @param definedNames list of defined variables with name and value
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 separated by '='
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 @type list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 for definedName in definedNames:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 if definedName:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 nameValueList = definedName.split("=")
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 name = nameValueList[0].strip()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 if len(nameValueList) > 1:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 value = nameValueList[1].strip()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 value = ""
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 QTreeWidgetItem(self.dnList, [name, value])
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
225 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder)
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
227 def __generateDefinedNamesList(self):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
228 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
229 Private method to prepare the list of 'Defined Names'.
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
230
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
231 @return list of 'Defined Names'
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
232 @rtype list of str
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
233 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
234 definedNames = []
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
235 for row in range(self.dnList.topLevelItemCount()):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
236 itm = self.dnList.topLevelItem(row)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
237 name = itm.text(0).strip()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
238 value = itm.text(1).strip()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
239 if value:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
240 definedNames.append("{0}={1}".format(name, value))
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
241 else:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
242 definedNames.append(name)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
243
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
244 return definedNames
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
245
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
246 def __definedNamesContain(self, name):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
247 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
248 Private method to test, if the currently defined 'Defined Names'
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
249 contain a given one.
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
250
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
251 @param name variable name to be tested
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
252 @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
253 @return flag indicating that the given name is already included
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
254 @rtype bool
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
255 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
256 return len(self.dnList.findItems(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
257 name, Qt.MatchFlag.MatchExactly, 0)) > 0
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
258
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 def on_dnList_itemSelectionChanged(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 Private slot handling the selection of a 'Define Name' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 self.__updateDefineNameButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 def on_dnAddButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
269 Private slot to add a 'Define Name' entry.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
271 dlg = IdlCompilerDefineNameDialog(parent=self)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
272 if dlg.exec() == QDialog.DialogCode.Accepted:
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
273 name, value = dlg.getData()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
274 if not self.__definedNamesContain(name):
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
275 QTreeWidgetItem(self.dnList, [name, value])
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
276
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
277 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder)
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 def on_dnDeleteButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
282 Private slot to delete the selected 'Define Name' entry.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
284 itm = self.dnList.selectedItems()[0]
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
285 index = self.dnList.indexOfTopLevelItem(itm)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
286 self.dnList.takeTopLevelItem(index)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
287 del itm
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 def on_dnEditButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
292 Private slot to edit the selected 'Define Name' entry.
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
294 itm = self.dnList.selectedItems()[0]
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
295
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
296 dlg = IdlCompilerDefineNameDialog(
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
297 name=itm.text(0), value=itm.text(1), parent=self)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
298 if dlg.exec() == QDialog.DialogCode.Accepted:
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
299 name, value = dlg.getData()
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
300 if self.__definedNamesContain(name) and itm.text(0) != name:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
301 # the entry exists already, delete the edited one
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
302 index = self.dnList.indexOfTopLevelItem(itm)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
303 self.dnList.takeTopLevelItem(index)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
304 del itm
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
305
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
306 # change the named one
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
307 itm = self.dnList.findItems(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
308 name, Qt.MatchFlag.MatchExactly, 0)[0]
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
309 itm.setText(1, value)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
310 else:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
311 itm.setText(0, name)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
312 itm.setText(1, value)
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
313
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
314 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder)
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 ## Methods implementing the 'Undefine Name' option
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 def __updateUndefineNameButtons(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 Private method to set the state of the 'Undefine Name' buttons.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 enable = len(self.unList.selectedItems())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 self.unDeleteButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 self.unEditButton.setEnabled(enable)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 def __generateUndefinedNamesList(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 Private method to prepare the list of 'Undefined Names'.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 @return list of 'Undefined Names'
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 @rtype list of str
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 return [
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 self.unList.item(row).text()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 for row in range(self.unList.count())
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 ]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 def __undefinedNamesContain(self, name):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 Private method to test, if the currently defined 'Undefined Names'
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 contain a given one.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 @param name variable name to be tested
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 @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
347 @return flag indicating that the given name is already included
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 @rtype bool
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
350 return len(self.unList.findItems(name, Qt.MatchFlag.MatchExactly)) > 0
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 def on_unList_itemSelectionChanged(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 Private slot handling the selection of a 'Undefine Name' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 self.__updateUndefineNameButtons()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 def on_unAddButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 Private slot to add a 'Undefine Name' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 name, ok = QInputDialog.getText(
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 self,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 self.tr("Undefine Name"),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 self.tr("Enter a variable name to be undefined:")
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 name = name.strip()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 if ok and name and not self.__undefinedNamesContain(name):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 self.unList.addItem(name)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 def on_unDeleteButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 Private slot to delete the selected 'Undefine Name' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 itm = self.unList.selectedItems()[0]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 row = self.unList.row(itm)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 self.unList.takeItem(row)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 del itm
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 def on_unEditButton_clicked(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 Private slot to edit the selected 'Undefine Name' entry.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 itm = self.unList.selectedItems()[0]
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 name, ok = QInputDialog.getText(
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 self,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 self.tr("Undefine Name"),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 self.tr("Enter a variable name to be undefined:"),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 text=itm.text()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 name = name.strip()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 if ok and name:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 if self.__undefinedNamesContain(name) and itm.text() != name:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 # the entry exists already, delete the edited one
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 row = self.unList.row(itm)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 self.unList.takeItem(row)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 del itm
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 itm.setText(name)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 ## Methods implementing the result preparation
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 def getData(self):
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 Public method to return the data entered by the user.
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 @return tuple containing the list of include directories, list of
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 defined names and list of undefined names
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 @rtype tuple of (list of str, list of str, list of str)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 return (
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 self.__generateIncludeDirectoriesList(),
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
419 self.__generateDefinedNamesList(),
6442
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.__generateUndefinedNamesList(),
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 )

eric ide

mercurial