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


Python VerticalPanel.insert方法代码示例

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


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

示例1: RegisterPanel

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import insert [as 别名]
class RegisterPanel(VerticalPanel):
    def __init__(self, listener):
        VerticalPanel.__init__(self, StyleName = "register")
                               
        self.listener = listener
                               
        self.form_panel = VerticalPanel(ID = "container", StyleName = "form")         
        
        self.form_panel.add(Label(JS('gettext("Create an account")')))
        
        button_box = HorizontalPanel(Width="100%")
        
        submit_button = Button(JS('gettext("Create the account")'), self.onSubmitButtonClick)
        cancel_button = PseudoLink(JS('gettext("Cancel")'), self.onCancelButtonClick)
        
        button_box.add(cancel_button)
        button_box.add(submit_button)
        button_box.setCellHorizontalAlignment(submit_button,
                                          HasAlignment.ALIGN_RIGHT)
        
        self.form_panel.add(button_box)
                     
        self.add(self.form_panel)
        
    def onShow(self):
        if not hasattr(self, 'form'):
            self.onFormLoad()
        else:
            self.form.clear_errors()
               
    def onFormLoad(self):
        self.formsvc = FormService(['usercreationform'])
        
        self.form = Form(getattr(self.formsvc, "usercreationform"), data = None,
                         listener=self, StyleName = "uniForm")
        self.form_panel.insert(self.form, 1)
        
    def onErrors(self, form, response):
        console.log("onErrors %s" % repr(response))
        
    def onRetrieveDone(self, form):
        self.listener.onBackToLogin(self)
                        
    def onSubmitButtonClick(self, sender):
        self.form.save()
                             
    def onCancelButtonClick(self, sender):
        self.listener.onBackToLogin(self)
开发者ID:fedenko,项目名称:clientbank,代码行数:50,代码来源:RegisterPanel.py

示例2: Circuit

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import insert [as 别名]
class Circuit(object):
    def __init__(self, handle):
        self.log = logging.getConsoleLogger(type(self).__name__, lev)
        self.log.disabled = False
        self.log.debug("__init__: Instantiation")
        self._cacheBreaker = 0
        self._handle = handle
        self.remoteService = DiagramService(handle.spinner)
        labelDisplay = Label("Diagram")
        self.display = HTMLPanel("No circuit created.")
        self.latex = TextArea()

        buttonPanel = HorizontalPanel()

        labelFormatting = Label("Formatting")
        labelCheckbox = Label("Show: ")
        self.checkboxValue = CheckBox("value")
        self.checkboxValue.setID("CBXV1")
        self.checkboxValue.addClickListener(self.onCirctuiTikzClick)
        self.checkboxSymbol = CheckBox("symbol")
        self.checkboxSymbol.setID("CBXS1")
        self.checkboxSymbol.addClickListener(self.onCirctuiTikzClick)
        checkboxPanel = HorizontalPanel()
        checkboxPanel.add(labelCheckbox)
        checkboxPanel.add(self.checkboxSymbol)
        checkboxPanel.add(self.checkboxValue)

        # layout
        self.layout = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, Spacing=10)
        self.layout.add(labelDisplay)
        self.layout.add(self.display)
        self.layout.add(Label("Circuitikz Markup"))
        self.layout.add(self.latex)
        self.layout.add(buttonPanel)
        self.layout.add(labelFormatting)
        self.layout.add(checkboxPanel)
        RootPanel().add(self.layout)

        # Set Default view
        self.actCircuitTikzLock(lock=True)

    def actClear(self):
        self.latex.setText("")
        self.layout.remove(self.display)
        self.display = HTMLPanel("No circuit created.")
        self.layout.insert(self.display, 1)

    def onMenuResume(self):
        self.remoteService.session_resume(self._handle)

    def onCirctuiTikzClick(self, sender, event):
        sendId = sender.getID()
        if sendId == "CBXV1":
            self.log.debug("click value")
            self.remoteService.change_display(self._handle, "value", self.checkboxValue.getChecked())
        elif sendId == "CBXS1":
            self.log.debug("click symbol")
            self.remoteService.change_display(self._handle, "symbol", self.checkboxSymbol.getChecked())

    def onCircuitTikzSubmit(self):
        self.log.debug("onCircuitTikzSubmit - entry")
        self.remoteService.render_circuitikz(self._handle, self.latex.getText())

    def actCircuitTikzSubmit(self, **kwargs):
        id = kwargs.get("id")
        app = "Circuit"
        sessionId = getCookie("session_id")
        image = "api/image?app=Diagram&tab=Circuit&Id=%d&Cache=%d" % (id, self._cacheBreaker)
        self.layout.remove(self.display)
        self.display = Image(image)
        self.layout.insert(self.display, 1)
        self._cacheBreaker = self._cacheBreaker + 1

    def actCircuitTikzLock(self, **kwargs):
        lock = bool(kwargs.get("lock"))
        self.latex.setReadonly(lock)
        self.latex.setStyleName("os-diagram-code-lock")

    def actCircuitTikzSet(self, **kwargs):
        latex = kwargs["latex"]
        self.latex.setText(latex)

    def actCircuitTikzFail(self):
        pass

    def actCircuitTikzDisplayUpdate(self, **kwargs):
        symbol = kwargs.get("symbol", None)
        value = kwargs.get("value", None)
        if symbol != None:
            self.checkboxSymbol.setChecked(symbol)
        if value != None:
            self.checkboxValue.setChecked(value)
开发者ID:OneSolver,项目名称:onesolver,代码行数:94,代码来源:Circuit.py


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