eric6/Project/IdlCompilerOptionsDialog.py

Wed, 30 Dec 2020 11:00:05 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:05 +0100
changeset 7923
91e843545d9a
parent 7780
41420f82c0ac
child 8143
2c730d5fd177
permissions
-rw-r--r--

Updated copyright for 2021.

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
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtCore import pyqtSlot, Qt
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QInputDialog
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
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from E5Gui import E5PathPickerDialog
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from E5Gui.E5PathPicker import E5PathPickerModes
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 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 super(IdlCompilerOptionsDialog, self).__init__(parent)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
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 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
120 return len(self.idList.findItems(directory, Qt.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
121
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 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
124 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 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
126 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 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
128
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 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
131 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 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
133 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 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
135 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
136 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 defaultDirectory = ""
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 path, ok = E5PathPickerDialog.getPath(
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,
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("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
141 self.tr("Select 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
142 E5PathPickerModes.DirectoryShowFilesMode,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 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
144 )
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 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
146 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
147 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
148 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
149 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 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
151 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
152
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 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
155 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 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
157 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 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
159 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
160 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
161 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
162
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 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
165 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 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
167 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 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
169 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
170 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
171 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
172 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 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
174 defaultDirectory = ""
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 path, ok = E5PathPickerDialog.getPath(
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,
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("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
178 self.tr("Select 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
179 E5PathPickerModes.DirectoryShowFilesMode,
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 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
181 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
182 )
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 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
184 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
185 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
186 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
187 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 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
189 # 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
190 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
191 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
192 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
193 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 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
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 #######################################################################
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 ## 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
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
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 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
201 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 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
203 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 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
205 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
206 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
207
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 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
209 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 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
211
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 @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
213 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
214 @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
215 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 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
217 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
218 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
219 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
220 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
221 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
222 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 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 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
225
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 self.dnList.sortItems(0, Qt.AscendingOrder)
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
228 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
229 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
230 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
231
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
232 @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
233 @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
234 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
235 definedNames = []
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
236 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
237 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
238 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
239 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
240 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
241 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
242 else:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
243 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
244
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
245 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
246
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
247 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
248 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
249 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
250 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
251
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
252 @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
253 @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
254 @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
255 @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
256 """
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
257 return len(self.dnList.findItems(name, Qt.MatchExactly, 0)) > 0
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)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
272 if dlg.exec() == QDialog.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
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
277 self.dnList.sortItems(0, Qt.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)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
298 if dlg.exec() == QDialog.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
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
307 itm = self.dnList.findItems(name, Qt.MatchExactly, 0)[0]
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
308 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
309 else:
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
310 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
311 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
312
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
313 self.dnList.sortItems(0, Qt.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
314
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 ## 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
317 #######################################################################
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 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
320 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 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
322 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 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
324 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
325 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
326
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 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
328 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 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
330
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 @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
332 @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
333 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 return [
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 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
336 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
337 ]
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 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
340 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 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
342 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
343
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 @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
345 @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
346 @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
347 @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
348 """
6445
2b022e5ba54c IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6442
diff changeset
349 return len(self.unList.findItems(name, Qt.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
350
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 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
353 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 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
355 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 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
357
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 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
360 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 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
362 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 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
364 self,
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.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
366 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
367 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 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
369 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
370 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
371
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 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
374 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 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
376 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 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
378 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
379 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
380 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
381
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 @pyqtSlot()
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 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
384 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 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
386 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 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
388 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
389 self,
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.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
391 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
392 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
393 )
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 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
395 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
396 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
397 # 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
398 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
399 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
400 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
401 else:
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 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
403
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 ## 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
406 #######################################################################
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 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
409 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 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
411
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 @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
413 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
414 @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
415 """
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 return (
9d42b6c08a27 IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 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
418 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
419 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
420 )

eric ide

mercurial