def __init__(self, parent=None):
if (issubclass(parent.__class__, QtWidgets.QMainWindow)<EOL>):  <EOL><INDENT>self.menu = parent.menuBar().addMenu(self.title)<EOL><DEDENT>elif (parent is None):  <EOL><INDENT>self.menu = QtWidgets.QMenu()<EOL><DEDENT>else:  <EOL><INDENT>assert(issubclass(parent.__class__, QtWidgets.QMenu))<EOL>self.menu = parent.addMenu(self.title)<EOL><DEDENT>for element in self.elements:<EOL><INDENT>if (isinstance(element, QuickMenuElement)):<EOL><INDENT>if (element.method_name is None):<EOL><INDENT>method_name = element.getTitle().lower().replace(<EOL>"<STR_LIT:U+0020>", "<STR_LIT:_>").strip()  <EOL><DEDENT>else:<EOL><INDENT>method_name = element.method_name<EOL><DEDENT>setattr(<EOL>self,<EOL>method_name,<EOL>self.menu.addAction(<EOL>element.getTitle()))<EOL>method = getattr(self, method_name)<EOL>"""<STR_LIT>"""<EOL><DEDENT>elif (isinstance(element, QuickMenuSection)):<EOL><INDENT>self.menu.addSection(element.title)<EOL><DEDENT>elif (issubclass(element, QuickMenu)):<EOL><INDENT>submenu = element(parent=self.menu)<EOL>submenu_title = element.title.lower().replace(<EOL>"<STR_LIT:U+0020>", "<STR_LIT:_>").strip()  <EOL>setattr(self, submenu_title, submenu)<EOL><DEDENT>else:  <EOL><INDENT>raise(<EOL>AssertionError("<STR_LIT>"))<EOL><DEDENT><DEDENT>
:param parent:  Where this menu will be placed