Exemplo n.º 1
0
        """
		Configures the widget as selector for a relationalBone and shows it.
		"""
        self.selectionCallback = callback
        self.selectionAllow = allow or TreeItemWidget
        self.selectionMulti = multi

        logging.debug("TREEEE")

    @staticmethod
    def canHandle(moduleName, moduleInfo):
        return moduleInfo["handler"] == "tree" or moduleInfo[
            "handler"].startswith("tree.")


moduleWidgetSelector.insert(1, TreeWidget.canHandle, TreeWidget)
displayDelegateSelector.insert(1, TreeWidget.canHandle, TreeWidget)


class BrowserLeafWidget(TreeLeafWidget):
    def setStyle(self):
        self["style"]["background-color"] = "#f7edd2"
        self["class"].append("hierarchy-item")
        self.additionalDropAreas()
        self.buildDescription()

    # self.toggleArrow()
    # self.EntryIcon()


class BrowserNodeWidget(TreeNodeWidget):
Exemplo n.º 2
0
				self.entryFrame.removeChild( c )

			for c in self.pathList._children[:]:
				self.pathList.removeChild(c)
			s = html5.Span()
			s.appendChild(html5.TextNode("Search"))
			self.pathList.appendChild(s)
			self.loadNode(node = self.rootNode ,overrideParams = {"search": searchStr})

	def getChildKey(self, widget):
		"""
			Derives a string used to sort the entries on each level
		"""
		name = str(widget.data.get("name")).lower()

		if isinstance(widget, self.nodeWidget):
			return "0-%s" % name
		elif isinstance(widget, self.leafWidget):
			return "1-%s" % name
		else:
			return "2-"


	@staticmethod
	def canHandle( module, moduleInfo ):
		return (moduleInfo[ "handler" ].startswith( "tree.file" ) or moduleInfo[ "handler" ].startswith( "tree.simple.file" ) )


moduleWidgetSelector.insert(1, FileWidget.canHandle, FileWidget)
displayDelegateSelector.insert(1, FileWidget.canHandle, FileWidget)
Exemplo n.º 3
0
        self.callback = callback

        listselectionPopup = ListSelection(self.module, self.filter)
        listselectionPopup.state.register("acceptSelection", self)

    def onAcceptSelectionChanged(self, event, *args, **kwargs):
        if event and "widget" in dir(event):
            self.callback(self, [event.widget.skel])

    @staticmethod
    def canHandle(moduleName, moduleInfo):
        return moduleInfo["handler"] == "list" or moduleInfo[
            "handler"].startswith("list.")


moduleWidgetSelector.insert(0, ListWidget.canHandle, ListWidget)


# @html5.tag  # fixme: What should be the tag-name for this?
class SkellistItem(Button):
    def __init__(self, skel):
        super().__init__()
        self.skel = skel
        self.addClass("skellist-element")
        self["style"]["width"] = "100%"
        self.buildWidget()

    def buildWidget(self):
        if "firstname" in self.skel and "lastname" in self.skel:
            self.appendChild(self.skel["firstname"] + " " +
                             self.skel["lastname"])