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


Python HTML.getText方法代码示例

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


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

示例1: DisplayPanel

# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import getText [as 别名]
class DisplayPanel(Composite):
    def __init__(self, owner):
        Composite.__init__(self)
        self.owner = owner
        self.bar = DockPanel()
        
        self.timer_msg = HTML("      timer: ")
        self.timer = TimeDisplay()
        self.timer_panel = HorizontalPanel()
        self.timer_panel.add(self.timer_msg)
        self.timer_panel.add(self.timer)
        
        self.counter_msg = HTML("      total moves: ")
        self.counter = HTML("0")
        self.counter_panel = HorizontalPanel()
        self.counter_panel.add(self.counter_msg)
        self.counter_panel.add(self.counter)
        
        self.initWidget(self.bar)
        self.bar.add(self.timer_panel, DockPanel.WEST)
        self.bar.add(self.counter_panel, DockPanel.EAST)

        self.setStyleName("Puzzle-DisplayPanel")

    def incrCount(self):
        count = self.counter.getText()
        count = int(count) + 1
        self.counter.setText(count)

    def reset(self):
        self.timer.setDisplay(0, 0, 0)
        self.counter.setText("0")
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:34,代码来源:Puzzle.py

示例2: PopupPagina

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

#.........这里部分代码省略.........
        cm1 = cm1.value
        lm2 = DOM.getElementById("lm2")
        lm2 = lm2.value
        cm2 = DOM.getElementById("cm2")
        cm2 = cm2.value
        if not lm1 or not lm2:
            Window.alert("Informe o numero de linhas da matriz M1 e M2.")
            return False

        if lm1 != lm2:
            Window.alert("A quantidade de linhas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
            return False

        if lm1 > "5" or lm2 > "5" or len(lm1) != 1 or len(lm2) != 1:
            Window.alert("A quantidade de linhas da matriz M1 e da matriz M2, deve ser menor ou igual a 5.")
            return False

        if not cm1 or not cm2:
            Window.alert("Informe o numero de colunas da matriz M1 e M2.")
            return False

        if cm1 != cm2:
            Window.alert("A quantidade de colunas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
            return False

        if cm1 > "7" or cm2 > "7" or len(cm1) != 1 or len(cm2) != 1:
            Window.alert("A quantidade de colunas da matriz M1 e da matriz M2, deve ser menor ou igual a 7.")
            return False
        return True

    def getHTML(self):
        return self.caption.getHTML()

    def getText(self):
        return self.caption.getText()

    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)
        return PopupPanel.onEventPreview(self, event)

    def onMouseDown(self, sender, x, y):
        self.dragging = True
        DOM.setCapture(self.caption.getElement())
        self.dragStartX = x
        self.dragStartY = y

    def onMouseMove(self, sender, x, y):
        if self.dragging:
            absX = x + self.getAbsoluteLeft()
            absY = y + self.getAbsoluteTop()
            self.setPopupPosition(absX - self.dragStartX, absY - self.dragStartY)

    def onMouseUp(self, sender, x, y):
        self.dragging = False
        DOM.releaseCapture(self.caption.getElement())

    def onMouseLeave(self, self, x, y):
        pass
开发者ID:nielsonsantana,项目名称:emath,代码行数:70,代码来源:PopupPagina.py

示例3: DialogBoxModal

# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import getText [as 别名]
class DialogBoxModal(PopupPanel):
    def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
        PopupPanel.__init__(self, autoHide, modal, rootpanel)

        self.identifier = identifier
        self.caption = HTML()
        self.child = None
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.closeButton = Image('cancel.png')
        self.closeButton.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)

        dock.add(self.closeButton, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.closeButton,
                                        HasAlignment.ALIGN_RIGHT)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, '100%')
        dock.setWidth('100%')

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight('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_CENTER,
        # HasVerticalAlignment.ALIGN_MIDDLE)
        PopupPanel.setWidget(self, self.panel)

        self.setStyleName('gwt-DialogBox')
        self.caption.setStyleName('Caption')
        self.closeButton.setStyleName('Close')
        dock.setStyleName('Header')
        self.caption.addMouseListener(self)

    def getHTML(self):
        return self.caption.getHTML()

    def getText(self):
        return self.caption.getText()

    def onMouseDown(self, sender, x, y):
        self.dragging = True
        DOM.setCapture(self.caption.getElement())
        self.dragStartX = x
        self.dragStartY = y

    def onMouseEnter(self, sender):
        pass

    def onMouseLeave(self, sender):
        pass

    def onMouseMove(self, sender, x, y):
        if self.dragging:
            absX = x + self.getAbsoluteLeft()
            absY = y + self.getAbsoluteTop()
            self.setPopupPosition(absX - self.dragStartX,
                                  absY - self.dragStartY)

    def onMouseUp(self, sender, x, y):
        self.dragging = False
        DOM.releaseCapture(self.caption.getElement())

    def remove(self, widget):
        if self.child != widget:
            return False

        self.panel.remove(widget)
        self.child = None
        return True

    def setHTML(self, html):
        self.caption.setHTML(html)

    def setText(self, text):
        self.caption.setText(text)

    def doAttachChildren(self):
        PopupPanel.doAttachChildren(self)
        self.caption.onAttach()

    def doDetachChildren(self):
        PopupPanel.doDetachChildren(self)
        self.caption.onDetach()

    def setWidget(self, widget):
        if self.child is not None:
            self.panel.remove(self.child)

#.........这里部分代码省略.........
开发者ID:fluidinfo,项目名称:Tickery,代码行数:103,代码来源:Popups.py

示例4: DialogBox

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

    def __init__(self, autoHide=None, modal=True, **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()
        cf.setHeight(1, 0, "100%")
        cf.setWidth(1, 0, "100%")
        cf.setAlignment(
            1, 0,
            HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE,
        )

        # Arguments section
        self.modal = modal
        self.caption = HTML()
        self.panel.setWidget(0, 0, self.caption)
        self.caption.setStyleName("Caption")
        self.caption.addMouseListener(self)

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

    @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)
        return PopupPanel.onEventPreview(self, event)

    def getHTML(self):
        return self.caption.getHTML()

    def getText(self):
        return self.caption.getText()

    def setHTML(self, html):
        self.caption.setHTML(html)

    def setText(self, text):
        self.caption.setText(text)

    def onMouseDown(self, sender, x, y):
        self.dragging = True
        GlassWidget.show(self.caption)
        self.dragStartX = x
        self.dragStartY = y

    def onMouseEnter(self, sender):
        pass

    def onMouseLeave(self, sender):
        pass

    def onMouseMove(self, sender, x, y):
        if not self.dragging:
            return
        absX = x + self.getAbsoluteLeft()
        absY = y + self.getAbsoluteTop()
        self.setPopupPosition(absX - self.dragStartX,
                              absY - self.dragStartY)

    def onMouseUp(self, sender, x, y):
        self.endDragging()

    def onMouseGlassEnter(self, sender):
        pass

    def onMouseGlassLeave(self, sender):
        self.endDragging()

    def endDragging(self):
        if not self.dragging:
            return
        self.dragging = False
        GlassWidget.hide()
#.........这里部分代码省略.........
开发者ID:anandology,项目名称:pyjamas,代码行数:103,代码来源:DialogBox.py

示例5: WebPageEdit

# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import getText [as 别名]
class WebPageEdit(Composite):
    def __init__(self, sink):
        Composite.__init__(self)

        self.remote = sink.remote

        panel = VerticalPanel(Width="100%", Spacing=8)

        self.view = Button("View", self)
        self.newpage = Button("New", self)
        self.todoId = None
        self.todoTextName = TextBox()
        self.todoTextName.addKeyboardListener(self)

        self.todoTextArea = RichTextEditor(basePath="/fckeditor/")
        self.todoTextArea.setWidth("100%")
        self.todoTextArea.addSaveListener(self)

        self.todoList = ListBox()
        self.todoList.setVisibleItemCount(7)
        self.todoList.setWidth("200px")
        self.todoList.addClickListener(self)

        self.fDialogButton = Button("Upload Files", self)

        self.status = HTML()

        panel.add(HTML("Status:"))
        panel.add(self.status)
        panel.add(self.fDialogButton)
        panel.add(Label("Create New Page (doesn't save current one!):"))
        panel.add(self.newpage)
        panel.add(Label("Add/Edit New Page:"))
        panel.add(self.todoTextName)
        panel.add(Label("Click to Load and Edit (doesn't save current one!):"))
        panel.add(self.todoList)
        panel.add(self.view)
        panel.add(Label("New Page HTML.  Click 'save' icon to save.  (pagename is editable as well)"))
        panel.add(self.todoTextArea)

        self.setWidget(panel)

        self.remote.getPages(self)

    def onKeyUp(self, sender, keyCode, modifiers):
        pass

    def onKeyDown(self, sender, keyCode, modifiers):
        pass

    def onKeyPress(self, sender, keyCode, modifiers):
        """
        This functon handles the onKeyPress event, and will add the item in the text box to the list when the user presses the enter key.  In the future, this method will also handle the auto complete feature.
        """
        pass

    def onSave(self, editor):
        self.status.setText("")
        name = self.todoTextName.getText()
        if not name:
            self.status.setText("Please enter a name for the page")
            return
        item = {"name": name, "text": self.todoTextArea.getHTML()}
        if self.todoId is None:
            rid = self.remote.addPage(item, self)
        else:
            item["id"] = self.todoId
            rid = self.remote.updatePage(item, self)

        if rid < 0:
            self.status.setHTML("Server Error or Invalid Response")
            return

    def onClick(self, sender):
        if sender == self.newpage:
            self.todoId = None
            self.todoTextName.setText("")
            self.todoTextArea.setHTML("")
            return
        elif sender == self.view:
            name = self.todoTextName.getText()
            html = self.todoTextArea.getHTML()
            if not html:
                return
            p = HTMLDialog(name, html)
            p.setPopupPosition(10, 10)
            p.setWidth(Window.getClientWidth() - 40)
            p.setHeight(Window.getClientHeight() - 40)
            p.show()
            return
        elif sender == self.fDialogButton:
            Window.open(fileedit_url, "fileupload", "width=800,height=600")
            return
            dlg = FileDialog(fileedit_url)
            left = self.fDialogButton.getAbsoluteLeft() + 10
            top = self.fDialogButton.getAbsoluteTop() + 10
            dlg.setPopupPosition(left, top)
            dlg.show()

        id = self.remote.getPage(sender.getValue(sender.getSelectedIndex()), self)
#.........这里部分代码省略.........
开发者ID:janjaapbos,项目名称:pyjs,代码行数:103,代码来源:WebPageEdit.py

示例6: DialogBox

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

#.........这里部分代码省略.........
        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)
        return PopupPanel.onEventPreview(self, event)

    def getHTML(self):
        return self.caption.getHTML()

    def getText(self):
        return self.caption.getText()

    def setHTML(self, html):
        self.caption.setHTML(html)

    def setText(self, text):
        self.caption.setText(text)

    def onMouseDown(self, sender, x, y):
        self.dragging = True
        GlassWidget.show(self.caption)
        self.dragStartX = x
        self.dragStartY = y

    def onMouseEnter(self, sender):
        pass

    def onMouseLeave(self, sender):
        pass

    def onMouseMove(self, sender, x, y):
        if not self.dragging:
            return
        absX = x + self.getAbsoluteLeft()
        absY = y + self.getAbsoluteTop()
        self.setPopupPosition(absX - self.dragStartX,
                              absY - self.dragStartY)

    def onMouseUp(self, sender, x, y):
        self.endDragging()

    def onMouseGlassEnter(self, sender):
开发者ID:Afey,项目名称:pyjs,代码行数:70,代码来源:DialogBox.py


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