本文整理汇总了Python中properties.Properties.convert方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.convert方法的具体用法?Python Properties.convert怎么用?Python Properties.convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类properties.Properties
的用法示例。
在下文中一共展示了Properties.convert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UIParser
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import convert [as 别名]
#.........这里部分代码省略.........
if background:
item.setBackground(background)
if foreground:
item.setForeground(foreground)
elif isinstance(w, QtGui.QTreeWidget):
if self.itemstack:
parent, _ = self.itemstack[-1]
_, nr_in_root = self.itemstack[0]
else:
parent = w
nr_in_root = self.item_nr
item = self.factory.createQObject("QTreeWidgetItem",
"item_%d" % len(self.itemstack), (parent, ), False)
if self.item_nr == 0 and not self.itemstack:
self.sorting_enabled = self.factory.invoke("__sortingEnabled", w.isSortingEnabled)
w.setSortingEnabled(False)
self.itemstack.append((item, self.item_nr))
self.item_nr = 0
# We have to access the item via the tree when setting the
# text.
titm = w.topLevelItem(nr_in_root)
for child, nr_in_parent in self.itemstack[1:]:
titm = titm.child(nr_in_parent)
column = -1
for prop in elem.findall("property"):
c_prop = self.wprops.convert(prop)
c_prop_name = prop.attrib["name"]
if c_prop_name == "text":
column += 1
if c_prop:
titm.setText(column, c_prop)
elif c_prop_name == "icon":
item.setIcon(column, c_prop)
elif c_prop_name == "flags":
item.setFlags(c_prop)
elif c_prop_name == "checkState":
item.setCheckState(column, c_prop)
elif c_prop_name == "background":
item.setBackground(column, c_prop)
elif c_prop_name == "foreground":
item.setForeground(column, c_prop)
self.traverseWidgetTree(elem)
_, self.item_nr = self.itemstack.pop()
elif isinstance(w, QtGui.QTableWidget):
text = self.wprops.getProperty(elem, "text")
item = self.factory.createQObject("QTableWidgetItem", "item",
(), False)
if self.item_nr == 0:
self.sorting_enabled = self.factory.invoke("__sortingEnabled", w.isSortingEnabled)
w.setSortingEnabled(False)
row = int(elem.attrib["row"])
col = int(elem.attrib["column"])