UI/UserInterface.py

branch
Py2 comp.
changeset 2791
a9577f248f04
parent 2677
3d4277929fb3
parent 2770
fd5ee85f0450
child 2847
1843ef6e2656
diff -r 6686a3326df8 -r a9577f248f04 UI/UserInterface.py
--- a/UI/UserInterface.py	Mon Jul 08 21:47:26 2013 +0200
+++ b/UI/UserInterface.py	Mon Jul 08 22:36:10 2013 +0200
@@ -32,7 +32,7 @@
 from E5Gui.E5SingleApplication import E5SingleApplicationServer
 from E5Gui.E5Action import E5Action, createActionGroup
 from E5Gui.E5ToolBarManager import E5ToolBarManager
-from E5Gui import E5MessageBox, E5FileDialog
+from E5Gui import E5MessageBox, E5FileDialog, E5ErrorMessage
 from E5Gui.E5Application import e5App
 from E5Gui.E5MainWindow import E5MainWindow
 from E5Gui.E5ZoomWidget import E5ZoomWidget
@@ -389,6 +389,8 @@
         self.viewmanager.changeCaption.connect(self.__setWindowCaption)
         self.viewmanager.checkActions.connect(self.__checkActions)
         self.viewmanager.editorChanged.connect(self.projectBrowser.handleEditorChanged)
+        self.viewmanager.editorLineChanged.connect(
+            self.projectBrowser.handleEditorLineChanged)
         self.viewmanager.checkActions.connect(self.cooperation.checkEditorActions)
         
         self.shell.zoomValueChanged.connect(self.viewmanager.zoomValueChanged)
@@ -1888,6 +1890,20 @@
             self.certificatesAct.triggered[()].connect(self.__showCertificatesDialog)
             self.actions.append(self.certificatesAct)
         
