def __init__(self, registry): super(SectionView, self).__init__() self.add_column(name="Name", edit_func=self.on_edited) self._treeview.show() # set up our drag provider dp = DragProvider(self._treeview) _exec = lambda cmd: self.execute(cmd) pd = PropertyDrop(exec_func=_exec) sd = SectionDrop(exec_func=_exec) for target in [ OdmlDrag(mime="odml/section-ref", inst=odml.section.Section), TextDrag(mime="odml/section", inst=odml.section.Section), TextDrag(mime="TEXT"), OdmlDrop(mime="odml/property-ref", target=pd, registry=registry, exec_func=_exec), OdmlDrop(mime="odml/section-ref", target=sd, registry=registry, exec_func=_exec), TextDrop(mime="odml/property", target=pd), TextDrop(mime="odml/section", target=sd), TextGenericDropForSectionTV(exec_func=_exec), ]: dp.append(target) dp.execute = _exec
def __init__(self, registry): super(PropertyView, self).__init__() tv = self._treeview for name, (id, propname) in PropertyModel.ColMapper.sort_iteritems(): column = self.add_column(name=name, edit_func=self.on_edited, id=id, data=propname) if name == "Value": tv.set_expander_column(column) tv.set_headers_visible(True) tv.set_rules_hint(True) tv.show() # set up our drag provider dp = DragProvider(self._treeview) _exec = lambda cmd: self.execute(cmd) vd = ValueDrop(exec_func=_exec) pd = PropertyDrop(exec_func=_exec) sd = SectionDrop(exec_func=_exec) for target in [ OdmlDrag(mime="odml/property-ref", inst=odml.property.Property), TextDrag(mime="odml/property", inst=odml.property.Property), OdmlDrag(mime="odml/value-ref", inst=odml.value.Value), TextDrag(mime="odml/value", inst=odml.value.Value), TextDrag(mime="TEXT"), OdmlDrop(mime="odml/value-ref", target=vd, registry=registry, exec_func=_exec), OdmlDrop(mime="odml/property-ref", target=pd, registry=registry, exec_func=_exec), OdmlDrop(mime="odml/section-ref", target=sd, registry=registry, exec_func=_exec), TextDrop(mime="odml/value", target=vd), TextDrop(mime="odml/property", target=pd), TextDrop(mime="odml/section", target=sd), TextGenericDropForPropertyTV(exec_func=_exec), ]: dp.append(target) dp.execute = _exec