297 @type QPoint |
297 @type QPoint |
298 @param index index of the tab the menu is requested for |
298 @param index index of the tab the menu is requested for |
299 @type int |
299 @type int |
300 """ |
300 """ |
301 if self.editors: |
301 if self.editors: |
302 self.contextMenuEditor = self.widget(index).getEditor() |
302 widget = self.widget(index) |
303 if self.contextMenuEditor: |
303 if widget is not None: |
304 self.saveMenuAct.setEnabled( |
304 self.contextMenuEditor = widget.getEditor() |
305 self.contextMenuEditor.isModified()) |
305 if self.contextMenuEditor: |
306 fileName = self.contextMenuEditor.getFileName() |
306 self.saveMenuAct.setEnabled( |
307 self.copyPathAct.setEnabled(bool(fileName)) |
307 self.contextMenuEditor.isModified()) |
308 if fileName: |
308 fileName = self.contextMenuEditor.getFileName() |
309 rej = "{0}.rej".format(fileName) |
309 self.copyPathAct.setEnabled(bool(fileName)) |
310 self.openRejectionsMenuAct.setEnabled(os.path.exists(rej)) |
310 if fileName: |
311 else: |
311 rej = "{0}.rej".format(fileName) |
312 self.openRejectionsMenuAct.setEnabled(False) |
312 self.openRejectionsMenuAct.setEnabled( |
313 |
313 os.path.exists(rej)) |
314 self.contextMenuIndex = index |
314 else: |
315 self.leftMenuAct.setEnabled(index > 0) |
315 self.openRejectionsMenuAct.setEnabled(False) |
316 self.rightMenuAct.setEnabled(index < self.count() - 1) |
316 |
317 self.firstMenuAct.setEnabled(index > 0) |
317 self.contextMenuIndex = index |
318 self.lastMenuAct.setEnabled(index < self.count() - 1) |
318 self.leftMenuAct.setEnabled(index > 0) |
319 |
319 self.rightMenuAct.setEnabled(index < self.count() - 1) |
320 self.closeOthersMenuAct.setEnabled(self.count() > 1) |
320 self.firstMenuAct.setEnabled(index > 0) |
321 |
321 self.lastMenuAct.setEnabled(index < self.count() - 1) |
322 coord = self.mapToGlobal(coord) |
322 |
323 self.__menu.popup(coord) |
323 self.closeOthersMenuAct.setEnabled(self.count() > 1) |
|
324 |
|
325 coord = self.mapToGlobal(coord) |
|
326 self.__menu.popup(coord) |
324 |
327 |
325 def __showNavigationMenu(self): |
328 def __showNavigationMenu(self): |
326 """ |
329 """ |
327 Private slot to show the navigation button menu. |
330 Private slot to show the navigation button menu. |
328 """ |
331 """ |