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


Python SimplePanel.setWidget方法代码示例

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


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

示例1: newPositioner

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
 def newPositioner(self, context):
     
     # Use two widgets so that setPixelSize() consistently affects dimensions
     outer = SimplePanel() 
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     
     # place off screen for border calculation
     RootPanel.get().add(outer, -500, -500) 
     
     # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     outer.setWidget(self.DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT)
     width = 0
     height = 0
     if isinstance(self.dropTarget,HorizontalPanel):
         for widget in context.selectedWidgets:
             width += widget.getOffsetWidth()
             height = Math.max(height, widget.getOffsetHeight())
     else:
         for widget in context.selectedWidgets:
             width = Math.max(width, widget.getOffsetWidth())
             height += widget.getOffsetHeight()
     inner = SimplePanel()
     inner.setPixelSize(
         width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer))
     outer.setWidget(inner)
     return outer
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:28,代码来源:IndexedDropController.py

示例2: Param

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
class Param(object):
    def __init__(self, container, kind, group, draw=True):
        self.container = container
        self.kind = kind
        self.group = group
        self.panel = SimplePanel(StyleName='aur-search-advanced-param')
        self.isInverted = False
        # assigned by parent, visual use only
        self.op = None
        if draw: self.draw()

    def draw(self):
        paramPanel = HorizontalPanel(Width='100%', VerticalAlignment='middle')
        options = self.drawOptions()
        label = Label(self.kind['item'], StyleName='aur-search-advanced-param-title')
        delSelf = Image(url='/ico/cross.png', Title='Delete this parameter')
        delSelf.addStyleName('aur-search-advanced-delete')
        if self.kind['allowsInverse']:
            invertSelf = Image(url='/ico/exclamation.png', Title='Invert this parameter')
            invertSelf.addClickListener(getattr(self, 'invertSelf'))
        else:
            invertSelf = Image(url='/ico/bullet_white.png', StyleName='aur-search-advanced-placeholder')
        self.container.add(self.panel)
        self.panel.setWidget(paramPanel)
        paramPanel.add(delSelf)
        paramPanel.add(label)
        paramPanel.add(options)
        paramPanel.add(invertSelf)
        paramPanel.setCellWidth(delSelf, '1px')
        paramPanel.setCellWidth(options, '1px')
        paramPanel.setCellWidth(invertSelf, '1px')
        delSelf.addClickListener(getattr(self, 'delSelf'))

    def drawOptions(self):
        widget = self.kind['widget']()
        if isinstance(widget, ListBox):
            for x in self.kind['params']:
                widget.addItem(x[0], x[1])
        elif isinstance(widget, TextBox):
            pass
        elif isinstance(widget, CheckBox):
            if self.kind['params'][0]:
                widget.setChecked(True)
        elif isinstance(widget, DateField):
            pass
        return widget

    def delSelf(self, sender):
        self.group.delParam(self)

    def invertSelf(self, sender):
        if self.isInverted:
            self.isInverted = False
            self.panel.removeStyleName('aur-search-advanced-param-inverted')
            self.op.setText(self.group.operator)
        else:
            self.isInverted = True
            self.panel.addStyleName('aur-search-advanced-param-inverted')
            self.op.setText(self.group.operator + ' not')
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:61,代码来源:Search.py

示例3: provider

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
def provider(content, cache=None):
    cont = SimplePanel(StyleName="aur-content-boundary")
    home = VerticalPanel.VerticalPanel(
        Width="100%", Height="100%", HorizontalAlignment="center", VerticalAlignment="middle"
    )
    content.setWidget(cont)
    cont.setWidget(home)
    doBuildContent(home)
    return cont
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:11,代码来源:searchResults.py

示例4: provider

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
def provider(content, cache=None):
    if cache is not None:
        content.setWidget(cache)
        return cache
    cont = SimplePanel(StyleName='aur-content-boundary')
    home = VerticalPanel.VerticalPanel(Width='100%', Height='100%', HorizontalAlignment='center', VerticalAlignment='middle')
    content.setWidget(cont)
    cont.setWidget(home)
    doBuildContent(home)
    return cont
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:12,代码来源:home.py

