239 |
239 |
240 def __initMenu(self): |
240 def __initMenu(self): |
241 """ |
241 """ |
242 Private method to initialize the tab context menu. |
242 Private method to initialize the tab context menu. |
243 """ |
243 """ |
|
244 self.__startMenu = QMenu(self.tr("Start"), self) |
|
245 self.__startMenu.addAction( |
|
246 UI.PixmapCache.getIcon("runScript"), |
|
247 self.tr('Run Script...'), |
|
248 self.__contextMenuRunScript) |
|
249 self.__startMenu.addAction( |
|
250 UI.PixmapCache.getIcon("debugScript"), |
|
251 self.tr('Debug Script...'), |
|
252 self.__contextMenuDebugScript) |
|
253 self.__startMenu.addAction( |
|
254 UI.PixmapCache.getIcon("profileScript"), |
|
255 self.tr('Profile Script...'), |
|
256 self.__contextMenuProfileScript) |
|
257 self.__startMenu.addAction( |
|
258 UI.PixmapCache.getIcon("coverageScript"), |
|
259 self.tr('Coverage run of Script...'), |
|
260 self.__contextMenuCoverageScript) |
|
261 |
244 self.__menu = QMenu(self) |
262 self.__menu = QMenu(self) |
245 self.leftMenuAct = self.__menu.addAction( |
263 self.leftMenuAct = self.__menu.addAction( |
246 UI.PixmapCache.getIcon("1leftarrow"), |
264 UI.PixmapCache.getIcon("1leftarrow"), |
247 self.tr('Move Left'), self.__contextMenuMoveLeft) |
265 self.tr('Move Left'), self.__contextMenuMoveLeft) |
248 self.rightMenuAct = self.__menu.addAction( |
266 self.rightMenuAct = self.__menu.addAction( |
276 self.__menu.addSeparator() |
294 self.__menu.addSeparator() |
277 self.openRejectionsMenuAct = self.__menu.addAction( |
295 self.openRejectionsMenuAct = self.__menu.addAction( |
278 self.tr("Open 'rejection' file"), |
296 self.tr("Open 'rejection' file"), |
279 self.__contextMenuOpenRejections) |
297 self.__contextMenuOpenRejections) |
280 self.__menu.addSeparator() |
298 self.__menu.addSeparator() |
|
299 self.__startAct = self.__menu.addMenu(self.__startMenu) |
|
300 self.__menu.addSeparator() |
281 self.__menu.addAction( |
301 self.__menu.addAction( |
282 UI.PixmapCache.getIcon("printPreview"), |
302 UI.PixmapCache.getIcon("printPreview"), |
283 self.tr("Print Preview"), self.__contextMenuPrintPreviewFile) |
303 self.tr("Print Preview"), self.__contextMenuPrintPreviewFile) |
284 self.__menu.addAction( |
304 self.__menu.addAction( |
285 UI.PixmapCache.getIcon("print"), |
305 UI.PixmapCache.getIcon("print"), |
309 self.copyPathAct.setEnabled(bool(fileName)) |
329 self.copyPathAct.setEnabled(bool(fileName)) |
310 if fileName: |
330 if fileName: |
311 rej = "{0}.rej".format(fileName) |
331 rej = "{0}.rej".format(fileName) |
312 self.openRejectionsMenuAct.setEnabled( |
332 self.openRejectionsMenuAct.setEnabled( |
313 os.path.exists(rej)) |
333 os.path.exists(rej)) |
|
334 |
|
335 ext = os.path.splitext(fileName)[1] |
|
336 self.__startAct.setEnabled( |
|
337 ext in Preferences.getDebugger( |
|
338 "Python3Extensions").split() |
|
339 ) |
314 else: |
340 else: |
315 self.openRejectionsMenuAct.setEnabled(False) |
341 self.openRejectionsMenuAct.setEnabled(False) |
|
342 self.__startAct.setEnabled(False) |
316 |
343 |
317 self.contextMenuIndex = index |
344 self.contextMenuIndex = index |
318 self.leftMenuAct.setEnabled(index > 0) |
345 self.leftMenuAct.setEnabled(index > 0) |
319 self.rightMenuAct.setEnabled(index < self.count() - 1) |
346 self.rightMenuAct.setEnabled(index < self.count() - 1) |
320 self.firstMenuAct.setEnabled(index > 0) |
347 self.firstMenuAct.setEnabled(index > 0) |
712 def __contextMenuMoveLast(self): |
739 def __contextMenuMoveLast(self): |
713 """ |
740 """ |
714 Private method to move a tab to the last position. |
741 Private method to move a tab to the last position. |
715 """ |
742 """ |
716 self.moveTab(self.contextMenuIndex, self.count() - 1) |
743 self.moveTab(self.contextMenuIndex, self.count() - 1) |
|
744 |
|
745 def __contextMenuRunScript(self): |
|
746 """ |
|
747 Private method to run the editor script. |
|
748 """ |
|
749 if self.contextMenuEditor: |
|
750 fn = self.contextMenuEditor.getFileName() |
|
751 if fn: |
|
752 ericApp().getObject("DebugUI").doRun(False, script=fn) |
|
753 |
|
754 def __contextMenuDebugScript(self): |
|
755 """ |
|
756 Private method to debug the editor script. |
|
757 """ |
|
758 if self.contextMenuEditor: |
|
759 fn = self.contextMenuEditor.getFileName() |
|
760 if fn: |
|
761 ericApp().getObject("DebugUI").doDebug(False, script=fn) |
|
762 |
|
763 def __contextMenuProfileScript(self): |
|
764 """ |
|
765 Private method to profile the editor script. |
|
766 """ |
|
767 if self.contextMenuEditor: |
|
768 fn = self.contextMenuEditor.getFileName() |
|
769 if fn: |
|
770 ericApp().getObject("DebugUI").doProfile(False, script=fn) |
|
771 |
|
772 def __contextMenuCoverageScript(self): |
|
773 """ |
|
774 Private method to run a coverage test of the editor script. |
|
775 """ |
|
776 if self.contextMenuEditor: |
|
777 fn = self.contextMenuEditor.getFileName() |
|
778 if fn: |
|
779 ericApp().getObject("DebugUI").doCoverage(False, script=fn) |
717 |
780 |
718 def __closeButtonClicked(self): |
781 def __closeButtonClicked(self): |
719 """ |
782 """ |
720 Private method to handle the press of the close button. |
783 Private method to handle the press of the close button. |
721 """ |
784 """ |