当前位置: 首页>>代码示例>>Python>>正文


Python DOM.setStyleAttribute方法代码示例

本文整理汇总了Python中pyjamas.DOM.setStyleAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.setStyleAttribute方法的具体用法?Python DOM.setStyleAttribute怎么用?Python DOM.setStyleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.DOM的用法示例。


在下文中一共展示了DOM.setStyleAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def __init__(self, autoHide=False, modal=True, rootpanel=None, glass=False,
                **kwargs):

        self.popupListeners = []
        self.showing = False
        self.autoHide = autoHide
        kwargs['Modal'] = kwargs.get('Modal', modal)

        if rootpanel is None:
            rootpanel = RootPanel()
        self.rootpanel = rootpanel

        self.glass = glass
        if self.glass:
            self.glass = DOM.createDiv()
            if not 'GlassStyleName' in kwargs:
                kwargs['GlassStyleName'] = "gwt-PopupPanelGlass"

        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')
        else:
            element = self.createElement()
        DOM.setStyleAttribute(element, "position", "absolute")

        SimplePanel.__init__(self, element, **kwargs)

        if glass:
            self.setGlassEnabled(True)
            if 'GlassStyleName' in kwargs:
                self.setGlassStyleName(kwargs.pop('GlassStyleName'))
开发者ID:Afey,项目名称:pyjs,代码行数:32,代码来源:PopupPanel.py

示例2: setPopupPosition

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def setPopupPosition(self, left, top):
        if isinstance(left, basestring):
            if left.endswith('%'):
                left = int(left[:-1])
                left = int(left * Window.getClientWidth() / 100)
            elif left.lower().endswith('px'):
                left = int(left[:-2])
        if isinstance(top, basestring):
            if top.lower().endswith('%'):
                top = int(top[:-1])
                top = int(top * Window.getClientHeight() / 100)
            elif top.endswith('px'):
                top = int(top[:-2])

        left = max(left, 0)
        top = max(top, 0)

        # Account for the difference between absolute position and the
        # body's positioning context.
        left -= DOM.getBodyOffsetLeft()
        top -= DOM.getBodyOffsetTop()

        element = self.getElement()
        DOM.setStyleAttribute(element, "left", "%dpx" % left)
        DOM.setStyleAttribute(element, "top", "%dpx" % top)
开发者ID:Afey,项目名称:pyjs,代码行数:27,代码来源:PopupPanel.py

示例3: setCellVerticalAlignment

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
 def setCellVerticalAlignment(self, widget, align):
     td = self.getWidgetTd(widget)
     if td is not None:
         if align is None:
             DOM.setStyleAttribute(td, "verticalAlign", "")
         else:
             DOM.setStyleAttribute(td, "verticalAlign", align)
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:CellPanel.py

示例4: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def __init__(self, min_value, max_value, start_value=None, step=None,
                       **kwargs):

        VerticalDemoSlider.__init__(self, min_value, max_value, start_value,
                                    **kwargs)
        DOM.setStyleAttribute(self.handle, "width", "10px")
        DOM.setStyleAttribute(self.handle, "height", "100%")                                
开发者ID:jaredly,项目名称:pyjamas,代码行数:9,代码来源:Controls.py

示例5: buildTree

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def buildTree(self):
        """ Build the contents of our tree.

            Note that, for now, we highlight the demos which haven't been
            written yet.
        """
        sections = {} # Maps section name to TreeItem object.

        for demo in self._demos:
            if demo['section'] not in sections:
                section = TreeItem('<b>' + demo['section'] + '</b>')
                DOM.setStyleAttribute(section.getElement(),
                                      "cursor", "pointer")
                DOM.setAttribute(section.itemTable, "cellPadding", "0")
                DOM.setAttribute(section.itemTable, "cellSpacing", "1")
                self._tree.addItem(section)
                sections[demo['section']] = section

            section = sections[demo['section']]

            if demo['doc'][:26] == "Documentation goes here...":
                item = TreeItem('<font style="color:#808080">' +
                                demo['title'] + '</font>')
            else:
                item = TreeItem(demo['title'])
            DOM.setStyleAttribute(item.getElement(), "cursor", "pointer")
            DOM.setAttribute(item.itemTable, "cellPadding", "0")
            DOM.setAttribute(item.itemTable, "cellSpacing", "1")
            item.setUserObject(demo)
            section.addItem(item)

        # Open the branches of the tree.

        for section in sections.keys():
            sections[section].setState(True, fireEvents=False)
开发者ID:Afey,项目名称:pyjs,代码行数:37,代码来源:Showcase.py

示例6: setWidth

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def setWidth(self, width):

        self.fontsize = math.floor(width / self.cols)
        AbsolutePanel.setWidth(self, "%dpx" % (self.cols*self.fontsize))

        ratio = self.fontsize / self.fontheight 
        DOM.setStyleAttribute(self.getElement(), 'fontSizeAdjust', str(ratio))
开发者ID:brodybits,项目名称:pyjs,代码行数:9,代码来源:textconsole.py

示例7: make_panel

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def make_panel(self):
        message = Label(
            'The configuration has been changed.\n'
            'You must apply the changes in order for them to take effect.')
        DOM.setStyleAttribute(message.getElement(), "whiteSpace", 'pre')

        msgbox = Grid(1, 2, StyleName='changes')
        msgbox.setWidget(0, 0, Image('icons/exclam.png'))
        msgbox.setWidget(0, 1, message)
        msgbox.getCellFormatter().setStyleName(0, 0, 'changes-image')
        msgbox.getCellFormatter().setStyleName(0, 1, 'changes-text')

        button = Button('apply changes')
        button.addClickListener(self.apply_clicked)

        self.changes = VerticalPanel()
        self.changes.setHorizontalAlignment('right')
        self.changes.setVisible(False)
        self.changes.add(msgbox)
        self.changes.add(button)

        panel = VerticalPanel()
        panel.setSpacing(10)
        panel.add(self.table)
        panel.add(self.status)
        panel.add(self.changes)

        return panel
