eric6/UI/UserInterface.py

branch
maintenance
changeset 7035
d2036d7f5ef6
parent 6989
8b8cadf8d7e9
parent 7008
e1b80fb11cc7
child 7051
a6dbc7c847cb
diff -r 68256afbba26 -r d2036d7f5ef6 eric6/UI/UserInterface.py
--- a/eric6/UI/UserInterface.py	Sat May 04 12:04:12 2019 +0200
+++ b/eric6/UI/UserInterface.py	Sun Jun 02 11:42:48 2019 +0200
@@ -316,6 +316,7 @@
         self.__notification = None
         self.__readingSession = False
         self.__versionsDialog = None
+        self.__configurationDialog = None
         
         # now setup the connections
         splash.showMessage(self.tr("Setting up connections..."))
@@ -723,6 +724,15 @@
         if interval > 0:
             QApplication.setKeyboardInputInterval(interval)
         
+    def networkAccessManager(self):
+        """
+        Public method to get a reference to the network access manager object.
+        
+        @return reference to the network access manager object
+        @rtype QNetworkAccessManager
+        """
+        return self.__networkManager
+    
     def __createLayout(self, debugServer):
         """
         Private method to create the layout of the various windows.
@@ -808,6 +818,10 @@
         self.__setupDockWindow(self.rToolboxDock, Qt.RightDockWidgetArea,
                                self.rToolbox, self.tr("Right Toolbox"))
         
+        ####################################################
+        ## Populate the left toolbox
+        ####################################################
+        
         # Create the project browser
         logging.debug("Creating Project Browser...")
         from Project.ProjectBrowser import ProjectBrowser
@@ -835,6 +849,10 @@
                                   UI.PixmapCache.getIcon("templateViewer.png"),
                                   self.tr("Template-Viewer"))
         
+        ####################################################
+        ## Populate the right toolbox
+        ####################################################
+        
         if Preferences.getUI("ShowCodeDocumentationViewer"):
             # Create the code documentation viewer
             logging.debug("Creating Code Documentation Viewer...")
@@ -888,6 +906,10 @@
                                   UI.PixmapCache.getIcon("irc.png"),
                                   self.tr("IRC"))
         
+        ####################################################
+        ## Populate the bottom toolbox
+        ####################################################
+        
         # Create the task viewer part of the user interface
         logging.debug("Creating Task Viewer...")
         from Tasks.TaskViewer import TaskViewer
@@ -904,18 +926,6 @@
                               UI.PixmapCache.getIcon("logViewer.png"),
                               self.tr("Log-Viewer"))
 
-        # Create the shell
-        # TODO: shell should be available in left or right toolbox
-        #       alternatively
-        logging.debug("Creating Shell...")
-        from QScintilla.Shell import ShellAssembly
-        self.shellAssembly = \
-            ShellAssembly(debugServer, self.viewmanager, self.project, True)
-        self.shell = self.shellAssembly.shell()
-        self.hToolbox.insertItem(0, self.shellAssembly,
-                                 UI.PixmapCache.getIcon("shell.png"),
-                                 self.tr("Shell"))
-        
         if Preferences.getUI("ShowFileBrowser"):
             # Create the file browser
             logging.debug("Creating File Browser...")
@@ -943,6 +953,33 @@
                                   UI.PixmapCache.getIcon("numbers.png"),
                                   self.tr("Numbers"))
         
+        ####################################################
+        ## Populate the configurable widgets
+        ####################################################
+        
+        # Create the shell
+        logging.debug("Creating Shell...")
+        self.__shellPosition = Preferences.getUI("ShellPosition")
+        if self.__shellPosition == "left":
+            self.__shellParent = self.lToolboxDock
+        elif self.__shellPosition == "right":
+            self.__shellParent = self.rToolboxDock
+        else:
+            self.__shellParent = self.hToolboxDock
+        from QScintilla.Shell import ShellAssembly
+        self.shellAssembly = \
+            ShellAssembly(debugServer, self.viewmanager, self.project, True)
+        self.shell = self.shellAssembly.shell()
+        self.__shellParent.widget().insertItem(
+            0, self.shellAssembly, UI.PixmapCache.getIcon("shell.png"),
+            self.tr("Shell"))
+        
+        ####################################################
+        ## Set the start index of each toolbox
+        ####################################################
+        
+        self.lToolbox.setCurrentIndex(0)
+        self.rToolbox.setCurrentIndex(0)
         self.hToolbox.setCurrentIndex(0)
         
     def __createSidebarsLayout(self, debugServer):
@@ -965,6 +1002,10 @@
         # Create the right sidebar
         self.rightSidebar = E5SideBar(E5SideBar.East, delay)
         
+        ####################################################
+        ## Populate the left side bar
+        ####################################################
+        
         # Create the project browser
         logging.debug("Creating Project Browser...")
         from Project.ProjectBrowser import ProjectBrowser
@@ -995,6 +1036,10 @@
                 UI.PixmapCache.getIcon("templateViewer.png"),
                 self.tr("Template-Viewer"))
 
+        ####################################################
+        ## Populate the right side bar
+        ####################################################
+        
         if Preferences.getUI("ShowCodeDocumentationViewer"):
             # Create the code documentation viewer
             logging.debug("Creating Code Documentation Viewer...")
@@ -1049,6 +1094,10 @@
                 self.irc, UI.PixmapCache.getIcon("irc.png"),
                 self.tr("IRC"))
         
+        ####################################################
+        ## Populate the bottom side bar
+        ####################################################
+        
         # Create the task viewer part of the user interface
         logging.debug("Creating Task Viewer...")
         from Tasks.TaskViewer import TaskViewer
@@ -1065,18 +1114,6 @@
                                   UI.PixmapCache.getIcon("logViewer.png"),
                                   self.tr("Log-Viewer"))
 
-        # Create the shell
-        # TODO: shell should be available in left or right sidebar
-        #       alternatively
-        logging.debug("Creating Shell...")
-        from QScintilla.Shell import ShellAssembly
-        self.shellAssembly = \
-            ShellAssembly(debugServer, self.viewmanager, self.project, True)
-        self.shell = self.shellAssembly.shell()
-        self.bottomSidebar.insertTab(0, self.shellAssembly,
-                                     UI.PixmapCache.getIcon("shell.png"),
-                                     self.tr("Shell"))
-
         if Preferences.getUI("ShowFileBrowser"):
             # Create the file browser
             logging.debug("Creating File Browser...")
@@ -1104,6 +1141,33 @@
                                       UI.PixmapCache.getIcon("numbers.png"),
                                       self.tr("Numbers"))
         
+        ####################################################
+        ## Populate the configurable widgets
+        ####################################################
+        
+        # Create the shell
+        logging.debug("Creating Shell...")
+        self.__shellPosition = Preferences.getUI("ShellPosition")
+        if self.__shellPosition == "left":
+            self.__shellParent = self.leftSidebar
+        elif self.__shellPosition == "right":
+            self.__shellParent = self.rightSidebar
+        else:
+            self.__shellParent = self.bottomSidebar
+        from QScintilla.Shell import ShellAssembly
+        self.shellAssembly = \
+            ShellAssembly(debugServer, self.viewmanager, self.project, True)
+        self.shell = self.shellAssembly.shell()
+        self.__shellParent.insertTab(0, self.shellAssembly,
+                                     UI.PixmapCache.getIcon("shell.png"),
+                                     self.tr("Shell"))
+        
+        ####################################################
+        ## Set the start index of each side bar
+        ####################################################
+        
+        self.leftSidebar.setCurrentIndex(0)
+        self.rightSidebar.setCurrentIndex(0)
         self.bottomSidebar.setCurrentIndex(0)
         
         # create the central widget
@@ -2728,6 +2792,10 @@
            not Preferences.getUI("UseNativeMenuBar"):
             mb.setNativeMenuBar(False)
         
+        ##############################################################
+        ## File menu
+        ##############################################################
+        
         self.__menus["file"] = self.viewmanager.initFileMenu()
         mb.addMenu(self.__menus["file"])
         self.__menus["file"].addSeparator()
@@ -2741,20 +2809,122 @@
         self.__menus["file"].insertAction(sep, self.newWindowAct)
         self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
         
+        ##############################################################
+        ## Edit menu
+        ##############################################################
+        
         self.__menus["edit"] = self.viewmanager.initEditMenu()
         mb.addMenu(self.__menus["edit"])
         
+        ##############################################################
+        ## Search menu
+        ##############################################################
+        
+        self.__menus["search"] = self.viewmanager.initSearchMenu()
+        mb.addMenu(self.__menus["search"])
+        
+        ##############################################################
+        ## View menu
+        ##############################################################
+        
         self.__menus["view"] = self.viewmanager.initViewMenu()
         mb.addMenu(self.__menus["view"])
+
+        ##############################################################
+        ## Bookmarks menu
+        ##############################################################
+        
+        self.__menus["bookmarks"] = self.viewmanager.initBookmarkMenu()
+        mb.addMenu(self.__menus["bookmarks"])
+        self.__menus["bookmarks"].setTearOffEnabled(True)
+        
+        ##############################################################
+        ## Multiproject menu
+        ##############################################################
+        
+        self.__menus["multiproject"] = self.multiProject.initMenu()
+        mb.addMenu(self.__menus["multiproject"])
+        
+        ##############################################################
+        ## Project menu
+        ##############################################################
+        
+        self.__menus["project"], self.__menus["project_tools"] = \
+            self.project.initMenus()
+        mb.addMenu(self.__menus["project"])
+        mb.addMenu(self.__menus["project_tools"])
+        
+        ##############################################################
+        ## Start and Debug menus
+        ##############################################################
         
         self.__menus["start"], self.__menus["debug"] = \
             self.debuggerUI.initMenus()
         mb.addMenu(self.__menus["start"])
         mb.addMenu(self.__menus["debug"])
         
+        ##############################################################
+        ## Extras menu
+        ##############################################################
+        
+        self.__menus["extras"] = QMenu(self.tr('E&xtras'), self)
+        self.__menus["extras"].setTearOffEnabled(True)
+        self.__menus["extras"].aboutToShow.connect(self.__showExtrasMenu)
+        mb.addMenu(self.__menus["extras"])
+        self.viewmanager.addToExtrasMenu(self.__menus["extras"])
+        
+        ##############################################################
+        ## Extras/Wizards menu
+        ##############################################################
+        
+        self.__menus["wizards"] = QMenu(self.tr('Wi&zards'), self)
+        self.__menus["wizards"].setTearOffEnabled(True)
+        self.__menus["wizards"].aboutToShow.connect(self.__showWizardsMenu)
+        self.wizardsMenuAct = self.__menus["extras"].addMenu(
+            self.__menus["wizards"])
+        self.wizardsMenuAct.setEnabled(False)
+        
+        ##############################################################
+        ## Extras/Macros menu
+        ##############################################################
+        
+        self.__menus["macros"] = self.viewmanager.initMacroMenu()
+        self.__menus["extras"].addMenu(self.__menus["macros"])
+        self.__menus["extras"].addSeparator()
+        
+        ##############################################################
+        ## Extras/VirtualEnv Manager menu entries
+        ##############################################################
+        
+        self.__menus["extras"].addAction(self.virtualenvManagerAct)
+        self.__menus["extras"].addAction(self.virtualenvConfigAct)
+        self.__menus["extras"].addSeparator()
+        
+        ##############################################################
+        ## Extras/Plugins menu
+        ##############################################################
+        
+        pluginsMenu = QMenu(self.tr('P&lugins'), self)
+        pluginsMenu.setIcon(UI.PixmapCache.getIcon("plugin.png"))
+        pluginsMenu.setTearOffEnabled(True)
+        pluginsMenu.addAction(self.pluginInfoAct)
+        pluginsMenu.addAction(self.pluginInstallAct)
+        pluginsMenu.addAction(self.pluginDeinstallAct)
+        pluginsMenu.addSeparator()
+        pluginsMenu.addAction(self.pluginRepoAct)
+        pluginsMenu.addSeparator()
+        pluginsMenu.addAction(
+            self.tr("Configure..."), self.__pluginsConfigure)
+        
+        self.__menus["extras"].addMenu(pluginsMenu)
+        self.__menus["extras"].addSeparator()
+    
+        ##############################################################
+        ## Extras/Unittest menu
+        ##############################################################
+        
         self.__menus["unittest"] = QMenu(self.tr('&Unittest'), self)
         self.__menus["unittest"].setTearOffEnabled(True)
-        mb.addMenu(self.__menus["unittest"])
         self.__menus["unittest"].addAction(self.utDialogAct)
         self.__menus["unittest"].addSeparator()
         self.__menus["unittest"].addAction(self.utRestartAct)
@@ -2763,39 +2933,28 @@
         self.__menus["unittest"].addAction(self.utScriptAct)
         self.__menus["unittest"].addAction(self.utProjectAct)
         
-        self.__menus["multiproject"] = self.multiProject.initMenu()
-        mb.addMenu(self.__menus["multiproject"])
-        
-        self.__menus["project"] = self.project.initMenu()
-        mb.addMenu(self.__menus["project"])
-        
-        self.__menus["extras"] = QMenu(self.tr('E&xtras'), self)
-        self.__menus["extras"].setTearOffEnabled(True)
-        self.__menus["extras"].aboutToShow.connect(self.__showExtrasMenu)
-        mb.addMenu(self.__menus["extras"])
-        self.viewmanager.addToExtrasMenu(self.__menus["extras"])
-        self.__menus["wizards"] = QMenu(self.tr('Wi&zards'), self)
-        self.__menus["wizards"].setTearOffEnabled(True)
-        self.__menus["wizards"].aboutToShow.connect(self.__showWizardsMenu)
-        self.wizardsMenuAct = self.__menus["extras"].addMenu(
-            self.__menus["wizards"])
-        self.wizardsMenuAct.setEnabled(False)
-        self.__menus["macros"] = self.viewmanager.initMacroMenu()
-        self.__menus["extras"].addMenu(self.__menus["macros"])
+        self.__menus["extras"].addMenu(self.__menus["unittest"])
         self.__menus["extras"].addSeparator()
-        self.__menus["extras"].addAction(self.virtualenvManagerAct)
-        self.__menus["extras"].addAction(self.virtualenvConfigAct)
+        
+        ##############################################################
+        ## Extras/Builtin,Plugin,User tools menus
+        ##############################################################
+        
         self.toolGroupsMenu = QMenu(self.tr("Select Tool Group"), self)
         self.toolGroupsMenu.aboutToShow.connect(self.__showToolGroupsMenu)
         self.toolGroupsMenu.triggered.connect(self.__toolGroupSelected)
         self.toolGroupsMenuTriggered = False
-        self.__menus["extras"].addSeparator()
         self.__initToolsMenus(self.__menus["extras"])
         self.__menus["extras"].addSeparator()
         
+        ##############################################################
+        ## Settings menu
+        ##############################################################
+        
         self.__menus["settings"] = QMenu(self.tr('Se&ttings'), self)
         mb.addMenu(self.__menus["settings"])
         self.__menus["settings"].setTearOffEnabled(True)
+        
         self.__menus["settings"].addAction(self.prefAct)
         self.__menus["settings"].addAction(self.prefExportAct)
         self.__menus["settings"].addAction(self.prefImportAct)
@@ -2818,11 +2977,19 @@
         self.__menus["settings"].addSeparator()
         self.__menus["settings"].addAction(self.clearPrivateDataAct)
         
+        ##############################################################
+        ## Window menu
+        ##############################################################
+        
         self.__menus["window"] = QMenu(self.tr('&Window'), self)
         mb.addMenu(self.__menus["window"])
         self.__menus["window"].setTearOffEnabled(True)
         self.__menus["window"].aboutToShow.connect(self.__showWindowMenu)
         
+        ##############################################################
+        ## Window/Windows menu
+        ##############################################################
+        
         self.__menus["subwindow"] = QMenu(self.tr("&Windows"),
                                           self.__menus["window"])
         self.__menus["subwindow"].setTearOffEnabled(True)
@@ -2832,6 +2999,8 @@
         except AttributeError:
             # Qt4
             pass
+        if self.__shellPosition == "left":
+            self.__menus["subwindow"].addAction(self.shellActivateAct)
         self.__menus["subwindow"].addAction(self.pbActivateAct)
         self.__menus["subwindow"].addAction(self.mpbActivateAct)
         if self.templateViewer is not None:
@@ -2846,7 +3015,8 @@
         except AttributeError:
             # Qt4
             self.__menus["subwindow"].addSeparator()
-        self.__menus["subwindow"].addAction(self.shellActivateAct)
+        if self.__shellPosition == "bottom":
+            self.__menus["subwindow"].addAction(self.shellActivateAct)
         self.__menus["subwindow"].addAction(self.taskViewerActivateAct)
         self.__menus["subwindow"].addAction(self.logViewerActivateAct)
         if self.numbersViewer is not None:
@@ -2857,6 +3027,8 @@
             # Qt4
             self.__menus["subwindow"].addSeparator()
         # right side
+        if self.__shellPosition == "right":
+            self.__menus["subwindow"].addAction(self.shellActivateAct)
         if self.codeDocumentationViewer is not None:
             self.__menus["subwindow"].addAction(
                 self.tr("Code Documentation Viewer"),
@@ -2881,6 +3053,10 @@
             # Qt4
             self.__menus["subwindow"].addSeparator()
         
+        ##############################################################
+        ## Window/Toolbars menu
+        ##############################################################
+        
         self.__menus["toolbars"] = \
             QMenu(self.tr("&Toolbars"), self.__menus["window"])
         self.__menus["toolbars"].setTearOffEnabled(True)
@@ -2889,24 +3065,12 @@
         
         self.__showWindowMenu()  # to initialize these actions
 
-        self.__menus["bookmarks"] = self.viewmanager.initBookmarkMenu()
-        mb.addMenu(self.__menus["bookmarks"])
-        self.__menus["bookmarks"].setTearOffEnabled(True)
-
-        self.__menus["plugins"] = QMenu(self.tr('P&lugins'), self)
-        mb.addMenu(self.__menus["plugins"])
-        self.__menus["plugins"].setTearOffEnabled(True)
-        self.__menus["plugins"].addAction(self.pluginInfoAct)
-        self.__menus["plugins"].addAction(self.pluginInstallAct)
-        self.__menus["plugins"].addAction(self.pluginDeinstallAct)
-        self.__menus["plugins"].addSeparator()
-        self.__menus["plugins"].addAction(self.pluginRepoAct)
-        self.__menus["plugins"].addSeparator()
-        self.__menus["plugins"].addAction(
-            self.tr("Configure..."), self.__pluginsConfigure)
-
         mb.addSeparator()
 
+        ##############################################################
+        ## Help menu
+        ##############################################################
+        
         self.__menus["help"] = QMenu(self.tr('&Help'), self)
         mb.addMenu(self.__menus["help"])
         self.__menus["help"].setTearOffEnabled(True)
@@ -4188,8 +4352,6 @@
         elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.projectBrowser)
-        else:
-            self.projectBrowser.show()
         self.projectBrowser.currentWidget().setFocus(
             Qt.ActiveWindowFocusReason)
         
@@ -4203,8 +4365,6 @@
         elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.multiProjectBrowser)
-        else:
-            self.multiProjectBrowser.show()
         self.multiProjectBrowser.setFocus(Qt.ActiveWindowFocusReason)
         
     def activateDebugViewer(self):
@@ -4217,8 +4377,6 @@
         elif self.__layoutType == "Sidebars":
             self.rightSidebar.show()
             self.rightSidebar.setCurrentWidget(self.debugViewer)
-        else:
-            self.debugViewer.show()
         self.debugViewer.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateShell(self):
@@ -4226,13 +4384,11 @@
         Private slot to handle the activation of the Shell window.
         """
         if self.__layoutType == "Toolboxes":
