ViewManager/ViewManager.py

changeset 1504
3e6ec85cede1
parent 1500
6ce6deb421cf
child 1509
c0b5e693b0eb
--- a/ViewManager/ViewManager.py	Fri Dec 23 17:48:33 2011 +0100
+++ b/ViewManager/ViewManager.py	Sat Dec 24 14:38:40 2011 +0100
@@ -2769,6 +2769,23 @@
         self.zoomOutAct.triggered[()].connect(self.__zoomOut)
         self.viewActions.append(self.zoomOutAct)
         
+        self.zoomResetAct = E5Action(QApplication.translate('ViewManager', 'Zoom reset'),
+                            UI.PixmapCache.getIcon("zoomReset.png"),
+                            QApplication.translate('ViewManager', 'Zoom &reset'),
+                            QKeySequence(QApplication.translate('ViewManager',
+                                "Ctrl+0", "View|Zoom reset")),
+                            0,
+                            self.viewActGrp, 'vm_view_zoom_reset')
+        self.zoomResetAct.setStatusTip(QApplication.translate('ViewManager',
+            'Reset the zoom of the text'))
+        self.zoomResetAct.setWhatsThis(QApplication.translate('ViewManager',
+                """<b>Zoom reset</b>"""
+                """<p>Reset the zoom of the text. """
+                """This sets the zoom factor to 100%.</p>"""
+                ))
+        self.zoomResetAct.triggered[()].connect(self.__zoomReset)
+        self.viewActions.append(self.zoomResetAct)
+        
         self.zoomToAct = E5Action(QApplication.translate('ViewManager', 'Zoom'),
                             UI.PixmapCache.getIcon("zoomTo.png"),
                             QApplication.translate('ViewManager', '&Zoom'),
@@ -4755,6 +4772,19 @@
             if aw:
                 aw.zoomOut()
         
+    def __zoomReset(self):
+        """
+        Private method to reset the zoom factor.
+        """
+        if QApplication.focusWidget() == e5App().getObject("Shell"):
+            e5App().getObject("Shell").zoomTo(0)
+        elif QApplication.focusWidget() == e5App().getObject("Terminal"):
+            e5App().getObject("Terminal").zoomTo(0)
+        else:
+            aw = self.activeWindow()
+            if aw:
+                aw.zoomTo(0)
+        
     def __zoom(self):
         """
         Private method to handle the zoom action.

eric ide

mercurial