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


Python VerticalPanel.remove方法代码示例

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


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

示例1: LoggerPanel

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class LoggerPanel(DisclosurePanel):
    def __init__(self, maxhistory=100, maxloglinelength=200, headerStyleName=None, panelStyleName=None,
                 buttonStyleName=None, labelStyleName=None):
        super(LoggerPanel, self).__init__(self, header='BLAH', isOpen=False)
        self.labelStyleName = labelStyleName
        self.maxhistory = maxhistory
        self.maxloglinelength = maxloglinelength

        self.getHeader().setStyleName(headerStyleName)
        self.logpanel = VerticalPanel(StyleName=panelStyleName)
        self.setContent(self.logpanel)

        self.clearbutton = Button('Clear', listener=self.clear, StyleName=buttonStyleName)
        self.logpanel.add(self.clearbutton)
        self.updateHeaderText()
    def log(self, string):
        self.logpanel.add(Label(string[:self.maxloglinelength], StyleName=self.labelStyleName))
        widgcnt = self.logpanel.getWidgetCount()
        if widgcnt > self.maxhistory:
            for i in range(0, widgcnt - self.maxhistory):
                self.logpanel.remove(self.logpanel.getWidget(i))
        self.updateHeaderText()
    def __call__(self, string):
        self.log(string)
        return
    def updateHeaderText(self):
        self.getHeader().setText('Logging: %s items' % (self.logpanel.getWidgetCount() - 1))
    def clear(self):
        self.logpanel.clear()
        self.logpanel.add(self.clearbutton)
        self.updateHeaderText()
开发者ID:satyam07,项目名称:taoggregator,代码行数:33,代码来源:commoncontrols.py

示例2: TheoremPanel

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class TheoremPanel(ScrollPanel):
    def __init__(self, after):
        ScrollPanel.__init__(self, Size=("630px", "500px"))
        self.after = after
        self.pok = VerticalPanel()
        self.add(self.pok)
        self.images = list()

        def onItemSelected():
            item = self.list2.getItemText(self.list2.getSelectedIndex())
            self.refresh_theorems(item)

        self.list2 = ListBox()
        self.list2.setVisibleItemCount(1)
        for f in Theorem.get_all_folders():
            self.list2.addItem(f)
        self.pok.add(self.list2)
        self.list2.addChangeListener(onItemSelected)

        self.refresh_theorems(self.list2.getItemText(self.list2.getSelectedIndex()))

    def remove_images(self):
        for im in self.images:
            self.pok.remove(im)
        self.images = list()

    def refresh_theorems(self, folder):
        self.remove_images()

        def onClick(theorem):
            def name(n):
                return "var" + str(n + 1)

            def print_scheme(n):
                return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n]

            def poas(sender):
                if len(theorem.operations) == 1:
                    constants = [Operation("const" + str(i + 1), 0, print_scheme(i), name(i), Operation.EXPRESSION)
                                 for i in range(theorem.operations[0].no_of_args)]

                    def after1(f):
                        self.after(
                            theorem.formula.substitute_definition(Formula([theorem.operations[0]] + constants), f),
                            predecessors=[], rule_name="insert")

                    request_formula([op for op in proof.get_operations()] + constants,
                                    after1, type=('rel' if theorem.operations[0].type == Operation.RELATION else 'exp'))
                else:
                    self.after(theorem.formula, predecessors=[], rule_name="insert")

            return poas

        for ax in [x for x in Theorem.theorems if x.folder == folder]:
            im = Image()
            im.addClickListener(onClick(ax))
            im.setUrl(latex_to_url(ax.formula.to_latex()))
            self.pok.add(im)
            self.images.append(im)
开发者ID:vizafogo123,项目名称:pokpok,代码行数:61,代码来源:TheoremPanel.py

