Esempio n. 1
0
def main(*args):
    try:
        parser = argparse.ArgumentParser()
        parser.add_argument('--debug',
                            help="Running in debug mode",
                            action="store_true")
        parsed = parser.parse_args()

        config = IMConfig(sys.platform)
        setup_logger(config, parsed.debug)
        log = logging.getLogger(__name__)
        lock_filename = "islands_lock"
        lock_filepath = os.path.join(tempfile.gettempdir(), lock_filename)
        lock = fasteners.InterProcessLock(lock_filepath)
        gotten = lock.acquire(blocking=False)
        if gotten:
            application = Application(config)
            application.run()
        else:
            log.info(
                "Another instance of Island Manager is already running. Exiting..."
            )
            sys.exit(0)
    except Exception as e:
        msg = "Application has crashed: %s" % str(e)
        print(msg)
        log = logging.getLogger(__name__)
        log.error(msg)
        sys.exit(1)
Esempio n. 2
0
from lib.application import Application

from PyQt5.QtWidgets import QApplication

if __name__ == '__main__':

    # to be able to close the app from terminal with
    # ctr+c we have to do the following:
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    # ------------------------------------------

    gui = 'demo.qml'
    app = Application(gui)
    app.run()
Esempio n. 3
0
if __name__ == '__main__':
    import sys
    import os.path

    from lib.application import Application

    from PyQt5.QtWidgets import QApplication

    # to be able to close the app from terminal with
    # ctr+c we have to do the following:
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    # ------------------------------------------

    def usage():
        """
        Prints how to use this script.
        """
        print('Can be supplied with a path to some QML script containing a GUI definition.')

    gui = sys.argv[1] if (len(sys.argv) == 2 and os.path.isfile(sys.argv[1])) else 'main.qml'
    app = Application(gui)
    app.run()