476 self.newAct = E5Action(QApplication.translate('ViewManager', 'New'), |
476 self.newAct = E5Action(QApplication.translate('ViewManager', 'New'), |
477 UI.PixmapCache.getIcon("new.png"), |
477 UI.PixmapCache.getIcon("new.png"), |
478 QApplication.translate('ViewManager', '&New'), |
478 QApplication.translate('ViewManager', '&New'), |
479 QKeySequence(QApplication.translate('ViewManager', "Ctrl+N", "File|New")), |
479 QKeySequence(QApplication.translate('ViewManager', "Ctrl+N", "File|New")), |
480 0, self, 'vm_file_new') |
480 0, self, 'vm_file_new') |
481 self.newAct.setStatusTip(\ |
481 self.newAct.setStatusTip( |
482 QApplication.translate('ViewManager', 'Open an empty editor window')) |
482 QApplication.translate('ViewManager', 'Open an empty editor window')) |
483 self.newAct.setWhatsThis(QApplication.translate('ViewManager', |
483 self.newAct.setWhatsThis(QApplication.translate('ViewManager', |
484 """<b>New</b>""" |
484 """<b>New</b>""" |
485 """<p>An empty editor window will be created.</p>""" |
485 """<p>An empty editor window will be created.</p>""" |
486 )) |
486 )) |
488 self.fileActions.append(self.newAct) |
488 self.fileActions.append(self.newAct) |
489 |
489 |
490 self.openAct = E5Action(QApplication.translate('ViewManager', 'Open'), |
490 self.openAct = E5Action(QApplication.translate('ViewManager', 'Open'), |
491 UI.PixmapCache.getIcon("open.png"), |
491 UI.PixmapCache.getIcon("open.png"), |
492 QApplication.translate('ViewManager', '&Open...'), |
492 QApplication.translate('ViewManager', '&Open...'), |
493 QKeySequence(\ |
493 QKeySequence( |
494 QApplication.translate('ViewManager', "Ctrl+O", "File|Open")), |
494 QApplication.translate('ViewManager', "Ctrl+O", "File|Open")), |
495 0, self, 'vm_file_open') |
495 0, self, 'vm_file_open') |
496 self.openAct.setStatusTip(QApplication.translate('ViewManager', 'Open a file')) |
496 self.openAct.setStatusTip(QApplication.translate('ViewManager', 'Open a file')) |
497 self.openAct.setWhatsThis(QApplication.translate('ViewManager', |
497 self.openAct.setWhatsThis(QApplication.translate('ViewManager', |
498 """<b>Open a file</b>""" |
498 """<b>Open a file</b>""" |
505 self.closeActGrp = createActionGroup(self) |
505 self.closeActGrp = createActionGroup(self) |
506 |
506 |
507 self.closeAct = E5Action(QApplication.translate('ViewManager', 'Close'), |
507 self.closeAct = E5Action(QApplication.translate('ViewManager', 'Close'), |
508 UI.PixmapCache.getIcon("close.png"), |
508 UI.PixmapCache.getIcon("close.png"), |
509 QApplication.translate('ViewManager', '&Close'), |
509 QApplication.translate('ViewManager', '&Close'), |
510 QKeySequence(\ |
510 QKeySequence( |
511 QApplication.translate('ViewManager', "Ctrl+W", "File|Close")), |
511 QApplication.translate('ViewManager', "Ctrl+W", "File|Close")), |
512 0, self.closeActGrp, 'vm_file_close') |
512 0, self.closeActGrp, 'vm_file_close') |
513 self.closeAct.setStatusTip(\ |
513 self.closeAct.setStatusTip( |
514 QApplication.translate('ViewManager', 'Close the current window')) |
514 QApplication.translate('ViewManager', 'Close the current window')) |
515 self.closeAct.setWhatsThis(QApplication.translate('ViewManager', |
515 self.closeAct.setWhatsThis(QApplication.translate('ViewManager', |
516 """<b>Close Window</b>""" |
516 """<b>Close Window</b>""" |
517 """<p>Close the current window.</p>""" |
517 """<p>Close the current window.</p>""" |
518 )) |
518 )) |
520 self.fileActions.append(self.closeAct) |
520 self.fileActions.append(self.closeAct) |
521 |
521 |
522 self.closeAllAct = E5Action(QApplication.translate('ViewManager', 'Close All'), |
522 self.closeAllAct = E5Action(QApplication.translate('ViewManager', 'Close All'), |
523 QApplication.translate('ViewManager', 'Clos&e All'), |
523 QApplication.translate('ViewManager', 'Clos&e All'), |
524 0, 0, self.closeActGrp, 'vm_file_close_all') |
524 0, 0, self.closeActGrp, 'vm_file_close_all') |
525 self.closeAllAct.setStatusTip(\ |
525 self.closeAllAct.setStatusTip( |
526 QApplication.translate('ViewManager', 'Close all editor windows')) |
526 QApplication.translate('ViewManager', 'Close all editor windows')) |
527 self.closeAllAct.setWhatsThis(QApplication.translate('ViewManager', |
527 self.closeAllAct.setWhatsThis(QApplication.translate('ViewManager', |
528 """<b>Close All Windows</b>""" |
528 """<b>Close All Windows</b>""" |
529 """<p>Close all editor windows.</p>""" |
529 """<p>Close all editor windows.</p>""" |
530 )) |
530 )) |
536 self.saveActGrp = createActionGroup(self) |
536 self.saveActGrp = createActionGroup(self) |
537 |
537 |
538 self.saveAct = E5Action(QApplication.translate('ViewManager', 'Save'), |
538 self.saveAct = E5Action(QApplication.translate('ViewManager', 'Save'), |
539 UI.PixmapCache.getIcon("fileSave.png"), |
539 UI.PixmapCache.getIcon("fileSave.png"), |
540 QApplication.translate('ViewManager', '&Save'), |
540 QApplication.translate('ViewManager', '&Save'), |
541 QKeySequence(\ |
541 QKeySequence( |
542 QApplication.translate('ViewManager', "Ctrl+S", "File|Save")), |
542 QApplication.translate('ViewManager', "Ctrl+S", "File|Save")), |
543 0, self.saveActGrp, 'vm_file_save') |
543 0, self.saveActGrp, 'vm_file_save') |
544 self.saveAct.setStatusTip(\ |
544 self.saveAct.setStatusTip( |
545 QApplication.translate('ViewManager', 'Save the current file')) |
545 QApplication.translate('ViewManager', 'Save the current file')) |
546 self.saveAct.setWhatsThis(QApplication.translate('ViewManager', |
546 self.saveAct.setWhatsThis(QApplication.translate('ViewManager', |
547 """<b>Save File</b>""" |
547 """<b>Save File</b>""" |
548 """<p>Save the contents of current editor window.</p>""" |
548 """<p>Save the contents of current editor window.</p>""" |
549 )) |
549 )) |
1105 """ the cursor.</p>""" |
1105 """ the cursor.</p>""" |
1106 )) |
1106 )) |
1107 self.autoCompleteFromAPIsAct.triggered[()].connect(self.__editAutoCompleteFromAPIs) |
1107 self.autoCompleteFromAPIsAct.triggered[()].connect(self.__editAutoCompleteFromAPIs) |
1108 self.editActions.append(self.autoCompleteFromAPIsAct) |
1108 self.editActions.append(self.autoCompleteFromAPIsAct) |
1109 |
1109 |
1110 self.autoCompleteFromAllAct = E5Action(\ |
1110 self.autoCompleteFromAllAct = E5Action( |
1111 QApplication.translate('ViewManager', |
1111 QApplication.translate('ViewManager', |
1112 'Autocomplete from Document and APIs'), |
1112 'Autocomplete from Document and APIs'), |
1113 QApplication.translate('ViewManager', |
1113 QApplication.translate('ViewManager', |
1114 'Autocomplete from Document and APIs'), |
1114 'Autocomplete from Document and APIs'), |
1115 QKeySequence(QApplication.translate('ViewManager', "Alt+Shift+Space", |
1115 QKeySequence(QApplication.translate('ViewManager', "Alt+Shift+Space", |
2958 # set the cwd of the dialog based on the following search criteria: |
2958 # set the cwd of the dialog based on the following search criteria: |
2959 # 1: Directory of currently active editor |
2959 # 1: Directory of currently active editor |
2960 # 2: Directory of currently active project |
2960 # 2: Directory of currently active project |
2961 # 3: CWD |
2961 # 3: CWD |
2962 filter = self._getOpenFileFilter() |
2962 filter = self._getOpenFileFilter() |
2963 progs = E5FileDialog.getOpenFileNamesAndFilter(\ |
2963 progs = E5FileDialog.getOpenFileNamesAndFilter( |
2964 self.ui, |
2964 self.ui, |
2965 QApplication.translate('ViewManager', "Open files"), |
2965 QApplication.translate('ViewManager', "Open files"), |
2966 self._getOpenStartDir(), |
2966 self._getOpenStartDir(), |
2967 QScintilla.Lexers.getOpenFileFiltersList(True, True), |
2967 QScintilla.Lexers.getOpenFileFiltersList(True, True), |
2968 filter |
2968 filter |
3597 for rs in self.recent: |
3597 for rs in self.recent: |
3598 if idx < 10: |
3598 if idx < 10: |
3599 formatStr = '&{0:d}. {1}' |
3599 formatStr = '&{0:d}. {1}' |
3600 else: |
3600 else: |
3601 formatStr = '{0:d}. {1}' |
3601 formatStr = '{0:d}. {1}' |
3602 act = self.recentMenu.addAction(\ |
3602 act = self.recentMenu.addAction( |
3603 formatStr.format(idx, |
3603 formatStr.format(idx, |
3604 Utilities.compactPath(rs, self.ui.maxMenuFilePathLen))) |
3604 Utilities.compactPath(rs, self.ui.maxMenuFilePathLen))) |
3605 act.setData(rs) |
3605 act.setData(rs) |
3606 act.setEnabled(QFileInfo(rs).exists()) |
3606 act.setEnabled(QFileInfo(rs).exists()) |
3607 idx += 1 |
3607 idx += 1 |
3608 |
3608 |
3609 self.recentMenu.addSeparator() |
3609 self.recentMenu.addSeparator() |
3610 self.recentMenu.addAction(\ |
3610 self.recentMenu.addAction( |
3611 QApplication.translate('ViewManager', '&Clear'), self.__clearRecent) |
3611 QApplication.translate('ViewManager', '&Clear'), self.__clearRecent) |
3612 |
3612 |
3613 def __openSourceFile(self, act): |
3613 def __openSourceFile(self, act): |
3614 """ |
3614 """ |
3615 Private method to open a file from the list of recently opened files. |
3615 Private method to open a file from the list of recently opened files. |
3631 Private method to set up bookmarked files menu. |
3631 Private method to set up bookmarked files menu. |
3632 """ |
3632 """ |
3633 self.bookmarkedMenu.clear() |
3633 self.bookmarkedMenu.clear() |
3634 |
3634 |
3635 for rp in self.bookmarked: |
3635 for rp in self.bookmarked: |
3636 act = self.bookmarkedMenu.addAction(\ |
3636 act = self.bookmarkedMenu.addAction( |
3637 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)) |
3637 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)) |
3638 act.setData(rp) |
3638 act.setData(rp) |
3639 act.setEnabled(QFileInfo(rp).exists()) |
3639 act.setEnabled(QFileInfo(rp).exists()) |
3640 |
3640 |
3641 if len(self.bookmarked): |
3641 if len(self.bookmarked): |
3642 self.bookmarkedMenu.addSeparator() |
3642 self.bookmarkedMenu.addSeparator() |
3643 self.bookmarkedMenu.addAction(\ |
3643 self.bookmarkedMenu.addAction( |
3644 QApplication.translate('ViewManager', '&Add'), self.__addBookmarked) |
3644 QApplication.translate('ViewManager', '&Add'), self.__addBookmarked) |
3645 self.bookmarkedMenu.addAction(\ |
3645 self.bookmarkedMenu.addAction( |
3646 QApplication.translate('ViewManager', '&Edit...'), self.__editBookmarked) |
3646 QApplication.translate('ViewManager', '&Edit...'), self.__editBookmarked) |
3647 self.bookmarkedMenu.addAction(\ |
3647 self.bookmarkedMenu.addAction( |
3648 QApplication.translate('ViewManager', '&Clear'), self.__clearBookmarked) |
3648 QApplication.translate('ViewManager', '&Clear'), self.__clearBookmarked) |
3649 |
3649 |
3650 def __addBookmarked(self): |
3650 def __addBookmarked(self): |
3651 """ |
3651 """ |
3652 Private method to add the current file to the list of bookmarked files. |
3652 Private method to add the current file to the list of bookmarked files. |
4249 """ |
4249 """ |
4250 Private method to handle the split orientation action. |
4250 Private method to handle the split orientation action. |
4251 """ |
4251 """ |
4252 if checked: |
4252 if checked: |
4253 self.setSplitOrientation(Qt.Horizontal) |
4253 self.setSplitOrientation(Qt.Horizontal) |
4254 self.splitViewAct.setIcon(\ |
4254 self.splitViewAct.setIcon( |
4255 UI.PixmapCache.getIcon("splitHorizontal.png")) |
4255 UI.PixmapCache.getIcon("splitHorizontal.png")) |
4256 self.splitRemoveAct.setIcon(\ |
4256 self.splitRemoveAct.setIcon( |
4257 UI.PixmapCache.getIcon("remsplitHorizontal.png")) |
4257 UI.PixmapCache.getIcon("remsplitHorizontal.png")) |
4258 else: |
4258 else: |
4259 self.setSplitOrientation(Qt.Vertical) |
4259 self.setSplitOrientation(Qt.Vertical) |
4260 self.splitViewAct.setIcon(\ |
4260 self.splitViewAct.setIcon( |
4261 UI.PixmapCache.getIcon("splitVertical.png")) |
4261 UI.PixmapCache.getIcon("splitVertical.png")) |
4262 self.splitRemoveAct.setIcon(\ |
4262 self.splitRemoveAct.setIcon( |
4263 UI.PixmapCache.getIcon("remsplitVertical.png")) |
4263 UI.PixmapCache.getIcon("remsplitVertical.png")) |
4264 |
4264 |
4265 ################################################################## |
4265 ################################################################## |
4266 ## Below are the action methods for the macro menu |
4266 ## Below are the action methods for the macro menu |
4267 ################################################################## |
4267 ################################################################## |