def __evt_contextmenu(self, point): """ show the right menu """ item = self.pluginList.currentItem() if item: menu = QMenu(self) if item.text(4) == "True": action = QAction(QApplication.translate("PluginInfoDialog", "DeActive"),self,\ triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, False)) #core plugin not allowed disabled action.setEnabled(not PluginAdapter.new().getPluginByName( item.text(0)).packageName == "__core__") else: action = QAction(QApplication.translate("PluginInfoDialog", "Active"),self,\ triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, True)) menu.addAction(action) menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self, point)))
def __evt_contextmenu(self,point): """ show the right menu """ item = self.pluginList.currentItem() if item: menu = QMenu(self) if item.text(4)=="True": action = QAction(QApplication.translate("PluginInfoDialog", "DeActive"),self,\ triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, False)) #core plugin not allowed disabled action.setEnabled(not PluginAdapter.new().getPluginByName(item.text(0)).packageName == "__core__") else: action = QAction(QApplication.translate("PluginInfoDialog", "Active"),self,\ triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, True)) menu.addAction(action) menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self,point)))
def __evt_showContextMenu(self, point): _tabbar = self.tabBar() for index in range(_tabbar.count()): rect = _tabbar.tabRect(index) if rect.contains(point): menu = QMenu(self) action = QAction( "close", self, triggered=lambda: self.__evt_close_tab_click(index)) action.setEnabled(self.count() > 1 and index is not 0) menu.addAction(action) action = QAction( "close others", self, triggered=lambda: self.__evt_contextMenuCloseOthers(index)) action.setEnabled(self.count() > 1) menu.addAction(action) action = QAction( "close all", self, triggered=lambda: self.__evt_contextMenuCloseOthers(0)) action.setEnabled(self.count() > 1) menu.addAction(action) menu.exec_(self.mapToGlobal(point))
def __evt_showContextMenu(self,point): _tabbar = self.tabBar() for index in range(_tabbar.count()): rect = _tabbar.tabRect(index) if rect.contains(point): menu = QMenu(self) action = QAction("close",self,triggered=lambda:self.__evt_close_tab_click(index)) action.setEnabled(self.count()>1 and index is not 0) menu.addAction(action) action = QAction("close others",self,triggered=lambda:self.__evt_contextMenuCloseOthers(index)) action.setEnabled(self.count()>1) menu.addAction(action) action = QAction("close all",self,triggered=lambda:self.__evt_contextMenuCloseOthers(0)) action.setEnabled(self.count()>1) menu.addAction(action) menu.exec_(self.mapToGlobal(point))