Beispiel #1
0
def launch():
    # Automatically compile all ui files if they have been changed.
    compile_and_import_ui_files()

    # Launch and open the window.
    app = QApplication(sys.argv)
    window = Window()

    # Show and bring window to foreground.
    window.show()
    app.installEventFilter(window)
    window.raise_()
    os._exit(app.exec_())
Beispiel #2
0
        Constructor for the mouse handler. Acts on the main window, which is passed in as a parameter. The main window
        contains the right widget, which is the widget affected by clicks.
        :param main_window: window containing the right widget
        """
        super(MouseDetector, self).__init__()
        self.window = main_window

    def eventFilter(self, obj, event):
        """
        General event handler. Used to add functionality to the click event to update the right pane.
        :param obj: Object being clicked
        :param event: Event Type
        :return: the event handler from the parent class
        """
        if event.type() == QtCore.QEvent.MouseButtonRelease:
            self.window.update_right_widget()
        return super(MouseDetector, self).eventFilter(obj, event)


if __name__ == "__main__":
    # Creates the app and the window containing the app
    app = QApplication(sys.argv)
    window = MainWindow(app)

    # Sets up the mouse handler
    mouseFilter = MouseDetector(window)
    app.installEventFilter(mouseFilter)

    window.show()
    sys.exit(app.exec_())