Example #1
0
 def publish_selected(self):
     #get selected rows
     for parmkey in self._parmlist:
         #      if not self._parmdict[parmkey]['publish']:
         if self.parmtable.isRowSelected(self._parmdict[parmkey]['row']):
             meqds.enable_node_publish(
                 parmkey, enable=not self._parmdict[parmkey]['publish'])
Example #2
0
def makeDataItem(udi, data=None, viewer=None, publish=False, viewopts={}):
    """Creates a data item given a UDI"""
    # parse udi
    (cat, name, trailer) = meqds.parse_udi(udi)
    if cat == 'node':
        if not name:
            raise ValueError, "invalid UDI: " + udi
        # check name or node index
        nn = name.split('#', 1)
        if not nn[0]:
            name = int(nn[1])
            # use node index if no name given
        node = meqds.nodelist[name]
        # enable publishing but do not ask for a state update -- this will
        # be done by the item later
        if publish:
            meqds.enable_node_publish(node, True, get_state=False)
        if not trailer:
            return makeNodeDataItem(node, viewer, viewopts)
        else:
            (name, caption) = meqds.make_udi_node_caption(node, trailer)
            desc = "node %s#%d, state field %s" % (node.name, node.nodeindex,
                                                   trailer)
            return Grid.DataItem(udi,
                                 name=name,
                                 caption=caption,
                                 desc=desc,
                                 data=data,
                                 refresh=curry(meqds.request_node_state,
                                               node.nodeindex),
                                 viewer=viewer,
                                 viewopts=viewopts)
    elif cat == 'forest':
        if not trailer:
            return makeForestDataItem(data, viewer, viewopts)
        else:
            (name,
             caption) = meqds.make_parsed_udi_caption(cat, name, trailer)
            return Grid.DataItem(udi,
                                 name=name,
                                 caption=caption,
                                 desc="Forest state field " + trailer,
                                 data=data,
                                 refresh=meqds.request_forest_state,
                                 viewer=viewer,
                                 viewopts=viewopts)
    else:
        raise ValueError, "can't display " + udi
Example #3
0
def makeDataItem (udi,data=None,viewer=None,publish=False,viewopts={}):
  """Creates a data item given a UDI""";
  # parse udi
  (cat,name,trailer) = meqds.parse_udi(udi);
  if cat == 'node':
    if not name:
      raise ValueError,"invalid UDI: "+udi;
    # check name or node index
    nn = name.split('#',1);
    if not nn[0]:
      name = int(nn[1]);     # use node index if no name given
    node = meqds.nodelist[name];
    # enable publishing but do not ask for a state update -- this will
    # be done by the item later
    if publish:
      meqds.enable_node_publish(node,True,get_state=False);
    if not trailer:
      return makeNodeDataItem(node,viewer,viewopts);
    else:
      (name,caption) = meqds.make_udi_node_caption(node,trailer);
      desc = "node %s#%d, state field %s" % (node.name,node.nodeindex,trailer);
      return Grid.DataItem(udi,
                name=name,caption=caption,desc=desc,
                data=data,
                refresh=curry(meqds.request_node_state,node.nodeindex),
                              viewer=viewer,viewopts=viewopts);
  elif cat == 'forest':
    if not trailer:
      return makeForestDataItem(data,viewer,viewopts);
    else:
      (name,caption) = meqds.make_parsed_udi_caption(cat,name,trailer);
      return Grid.DataItem(udi,
         name=name,caption=caption,desc="Forest state field "+trailer,
         data=data,
         refresh=meqds.request_forest_state,
         viewer=viewer,viewopts=viewopts);
  else:
    raise ValueError,"can't display "+udi;
Example #4
0
 def publish_selected(self):
     # get selected rows
     for parmkey in self._parmlist:
         #      if not self._parmdict[parmkey]['publish']:
         if self.parmtable.isRowSelected(self._parmdict[parmkey]["row"]):
             meqds.enable_node_publish(parmkey, enable=not self._parmdict[parmkey]["publish"])