本文整理汇总了Python中PyQt4.QtDeclarative.QDeclarativeView.tr方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.tr方法的具体用法?Python QDeclarativeView.tr怎么用?Python QDeclarativeView.tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.tr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QApplication
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import tr [as 别名]
from pkglist import PkgListModel
from reviewslist import ReviewsListModel
from categoriesmodel import CategoriesModel
from softwarecenter.utils import mangle_paths_if_running_in_local_checkout
if __name__ == '__main__':
app = QApplication(sys.argv)
# TODO do this async
app.cache = get_pkg_info()
app.cache.open()
view = QDeclarativeView()
view.setWindowTitle(view.tr("Ubuntu Software Center"))
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)