-            self.hToolboxDock.show()
-            self.hToolbox.setCurrentWidget(self.shellAssembly)
+            self.__shellParent.show()
+            self.__shellParent.widget().setCurrentWidget(self.shellAssembly)
         elif self.__layoutType == "Sidebars":
-            self.bottomSidebar.show()
-            self.bottomSidebar.setCurrentWidget(self.shellAssembly)
-        else:
-            self.shell.show()
+            self.__shellParent.show()
+            self.__shellParent.setCurrentWidget(self.shellAssembly)
         self.shell.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateLogViewer(self):
@@ -4245,8 +4401,6 @@
         elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.logViewer)
-        else:
-            self.logViewer.show()
         self.logViewer.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateTaskViewer(self):
@@ -4259,8 +4413,6 @@
         elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.taskViewer)
-        else:
-            self.taskViewer.show()
         self.taskViewer.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateTemplateViewer(self):
@@ -4274,8 +4426,6 @@
             elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.templateViewer)
-            else:
-                self.templateViewer.show()
             self.templateViewer.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateBrowser(self):
@@ -4289,8 +4439,6 @@
             elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.browser)
-            else:
-                self.browser.show()
             self.browser.setFocus(Qt.ActiveWindowFocusReason)
         
     def __toggleLeftToolbox(self):