开发者ID:christophgysin,项目名称:schoolbell,代码行数:30,代码来源:alarmwidget.py

示例8: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def __init__(self, headerText, isOpen=False, **kwargs):

        self.handlers = []
        self.content = None

        # this is awkward: VerticalPanel is the composite,
        # so we get the element here, and pass it in to VerticalPanel.
        element = None
        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')

        self.mainPanel = VerticalPanel(Element=element)

        self.header = ClickableHeader(self)
        self.contentWrapper = SimplePanel()
        self.mainPanel.add(self.header)
        self.mainPanel.add(self.contentWrapper)
        DOM.setStyleAttribute(self.contentWrapper.getElement(),
                              "padding", "0px");
        DOM.setStyleAttribute(self.contentWrapper.getElement(),
                              "overflow", "hidden");

        self.isOpen = isOpen

        self.headerObj = DefaultHeader(headerText, self)
        self.setHeader(self.headerObj)

        if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-DisclosurePanel"
        Composite.__init__(self, self.mainPanel, **kwargs)

        self.setContentDisplay()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:33,代码来源:DisclosurePanel.py

示例9: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def __init__(self, min_value, max_value,
                 start_value=None, step=None,
                 **kwargs):

        if not kwargs.has_key("StyleName"):
            kwargs['StyleName'] = "gwt-VerticalSlider"

        if kwargs.has_key('Element'):
            # XXX FIXME: Focus.createFocusable is here for a reason...
            element = kwargs.pop('Element')
        else:
            element = Focus.createFocusable()
        DOM.setStyleAttribute(element, "position", "relative")
        DOM.setStyleAttribute(element, "overflow", "hidden")

        self.handle = DOM.createDiv()
        DOM.appendChild(element, self.handle)

        self.setHandleStyle("1px", "100%", "10px", "#808080")

        # must use DoubleControl; otherwise, this init is = Vertical init,
        # plus a change in the handle style
        # this should be refactored, so that the AreaSlider
        # can be built on VerticalSlider
        DoubleControl.__init__(self, element, min_value, max_value,
                               start_value, step,
                               **kwargs)

        self.addClickListener(self)
        self.addFocusListener(self)
        self.addMouseListener(self)

        #Redefine VDS's styles for handle
        self.setHandleStyle("1px", "10px", "10px", "#808080")
开发者ID:anandology,项目名称:pyjamas,代码行数:36,代码来源:AreaSlider.py

示例10: setWordWrap

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def setWordWrap(self, row, column, wrap):
        self.outer.prepareCell(row, column)
        if wrap:
            wrap_str = ""
        else:
            wrap_str = "nowrap"

        DOM.setStyleAttribute(self.getElement(row, column), "whiteSpace", wrap_str)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:10,代码来源:CellFormatter.py

示例11: createBoxes

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
 def createBoxes(self):
     while self.table.getWidgetCount():
         self.table.remove(0)
     for w in self.words:
         el = DOM.createDiv()
         DOM.setStyleAttribute(el, "float", "left")
         wid = HTML(w, Element=el, 
                     StyleName="flowpanelword")
         self.table.add(wid)
开发者ID:davelab6,项目名称:telaro,代码行数:11,代码来源:wordbox.py

示例12: setPopupPosition

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def setPopupPosition(self, left, top):
        if left < 0:
            left = 0
        if top < 0:
            top = 0

        element = self.getElement()
        DOM.setStyleAttribute(element, 'left', '%dpx' % left)
        DOM.setStyleAttribute(element, 'top', '%dpx' % top)
开发者ID:fluidinfo,项目名称:Tickery,代码行数:11,代码来源:Popups.py

示例13: setPopupPosition

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
    def setPopupPosition(self, left, top):
        if left < 0:
            left = 0
        if top < 0:
            top = 0

        element = self.getElement()
        DOM.setStyleAttribute(element, "left", "%dpx" % left )
        DOM.setStyleAttribute(element, "top", "%dpx" % top)
开发者ID:Afey,项目名称:pyjs,代码行数:11,代码来源:Popups.py

示例14: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
 def __init__(self, disclosurePanel, **kwargs):
     element = kwargs.pop('Element', DOM.createAnchor())
     SimplePanel.__init__(self, element)
     self.disclosurePanel = disclosurePanel
     element = self.getElement()
     DOM.setAttribute(element, "href", "javascript:void(0);");
     DOM.setStyleAttribute(element, "display", "block")
     self.sinkEvents(Event.ONCLICK)
     self.setStyleName("header")
开发者ID:anandology,项目名称:pyjamas,代码行数:11,代码来源:DisclosurePanel.py

示例15: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setStyleAttribute [as 别名]
 def __init__(self, **kwargs):
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createDiv()
     self.setElement(element)
     DOM.setStyleAttribute(self.getElement(), "position", "relative")
     DOM.setStyleAttribute(self.getElement(), "overflow", "hidden")
     ComplexPanel.__init__(self, **kwargs)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:11,代码来源:AbsolutePanel.py


注:本文中的pyjamas.DOM.setStyleAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。