diff --git a/main.py b/main.py old mode 100644 new mode 100755 index 0c4b88a..d6cf14b --- a/main.py +++ b/main.py @@ -8,5 +8,36 @@ # Distributed under terms of the MIT license. # +import PyQt5.QtGui as qtg +import PyQt5.QtWidgets as qtw +import sys +class BadWitch: + def __init__(self, Argv): + # Initialize UI + self.app = qtw.QApplication(Argv) + self.main_window = qtw.QMainWindow() + # Initialize a UI helper + self.ui = Ui_MainHelper() + # Build the application + self.ui.create_actions(self.app, self.main_window) + self.ui.create_menus(self.app, self.main_window) + self.ui.build_mainwindow(self.app, self.main_window) + def show_application(self): + self.main_window.show() + self.app.exec_() + +class Ui_MainHelper: + def create_actions(self, App, MainWindow): + self.action_exit = qtw.QAction(qtg.QIcon.fromTheme("application-exit"), "Quit") + self.action_exit.triggered.connect(App.closeAllWindows) + def create_menus(self, App, MainWindow): + self.menu_file = qtw.QMenu("File") + def build_mainwindow(self, App, MainWindow): + self.menu_file.addAction(self.action_exit) + MainWindow.menuBar().addMenu(self.menu_file) + +if __name__ == "__main__": + bw = BadWitch(sys.argv) + bw.show_application()