示例5: makePositioner

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
 def makePositioner(self, reference):
     outer = SimplePanel() # Use two widgets so that setPixelSize() consistently affects dimensions
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     outer.getElement().getStyle().setProperty("margin", "0px")
     RootPanel.get().add(outer, -500, -500) # place off screen for border calculation
     outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT) # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     inner = SimplePanel()
     inner.getElement().getStyle().setProperty("margin", "0px")
     inner.getElement().getStyle().setProperty("border", "none")
     offsetWidth = reference.getOffsetWidth() - DOMUtil.getHorizontalBorders(outer)
     offsetHeight = reference.getOffsetHeight() - DOMUtil.getVerticalBorders(outer)
     inner.setPixelSize(offsetWidth, offsetHeight)
     outer.setWidget(inner)
     return outer
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:16,代码来源:AbsolutePositionDropController.py

示例6: newPositioner

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
 def newPositioner(self, context):
     # Use two widgets so that setPixelSize() consistently affects dimensions
     # excluding positioner border in quirks and strict modes
     SimplePanel outer = SimplePanel()
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     
     # place off screen for border calculation
     RootPanel.get().add(outer, -500, -500)
     
     # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     # DOMUtil.getVerticalBorders(outer)
     outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT)
     
     int width = 0
     int height = 0
     if dropTarget instanceof HorizontalPanel:
         for Iterator iterator = context.selectedWidgets.iterator(); iterator.hasNext();:
开发者ID:jaredly,项目名称:pyjamas,代码行数:19,代码来源:IndexedDropController.py

示例7: __init__

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
    def __init__(self, sink):
        SimplePanel.__init__(self)
        self.sink = sink
        self.caption = HTML()
        self.child = None 
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.collapse = Image("./images/cancel.png")
        self.collapse.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)
        
        dock.add(self.collapse, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT)
        dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, "100%")
        dock.setWidth("100%")
        dock.setHeight("100%")

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight("100%")
        self.panel.setWidth("100%")
        self.panel.setBorderWidth(0)
        self.panel.setCellPadding(0)
        self.panel.setCellSpacing(0)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP)
        SimplePanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.collapse.setStyleName("Close")
        dock.setStyleName("Header")
        #self.caption.addMouseListener(self)
        self.collapsed = False

        self.collapsed_width = "15px"
        self.uncollapsed_width = "100%"
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:48,代码来源:InfoDirectory.py

示例8: ClickDelegatePanel

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
class ClickDelegatePanel(Composite):

    def __init__(self, p, child, cDelegate, kDelegate) :

        Composite.__init__(self)

        self.clickDelegate = cDelegate
        self.keyDelegate = kDelegate

        self.focusablePanel = SimplePanel(Focus.createFocusable())
        self.focusablePanel.setWidget(child)
        wrapperWidget = p.createTabTextWrapper()
        if wrapperWidget is None:
            self.initWidget(self.focusablePanel)
        else :
            wrapperWidget.setWidget(self.focusablePanel)
            self.initWidget(wrapperWidget)

        if hasattr(child, "addKeyboardListener"):
            child.addKeyboardListener(kDelegate)

        self.sinkEvents(Event.ONCLICK | Event.ONKEYDOWN)

    # receive Label's onClick and pass it through, pretending it came from us
    def onClick(self, sender=None):
        self.clickDelegate.onClick(sender)

    def getFocusablePanel(self):
        return self.focusablePanel

    def onBrowserEvent(self, event) :
        type = DOM.eventGetType(event)
        if type == "click":
            self.onClick(self)

        elif type == "keydown":
            modifiers = KeyboardListener.getKeyboardModifiers(event)
            if hasattr(self.keyDelegate, "onKeyDown"):
                self.keyDelegate.onKeyDown(self, DOM.eventGetKeyCode(event),
                                       modifiers)
开发者ID:Afey,项目名称:pyjs,代码行数:42,代码来源:ClickDelegatePanel.py

示例9: Calendar

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]

