def onRemoteResponse(self, response, request_info):
        for name in response:
            item = TreeItem(name)
            item.addItem(PendingItem())
            self.tree.addItem(item)

        self.status.setText('')
    def onRemoteResponse(self, response, request_info):
        for name in response:
            item = TreeItem(name)
            item.addItem(PendingItem())
            self.tree.addItem(item)

        self.status.setText('')
    def __init__(self):
        """ Constructs a new EditPanel.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        #        self.remote_py = RegionNamesServicePython()

        self.panel = VerticalPanel()

        top_panel = HorizontalPanel()
        top_panel.setSpacing(8)
        self.panel.add(top_panel)

        refresh = Button("Refresh", self)
        top_panel.add(refresh)

        self.status = Label()
        top_panel.add(self.status)

        edit_panel = HorizontalPanel()
        self.panel.add(edit_panel)

        self.tree = Tree()
        self.tree.addTreeListener(self)
        edit_panel.add(self.tree)

        upload_item = TreeItem("Upload")
        self.tree.add(upload_item)
        map_item = TreeItem("Map")
        self.tree.add(map_item)
Exemple #4
0
 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)
Exemple #5
0
 def get_case_tree(self):
     tree = self.tree = Tree()
     case_item = TreeItem("Case_1")
     tree.addItem(case_item)
     buses = self.buses = TreeItem("Buses")
     case_item.addItem(buses)
     id = self.remote_case.buses("name", self)
     return tree
Exemple #6
0
 def get_case_tree(self):
     tree = self.tree = Tree()
     case_item = TreeItem("Case_1")
     tree.addItem(case_item)
     buses = self.buses = TreeItem("Buses")
     case_item.addItem(buses)
     id = self.remote_case.buses("name", self)
     return tree
Exemple #7
0
    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)
Exemple #8
0
    def insertItem(self, item, index=None):
        if isinstance(item, basestring):
            item = TreeItem(item)

        ret = self.root.addItem(item)
        if index is None:
            DOM.appendChild(self.getElement(), item.getElement())
        else:
            DOM.insertChild(self.getElement(), item.getElement(), index)

        return ret
Exemple #9
0
    def insertItem(self, item, index=None):
        if isinstance(item, basestring):
            item = TreeItem(item)

        ret = self.root.addItem(item)
        if index is None:
            DOM.appendChild(self.getElement(), item.getElement())
        else:
            DOM.insertChild(self.getElement(), item.getElement(), index)

        return ret
Exemple #10
0
 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)
Exemple #11
0
    def __init__(self):
        Composite.__init__(self)

        self.tree = Tree()
        root = TreeItem(self.imageItemHTML("home.gif", "*****@*****.**"))
        self.tree.addItem(root)
        inboxItem = self.addImageItem(root, "Inbox")
        self.addImageItem(root, "Drafts")
        self.addImageItem(root, "Templates")
        self.addImageItem(root, "Sent")
        self.addImageItem(root, "Trash")

        root.setState(True)
        self.initWidget(self.tree)
Exemple #12
0
    def __init__(self):
        Composite.__init__(self)

        self.tree = Tree()
        root = TreeItem(self.imageItemHTML("home.gif", "*****@*****.**"))
        self.tree.addItem(root)
        inboxItem = self.addImageItem(root, "Inbox")
        self.addImageItem(root, "Drafts")
        self.addImageItem(root, "Templates")
        self.addImageItem(root, "Sent")
        self.addImageItem(root, "Trash")

        root.setState(True)
        self.initWidget(self.tree)
Exemple #13
0
    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
        if AMSJavascript.sent > AMSJavascript.recv:
            self.status.setText('Press button again: AMSJavascript.sent ' +
                                str(AMSJavascript.sent) +
                                ' AMSJavascript.recv ' +
                                str(AMSJavascript.recv))
            return
        if self.commobj.commname == 'No AMS publisher running':
            self.status.setText(self.commobj.commname)
        else:
            self.status.setText('Memories for AMS Comm: ' +
                                str(AMSJavascript.sent) +
                                str(AMSJavascript.recv) +
                                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)
Exemple #14
0
def main():
    root = RootPanel()
    tree = Tree()
    cb1 = CheckBox('test 1')
    cb1.addClickListener(onCb1)
    root.add(cb1)
    cb2 = CheckBox('test 2')
    cb2.addClickListener(onCb2)
    item = TreeItem(cb2)
    tree.addItem(item)
    root.add(tree)
Exemple #15
0
    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
        if AMSJavascript.sent > AMSJavascript.recv: 
           self.status.setText('Press button again: AMSJavascript.sent '+str(AMSJavascript.sent)+' AMSJavascript.recv '+str(AMSJavascript.recv))
           return
        if self.commobj.commname == 'No AMS publisher running':
           self.status.setText(self.commobj.commname)
        else:
           self.status.setText('Memories for AMS Comm: '+str(AMSJavascript.sent)+str(AMSJavascript.recv)+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)
Exemple #16
0
 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)
Exemple #17
0
    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)
 def __init__(self):
     """ Construct a new PendingItem instance.
     """
     TreeItem.__init__(self, "Please wait...")
Exemple #19
0
 def addImageItem(self, root, title):
     item = TreeItem(self.imageItemHTML(title + ".gif", title))
     root.addItem(item)
     return item
Exemple #20
0
 def __init__(self):
     TreeItem.__init__(self, "Please wait...")
Exemple #21
0
 def createItem(self, proto):
     proto.item = TreeItem(proto.text)
     proto.item.setUserObject(proto)
     if len(proto.children) > 0:
         proto.item.addItem(PendingItem())
Exemple #22
0
 def createItem(self, label, value=None):
     item = TreeItem(label)
     DOM.setStyleAttribute(item.getElement(), "cursor", "pointer")
     if value is not None:
         item.setUserObject(value)
     return item
 def __init__(self):
     """ Construct a new PendingItem instance.
     """
     TreeItem.__init__(self, "Please wait...")