+        self.editMessageFilterAct = E5Action(self.trUtf8('Edit Message Filters'),
+                UI.PixmapCache.getIcon("warning.png"),
+                self.trUtf8('Edit Message Filters...'), 0, 0, self,
+                'manage_message_filters')
+        self.editMessageFilterAct.setStatusTip(self.trUtf8(
+            'Edit the message filters used to suppress unwanted messages'))
+        self.editMessageFilterAct.setWhatsThis(self.trUtf8(
+            """<b>Edit Message Filters</b>"""
+            """<p>Opens a dialog to edit the message filters used to suppress"""
+            """ unwanted messages been shown in an error window.</p>"""
+        ))
+        self.editMessageFilterAct.triggered[()].connect(E5ErrorMessage.editMessageFilters)
+        self.actions.append(self.editMessageFilterAct)
+
         self.viewmanagerActivateAct = E5Action(self.trUtf8('Activate current editor'),
                 self.trUtf8('Activate current editor'),
                 QKeySequence(self.trUtf8("Alt+Shift+E")),
@@ -2009,7 +2025,7 @@
         self.actions.append(self.qt5DocAct)
       
         self.pyqt4DocAct = E5Action(self.trUtf8('PyQt4 Documentation'),
-                self.trUtf8('P&yQt4 Documentation'), 0, 0, self, 'pyqt4_documentation')
+                self.trUtf8('PyQt&4 Documentation'), 0, 0, self, 'pyqt4_documentation')
         self.pyqt4DocAct.setStatusTip(self.trUtf8('Open PyQt4 Documentation'))
         self.pyqt4DocAct.setWhatsThis(self.trUtf8(
             """<b>PyQt4 Documentation</b>"""
@@ -2020,6 +2036,22 @@
         self.pyqt4DocAct.triggered[()].connect(self.__showPyQt4Doc)
         self.actions.append(self.pyqt4DocAct)
         
+        try:
+            import PyQt5        # __IGNORE_WARNING__
+            self.pyqt5DocAct = E5Action(self.trUtf8('PyQt5 Documentation'),
+                self.trUtf8('PyQt&5 Documentation'), 0, 0, self, 'pyqt5_documentation')
+            self.pyqt5DocAct.setStatusTip(self.trUtf8('Open PyQt5 Documentation'))
+            self.pyqt5DocAct.setWhatsThis(self.trUtf8(
+                """<b>PyQt5 Documentation</b>"""
+                """<p>Display the PyQt5 Documentation. Dependant upon your settings,"""
+                """ this will either show the help in Eric's internal help viewer,"""
+                """ or execute a web browser or Qt Assistant. </p>"""
+            ))
+            self.pyqt5DocAct.triggered[()].connect(self.__showPyQt5Doc)
+            self.actions.append(self.pyqt5DocAct)
+        except ImportError:
+            self.pyqt5DocAct = None
+        
     def __initPythonDocActions(self):
         """
         Private slot to initialize the actions to show the Python documentation.
@@ -2176,6 +2208,8 @@
         if SSL_AVAILABLE:
             self.__menus["settings"].addSeparator()
             self.__menus["settings"].addAction(self.certificatesAct)
+        self.__menus["settings"].addSeparator()
+        self.__menus["settings"].addAction(self.editMessageFilterAct)
         
         self.__menus["window"] = QMenu(self.trUtf8('&Window'), self)
         mb.addMenu(self.__menus["window"])
@@ -2237,6 +2271,8 @@
         self.__menus["help"].addAction(self.qt4DocAct)
         self.__menus["help"].addAction(self.qt5DocAct)
         self.__menus["help"].addAction(self.pyqt4DocAct)
+        if self.pyqt5DocAct is not None:
+            self.__menus["help"].addAction(self.pyqt5DocAct)
         if self.pysideDocAct is not None:
             self.__menus["help"].addAction(self.pysideDocAct)
         self.__menus["help"].addSeparator()
@@ -2583,6 +2619,14 @@
         
         self.showMenu.emit("Help", self.__menus["help"])
     
+    def __showSettingsMenu(self):
+        """
+        Private slot to show the Settings menu.
+        """
+        self.editMessageFilterAct.setEnabled(E5ErrorMessage.messageHandlerInstalled())
+        
+        self.showMenu.emit("Settings", self.__menus["settings"])
+    
     def __showNext(self):
         """
         Private slot used to show the next tab or file.
@@ -4438,7 +4482,6 @@
                 if not os.path.splitext(pyqt4DocDir)[1]:
                     possibleHomes = [\
                         Utilities.normjoinpath(pyqt4DocDir, 'index.html'),
-                        Utilities.normjoinpath(pyqt4DocDir, 'pyqt4ref.html'),
                         Utilities.normjoinpath(pyqt4DocDir, 'classes.html'),
                     ]
                     for possibleHome in possibleHomes:
@@ -4473,6 +4516,64 @@
         else:
             self.__customViewer(home)
         
+    def __showPyQt5Doc(self):
+        """
+        Private slot to show the PyQt5 documentation.
+        """
+        pyqt5DocDir = Preferences.getHelp("PyQt5DocDir")
+        if not pyqt5DocDir:
+            pyqt5DocDir = Utilities.getEnvironmentEntry("PYQT5DOCDIR", None)
+        
+        if not pyqt5DocDir:
+            E5MessageBox.warning(self,
+                self.trUtf8("Documentation"),
+                self.trUtf8("""<p>The PyQt5 documentation starting point"""
+                            """ has not been configured.</p>"""))
+            return
+        
+        if not pyqt5DocDir.startswith("http://") and \
+           not pyqt5DocDir.startswith("https://"):
+            home = ""
+            if pyqt5DocDir:
+                if pyqt5DocDir.startswith("file://"):
+                    pyqt5DocDir = pyqt5DocDir[7:]
+                if not os.path.splitext(pyqt5DocDir)[1]:
+                    possibleHomes = [\
+                        Utilities.normjoinpath(pyqt5DocDir, 'index.html'),
+                        Utilities.normjoinpath(pyqt5DocDir, 'class_reference.html'),
+                    ]
+                    for possibleHome in possibleHomes:
+                        if os.path.exists(possibleHome):
+                            home = possibleHome
+                            break
+                else:
+                    home = pyqt5DocDir
+            
+            if not home or not os.path.exists(home):
+                E5MessageBox.warning(self,
+                    self.trUtf8("Documentation Missing"),
+                    self.trUtf8("""<p>The documentation starting point"""
+                                """ "<b>{0}</b>" could not be found.</p>""")\
+                        .format(home))
+                return
+            
+            if Utilities.isWindowsPlatform():
+                home = "file:///" + Utilities.fromNativeSeparators(home)
+            else:
+                home = "file://" + home
+        else:
+            home = pyqt5DocDir
+        
+        hvType = Preferences.getHelp("HelpViewerType")
+        if hvType == 1:
+            self.launchHelpViewer(home)
+        elif hvType == 2:
+            self.__assistant(home, version=4)
+        elif hvType == 3:
+            self.__webBrowser(home)
+        else:
+            self.__customViewer(home)
+        
     def __showEricDoc(self):
         """
         Private slot to show the Eric documentation.
@@ -5585,7 +5686,7 @@
         Private method to get the geometry of a floating windows.
         
         @param w reference to the widget to be saved (QWidget)
-        @return list giving the widget's geometry and it's visibility
+        @return list giving the widget's geometry and its visibility
         """
         s = w.size()
         p = w.pos()

eric ide

mercurial