@@ -4379,8 +4527,6 @@
             elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.cooperation)
-            else:
-                self.cooperation.show()
             self.cooperation.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateIRC(self):
@@ -4394,8 +4540,6 @@
             elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.irc)
-            else:
-                self.irc.show()
             self.irc.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateSymbolsViewer(self):
@@ -4409,8 +4553,6 @@
             elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.symbolsViewer)
-            else:
-                self.symbolsViewer.show()
             self.symbolsViewer.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateNumbersViewer(self):
@@ -4424,8 +4566,6 @@
             elif self.__layoutType == "Sidebars":
                 self.bottomSidebar.show()
                 self.bottomSidebar.setCurrentWidget(self.numbersViewer)
-            else:
-                self.numbersViewer.show()
             self.numbersViewer.setFocus(Qt.ActiveWindowFocusReason)
         
     def __activateViewmanager(self):
@@ -4451,8 +4591,6 @@
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(
                     self.codeDocumentationViewer)
-            else:
-                self.codeDocumentationViewer.show()
             if switchFocus:
                 self.codeDocumentationViewer.setFocus(
                     Qt.ActiveWindowFocusReason)
@@ -4468,8 +4606,6 @@
             elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.pipWidget)
-            else:
-                self.pipWidget.show()
             self.pipWidget.setFocus(Qt.ActiveWindowFocusReason)
     
     def __activateCondaWidget(self):
