view.setWindowIcon(
        QIcon(
            os.path.join(
                os.path.dirname(__file__),
                "../../../data/icons/scalable/apps/softwarecenter.svg")))
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)

    # if running locally, fixup softwarecenter.paths
    mangle_paths_if_running_in_local_checkout()

    # ideally this should be part of the qml by using a qmlRegisterType()
    # but that does not seem to be supported in pyqt yet(?) so we need
    # to cowboy it in here
    pkglistmodel = PkgListModel()
    reviewslistmodel = ReviewsListModel()
    categoriesmodel = CategoriesModel()
    rc = view.rootContext()
    rc.setContextProperty('pkglistmodel', pkglistmodel)
    rc.setContextProperty('reviewslistmodel', reviewslistmodel)
    rc.setContextProperty('categoriesmodel', categoriesmodel)

    # debug
    if len(sys.argv) > 1:
        # FIXME: we really should set the text entry here
        pkglistmodel.setSearchQuery(sys.argv[1])

    # load the main QML file into the view
    qmlpath = os.path.join(os.path.dirname(__file__), "sc.qml")
    view.setSource(QUrl.fromLocalFile(qmlpath))

    # show it