Esempio n. 1
0
    def setCurrentModulDescr(self,
                             descr="",
                             iconURL=None,
                             iconClasses=None,
                             path=None):
        for c in self.modulImg._children[:]:
            self.modulImg.removeChild(c)
        for c in self.moduleName._children[:]:
            self.moduleName.removeChild(c)
        for c in self.modulImg["class"]:
            self.modulImg["class"].remove(c)

        descr = html5.utils.unescape(descr)
        self.moduleName.appendChild(html5.TextNode(descr))

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

        if iconClasses is not None:
            for cls in iconClasses:
                self.modulImg["class"].append(cls)

        conf["theApp"].setTitle(descr)

        if path:
            conf["theApp"].setPath(path)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        super(LoginScreen, self).__init__(*args, **kwargs)
        self.addClass("vi-login")

        # --- Surrounding Dialog ---
        self.dialog = html5.Div()
        self.dialog.addClass("vi-login-dialog")
        self.appendChild(self.dialog)

        # --- Header ---
        header = html5.Div()
        header.addClass("vi-login-header")
        self.dialog.appendChild(header)

        # Login
        h1 = html5.H1()
        h1.addClass("vi-login-headline")
        h1.appendChild(html5.TextNode(translate("vi.login.title")))
        header.appendChild(h1)

        # Logo
        img = html5.Img()
        img.addClass("vi-login-logo")
        img["src"] = "login-logo.png"
        header.appendChild(img)

        # --- Dialog ---

        self.loginMethodSelector = html5.Ul()
        self.loginMethodSelector.addClass("vi-login-method")
        self.dialog.appendChild(self.loginMethodSelector)

        self.haveLoginHandlers = False
Esempio n. 3
0
	def __init__(self, *args, **kwargs):
		print("kwargs", kwargs)
		if "destModule" in kwargs:
			kwargs["destModule"] = kwargs["destModule"][ : kwargs["destModule"].find("_") ] # Remove _rootNode
		# print( "xx%syy" % kwargs["destModul"])
		super(TreeDirSingleSelectionBone, self).__init__( *args, **kwargs )

		self.previewImg = html5.Img()
		self.previewImg["class"].append("previewimg")
		self.appendChild( self.previewImg )
Esempio n. 4
0
    def __init__(self, modul, data, structure, *args, **kwargs):
        super(LeafFileWidget, self).__init__(modul, data, structure, *args,
                                             **kwargs)

        if utils.getImagePreview(data):
            self.prependChild(html5.Img(utils.getImagePreview(data)))

        if "mimetype" in data.keys():
            try:
                ftype, fformat = data["mimetype"].split("/")
                self["class"].append("type_%s" % ftype)
                self["class"].append("format_%s" % fformat.replace("+", "_"))
            except:
                pass

        self["class"].append("file")
        self.sinkEvent("onDragOver", "onDragLeave")
Esempio n. 5
0
	def __init__(self, *args, **kwargs):
		super(TreeDirMultiSelectionBoneEntry, self).__init__(*args, **kwargs)
		self["class"].append("fileentry")

		src = utils.getImagePreview(self.data)

		if src is not None:
			img = html5.Img()
			img["src"] = src
			img["class"].append("previewimg")
			self.appendChild(img)

			# Move the img in front of the lbl
			self.element.removeChild(img.element)
			self.element.insertBefore(img.element, self.element.children.item(0))

		#Remove the editbutton. This won't work on directories; but we maybe need this for other modules?!
		self.removeChild(self.editBtn)
		self.editBtn = None
Esempio n. 6
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)
Esempio n. 7
0
    def __init__(self, module, handler, actionName, *args, **kwargs):
        dsc = actionName.split(".", 3)
        assert dsc[0] == "context", u"Invalid definition!"
        mod = dsc[1]
        vars = dsc[2].split(",")

        assert mod in conf[
            "modules"], "The module '%s' must provide an adminInfo when run in a context action"
        adminInfo = conf["modules"][mod]

        if "visibleName" in adminInfo:
            title = adminInfo["visibleName"]
        elif "name" in adminInfo:
            title = adminInfo["name"]
        else:
            title = mod

        icon = adminInfo.get("icon")

        super(ContextAction, self).__init__(txt=title, *args, **kwargs)

        self.widget = None
        self.adminInfo = adminInfo
        self.contextModule = mod
        self.contextVariables = vars

        self.title = title
        self.filter = filter
        self.icon = icon

        #self.addClass("icon")
        self.addClass("context-%s" % self.contextModule)

        if icon:
            img = html5.Img()
            img["src"] = icon
            self.prependChild(img)

        self.disable()
Esempio n. 8
0
    def __init__(self, preview, *args, **kwargs):
        super(FileImagePopup, self).__init__(title=preview.currentFile.get(
            "name", translate("Unnamed Image")),
                                             className="image-viewer",
                                             *args,
                                             **kwargs)
        self.sinkEvent("onClick")
        self.preview = preview

        img = html5.Img()
        img["src"] = utils.getImagePreview(preview.currentFile, size=None)
        self.appendChild(img)

        div = html5.Div()
        self.appendChild(div)

        btn = html5.ext.Button(translate("Download"), self.onDownloadBtnClick)
        btn.addClass("icon", "download")
        div.appendChild(btn)

        btn = html5.ext.Button(translate("Close"), self.onClick)
        btn.addClass("btn_no")
        div.appendChild(btn)