UserInterface, Translator: fixed an issue switching to the translator via the keyboard shortcut.

Sun, 15 Jul 2018 19:21:28 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Jul 2018 19:21:28 +0200
changeset 6434
872d10fa686a
parent 6433
92680b6a3585
child 6435
4f42a7bb86c4

UserInterface, Translator: fixed an issue switching to the translator via the keyboard shortcut.

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric6.UI.UserInterface.html file | annotate | diff | comparison | revisions
Plugins/UiExtensionPlugins/Translator/Translator.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Sun Jul 15 19:00:10 2018 +0200
+++ b/APIs/Python3/eric6.api	Sun Jul 15 19:21:28 2018 +0200
@@ -9904,6 +9904,7 @@
 eric6.UI.UserInterface.UserInterface.dropEvent?4(event)
 eric6.UI.UserInterface.UserInterface.getActions?4(actionType)
 eric6.UI.UserInterface.UserInterface.getHelpViewer?4(preview=False)
+eric6.UI.UserInterface.UserInterface.getLayoutType?4()
 eric6.UI.UserInterface.UserInterface.getLocale?4()
 eric6.UI.UserInterface.UserInterface.getMenu?4(name)
 eric6.UI.UserInterface.UserInterface.getMenuAction?4(menuName, actionName)
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sun Jul 15 19:00:10 2018 +0200
+++ b/Documentation/Help/source.qhp	Sun Jul 15 19:21:28 2018 +0200
@@ -16872,6 +16872,7 @@
       <keyword name="UserInterface.dropEvent" id="UserInterface.dropEvent" ref="eric6.UI.UserInterface.html#UserInterface.dropEvent" />
       <keyword name="UserInterface.getActions" id="UserInterface.getActions" ref="eric6.UI.UserInterface.html#UserInterface.getActions" />
       <keyword name="UserInterface.getHelpViewer" id="UserInterface.getHelpViewer" ref="eric6.UI.UserInterface.html#UserInterface.getHelpViewer" />
+      <keyword name="UserInterface.getLayoutType" id="UserInterface.getLayoutType" ref="eric6.UI.UserInterface.html#UserInterface.getLayoutType" />
       <keyword name="UserInterface.getLocale" id="UserInterface.getLocale" ref="eric6.UI.UserInterface.html#UserInterface.getLocale" />
       <keyword name="UserInterface.getMenu" id="UserInterface.getMenu" ref="eric6.UI.UserInterface.html#UserInterface.getMenu" />
       <keyword name="UserInterface.getMenuAction" id="UserInterface.getMenuAction" ref="eric6.UI.UserInterface.html#UserInterface.getMenuAction" />
--- a/Documentation/Source/eric6.UI.UserInterface.html	Sun Jul 15 19:00:10 2018 +0200
+++ b/Documentation/Source/eric6.UI.UserInterface.html	Sun Jul 15 19:21:28 2018 +0200
@@ -735,6 +735,9 @@
 <td><a href="#UserInterface.getHelpViewer">getHelpViewer</a></td>
 <td>Public method to get a reference to the help window instance.</td>
 </tr><tr>
+<td><a href="#UserInterface.getLayoutType">getLayoutType</a></td>
+<td>Public method to get the current layout type.</td>
+</tr><tr>
 <td><a href="#UserInterface.getLocale">getLocale</a></td>
 <td>Public method to get the locale of the IDE.</td>
 </tr><tr>
@@ -2299,6 +2302,21 @@
 <dd>
 reference to the help window instance (HelpWindow)
 </dd>
+</dl><a NAME="UserInterface.getLayoutType" ID="UserInterface.getLayoutType"></a>
+<h4>UserInterface.getLayoutType</h4>
+<b>getLayoutType</b>(<i></i>)
+<p>
+        Public method to get the current layout type.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+current layout type
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+str
+</dd>
 </dl><a NAME="UserInterface.getLocale" ID="UserInterface.getLocale"></a>
 <h4>UserInterface.getLocale</h4>
 <b>getLocale</b>(<i></i>)