#.........这里部分代码省略.........
            left = 0
        if top < 0:
            top = 0
        self.setPosition(left, top)
        self.drawCurrent()
        self.setVisible(True)

    def drawCurrent(self):
        yr, mth, day = self.currentYear, self.currentMonth, self.currentDay
        self.draw(int(mth), int(yr))


    def draw(self, month , year):
        tod = time.localtime()
        mm = tod.tm_mon
        yy = tod.tm_year
        # has today changed and thus changed month? cater to rare case
        # where widget in created on last day of month and
        # page left till next day
        hasChangeMonth = False
        if yy <> self.todayYear or mm <> self.todayMonth:
            hasChangeMonth = True
            self.todayYear = yy
            self.todayMonth = mm

        # check to see if we have drawn the full widget before
        if self.defaultGrid is None:
            self.drawFull(month, year)
        else:
            # ok means we are re-drawing, but first check if it is the same
            # as the defaultGrid, if yes, just use it
            if not hasChangeMonth and month == self.todayMonth and \
                   year == self.todayYear:
                self.middlePanel.setWidget(self.defaultGrid)
                self.currentMonth = self.todayMonth
                self.currentYear = self.todayYear
            else:
                # we have to redraw the grid -- bah
                g = self.drawGrid(month, year)

                if hasChangeMonth:
                    # reset the default grid as we have changed months
                    self.defaultGrid = grid

            #
            # what about the title panel?
            #
            txt = "<b>"
            txt += self.getMonthsOfYear()[month-1] + " " + str(year)
            txt += "</b>"
            self.titlePanel.setWidget(HTML(txt))
            self.setVisible(True)

        return

    def drawFull(self, month, year):
        # should be called only once when we draw the calendar for
        # the first time
        self.vp = VerticalPanel()
        self.vp.setSpacing(2)
        self.vp.addStyleName("calendarbox calendar-module calendar")
        self.setWidget(self.vp)
        self.setVisible(False)
        #
        mth = int(month)
        yr = int(year)
开发者ID:jwashin,项目名称:pyjs,代码行数:70,代码来源:Calendar.py

