def _add_menu_item(self, name, parent_menu, callback, properties=None): action = QtWidgets.QAction(name, parent_menu) parent_menu.addAction(action) action.triggered.connect(callback) if properties: if "tooltip" in properties: action.setTooltip(properties["tooltip"]) action.setStatustip(properties["tooltip"]) if "enable_callback" in properties: action.setEnabled(properties["enable_callback"]()) return action
def _add_divider(self, parent_menu): divider = QtWidgets.QAction(parent_menu) divider.setSeparator(True) parent_menu.addAction(divider) return divider