--- a/Plugins/UiExtensionPlugins/Translator/Translator.py	Sun Jul 15 19:00:10 2018 +0200
+++ b/Plugins/UiExtensionPlugins/Translator/Translator.py	Sun Jul 15 19:21:28 2018 +0200
@@ -92,10 +92,11 @@
         """
         Private slot to handle the activation of the project browser.
         """
-        if self.__ui.layout == "Toolboxes":
+        uiLayoutType = self.__ui.getLayoutType()
+        if uiLayoutType == "Toolboxes":
             self.__ui.hToolboxDock.show()
-            self.__ui.hToolboxDock.setCurrentWidget(self.__widget)
-        elif self.__ui.layout == "Sidebars":
+            self.__ui.hToolbox.setCurrentWidget(self.__widget)
+        elif uiLayoutType == "Sidebars":
             self.__ui.bottomSidebar.show()
             self.__ui.bottomSidebar.setCurrentWidget(self.__widget)
         else:
--- a/UI/UserInterface.py	Sun Jul 15 19:00:10 2018 +0200
+++ b/UI/UserInterface.py	Sun Jul 15 19:21:28 2018 +0200
@@ -209,7 +209,7 @@
         self.__disableCrashSession = disableCrashSession
         self.__disabledPlugins = disabledPlugins[:]
         
-        self.layoutType = Preferences.getUI("LayoutType")
+        self.__layoutType = Preferences.getUI("LayoutType")
         
         self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
         
@@ -762,18 +762,18 @@
         splitter.addWidget(self.__previewer)
         
         # Create layout with toolbox windows embedded in dock windows
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             logging.debug("Creating toolboxes...")
             self.__createToolboxesLayout(debugServer)
         
         # Create layout with sidebar windows embedded in dock windows
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             logging.debug("Creating sidebars...")
             self.__createSidebarsLayout(debugServer)
         
         else:
             raise ValueError("Wrong layout type given ({0})".format(
-                self.layoutType))
+                self.__layoutType))
         logging.debug("Created Layout")
 
     def __createToolboxesLayout(self, debugServer):
@@ -1114,14 +1114,14 @@
         """
         assert side in [UserInterface.LeftSide, UserInterface.BottomSide]
         
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             if side == UserInterface.LeftSide:
                 self.lToolbox.addItem(widget, icon, label)
             elif side == UserInterface.BottomSide:
                 self.hToolbox.addItem(widget, icon, label)
             elif side == UserInterface.RightSide:
                 self.rToolbox.addItem(widget, icon, label)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             if side == UserInterface.LeftSide:
                 self.leftSidebar.addTab(widget, icon, label)
             elif side == UserInterface.BottomSide:
@@ -1135,12 +1135,12 @@
         
         @param widget reference to the widget to remove (QWidget)
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             for container in [self.lToolbox, self.hToolbox, self.rToolbox]:
                 index = container.indexOf(widget)
                 if index != -1:
                     container.removeItem(index)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             for container in [self.leftSidebar, self.bottomSidebar,
                               self.rightSidebar]:
                 index = container.indexOf(widget)
@@ -1152,11 +1152,11 @@
         Public method to show the Log-Viewer.
         """
         if Preferences.getUI("LogViewerAutoRaise"):
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.hToolboxDock.show()
                 self.hToolbox.setCurrentWidget(self.logViewer)
                 self.hToolboxDock.raise_()
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.bottomSidebar.show()
                 self.bottomSidebar.setCurrentWidget(self.logViewer)
                 self.bottomSidebar.raise_()
@@ -3826,14 +3826,14 @@
         self.__menus["window"].addActions(self.viewProfileActGrp.actions())
         self.__menus["window"].addSeparator()
         
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.__menus["window"].addAction(self.ltAct)
             self.ltAct.setChecked(not self.lToolboxDock.isHidden())
             self.__menus["window"].addAction(self.rtAct)
             self.rtAct.setChecked(not self.lToolboxDock.isHidden())
             self.__menus["window"].addAction(self.htAct)
             self.htAct.setChecked(not self.hToolboxDock.isHidden())
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.__menus["window"].addAction(self.lsbAct)
             self.lsbAct.setChecked(not self.leftSidebar.isHidden())
             self.__menus["window"].addAction(self.rsbAct)
