def __init__(self, parent=None): Dialog.__init__(self, parent) self.ui = Ui_ContextMenu() self.ui.setupUi(self) # no window border pls self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint) self._dynamic_widgets = [] self._ui_visible = True
def accept(self): """ closes the menu object. This may be called several times and will do the right thing (e.g. if the actual UI object has been destroyed, it will just do nothing """ if self._ui_visible: Dialog.accept(self) self._ui_visible = False