示例3: FormulaListPanel

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class FormulaListPanel(ScrollPanel):
    def __init__(self,onClick):
        ScrollPanel.__init__(self, Size=("630px", "500px"))
        self.checkbox_list = []
        self.hpanel_list = []
        self.image_list = []

        self.pok = VerticalPanel()
        self.add(self.pok)
        self.onclick=onClick

    def add_formula(self, f):
        h = HorizontalPanel()
        im = Image()
        im.setUrl(latex_to_url(f.to_latex()))
        c = CheckBox()
        h.add(c)
        h.add(im)
        self.pok.add(h)
        self.checkbox_list.append(c)
        self.hpanel_list.append(h)
        self.image_list.append(im)

    def set_checks_to_def(self,split_points):
        for i in range(len(self.checkbox_list)):
            self.checkbox_list[i].setChecked(False)
            if i in split_points:
                self.checkbox_list[i].setStyleAttribute('background-color','#FF0000')
            else:
                self.checkbox_list[i].setStyleAttribute('background-color', 'transparent')
        self.checkbox_list[-1].setChecked(True)

    def get_selected_indices(self):
        return [i for i, c in enumerate(self.checkbox_list) if c.isChecked()]

    def reload(self, formula_list,split_points):
        if len(formula_list)<len(self.hpanel_list):
            for h in self.hpanel_list[len(formula_list):]:
                self.pok.remove(h)
            self.hpanel_list=self.hpanel_list[:len(formula_list)]
            self.checkbox_list = self.checkbox_list[:len(formula_list)]
            self.image_list = self.image_list[:len(formula_list)]
        for f, im in zip(formula_list, self.image_list):
            im.setUrl(latex_to_url(f.to_latex()))
        x = formula_list[len(self.hpanel_list):]
        for f in x:
            self.add_formula(f)
        self.set_checks_to_def(split_points)

        for i in range(len(self.image_list)):
            self.image_list[i].clearClickListener()
            self.image_list[i].addClickListener(self.onclick(i))
开发者ID:vizafogo123,项目名称:pokpok,代码行数:54,代码来源:FormulaListPanel.py

