Пример #1
0
    def setActions(self, actions):
        """
			Sets the list of valid actions for this modul.
			This function tries to resolve a suitable action-widget for each
			given action-name and adds them on success.
			All previous actions are removed.
			@param actions: List of names of actions which should be avaiable.
			@type actions: List of String
		"""
        for c in self._children[:]:
            self.removeChild(c)
        if self.currentAction is not None:
            h3 = html5.H3()
            h3["class"].append("modul_%s" % self.module)
            h3["class"].append("apptype_%s" % self.appType)
            h3["class"].append("action_%s" % self.currentAction)

            h3.appendChild(html5.TextNode(translate(self.currentAction)))
            self.appendChild(h3)

        self.widgets = {}
        self.actions = actions

        for action in actions:
            if action == "|":
                span = html5.Span()
                span["class"].append("spacer")
                self.appendChild(span)
            else:
                if self.module is not None and self.module in conf[
                        "modules"].keys():
                    handler = conf["modules"][self.module]["handler"]
                else:
                    handler = ""

                actionWdg = actionDelegateSelector.select(
                    self.module, handler, action)
                if actionWdg is not None:
                    try:
                        actionWdg = actionWdg(self.module, handler, action)
                    except:
                        actionWdg = actionWdg()

                    self.appendChild(actionWdg)
                    self.widgets[action] = actionWdg
Пример #2
0
    def setText(self, descr=None, iconURL=None):
        self.label.removeAllChildren()

        if iconURL is None:
            iconURL = self.iconURL

        if iconURL is not None:
            self.img = html5.Img()
            self.img["src"] = iconURL
            self.label.appendChild(self.img)

        if self.iconClasses is not None:
            for cls in self.iconClasses:
                self.label.addClass(cls)

        if descr is None:
            descr = self.descr

        if descr is not None:
            h = html5.H3()
            h.appendChild(descr)
            self.label.appendChild(h)
Пример #3
0
	def __init__(self, modul, key):
		super(RepeatDatePopup, self).__init__()
		self.module = modul
		self.editIdx = RepeatDatePopup.__editIdx_ #Iternal counter to ensure unique ids
		RepeatDatePopup.__editIdx_ += 1
		self.key = key
		self._lastData = {} #Dict of structure and values received
		self.closeOnSuccess = False

		h3 = html5.H3()
		h3["class"].append("modul_%s" % self.module)
		h3["class"].append("apptype_list")

		h3.appendChild(html5.TextNode(translate("create recurrent dates")))

		self.wasInitialRequest = True
		self.actionbar = ActionBar( self.module, "list", "repeatdate")
		self.appendChild( self.actionbar )
		self.form = html5.Form()
		self.appendChild(self.form)
		self.actionbar.setActions(["create.recurrent"])
		self.reloadData()