Exemple #1
0
def main():
    check_dependencies()
    try:
        init_translations()
        # Support for command line options.
        parser = optparse.OptionParser(version='%prog ' + avernus.__version__)
        parser.add_option("-d", "--debug", action="store_true", dest="debug", help=_("enable debug output"))
        parser.add_option("-f", "--file", dest="datafile", help="set database file")
        (options, args) = parser.parse_args()
        init_logger(options.debug)
        init_icons()
        db_file = options.datafile
        if db_file == None:
            configs = config.avernusConfig()
            default_file = os.path.join(config.config_path, 'avernus.db')
            db_file = configs.get_option('database file', default=default_file)

        from avernus.objects import db
        db.set_db(db_file)
        db.connect(True)

        GObject.threads_init()

        from avernus.gui.mainwindow import MainWindow
        main_window = MainWindow()
        try:
            Gtk.main()
        except:
            main_window.on_destroy()
            raise
    except:
        print "crashed ... !!"
        import traceback
        traceback.print_exc()
        db.close_session()
        threads.terminate_all()
        exit(1)
Exemple #2
0
 def setUp(self):
     db.set_db(dbfile)
     db.connect()
     objects.session.commit()
     GObject.threads_init()
Exemple #3
0
                return res
        return None


if __name__ == "__main__":
    import sys
    sys.path.append("../../")
    import __builtin__
    __builtin__._ = str
    from avernus import objects
    from avernus.objects import db
    from avernus.controller import datasource_controller as dsm

    dbfile = ":memory:"
    db.set_db(dbfile)
    db.connect()

    test_asset = 'FR0010959676'

    y = DataSource()
    for res in y.search(test_asset):
        item, source, source_info = res
        dsm._item_found_callback(item, source, source_info)

    asset = objects.asset.get_asset_for_searchstring(test_asset)[0]
    for foo in dsm.update_assets([asset]):
        pass

    for asset in objects.asset.get_all_assets():
        for foo in dsm.update_historical_prices_asset(asset, threaded=False):
            for bar in foo:
 def setUp(self):
     db.set_db(dbfile)
     db.connect()
     objects.session.commit()