示例4: SinkList

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class SinkList(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.vp_list=VerticalPanel()
        self.sinks=[]
        self.selectedSink=-1
        
        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def add(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-SinkItem")
        self.vp_list.add(link)
        self.sinks.append(info)

    def remove(self, info):
        if isinstance(info, str):
            info = self.find(info)
        name = info.getName()
        for hl in self.vp_list:
            if hl.getTargetHistoryToken() != name:
                continue
            self.vp_list.remove(hl)
            break

        self.sinks.remove(info)

    def clear(self):
        while len(self.sinks) > 0:
            info = self.sinks[0]
            self.remove(info)

    def find(self, sinkName):
        for info in self.sinks:
            if info.getName()==sinkName:
                return info
        return None

    def setSinkSelection(self, name):
        if self.selectedSink <> -1:
            self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")

        for i in range(len(self.sinks)):
            info = self.sinks[i]
            if (info.getName()==name):
                self.selectedSink = i
                widget=self.vp_list.getWidget(self.selectedSink)
                widget.addStyleName("ks-SinkItem-selected")
                return
开发者ID:,项目名称:,代码行数:54,代码来源:

示例5: onModuleLoad

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class AMSSnoopStack:
    def onModuleLoad(self):
        global statusbar
        statusbar = Label()
        self.button = Button("Display Current Stack Frames", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(statusbar)
        RootPanel().add(self.panel)
        self.commobj = AMS.AMS_Comm()
        self.textarea = None

    def onClick(self, sender):
        global statusbar,boxes
        statusbar.setText('Button pressed')
        pass
        if sender == self.buttonupdate:
            self.commobj = AMS.AMS_Comm()
            statusbar.setText('Updating data: Press Display list button to refesh')
        if sender == self.button:
            if AMS.sent > AMS.recv:
               statusbar.setText('Press button again: sent '+str(AMS.sent)+' recv '+str(AMS.recv))
            if self.commobj.commname == 'No AMS publisher running' or not self.commobj.commname or  self.commobj.comm == -1:
               if self.textarea: self.panel.remove(self.textarea)
               pass
            else:
               statusbar.setText('Memories for AMS Comm: '+self.commobj.commname)
               result = self.commobj.get_memory_list()
               if self.textarea: self.panel.remove(self.textarea)
               self.textarea = TextArea()
               memory = self.commobj.memory_attach("Stack")
               size = memory.get_field_info("current size")
               functions = memory.get_field_info("functions")
               funcs = '\n'.join(functions[4])
               self.textarea.setText(str(funcs))
               self.textarea.setVisibleLines(size[4])
               self.panel.add(self.textarea)
开发者ID:00liujj,项目名称:petsc,代码行数:49,代码来源:AMSSnoopStack.py

示例6: onModuleLoad

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class AMSJavascriptExample:
    def onModuleLoad(self):
        self.status=Label()
        self.button = Button("Display list of all published memories and fields", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(self.status)
        RootPanel().add(self.panel)
        self.commobj = AMS_Comm()
        self.tree = None

    def onClick(self, sender):
        global sent,recv
        self.status.setText('Button pressed')
        if sender == self.buttonupdate:
            self.commobj = AMS_Comm()
            self.status.setText('Updating data: Press Display list button to refesh')
        if sender == self.button:
            if sent > recv:
               self.status.setText('Press button again: sent '+str(sent)+' recv '+str(recv))
            if self.commobj.commname == 'No AMS publisher running':
               self.status.setText(self.commobj.commname)
            else:
               self.status.setText('Memories for AMS Comm: '+self.commobj.commname)
               result = self.commobj.get_memory_list()
               if self.tree: self.panel.remove(self.tree)
               self.tree = Tree()
               for i in result:
                  subtree = TreeItem(i)
                  memory = self.commobj.memory_attach(i)
                  fields = memory.get_field_list()
                  for j in fields:
                     field = memory.get_field_info(j)
                     subtree.addItem(j+' = '+str(field[4]))
                  self.tree.addItem(subtree)
                  self.panel.add(self.tree)
开发者ID:erdc-cm,项目名称:petsc-dev,代码行数:48,代码来源:AMSJavascript.py

示例7: onModuleLoad

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class AMSSnoopObjects:
    def onModuleLoad(self):
        global statusbar
        statusbar = Label()
        self.button = Button("Display list of all published memories and fields", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(statusbar)
        RootPanel().add(self.panel)
        self.commobj = AMS.AMS_Comm()
        self.tree = None

    def textboxlistener(self, arg):
        global boxes, statusbar
        statusbar.setText("User changed value in text box to " + str(arg.getText()) + " " + str(boxes[arg]))
        # the user has changed this value we should send it back to the AMS program
        boxes[arg][2].set_field_info(boxes[arg][1], arg.getText())

    def onClick(self, sender):
        global statusbar, boxes
        statusbar.setText("Button pressed")
        pass
        if sender == self.buttonupdate:
            self.commobj = AMS.AMS_Comm()
            statusbar.setText("Updating data: Press Display list button to refesh")
        if sender == self.button:
            if AMS.sent > AMS.recv:
                statusbar.setText("Press button again: sent " + str(AMS.sent) + " recv " + str(AMS.recv))
            if (
                self.commobj.commname == "No AMS publisher running"
                or not self.commobj.commname
                or self.commobj.comm == -1
            ):
                if self.tree:
                    self.panel.remove(self.tree)
            else:
                statusbar.setText("Memories for AMS Comm: " + self.commobj.commname)
                result = self.commobj.get_memory_list()
                if self.tree:
                    self.panel.remove(self.tree)
                self.tree = Tree()
                for i in result:
                    if i == "Stack":
                        continue
                    subtree = TreeItem(i)
                    memory = self.commobj.memory_attach(i)
                    fields = memory.get_field_list()
                    if not isinstance(fields, list):
                        fields = [fields]
                    block = false
                    for j in fields:
                        field = memory.get_field_info(j)
                        if str(field[1]) == "AMS_READ":
                            if j == "Publish Block":
                                if field[4] == "true":
                                    block = true
                            else:
                                subtree.addItem(j + " = " + str(field[4]))
                        else:
                            if j == "Block" and not block:
                                continue
                            PN = HorizontalPanel()
                            PN.add(Label(Text=j + " ="))
                            tb = TextBox(Text=str(field[4]))
                            boxes[tb] = [i, j, memory]
                            tb.addChangeListener(self.textboxlistener)
                            PN.add(tb)
                            subtree.addItem(PN)
                    self.tree.addItem(subtree)
                    self.panel.add(self.tree)
开发者ID:00liujj,项目名称:petsc,代码行数:82,代码来源:AMSSnoopObjects.py

示例8: ParamGroup

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

#.........这里部分代码省略.........
        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)
            self.addParam(None)
        self.paramChooser.setSelectedIndex(old)

    def delGroup(self, child):
        self.children.remove(child)
        self.childPanel.remove(child.op)
        self.childPanel.remove(child.panel)
        lp = len(self.parameters)
        lc = len(self.children)
        if lp == 0 and lc > 0:
            self.children[0].op.setVisible(False)
        if lp == 0 and lc == 0:
            self.listPanel.setVisible(False)

    def delParam(self, param):
        self.parameters.remove(param)
        self.paramPanel.remove(param.op)
        self.paramPanel.remove(param.panel)
        lp = len(self.parameters)
        lc = len(self.children)
        if lp > 0:
            self.parameters[0].op.setVisible(False)
        if lp == 0 and lc > 0:
            self.children[0].op.setVisible(False)
        if lp == 0 and lc == 0:
            self.listPanel.setVisible(False)

    def delSelf(self, sender):
        self.parent.delGroup(self)

    def invertSelf(self, sender):
        if self.isInverted:
            self.isInverted = False
            self.panel.removeStyleName('aur-search-advanced-group-inverted')
            self.op.setText(self.operator)
        else:
            self.isInverted = True
            self.panel.addStyleName('aur-search-advanced-group-inverted')
            self.op.setText(self.operator + ' not')

    def invertOperator(self, sender):
        self.operator = 'or' if self.operator == 'and' else 'and'
        for x in self.parameters:
            suffix = ' not' if x.isInverted else ''
            x.op.setText(self.operator + suffix)
        for x in self.children:
            suffix = ' not' if x.isInverted else ''
            x.op.setText(self.operator + suffix)
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:104,代码来源:Search.py

示例9: Input_Form

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [as 别名]
class Input_Form(Abstract_View):
    '''Input form that modifies itself depending on the proejct.
    '''
    def __init__(self):
        Abstract_View.__init__(self)
        self.dev_fields = Dev_Fields()
        

    def register(self, controller):
        '''Register controller for view and its subviews'''
        self.controller = controller
        self.dev_fields.register(controller)
        
    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        # Create list of projects 
        proj_list = ListBox(Height='34px')
       
        proj_list.addItem('')
       
        proj_list.setVisibleItemCount(0)
        proj_list.addChangeListener(getattr(self, 'on_project_changed'))
        proj_list.setStyleName('form-control input-lg')
        
        self.proj_row = Form_Row('Select project',
                            proj_list,
                            help='project, status of which you want to report')
        
        # Project-specific container
        self.project_panel = VerticalPanel()

        # Submit report button
        self.submit_btn = Button('Submit report', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')
        self.submit_btn.setEnabled(False)

        self.msg_lbl = HTMLPanel('', Width='475px')

        # Add controls here
        self.panel.add(self.proj_row.panel())
        self.panel.add(self.project_panel)
        self.panel.add(Label(Height='20px'))
        self.panel.add(self.msg_lbl)
        btn_holder = HorizontalPanel()
        btn_holder.add(self.submit_btn)
        help_btn = HTMLPanel('')

        help_btn.setHTML(MODAL_PNL)
        btn_holder.add(Label(Width='10px'))
        btn_holder.add(help_btn)
        self.panel.add(btn_holder)
        
        self.root = RootPanel('report')
        self.root.add(self.panel)

    def _load_project(self, project):
        '''Load project specific fields in the panel
        '''
        if self.dev_fields is not None:
            self.project_panel.remove(self.dev_fields)
        # Remove the old one and add brand new
        self.dev_fields = Dev_Fields()
        self.project_panel.add(self.dev_fields)

    def send_data(self):
        '''Retrieve data for the active project fields and send to flask.
        '''
        #data = self.dev_fields.prep_data()
        self.controller.process_msg(SEND_DATA_MSG)
        
    def on_project_changed(self, event):
        '''Change form fields depending on the proejct.
        '''
        proj_list = self.proj_row.widget()
        project = proj_list.getItemText(proj_list.getSelectedIndex())
        if project != '':
            self.controller.process_msg(PROJ_CHANGED_MSG, project)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:84,代码来源:form.py

示例10: Circuit

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import remove [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.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。