@@ -3958,10 +3958,10 @@
         """
         if self.currentProfile and save:
             # step 1: save the window geometries of the active profile
-            if self.layoutType in ["Toolboxes", "Sidebars"]:
+            if self.__layoutType in ["Toolboxes", "Sidebars"]:
                 state = self.saveState()
                 self.profiles[self.currentProfile][0] = state
-                if self.layoutType == "Sidebars":
+                if self.__layoutType == "Sidebars":
                     state = self.leftSplitter.saveState()
                     self.profiles[self.currentProfile][2][0] = state
                     state = self.verticalSplitter.saveState()
@@ -3975,14 +3975,14 @@
                     state = self.rightSidebar.saveState()
                     self.profiles[self.currentProfile][2][5] = state
             # step 2: save the visibility of the windows of the active profile
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.profiles[self.currentProfile][1][0] = \
                     self.lToolboxDock.isVisible()
                 self.profiles[self.currentProfile][1][1] = \
                     self.hToolboxDock.isVisible()
                 self.profiles[self.currentProfile][1][2] = \
                     self.rToolboxDock.isVisible()
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.profiles[self.currentProfile][1][0] = \
                     self.leftSidebar.isVisible()
                 self.profiles[self.currentProfile][1][1] = \
@@ -4004,11 +4004,11 @@
             self.__saveCurrentViewProfile(save)
             
             # step 2: set the window geometries of the new profile
-            if self.layoutType in ["Toolboxes", "Sidebars"]:
+            if self.__layoutType in ["Toolboxes", "Sidebars"]:
                 state = self.profiles[name][0]
                 if not state.isEmpty():
                     self.restoreState(state)
-                if self.layoutType == "Sidebars":
+                if self.__layoutType == "Sidebars":
                     state = self.profiles[name][2][0]
                     if not state.isEmpty():
                         self.leftSplitter.restoreState(state)
@@ -4030,11 +4030,11 @@
                 self.__configureDockareaCornerUsage()
             
             # step 3: activate the windows of the new profile
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.setVisible(self.profiles[name][1][0])
                 self.hToolboxDock.setVisible(self.profiles[name][1][1])
                 self.rToolboxDock.setVisible(self.profiles[name][1][2])
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.setVisible(self.profiles[name][1][0])
                 self.bottomSidebar.setVisible(self.profiles[name][1][1])
                 self.rightSidebar.setVisible(self.profiles[name][1][2])
@@ -4057,12 +4057,12 @@
         Private slot to handle the start of a debugging session.
         """
         self.setDebugProfile()
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.__currentRightWidget = self.rToolbox.currentWidget()
             self.rToolbox.setCurrentWidget(self.debugViewer)
             self.__currentBottomWidget = self.hToolbox.currentWidget()
             self.hToolbox.setCurrentWidget(self.shellAssembly)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.__currentRightWidget = self.rightSidebar.currentWidget()
             self.rightSidebar.setCurrentWidget(self.debugViewer)
             self.__currentBottomWidget = self.bottomSidebar.currentWidget()
@@ -4073,12 +4073,12 @@
         Private slot to handle the end of a debugging session.
         """
         self.__setEditProfile()
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             if self.__currentRightWidget:
                 self.rToolbox.setCurrentWidget(self.__currentRightWidget)
             if self.__currentBottomWidget:
                 self.hToolbox.setCurrentWidget(self.__currentBottomWidget)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             if self.__currentRightWidget:
                 self.rightSidebar.setCurrentWidget(self.__currentRightWidget)
             if self.__currentBottomWidget:
@@ -4118,15 +4118,24 @@
         @return the name of the current view profile (string)
         """
         return self.currentProfile
