454 """ |
455 """ |
455 self.fileActions = [] |
456 self.fileActions = [] |
456 self.editActions = [] |
457 self.editActions = [] |
457 self.helpActions = [] |
458 self.helpActions = [] |
458 self.searchActions = [] |
459 self.searchActions = [] |
|
460 self.viewActions = [] |
459 |
461 |
460 self.__createFileActions() |
462 self.__createFileActions() |
461 self.__createEditActions() |
463 self.__createEditActions() |
462 self.__createHelpActions() |
464 self.__createHelpActions() |
463 self.__createSearchActions() |
465 self.__createSearchActions() |
|
466 self.__createViewActions() |
464 |
467 |
465 # read the keyboard shortcuts and make them identical to the main |
468 # read the keyboard shortcuts and make them identical to the main |
466 # eric6 shortcuts |
469 # eric6 shortcuts |
467 for act in self.helpActions: |
470 for act in self.helpActions: |
468 self.__readShortcut(act, "General") |
471 self.__readShortcut(act, "General") |
2199 )) |
2204 )) |
2200 self.replaceAllAct.triggered.connect( |
2205 self.replaceAllAct.triggered.connect( |
2201 self.__replaceWidget.replaceAll) |
2206 self.__replaceWidget.replaceAll) |
2202 self.searchActions.append(self.replaceAllAct) |
2207 self.searchActions.append(self.replaceAllAct) |
2203 |
2208 |
|
2209 def __createViewActions(self): |
|
2210 """ |
|
2211 Private method to create the View actions. |
|
2212 """ |
|
2213 self.zoomInAct = E5Action( |
|
2214 QCoreApplication.translate('ViewManager', 'Zoom in'), |
|
2215 UI.PixmapCache.getIcon("zoomIn"), |
|
2216 QCoreApplication.translate('ViewManager', 'Zoom &in'), |
|
2217 QKeySequence(QCoreApplication.translate( |
|
2218 'ViewManager', "Ctrl++", "View|Zoom in")), |
|
2219 QKeySequence(QCoreApplication.translate( |
|
2220 'ViewManager', "Zoom In", "View|Zoom in")), |
|
2221 self, 'vm_view_zoom_in') |
|
2222 self.zoomInAct.setStatusTip(QCoreApplication.translate( |
|
2223 'ViewManager', 'Zoom in on the text')) |
|
2224 self.zoomInAct.setWhatsThis(QCoreApplication.translate( |
|
2225 'ViewManager', |
|
2226 """<b>Zoom in</b>""" |
|
2227 """<p>Zoom in on the text. This makes the text bigger.</p>""" |
|
2228 )) |
|
2229 self.zoomInAct.triggered.connect(self.__zoomIn) |
|
2230 self.viewActions.append(self.zoomInAct) |
|
2231 |
|
2232 self.zoomOutAct = E5Action( |
|
2233 QCoreApplication.translate('ViewManager', 'Zoom out'), |
|
2234 UI.PixmapCache.getIcon("zoomOut"), |
|
2235 QCoreApplication.translate('ViewManager', 'Zoom &out'), |
|
2236 QKeySequence(QCoreApplication.translate( |
|
2237 'ViewManager', "Ctrl+-", "View|Zoom out")), |
|
2238 QKeySequence(QCoreApplication.translate( |
|
2239 'ViewManager', "Zoom Out", "View|Zoom out")), |
|
2240 self, 'vm_view_zoom_out') |
|
2241 self.zoomOutAct.setStatusTip(QCoreApplication.translate( |
|
2242 'ViewManager', 'Zoom out on the text')) |
|
2243 self.zoomOutAct.setWhatsThis(QCoreApplication.translate( |
|
2244 'ViewManager', |
|
2245 """<b>Zoom out</b>""" |
|
2246 """<p>Zoom out on the text. This makes the text smaller.</p>""" |
|
2247 )) |
|
2248 self.zoomOutAct.triggered.connect(self.__zoomOut) |
|
2249 self.viewActions.append(self.zoomOutAct) |
|
2250 |
|
2251 self.zoomResetAct = E5Action( |
|
2252 QCoreApplication.translate('ViewManager', 'Zoom reset'), |
|
2253 UI.PixmapCache.getIcon("zoomReset"), |
|
2254 QCoreApplication.translate('ViewManager', 'Zoom &reset'), |
|
2255 QKeySequence(QCoreApplication.translate( |
|
2256 'ViewManager', "Ctrl+0", "View|Zoom reset")), |
|
2257 0, |
|
2258 self, 'vm_view_zoom_reset') |
|
2259 self.zoomResetAct.setStatusTip(QCoreApplication.translate( |
|
2260 'ViewManager', 'Reset the zoom of the text')) |
|
2261 self.zoomResetAct.setWhatsThis(QCoreApplication.translate( |
|
2262 'ViewManager', |
|
2263 """<b>Zoom reset</b>""" |
|
2264 """<p>Reset the zoom of the text. """ |
|
2265 """This sets the zoom factor to 100%.</p>""" |
|
2266 )) |
|
2267 self.zoomResetAct.triggered.connect(self.__zoomReset) |
|
2268 self.viewActions.append(self.zoomResetAct) |
|
2269 |
|
2270 self.zoomToAct = E5Action( |
|
2271 QCoreApplication.translate('ViewManager', 'Zoom'), |
|
2272 UI.PixmapCache.getIcon("zoomTo"), |
|
2273 QCoreApplication.translate('ViewManager', '&Zoom'), |
|
2274 QKeySequence(QCoreApplication.translate( |
|
2275 'ViewManager', "Ctrl+#", "View|Zoom")), |
|
2276 0, |
|
2277 self, 'vm_view_zoom') |
|
2278 self.zoomToAct.setStatusTip(QCoreApplication.translate( |
|
2279 'ViewManager', 'Zoom the text')) |
|
2280 self.zoomToAct.setWhatsThis(QCoreApplication.translate( |
|
2281 'ViewManager', |
|
2282 """<b>Zoom</b>""" |
|
2283 """<p>Zoom the text. This opens a dialog where the""" |
|
2284 """ desired size can be entered.</p>""" |
|
2285 )) |
|
2286 self.zoomToAct.triggered.connect(self.__zoom) |
|
2287 self.viewActions.append(self.zoomToAct) |
|
2288 |
2204 def __createHelpActions(self): |
2289 def __createHelpActions(self): |
2205 """ |
2290 """ |
2206 Private method to create the Help actions. |
2291 Private method to create the Help actions. |
2207 """ |
2292 """ |
2208 self.aboutAct = E5Action( |
2293 self.aboutAct = E5Action( |
2281 self.editMenu.addAction(self.replaceAct) |
2366 self.editMenu.addAction(self.replaceAct) |
2282 self.editMenu.addAction(self.replaceAndSearchAct) |
2367 self.editMenu.addAction(self.replaceAndSearchAct) |
2283 self.editMenu.addAction(self.replaceSelectionAct) |
2368 self.editMenu.addAction(self.replaceSelectionAct) |
2284 self.editMenu.addAction(self.replaceAllAct) |
2369 self.editMenu.addAction(self.replaceAllAct) |
2285 |
2370 |
|
2371 self.viewMenu = self.menuBar().addMenu(self.tr("&View")) |
|
2372 self.viewMenu.addAction(self.zoomInAct) |
|
2373 self.viewMenu.addAction(self.zoomOutAct) |
|
2374 self.viewMenu.addAction(self.zoomResetAct) |
|
2375 self.viewMenu.addAction(self.zoomToAct) |
|
2376 |
2286 self.menuBar().addSeparator() |
2377 self.menuBar().addSeparator() |
2287 |
2378 |
2288 self.helpMenu = self.menuBar().addMenu(self.tr("&Help")) |
2379 self.helpMenu = self.menuBar().addMenu(self.tr("&Help")) |
2289 self.helpMenu.addAction(self.aboutAct) |
2380 self.helpMenu.addAction(self.aboutAct) |
2290 self.helpMenu.addAction(self.aboutQtAct) |
2381 self.helpMenu.addAction(self.aboutQtAct) |
2324 findtb.setIconSize(UI.Config.ToolBarIconSize) |
2415 findtb.setIconSize(UI.Config.ToolBarIconSize) |
2325 findtb.addAction(self.searchAct) |
2416 findtb.addAction(self.searchAct) |
2326 findtb.addAction(self.searchNextAct) |
2417 findtb.addAction(self.searchNextAct) |
2327 findtb.addAction(self.searchPrevAct) |
2418 findtb.addAction(self.searchPrevAct) |
2328 findtb.addAction(self.searchClearMarkersAct) |
2419 findtb.addAction(self.searchClearMarkersAct) |
|
2420 |
|
2421 viewtb = self.addToolBar(self.tr("View")) |
|
2422 viewtb.setIconSize(UI.Config.ToolBarIconSize) |
|
2423 viewtb.addAction(self.zoomInAct) |
|
2424 viewtb.addAction(self.zoomOutAct) |
|
2425 viewtb.addAction(self.zoomResetAct) |
|
2426 viewtb.addAction(self.zoomToAct) |
2329 |
2427 |
2330 helptb = self.addToolBar(self.tr("Help")) |
2428 helptb = self.addToolBar(self.tr("Help")) |
2331 helptb.setIconSize(UI.Config.ToolBarIconSize) |
2429 helptb.setIconSize(UI.Config.ToolBarIconSize) |
2332 helptb.addAction(self.whatsThisAct) |
2430 helptb.addAction(self.whatsThisAct) |
2333 |
2431 |
3673 self.__setSbFile(line + 1, pos, language=lang) |
3771 self.__setSbFile(line + 1, pos, language=lang) |
3674 |
3772 |
3675 ####################################################################### |
3773 ####################################################################### |
3676 ## Methods supporting zooming |
3774 ## Methods supporting zooming |
3677 ####################################################################### |
3775 ####################################################################### |
|
3776 |
|
3777 def __zoomIn(self): |
|
3778 """ |
|
3779 Private method to handle the zoom in action. |
|
3780 """ |
|
3781 self.zoomIn() |
|
3782 self.sbZoom.setValue(self.getZoom()) |
|
3783 |
|
3784 def __zoomOut(self): |
|
3785 """ |
|
3786 Private method to handle the zoom out action. |
|
3787 """ |
|
3788 self.zoomOut() |
|
3789 self.sbZoom.setValue(self.getZoom()) |
|
3790 |
|
3791 def __zoomReset(self): |
|
3792 """ |
|
3793 Private method to reset the zoom factor. |
|
3794 """ |
|
3795 self.__zoomTo(0) |
|
3796 |
|
3797 def __zoom(self): |
|
3798 """ |
|
3799 Private method to handle the zoom action. |
|
3800 """ |
|
3801 from QScintilla.ZoomDialog import ZoomDialog |
|
3802 dlg = ZoomDialog(self.getZoom(), self, None, True) |
|
3803 if dlg.exec_() == QDialog.Accepted: |
|
3804 value = dlg.getZoomSize() |
|
3805 self.__zoomTo(value) |
3678 |
3806 |
3679 def __zoomTo(self, value): |
3807 def __zoomTo(self, value): |
3680 """ |
3808 """ |
3681 Private slot to zoom to a given value. |
3809 Private slot to zoom to a given value. |
3682 |
3810 |