Esempio n. 1
0
def viewhdf(filepaths):
    app = QtGui.QApplication(filepaths)

    # These imports must be done after the QApplication has been instantiated
    with warnings.catch_warnings():
        # ignore deprecation warnings just for this import
        warnings.filterwarnings("ignore", category=DeprecationWarning)
        from vitables.vtapp import VTApp

    from vitables.preferences import vtconfig

    # Specify the organization's Internet domain. When the Internet
    # domain is set, it is used on Mac OS X instead of the organization
    # name, since Mac OS X applications conventionally use Internet
    # domains to identify themselves
    app.setOrganizationDomain('vitables.org')
    app.setOrganizationName('ViTables')
    app.setApplicationName('ViTables')
    app.setApplicationVersion(vtconfig.getVersion())

    # Localize the application using the system locale
    # numpy seems to have problems with decimal separator in some locales
    # (catalan, german...) so C locale is always used for numbers.
    locale.setlocale(locale.LC_ALL, '')
    locale.setlocale(locale.LC_NUMERIC, 'C')

    # Start the application
    vtapp = VTApp(mode='a', h5files=filepaths)
    vtapp.show()
    app.exec_()
Esempio n. 2
0
def viewhdf(filepaths):
    app = QtWidgets.QApplication(filepaths)

    # These imports must be done after the QApplication has been instantiated
    with warnings.catch_warnings():
        # ignore deprecation warnings just for this import
        warnings.filterwarnings("ignore", category=DeprecationWarning)
        from vitables.vtapp import VTApp

    from vitables.preferences import vtconfig

    # Specify the organization's Internet domain. When the Internet
    # domain is set, it is used on Mac OS X instead of the organization
    # name, since Mac OS X applications conventionally use Internet
    # domains to identify themselves
    app.setOrganizationDomain('vitables.org')
    app.setOrganizationName('ViTables')
    app.setApplicationName('ViTables')
    app.setApplicationVersion(vtconfig.getVersion())

    # Localize the application using the system locale
    # numpy seems to have problems with decimal separator in some locales
    # (catalan, german...) so C locale is always used for numbers.
    locale.setlocale(locale.LC_ALL, '')
    locale.setlocale(locale.LC_NUMERIC, 'C')

    # Start the application
    vtapp = VTApp(mode='a', h5files=filepaths)
    vtapp.gui.show()
    app.exec_()
Esempio n. 3
0
 def setup_class(cls):
     """Create app and store shortcuts to the application objects."""
     cls.app = QtWidgets.QApplication(sys.argv)
     cls.vtapp = VTApp(keep_splash=False)
     cls.vtgui = cls.vtapp.gui
     cls.model = cls.vtgui.dbs_tree_model
     cls.view = cls.vtgui.dbs_tree_view
Esempio n. 4
0
def globalSetup():
    global QTAPP, VTAPP, VTApp

    # Avoid <QApplication: There should be max one application object> errors:
    # if an instance of QApplication already exists then use a pointer to it
    try:
        qt.qApp.argv()
        QTAPP = qt.qApp
    except RuntimeError:
        QTAPP = qt.QApplication(sys.argv)
    from vitables.vtapp import VTApp
    VTAPP = VTApp(keep_splash=False)
    QTAPP.setMainWidget(VTAPP.gui)
Esempio n. 5
0
def gui():
    """The application launcher.

    First of all, translators are loaded. Then the GUI is shown and
    the events loop is started.

    """
    _check_versions()
    app = QtWidgets.QApplication(sys.argv)
    _set_credentials(app)
    translator = _set_locale(app)  # must not be destroyed before app quits
    args = _parse_command_line()
    logger, console_log_handler = _setup_logger(args)
    vtapp = VTApp(mode=args.mode, dblist=args.dblist, h5files=args.h5file)
    vtapp.gui.show()
    logger.removeHandler(console_log_handler)
    app.exec_()
Esempio n. 6
0
def main(args):
    """The application launcher.

    First of all, translators are loaded. Then the GUI is shown and the events
    loop is started.
    """

    app = QtGui.QApplication(args)
    # These imports must be done after the QApplication has been instantiated
    from vitables.vtapp import VTApp
    from vitables.preferences import vtconfig

    # Specify the organization's Internet domain. When the Internet
    # domain is set, it is used on Mac OS X instead of the organization
    # name, since Mac OS X applications conventionally use Internet
    # domains to identify themselves
    app.setOrganizationDomain('vitables.org')
    app.setOrganizationName('ViTables')
    app.setApplicationName('ViTables')
    app.setApplicationVersion(vtconfig.getVersion())
    config = vtconfig.Config()

    # Localize the application using the system locale
    # numpy seems to have problems with decimal separator in some locales
    # (catalan, german...) so C locale is always used for numbers.
    locale.setlocale(locale.LC_ALL, '')
    locale.setlocale(locale.LC_NUMERIC, 'C')
    language = locale.getlocale()[0]
    # Future translations (if any) will use resource files
    # vt_translator = QTranslator()
    # vt_translator.load('vitables_%s' % language, config.translations_dir)
    # qt_translator = QTranslator()
    # qt_translator.load('qt_%s' % language, config.translations_dir)
    # app.installTranslator(vt_translator)
    # app.installTranslator(qt_translator)

    # Parse the command line
    parser = OptionParser(prog='vitables',
                          version=vtconfig.getVersion(),
                          usage='''%prog [options] [h5file]''')
    parser.add_option('-m',
                      '--mode',
                      dest='mode',
                      choices=['r', 'a'],
                      help='mode access for a database',
                      metavar='MODE')
    parser.add_option('-d',
                      '--dblist',
                      dest='dblist',
                      help='a file with the list of databases to be open',
                      metavar='h5list')
    parser.set_defaults(mode='a', dblist='')
    (options, h5files) = parser.parse_args()
    if options.dblist:
        # Other options and positional arguments are silently ignored
        options.mode = ''
        h5files = []

    # Start the application
    del config
    vtapp = VTApp(mode=options.mode, dblist=options.dblist, h5files=h5files)
    vtapp.gui.show()
    app.exec_()