-        
+    
+    def getLayoutType(self):
+        """
+        Public method to get the current layout type.
+        
+        @return current layout type
+        @rtype str
+        """
+        return self.__layoutType
+    
     def __activateProjectBrowser(self):
         """
         Private slot to handle the activation of the project browser.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.lToolboxDock.show()
             self.lToolbox.setCurrentWidget(self.projectBrowser)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.projectBrowser)
         else:
@@ -4138,10 +4147,10 @@
         """
         Private slot to handle the activation of the project browser.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.lToolboxDock.show()
             self.lToolbox.setCurrentWidget(self.multiProjectBrowser)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.multiProjectBrowser)
         else:
@@ -4152,10 +4161,10 @@
         """
         Public slot to handle the activation of the debug viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.rToolboxDock.show()
             self.rToolbox.setCurrentWidget(self.debugViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.rightSidebar.show()
             self.rightSidebar.setCurrentWidget(self.debugViewer)
         else:
@@ -4166,10 +4175,10 @@
         """
         Private slot to handle the activation of the Shell window.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.shellAssembly)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.shellAssembly)
         else:
@@ -4180,10 +4189,10 @@
         """
         Private slot to handle the activation of the Log Viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.logViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.logViewer)
         else:
@@ -4194,10 +4203,10 @@
         """
         Private slot to handle the activation of the Task Viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.taskViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.taskViewer)
         else:
@@ -4209,10 +4218,10 @@
         Private slot to handle the activation of the Template Viewer.
         """
         if self.templateViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.templateViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.templateViewer)
             else:
@@ -4224,10 +4233,10 @@
         Private slot to handle the activation of the file browser.
         """
         if self.browser is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.browser)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.browser)
             else:
@@ -4314,10 +4323,10 @@
         Public slot to handle the activation of the cooperation window.
         """
         if self.cooperation is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.cooperation)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.cooperation)
             else:
@@ -4329,10 +4338,10 @@
         Private slot to handle the activation of the IRC window.
         """
         if self.irc is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.irc)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.irc)
             else:
@@ -4344,10 +4353,10 @@
         Private slot to handle the activation of the Symbols Viewer.
         """
         if self.symbolsViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.symbolsViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.symbolsViewer)
             else:
@@ -4359,10 +4368,10 @@
         Private slot to handle the activation of the Numbers Viewer.
         """
         if self.numbersViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.hToolboxDock.show()
                 self.hToolbox.setCurrentWidget(self.numbersViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.bottomSidebar.show()
                 self.bottomSidebar.setCurrentWidget(self.numbersViewer)
             else:
@@ -4385,10 +4394,10 @@
         @type bool
         """
         if self.codeDocumentationViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(
                     self.codeDocumentationViewer)
@@ -5799,7 +5808,7 @@
         SpellChecker.setDefaultLanguage(
             Preferences.getEditor("SpellCheckingDefaultLanguage"))
         
-        if self.layoutType == "Sidebars":
+        if self.__layoutType == "Sidebars":
             delay = Preferences.getUI("SidebarDelay")
             self.leftSidebar.setDelay(delay)
             self.bottomSidebar.setDelay(delay)
@@ -5863,7 +5872,7 @@
         Private slot to configure the various view profiles.
         """
         from Preferences.ViewProfileDialog import ViewProfileDialog
-        dlg = ViewProfileDialog(self.layoutType, self.profiles['edit'][1],
+        dlg = ViewProfileDialog(self.__layoutType, self.profiles['edit'][1],
                                 self.profiles['debug'][1])
         if dlg.exec_() == QDialog.Accepted:
             edit, debug = dlg.getVisibilities()
@@ -6565,7 +6574,7 @@
         
         self.virtualenvManager.shutdown()
         
-        if self.layoutType == "Sidebars":
+        if self.__layoutType == "Sidebars":
             self.leftSidebar.shutdown()
             self.bottomSidebar.shutdown()
             self.rightSidebar.shutdown()

eric ide

mercurial