def showMenu(self,pos): # mode work = self.ui.work_radioButton.isChecked() publish = self.ui.publish_radioButton.isChecked() sourceFile = self.ui.source_radioButton.isChecked() selItem = str(self.ui.work_listWidget.currentItem().text()) if not '==' in selItem : if publish : if self.ui.work_listWidget.currentItem() : menu=QtGui.QMenu(self) # menu.addAction('Rename') # menu.addAction('Delete') subMenu = QtGui.QMenu('Open', self) subMenu.addAction('Open') subMenu.addAction('Open as work file') subMenu2 = QtGui.QMenu('Import', self) subMenu2.addAction('Import') subMenu2.addAction('Import to new file') subMenu3 = QtGui.QMenu('Reference', self) subMenu3.addAction('Reference') subMenu3.addAction('Reference to new file') # items = self.getPlayblastFile() # for each in items : # subMenu3.addAction(each) menu.addMenu(subMenu) menu.addMenu(subMenu2) menu.addMenu(subMenu3) menu.popup(self.ui.work_listWidget.mapToGlobal(pos)) result = menu.exec_(self.ui.work_listWidget.mapToGlobal(pos)) if result : self.menuCommand(result.text(), result.parentWidget().title())
def showMenu2(self, pos) : path = str(self.ui.path_lineEdit.text()) if path : if not os.path.exists(path) : menu = QtGui.QMenu(self) menu.addAction('Create work dir') menu.popup(self.ui.status_label.mapToGlobal(pos)) result = menu.exec_(self.ui.status_label.mapToGlobal(pos)) if result.text() == 'Create work dir' : os.makedirs(path) self.setLabel(True)