9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import * |
12 from PyQt4.QtCore import * |
13 from PyQt4.QtGui import * |
13 from PyQt4.QtGui import * |
14 |
|
15 from E5Gui.E5Application import e5App |
|
16 |
14 |
17 from ViewManager.ViewManager import ViewManager |
15 from ViewManager.ViewManager import ViewManager |
18 |
16 |
19 import QScintilla.Editor |
17 import QScintilla.Editor |
20 from QScintilla.Editor import Editor |
18 from QScintilla.Editor import Editor |
203 self.trUtf8('Save'), self.__contextMenuSave) |
201 self.trUtf8('Save'), self.__contextMenuSave) |
204 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveAs.png"), |
202 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveAs.png"), |
205 self.trUtf8('Save As...'), self.__contextMenuSaveAs) |
203 self.trUtf8('Save As...'), self.__contextMenuSaveAs) |
206 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveAll.png"), |
204 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveAll.png"), |
207 self.trUtf8('Save All'), self.__contextMenuSaveAll) |
205 self.trUtf8('Save All'), self.__contextMenuSaveAll) |
208 self.projectMenuAct = \ |
|
209 self.__menu.addAction(UI.PixmapCache.getIcon("fileSaveProject.png"), |
|
210 self.trUtf8('Save to Project'), self.__contextMenuSaveToProject) |
|
211 self.__menu.addSeparator() |
206 self.__menu.addSeparator() |
212 self.__menu.addAction(UI.PixmapCache.getIcon("print.png"), |
207 self.__menu.addAction(UI.PixmapCache.getIcon("print.png"), |
213 self.trUtf8('Print'), self.__contextMenuPrintFile) |
208 self.trUtf8('Print'), self.__contextMenuPrintFile) |
214 |
209 |
215 def __showMenu(self, point): |
210 def __showMenu(self, point): |
221 if itm is not None: |
216 if itm is not None: |
222 row = self.viewlist.row(itm) |
217 row = self.viewlist.row(itm) |
223 self.contextMenuEditor = self.editors[row] |
218 self.contextMenuEditor = self.editors[row] |
224 if self.contextMenuEditor: |
219 if self.contextMenuEditor: |
225 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified()) |
220 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified()) |
226 self.projectMenuAct.setEnabled(e5App().getObject("Project").isOpen()) |
|
227 self.__menu.popup(self.viewlist.mapToGlobal(point)) |
221 self.__menu.popup(self.viewlist.mapToGlobal(point)) |
228 |
222 |
229 def canCascade(self): |
223 def canCascade(self): |
230 """ |
224 """ |
231 Public method to signal if cascading of managed windows is available. |
225 Public method to signal if cascading of managed windows is available. |
596 def __contextMenuSaveAll(self): |
590 def __contextMenuSaveAll(self): |
597 """ |
591 """ |
598 Private method to save all tabs. |
592 Private method to save all tabs. |
599 """ |
593 """ |
600 self.saveEditorsList(self.editors) |
594 self.saveEditorsList(self.editors) |
601 |
|
602 def __contextMenuSaveToProject(self): |
|
603 """ |
|
604 Private method to save the selected tab to the current project. |
|
605 """ |
|
606 if self.contextMenuEditor: |
|
607 self.saveEditorToProjectEd(self.contextMenuEditor) |
|
608 |
595 |
609 def __contextMenuPrintFile(self): |
596 def __contextMenuPrintFile(self): |
610 """ |
597 """ |
611 Private method to print the selected tab. |
598 Private method to print the selected tab. |
612 """ |
599 """ |