#!/usr/bin/python3
import sys
from PyQt5.QtWidgets import QApplication
from nixview.ui.mainwindow import NixView
import argparse

def main():
    parser = argparse.ArgumentParser(description="NixView. Viewer for NIX data files. For more on nix see https://nixio.readthedocs.io/en/master")
    parser.add_argument("file", nargs="?", default="", type=str, help="The nix file that should be opened.")
    args = parser.parse_args()
    app = QApplication(sys.argv)
    window = NixView()
    window.setMinimumWidth(800)
    window.setMinimumHeight(600)
    if len(args.file.strip()) > 0:
        window.open_file(args.file)
    window.show()
    sys.exit(app.exec_())

if __name__ == "__main__":
    main()