示例10: DisclosurePanel

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
class DisclosurePanel(Composite):

    def __init__(self, *args, **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 = kwargs.pop('Element', None)

        # process the passed arguments
        headerText = headerWidget = None
        isOpen = False
        if len(args) == 1:
            header = args[0]
        if len(args) == 2:
            header, isOpen = args[:2]
        # apparently "basestring" is not understood
        if isinstance(header, basestring):
            headerText = header
        else:
            headerWidget = header
        isOpen = kwargs.pop('isOpen', isOpen)
        headerText = kwargs.pop('header', headerText)
        headerWidget = kwargs.pop('header', headerWidget)
        # TODO: add ImageBundle
        # images = kwargs.pop('images', None)
        
        # If both headerText and headerWidget are arguments, headerText will
        # be used to preserve API compatibility.
        headerContent = headerWidget
        if headerText is not None or headerContent is None:
            if headerText is None:
                headerText = ""
            headerContent = DefaultHeader(headerText)

        self.mainPanel = VerticalPanel(Element=element)

        self._init_header(headerContent)

        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");

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DisclosurePanel")
        Composite.__init__(self, self.mainPanel, **kwargs)

        # Must call setOpen after creating the initializing the object
        self.isOpen = None
        self.setOpen(isOpen)

        self.setContentDisplay()

    def _init_header(self, headerContent):
        self.header = ClickableHeader(self)
        self.headerObj = headerContent
        self.addEventHandler(self.headerObj)
        self.setHeader(self.headerObj)

    def add(self, widget):
        if self.getContent() is None:
            self.setContent(widget)

    def addEventHandler(self, handler):
        self.handlers.append(handler)

    def removeEventHandler(self, handler):
        self.handlers.remove(handler)

    def clear(self):
        self.setContent(None)

    def getContent(self):
        return self.content

    def getHeader(self):
        return self.header.getWidget()

    def getOpen(self):
        return self.isOpen

    def remove(self, widget):
        if widget == self.getContent():
            self.setContent(None)
            return True
        return False

    def setContent(self, widget):
        if self.content is not None:
            self.contentWrapper.setWidget(None)
            self.content.removeStyleName("content")

        self.content = widget
        if self.content is not None:
            self.contentWrapper.setWidget(self.content)
#.........这里部分代码省略.........
开发者ID:anandology,项目名称:pyjamas,代码行数:103,代码来源:DisclosurePanel.py

示例11: ParamGroup

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
class ParamGroup(object):
    def __init__(self, container, kind, parent=None, level=0, draw=True, title=None):
        self.container = container
        self.kind = kind
        self.parent = parent
        self.level = level
        self.title = title
        self.panel = SimplePanel(StyleName='aur-search-advanced-group')
        if level % 2 == 0: self.panel.addStyleName('aur-search-advanced-group-nested')
        self.childPanel = VerticalPanel(StyleName='aur-search-advanced-group-list', Width='100%')
        self.paramPanel = VerticalPanel(StyleName='aur-search-advanced-param-list', Width='100%')
        self.listPanel = VerticalPanel(StyleName='aur-search-advanced-list-boundary', Width='100%', Visible=False)
        self.paramChooser = ListBox()
        self.children = []
        self.parameters = []
        self.isInverted = False
        self.operator = 'and'
        # assigned by parent, visual use only
        self.op = None if parent else Label('and')
        if draw: self.draw()

    def draw(self):
        cont = VerticalPanel(Width='100%')
        header = HorizontalPanel(Width='100%', VerticalAlignment='middle', StyleName='aur-search-advanced-group-header')
        params = self.paramChooser
        addParam = Image(url='/ico/tick.png', Title='Add parameter to this group')
        addGroup = Image(url='/ico/table_add.png', Title='Nest group within this group')
        addGroupFull = Image(url='/ico/table_lightning.png', Title='Nest group within this group; all parameters')
        invertSelf = Image(url='/ico/exclamation.png', Title='Invert this parameter group')
        self.container.add(self.panel)
        self.panel.setWidget(cont)
        cont.add(header)
        if self.parent:
            d = Image(url='/ico/cross.png', Title='Delete this parameter group')
            d.addStyleName('aur-search-advanced-delete')
            header.add(d)
            header.setCellWidth(d, '1px')
            d.addClickListener(getattr(self, 'delSelf'))
        if self.title:
            t = Label(self.title, StyleName='aur-search-advanced-group-header-title')
            header.add(t)
            header.setCellWidth(t, '1px')
        header.add(params)
        header.add(addParam)
        header.add(addGroup)
        header.add(addGroupFull)
        header.add(invertSelf)
        header.setCellWidth(params, '1px')
        header.setCellWidth(addGroup, '1px')
        header.setCellWidth(addGroupFull, '1px')
        header.setCellWidth(invertSelf, '1px')
        for x in self.kind:
            params.addItem(x['item'], x['index'])
        cont.add(self.listPanel)
        self.listPanel.add(self.paramPanel)
        self.listPanel.add(self.childPanel)
        addParam.addClickListener(getattr(self, 'addParam'))
        addGroup.addClickListener(getattr(self, 'addGroup'))
        addGroupFull.addClickListener(getattr(self, 'addGroupFull'))
        invertSelf.addClickListener(getattr(self, 'invertSelf'))

    def addGroup(self, sender):
        self.listPanel.setVisible(True)
        op = Label(self.operator, Title='Invert group operator', StyleName='aur-search-advanced-group-op', Visible=False)
        op.addClickListener(getattr(self, 'invertOperator'))
        if len(self.children) > 0 or len(self.parameters) > 0: op.setVisible(True)
        self.childPanel.add(op)
        self.childPanel.setCellHorizontalAlignment(op, 'right')
        g = ParamGroup(self.childPanel, self.kind, self, self.level+1)
        g.op = op
        self.children.append(g)

    def addGroupFull(self, sender):
        # this is a little hacky, but it's so fast you don't see it
        self.addGroup(None)
        group = self.children[len(self.children)-1]
        for x in range(group.paramChooser.getItemCount()):
            group.paramChooser.setSelectedIndex(x)
            group.addParam(None)
        group.paramChooser.setSelectedIndex(0)

    def addParam(self, sender):
        self.listPanel.setVisible(True)
        op = Label(self.operator, Title='Invert group operator', StyleName='aur-search-advanced-param-op', Visible=False)
        op.addClickListener(getattr(self, 'invertOperator'))
        if len(self.parameters) > 0: op.setVisible(True)
        self.paramPanel.add(op)
        self.paramPanel.setCellHorizontalAlignment(op, 'right')
        k = self.kind[self.paramChooser.getSelectedValues()[0]]
        p = Param(self.paramPanel, k, self)
        p.op = op
        self.parameters.append(p)
        if len(self.children) > 0:
            self.children[0].op.setVisible(True)

    def addParamFull(self, sender):
        # this is a little hacky, but it's so fast you don't see it
        old = self.paramChooser.getSelectedIndex()
        for x in range(self.paramChooser.getItemCount()):
            self.paramChooser.setSelectedIndex(x)
#.........这里部分代码省略.........
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:103,代码来源:Search.py

示例12: DialogBox

# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidget [as 别名]
class DialogBox(PopupPanel):
    _props = [
        ("caption", "Caption", "HTML", None),
    ]

    def __init__(self, autoHide=None, modal=True, centered=False,
                 **kwargs):
        # Init section
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.child = None
        self.panel = FlexTable(
            Height="100%",
            BorderWidth="0",
            CellPadding="0",
            CellSpacing="0",
        )

        cf = self.panel.getCellFormatter()
        rf = self.panel.getRowFormatter()

        # Arguments section
        self.modal = modal
        self.caption = HTML()
        self.caption.setStyleName("Caption")
        self.caption.addMouseListener(self)

        # Make the DialogBox a 3x3 table, like GWT does, with
        # empty elements with specific style names. These can be
        # used with CSS to, for example, create border around the
        # dialog box.
        self.generate_gwt15 = kwargs.pop('gwt15', False) and True

        if not self.generate_gwt15:
            cf.setHeight(1, 0, "100%")
            cf.setWidth(1, 0, "100%")
            cf.setAlignment(
                1, 0,
                HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_MIDDLE,
            )
            self.panel.setWidget(0, 0, self.caption)
        else:
            row_labels = ['Top', 'Middle', 'Bottom']
            col_labels = ['Left', 'Center', 'Right']

            for r in range(3):
                rf.setStyleName(r, 'dialog%s' % row_labels[r])
                for c in range(3):
                    cf.setStyleName(r, c, 'dialog%s%s' % (row_labels[r],
                                                          col_labels[c]))
                    sp = SimplePanel()
                    sp.setStyleName('dialog%s%sInner' % (row_labels[r],
                                                         col_labels[c]))
                    self.panel.setWidget(r, c, sp)

            cf.setAlignment(
                1, 1,
                HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_MIDDLE,
            )

            self.dialog_content = SimplePanel()
            self.dialog_content.setStyleName('dialogContent')

            self.panel.getWidget(0, 1).add(self.caption)
            self.panel.getWidget(1, 1).add(self.dialog_content)

        # Finalize
        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox")
        PopupPanel.__init__(self, autoHide, modal, **kwargs)
        PopupPanel.setWidget(self, self.panel)

        self.centered = centered

    def onWindowResized(self, width, height):
        super(DialogBox, self).onWindowResized(width, height)
        if self.centered:
            self.centerBox()

    def show(self):
        super(DialogBox, self).show()
        if self.centered:
            self.centerBox()

    @classmethod
    def _getProps(self):
        return PopupPanel._getProps() + self._props

    def onEventPreview(self, event):
        # preventDefault on mousedown events, outside of the
        # dialog, to stop text-selection on dragging
        type = DOM.eventGetType(event)
        if type == 'mousedown':
            target = DOM.eventGetTarget(event)
            elem = self.caption.getElement()
            event_targets_popup = target and DOM.isOrHasChild(elem, target)
            if event_targets_popup:
                DOM.eventPreventDefault(event)
#.........这里部分代码省略.........
开发者ID:Afey,项目名称:pyjs,代码行数:103,代码来源:DialogBox.py


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