Project/ProjectInterfacesBrowser.py

branch
corba_options
changeset 6439
86dd19e45d95
parent 6048
82ad8ec9548c
child 6442
9d42b6c08a27
--- a/Project/ProjectInterfacesBrowser.py	Sat Jul 28 11:49:00 2018 +0200
+++ b/Project/ProjectInterfacesBrowser.py	Sat Jul 28 12:03:33 2018 +0200
@@ -100,6 +100,11 @@
             self.sourceMenu.addAction(
                 self.tr('Compile all interfaces'),
                 self.__compileAllInterfaces)
+            self.sourceMenu.addSeparator()
+            self.sourceMenu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.sourceMenu.addSeparator()
         self.sourceMenu.addAction(self.tr('Open'), self._openItem)
         self.sourceMenu.addSeparator()
         act = self.sourceMenu.addAction(
@@ -137,6 +142,11 @@
             self.menu.addAction(
                 self.tr('Compile all interfaces'),
                 self.__compileAllInterfaces)
+            self.menu.addSeparator()
+            self.menu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.menu.addSeparator()
         self.menu.addAction(self.tr('Open'), self._openItem)
         self.menu.addSeparator()
         self.menu.addAction(
@@ -160,6 +170,10 @@
                 self.tr('Compile all interfaces'),
                 self.__compileAllInterfaces)
             self.backMenu.addSeparator()
+            self.backMenu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.backMenu.addSeparator()
         self.backMenu.addAction(
             self.tr('Add interfaces...'), self.project.addIdlFiles)
         self.backMenu.addAction(
@@ -181,6 +195,11 @@
             self.multiMenu.addAction(
                 self.tr('Compile interfaces'),
                 self.__compileSelectedInterfaces)
+            self.multiMenu.addSeparator()
+            self.multiMenu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.multiMenu.addSeparator()
         self.multiMenu.addAction(self.tr('Open'), self._openItem)
         self.multiMenu.addSeparator()
         act = self.multiMenu.addAction(
@@ -205,6 +224,10 @@
                 self.tr('Compile all interfaces'),
                 self.__compileAllInterfaces)
             self.dirMenu.addSeparator()
+            self.dirMenu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.dirMenu.addSeparator()
         act = self.dirMenu.addAction(
             self.tr('Remove from project'), self._removeFile)
         self.dirMenuActions.append(act)
@@ -236,6 +259,10 @@
                 self.tr('Compile all interfaces'),
                 self.__compileAllInterfaces)
             self.dirMultiMenu.addSeparator()
+            self.dirMultiMenu.addAction(
+                self.tr('Configure IDL compiler'),
+                self.__configureIdlCompiler)
+            self.dirMultiMenu.addSeparator()
         self.dirMultiMenu.addAction(
             self.tr('Add interfaces...'), self.project.addIdlFiles)
         self.dirMultiMenu.addAction(
@@ -525,11 +552,19 @@
         @param progress reference to the progress dialog (E5ProgressDialog)
         @return reference to the compile process (QProcess)
         """
+        params = self.project.pdata["IDLPARAMS"]
+        
         self.compileProc = QProcess()
         args = []
         
         args.append("-bpython")
         args.append("-I.")
+        for directory in params["IncludeDirs"]:
+            args.append("-I{0}".format(directory))
+        for name in params["DefinedNames"]:
+            args.append("-D{0}".format(name))
+        for name in params["UndefinedNames"]:
+            args.append("-U{0}".format(name))
         
         fn = os.path.join(self.project.ppath, fn)
         self.idlFile = fn
@@ -640,3 +675,31 @@
         Private method to open the configuration dialog.
         """
         e5App().getObject("UserInterface").showPreferences("corbaPage")
+    
+    def __configureIdlCompiler(self):
+        """
+        Private method to show a dialog to configure some options for the
+        IDL compiler.
+        """
+        params = self.project.pdata["IDLPARAMS"]
+        
+        # TODO: remove this test code once done
+        print("__configureIdlCompiler")
+        return
+        
+        # TODO: implement IDL compiler options dialog
+        from .IdlCompilerOptionsDialog import IdlCompilerOptionsDialog
+        dlg = IdlCompilerOptionsDialog(
+            params["IncludeDirs"][:], params["DefinedNames"][:],
+            params["UndefinedNames"][:])
+        if dlg.exec_() == QDialog.Accepted:
+            include, defined, undefined = dlg.getData()
+            if include != params["IncludeDirs"]:
+                params["IncludeDirs"] = include[:]
+                self.project.setDirty(True)
+            if defined != params["DefinedNames"]:
+                params["DefinedNames"] = defined[:]
+                self.project.setDirty(True)
+            if undefined != params["UndefinedNames"]:
+                params["UndefinedNames"] = undefined[:]
+                self.project.setDirty(True)

eric ide

mercurial