ViewManager/ViewManager.py

branch
Py2 comp.
changeset 3142
55030c09e142
parent 3080
6c0a430b19df
parent 3102
0bc989a51428
child 3145
a9de05d4a22f
equal deleted inserted replaced
3141:72f3bde98c58 3142:55030c09e142
416 416
417 @return Flag indicating successful deletion 417 @return Flag indicating successful deletion
418 """ 418 """
419 return False 419 return False
420 420
421 def getSplitOrientation(self):
422 """
423 Public method to get the orientation of the split view.
424
425 @return orientation of the split (Qt.Horizontal or Qt.Vertical)
426 """
427 return Qt.Vertical
428
421 def setSplitOrientation(self, orientation): 429 def setSplitOrientation(self, orientation):
422 """ 430 """
423 Public method used to set the orientation of the split view. 431 Public method used to set the orientation of the split view.
424 432
425 @param orientation orientation of the split 433 @param orientation orientation of the split
426 (Qt.Horizontal or Qt.Vertical) 434 (Qt.Horizontal or Qt.Vertical)
427 """ 435 """
428 pass 436 pass
429 437
430 def nextSplit(self): 438 def nextSplit(self):
431 """ 439 """
3319 """<p>Remove the highlights of all editors.</p>""" 3327 """<p>Remove the highlights of all editors.</p>"""
3320 )) 3328 ))
3321 self.unhighlightAct.triggered[()].connect(self.unhighlight) 3329 self.unhighlightAct.triggered[()].connect(self.unhighlight)
3322 self.viewActions.append(self.unhighlightAct) 3330 self.viewActions.append(self.unhighlightAct)
3323 3331
3332 self.newDocumentViewAct = E5Action(
3333 QApplication.translate('ViewManager', 'New Document View'),
3334 UI.PixmapCache.getIcon("documentNewView.png"),
3335 QApplication.translate('ViewManager', 'New &Document View'),
3336 0, 0, self, 'vm_view_new_document_view')
3337 self.newDocumentViewAct.setStatusTip(QApplication.translate(
3338 'ViewManager', 'Open a new view of the current document'))
3339 self.newDocumentViewAct.setWhatsThis(QApplication.translate(
3340 'ViewManager',
3341 """<b>New Document View</b>"""
3342 """<p>Opens a new view of the current document. Both views show"""
3343 """ the same document. However, the cursors may be positioned"""
3344 """ independently.</p>"""
3345 ))
3346 self.newDocumentViewAct.triggered[()].connect(self.__newDocumentView)
3347 self.viewActions.append(self.newDocumentViewAct)
3348
3349 self.newDocumentSplitViewAct = E5Action(
3350 QApplication.translate(
3351 'ViewManager', 'New Document View (with new split)'),
3352 UI.PixmapCache.getIcon("splitVertical.png"),
3353 QApplication.translate(
3354 'ViewManager', 'New Document View (with new split)'),
3355 0, 0, self, 'vm_view_new_document_split_view')
3356 self.newDocumentSplitViewAct.setStatusTip(QApplication.translate(
3357 'ViewManager',
3358 'Open a new view of the current document in a new split'))
3359 self.newDocumentSplitViewAct.setWhatsThis(QApplication.translate(
3360 'ViewManager',
3361 """<b>New Document View</b>"""
3362 """<p>Opens a new view of the current document in a new split."""
3363 """ Both views show the same document. However, the cursors may"""
3364 """ be positioned independently.</p>"""
3365 ))
3366 self.newDocumentSplitViewAct.triggered[()].connect(
3367 self.__newDocumentSplitView)
3368 self.viewActions.append(self.newDocumentSplitViewAct)
3369
3324 self.splitViewAct = E5Action( 3370 self.splitViewAct = E5Action(
3325 QApplication.translate('ViewManager', 'Split view'), 3371 QApplication.translate('ViewManager', 'Split view'),
3326 UI.PixmapCache.getIcon("splitVertical.png"), 3372 UI.PixmapCache.getIcon("splitVertical.png"),
3327 QApplication.translate('ViewManager', '&Split view'), 3373 QApplication.translate('ViewManager', '&Split view'),
3328 0, 0, self, 'vm_view_split_view') 3374 0, 0, self, 'vm_view_split_view')
3439 menu.addActions(self.viewFoldActGrp.actions()) 3485 menu.addActions(self.viewFoldActGrp.actions())
3440 menu.addSeparator() 3486 menu.addSeparator()
3441 menu.addAction(self.previewAct) 3487 menu.addAction(self.previewAct)
3442 menu.addSeparator() 3488 menu.addSeparator()
3443 menu.addAction(self.unhighlightAct) 3489 menu.addAction(self.unhighlightAct)
3490 menu.addSeparator()
3491 menu.addAction(self.newDocumentViewAct)
3444 if self.canSplit(): 3492 if self.canSplit():
3493 menu.addAction(self.newDocumentSplitViewAct)
3445 menu.addSeparator() 3494 menu.addSeparator()
3446 menu.addAction(self.splitViewAct) 3495 menu.addAction(self.splitViewAct)
3447 menu.addAction(self.splitOrientationAct) 3496 menu.addAction(self.splitOrientationAct)
3448 menu.addAction(self.splitRemoveAct) 3497 menu.addAction(self.splitRemoveAct)
3449 menu.addAction(self.nextSplitAct) 3498 menu.addAction(self.nextSplitAct)
3465 tb.setToolTip(QApplication.translate('ViewManager', 'View')) 3514 tb.setToolTip(QApplication.translate('ViewManager', 'View'))
3466 3515
3467 tb.addActions(self.viewActGrp.actions()) 3516 tb.addActions(self.viewActGrp.actions())
3468 tb.addSeparator() 3517 tb.addSeparator()
3469 tb.addAction(self.previewAct) 3518 tb.addAction(self.previewAct)
3519 tb.addSeparator()
3520 tb.addAction(self.newDocumentViewAct)
3521 if self.canSplit():
3522 tb.addAction(self.newDocumentSplitViewAct)
3470 3523
3471 toolbarManager.addToolBar(tb, tb.windowTitle()) 3524 toolbarManager.addToolBar(tb, tb.windowTitle())
3472 toolbarManager.addAction(self.unhighlightAct, tb.windowTitle()) 3525 toolbarManager.addAction(self.unhighlightAct, tb.windowTitle())
3473 toolbarManager.addAction(self.splitViewAct, tb.windowTitle()) 3526 toolbarManager.addAction(self.splitViewAct, tb.windowTitle())
3474 toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle()) 3527 toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle())
5543 aw = self.activeWindow() 5596 aw = self.activeWindow()
5544 if aw: 5597 if aw:
5545 line, index = aw.getCursorPosition() 5598 line, index = aw.getCursorPosition()
5546 aw.foldLine(line) 5599 aw.foldLine(line)
5547 5600
5601 def __newDocumentView(self):
5602 """
5603 Private method to open a new view of the current editor.
5604 """
5605 aw = self.activeWindow()
5606 if aw:
5607 self.newEditorView(aw.getFileName(), aw, aw.getFileType())
5608
5609 def __newDocumentSplitView(self):
5610 """
5611 Private method to open a new view of the current editor in a new split.
5612 """
5613 aw = self.activeWindow()
5614 if aw:
5615 self.addSplit()
5616 self.newEditorView(aw.getFileName(), aw, aw.getFileType())
5617
5548 def __splitView(self): 5618 def __splitView(self):
5549 """ 5619 """
5550 Private method to handle the split view action. 5620 Private method to handle the split view action.
5551 """ 5621 """
5552 self.addSplit() 5622 self.addSplit()
5562 self.setSplitOrientation(Qt.Horizontal) 5632 self.setSplitOrientation(Qt.Horizontal)
5563 self.splitViewAct.setIcon( 5633 self.splitViewAct.setIcon(
5564 UI.PixmapCache.getIcon("splitHorizontal.png")) 5634 UI.PixmapCache.getIcon("splitHorizontal.png"))
5565 self.splitRemoveAct.setIcon( 5635 self.splitRemoveAct.setIcon(
5566 UI.PixmapCache.getIcon("remsplitHorizontal.png")) 5636 UI.PixmapCache.getIcon("remsplitHorizontal.png"))
5637 self.newDocumentSplitViewAct.setIcon(
5638 UI.PixmapCache.getIcon("splitHorizontal.png"))
5567 else: 5639 else:
5568 self.setSplitOrientation(Qt.Vertical) 5640 self.setSplitOrientation(Qt.Vertical)
5569 self.splitViewAct.setIcon( 5641 self.splitViewAct.setIcon(
5570 UI.PixmapCache.getIcon("splitVertical.png")) 5642 UI.PixmapCache.getIcon("splitVertical.png"))
5571 self.splitRemoveAct.setIcon( 5643 self.splitRemoveAct.setIcon(
5572 UI.PixmapCache.getIcon("remsplitVertical.png")) 5644 UI.PixmapCache.getIcon("remsplitVertical.png"))
5645 self.newDocumentSplitViewAct.setIcon(
5646 UI.PixmapCache.getIcon("splitVertical.png"))
5573 5647
5574 def __previewEditor(self, checked): 5648 def __previewEditor(self, checked):
5575 """ 5649 """
5576 Private slot to handle a change of the preview selection state. 5650 Private slot to handle a change of the preview selection state.
5577 5651
6037 self.searchActGrp.setEnabled(False) 6111 self.searchActGrp.setEnabled(False)
6038 self.quickFindtextCombo.setEnabled(False) 6112 self.quickFindtextCombo.setEnabled(False)
6039 self.viewActGrp.setEnabled(False) 6113 self.viewActGrp.setEnabled(False)
6040 self.viewFoldActGrp.setEnabled(False) 6114 self.viewFoldActGrp.setEnabled(False)
6041 self.unhighlightAct.setEnabled(False) 6115 self.unhighlightAct.setEnabled(False)
6116 self.newDocumentViewAct.setEnabled(False)
6117 self.newDocumentSplitViewAct.setEnabled(False)
6042 self.splitViewAct.setEnabled(False) 6118 self.splitViewAct.setEnabled(False)
6043 self.splitOrientationAct.setEnabled(False) 6119 self.splitOrientationAct.setEnabled(False)
6044 self.previewAct.setEnabled(True) 6120 self.previewAct.setEnabled(True)
6045 self.macroActGrp.setEnabled(False) 6121 self.macroActGrp.setEnabled(False)
6046 self.bookmarkActGrp.setEnabled(False) 6122 self.bookmarkActGrp.setEnabled(False)
6074 self.searchActGrp.setEnabled(True) 6150 self.searchActGrp.setEnabled(True)
6075 self.quickFindtextCombo.setEnabled(True) 6151 self.quickFindtextCombo.setEnabled(True)
6076 self.viewActGrp.setEnabled(True) 6152 self.viewActGrp.setEnabled(True)
6077 self.viewFoldActGrp.setEnabled(True) 6153 self.viewFoldActGrp.setEnabled(True)
6078 self.unhighlightAct.setEnabled(True) 6154 self.unhighlightAct.setEnabled(True)
6155 self.newDocumentViewAct.setEnabled(True)
6079 if self.canSplit(): 6156 if self.canSplit():
6157 self.newDocumentSplitViewAct.setEnabled(True)
6080 self.splitViewAct.setEnabled(True) 6158 self.splitViewAct.setEnabled(True)
6081 self.splitOrientationAct.setEnabled(True) 6159 self.splitOrientationAct.setEnabled(True)
6082 self.macroActGrp.setEnabled(True) 6160 self.macroActGrp.setEnabled(True)
6083 self.bookmarkActGrp.setEnabled(True) 6161 self.bookmarkActGrp.setEnabled(True)
6084 self.__enableSpellingActions() 6162 self.__enableSpellingActions()

eric ide

mercurial