def __showContextMenu(self, pos): tree = self.__view index = tree.indexAt(pos) if not index: return # TODO: Folder context menu? typ = index.data(TYPE_ROLE) if typ != JOB_TYPE: return jobs = self.selectedJobs() if not jobs: return job = index.data(OBJECT_ROLE) if jobs[0] is not job: try: jobs.remove(job) except ValueError: pass jobs.insert(0, job) menu = JobContextMenu(jobs, partial(self.queueRefresh, True), tree) menu.popup(tree.mapToGlobal(pos))
def __showContextMenu(self, pos): tree = self.__tree item = tree.itemAt(pos) if not item: return jobs = self.selectedJobs() menu = JobContextMenu(jobs, parent=tree) menu.popup(tree.mapToGlobal(pos))