@@ -4483,8 +4619,6 @@
             elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.condaWidget)
-            else:
-                self.condaWidget.show()
             self.condaWidget.setFocus(Qt.ActiveWindowFocusReason)
     
     def __toggleWindow(self, w):
@@ -5845,28 +5979,39 @@
         
         @param pageName name of the configuration page to show (string)
         """
-        from Preferences.ConfigurationDialog import ConfigurationDialog
-        dlg = ConfigurationDialog(
-            self, 'Configuration',
-            expandedEntries=self.__expandedConfigurationEntries,
-        )
-        dlg.preferencesChanged.connect(self.__preferencesChanged)
-        dlg.masterPasswordChanged.connect(self.__masterPasswordChanged)
-        dlg.show()
-        if pageName is not None:
-            dlg.showConfigurationPageByName(pageName)
-        elif self.__lastConfigurationPageName:
-            dlg.showConfigurationPageByName(self.__lastConfigurationPageName)
-        else:
-            dlg.showConfigurationPageByName("empty")
-        dlg.exec_()
-        QApplication.processEvents()
-        if dlg.result() == QDialog.Accepted:
-            dlg.setPreferences()
-            Preferences.syncPreferences()
-            self.__preferencesChanged()
-        self.__lastConfigurationPageName = dlg.getConfigurationPageName()
-        self.__expandedConfigurationEntries = dlg.getExpandedEntries()
+        if self.__configurationDialog is None:
+            # only one invocation at a time is allowed
+            from Preferences.ConfigurationDialog import ConfigurationDialog
+            self.__configurationDialog = ConfigurationDialog(
+                self, 'Configuration',
+                expandedEntries=self.__expandedConfigurationEntries,
+            )
+            self.__configurationDialog.preferencesChanged.connect(
+                self.__preferencesChanged)
+            self.__configurationDialog.masterPasswordChanged.connect(
+                self.__masterPasswordChanged)
+            self.__configurationDialog.show()
+            if pageName is not None:
+                self.__configurationDialog.showConfigurationPageByName(
+                    pageName)
+            elif self.__lastConfigurationPageName:
+                self.__configurationDialog.showConfigurationPageByName(
+                    self.__lastConfigurationPageName)
+            else:
+                self.__configurationDialog.showConfigurationPageByName("empty")
+            self.__configurationDialog.exec_()
+            QApplication.processEvents()
+            if self.__configurationDialog.result() == QDialog.Accepted:
+                self.__configurationDialog.setPreferences()
+                Preferences.syncPreferences()
+                self.__preferencesChanged()
+            self.__lastConfigurationPageName = \
+                self.__configurationDialog.getConfigurationPageName()
+            self.__expandedConfigurationEntries = \
+                self.__configurationDialog.getExpandedEntries()
+            
+            self.__configurationDialog.deleteLater()
+            self.__configurationDialog = None
         
     def __exportPreferences(self):
         """

eric ide

mercurial