示例#1
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "services"])

    services = rosservice.get_service_list(None)
    services.sort()
    
    i = 0
    for service in services:
      i = i + 1
      hdf.setValue("CGI.cur.services.%d" % i, service)
示例#2
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])
        webutil.set_tabs(hdf, ["status", "services"])

        services = rosservice.get_service_list(None)
        services.sort()

        i = 0
        for service in services:
            i = i + 1
            hdf.setValue("CGI.cur.services.%d" % i, service)
示例#3
0
  def display(self, hdf):
    topic = hdf.getValue("Query.topic", "")
    hdf.setValue("CGI.cur.topic", topic)
    webutil.set_tabs(hdf, ["status", "topics"])
    webutil.grabTopics(hdf, ["/topics", topic, "/battery_state", "/power_board_state", "/app_status"])

    topic_data = nodeutil.topic_info(topic)

    if "error" in topic_data:
      hdf.setValue("CGI.cur.error", topic_data["error"])
    else:
      webutil.hdf_array(hdf, sorted(topic_data["publishers"]), "CGI.cur.publishers")
      webutil.hdf_array(hdf, sorted(topic_data["subscribers"]), "CGI.cur.subscribers")
示例#4
0
文件: node.py 项目: PR2/web_interface
  def display(self, hdf):
    node = hdf.getValue("Query.node", "")
    hdf.setValue("CGI.cur.node", node)
    webutil.set_tabs(hdf, ["status", "nodes"])
    webutil.grabTopics(hdf, ["/topics"])

    node_data = nodeutil.node_info(node)

    webutil.hdf_array(hdf, sorted(node_data["subscriptions"]), "CGI.cur.subscriptions")
    webutil.hdf_array(hdf, sorted(node_data["publications"]), "CGI.cur.publications")
    webutil.hdf_array(hdf, sorted(node_data["services"]), "CGI.cur.services")
    
    if "error" in node_data:
      hdf.setValue("CGI.cur.error", node_data["error"])
示例#5
0
    def display(self, hdf):
        #    webutil.grabTopics(hdf, [])
        webutil.set_tabs(hdf, ["status", "services"])

        service = hdf.getValue("Query.service", "")

        args = rosservice.get_service_args(service)
        args = args.strip()
        args = args.split(" ")

        hdf.setValue("CGI.cur.service", service)

        i = 0
        for arg in args:
            i = i + 1
            hdf.setValue("CGI.cur.args.%d" % i, arg)
示例#6
0
  def display(self, hdf):
#    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "services"])

    service = hdf.getValue("Query.service", "")

    args = rosservice.get_service_args(service)
    args = args.strip()
    args = args.split(" ")

    hdf.setValue("CGI.cur.service", service)

    i = 0
    for arg in args:
      i = i + 1
      hdf.setValue("CGI.cur.args.%d" % i, arg)
示例#7
0
    def display(self, hdf):
        node = hdf.getValue("Query.node", "")
        hdf.setValue("CGI.cur.node", node)
        webutil.set_tabs(hdf, ["status", "nodes"])
        webutil.grabTopics(hdf, ["/topics"])

        node_data = nodeutil.node_info(node)

        webutil.hdf_array(hdf, sorted(node_data["subscriptions"]),
                          "CGI.cur.subscriptions")
        webutil.hdf_array(hdf, sorted(node_data["publications"]),
                          "CGI.cur.publications")
        webutil.hdf_array(hdf, sorted(node_data["services"]),
                          "CGI.cur.services")

        if "error" in node_data:
            hdf.setValue("CGI.cur.error", node_data["error"])
示例#8
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "processes"])    
    try:
      proc = subprocess.Popen(["sudo", "ckill", "list"], stdout=subprocess.PIPE)
      out, err = proc.communicate()
      out = string.strip(out)
      i = 0
      lines = out.split('\n')
      if out == "" and hdf.getValue("Query.reset", "") != "":
        self.redirectUri(config.gBaseURL + "webui/reset.py?Action.DoReset=1")
      else:
        for line in lines:
          hdf.setValue("CGI.cur.lines.%d" % i, line)
          i += 1

    except:
      hdf.setValue("CGI.cur.error", "Unable to call ckill on this robot.")
示例#9
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])
        webutil.set_tabs(hdf, ["status", "processes"])
        try:
            proc = subprocess.Popen(["sudo", "ckill", "list"],
                                    stdout=subprocess.PIPE)
            out, err = proc.communicate()
            out = string.strip(out)
            i = 0
            lines = out.split('\n')
            if out == "" and hdf.getValue("Query.reset", "") != "":
                self.redirectUri(config.gBaseURL +
                                 "webui/reset.py?Action.DoReset=1")
            else:
                for line in lines:
                    hdf.setValue("CGI.cur.lines.%d" % i, line)
                    i += 1

        except:
            hdf.setValue("CGI.cur.error",
                         "Unable to call ckill on this robot.")
示例#10
0
    def display(self, hdf):
        webutil.set_tabs(hdf, ["apps", "appinfo"])
        webutil.grabTopics(hdf, [])
        taskid = hdf.getValue("Query.taskid", "")
        doc = app.App(taskid).load_yaml()

        prefix = "CGI.cur.app"
        hdf.setValue(prefix + "." + "taskid", taskid)
        for key, val in doc.items():
            if type(val) is list:
                for i in range(0, len(val)):
                    hdf.setValue(prefix + "." + key + "." + str(i), val[i])
            elif val is not None:
                hdf.setValue(prefix + "." + key, val)
            else:
                hdf.setValue(prefix + "." + key, '')

        # for favorite apps
        user_record = self.authdb.users.lookup(self.username)
        hdf.setValue("CGI.cur.user.favorite_apps", user_record.favorite_apps)

        if user_record.is_favorite_app(taskid):
            hdf.setValue("CGI.cur.app.favorite", "1")
示例#11
0
  def display(self, hdf):
    webutil.set_tabs(hdf, ["apps", "appinfo"])
    webutil.grabTopics(hdf, [])
    taskid = hdf.getValue("Query.taskid", "")
    doc = app.App(taskid).load_yaml()
  
    prefix = "CGI.cur.app"
    hdf.setValue(prefix + "." + "taskid", taskid)
    for key, val in doc.items():
      if type(val) is list:
        for i in range(0,len(val)):
          hdf.setValue(prefix + "." + key + "." + str(i), val[i])
      elif val is not None:
        hdf.setValue(prefix + "." + key, val)
      else:
        hdf.setValue(prefix + "." + key, '')

    # for favorite apps
    user_record = self.authdb.users.lookup(self.username)
    hdf.setValue("CGI.cur.user.favorite_apps", user_record.favorite_apps)

    if user_record.is_favorite_app(taskid):
      hdf.setValue("CGI.cur.app.favorite", "1")
示例#12
0
    def display(self, hdf):
        webutil.set_tabs(hdf, ["apps", "appgroup"])

        i = 0
        for taskid in self.appids:
            doc = launchman.app.App(taskid).load_yaml()

            prefix = "CGI.cur.app_group.apps.%s" % i
            hdf.setValue(prefix + "." + "taskid", taskid)
            for key, val in doc.items():
                if val is not None:
                    hdf.setValue(prefix + "." + key, val)
                else:
                    hdf.setValue(prefix + "." + key, '')
            i += 1

        self.appgroup.hdfExport("CGI.cur.app_group", hdf)

        # experimental new stuff
        apps = webutil.list_apps()
        n = 0
        for appfn in apps:
            taskid = db_webui.path2taskid(appfn)
            prefix = "CGI.cur.available_apps.%d" % n
            _app = launchman.app.App(taskid)
            doc = _app.load_yaml()

            if taskid in self.appids:
                pass
            else:
                n = n + 1
                hdf.setValue(prefix + "." + "taskid", taskid)
                for key, val in doc.items():
                    if val is not None:
                        hdf.setValue(prefix + "." + key, val)
                    else:
                        hdf.setValue(prefix + "." + key, '')
示例#13
0
  def display(self, hdf):
    webutil.set_tabs(hdf, ["apps", "appgroup"])
   
    i = 0
    for taskid in self.appids:
      doc = launchman.app.App(taskid).load_yaml()
  
      prefix = "CGI.cur.app_group.apps.%s" % i
      hdf.setValue(prefix + "." + "taskid", taskid)
      for key, val in doc.items():
        if val is not None:
          hdf.setValue(prefix + "." + key, val)
        else:
          hdf.setValue(prefix + "." + key, '')
      i += 1

    self.appgroup.hdfExport("CGI.cur.app_group", hdf)

    # experimental new stuff
    apps = webutil.list_apps()
    n = 0
    for appfn in apps:
      taskid = db_webui.path2taskid(appfn)
      prefix = "CGI.cur.available_apps.%d" % n
      _app = launchman.app.App(taskid)
      doc = _app.load_yaml()

      if taskid in self.appids:
        pass
      else: 
        n = n + 1 
        hdf.setValue(prefix + "." + "taskid", taskid)
        for key, val in doc.items():
          if val is not None:
            hdf.setValue(prefix + "." + key, val)
          else:
            hdf.setValue(prefix + "." + key, '')
示例#14
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "params"])    

    _c, _t, params = self.master.getParam(_get_caller_id(), "/")
    self.flatten(hdf, params, path="CGI.cur.params.")
示例#15
0
 def display(self, hdf):
   webutil.grabTopics(hdf, ["/topics"])
   webutil.set_tabs(hdf, ["status", "monitor"])
示例#16
0
 def display(self, hdf):
     webutil.grabTopics(hdf, ["/topics"])
     webutil.set_tabs(hdf, ["status", "topics"])
示例#17
0
 def display(self, hdf):
   webutil.set_tabs(hdf, ["admin"])
   if self.userRec.role != "admin":
     hdf.setValue("Content", "not_admin.cs")
示例#18
0
 def display(self, hdf):
   webutil.set_tabs(hdf, ["admin"])
示例#19
0
 def display(self, hdf):
     webutil.set_tabs(hdf, ["admin"])
示例#20
0
 def display(self, hdf):
   webutil.grabTopics(hdf, ["/rosout", "/users"])
   webutil.set_tabs(hdf, ["status", "log"])
示例#21
0
 def display(self, hdf):
     webutil.set_tabs(hdf, ["status", "powerboard"])
示例#22
0
 def display(self, hdf):
   webutil.set_tabs(hdf, ["admin", "users"])
   username = hdf.getValue("Query.username", "").strip()
   row = self.authdb.users.lookup(username=username)
   row.hdfExport("CGI.cur.user", hdf)
示例#23
0
 def display(self, hdf):
   webutil.set_tabs(hdf, ["status", "powerboard"])
示例#24
0
 def display(self, hdf):
     webutil.set_tabs(hdf, ["admin", "users"])
     username = hdf.getValue("Query.username", "").strip()
     row = self.authdb.users.lookup(username=username)
     row.hdfExport("CGI.cur.user", hdf)
示例#25
0
 def display(self, hdf):
     webutil.set_tabs(hdf, ["admin", "users"])
     #users = self.auth_db.getAllUsers()
     user_records = self.auth_db.users.fetchAllRows()
     user_records.hdfExport("CGI.cur.users", hdf)
示例#26
0
 def display(self, hdf):
     webutil.grabTopics(hdf, ["/rosout", "/users"])
     webutil.set_tabs(hdf, ["status", "log"])
示例#27
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])

        hdf.setValue("CGI.now", str(time.time()))
        webutil.set_tabs(hdf, ["apps"])

        apps = self.db.apps.fetchAllRows()
        prefix = "CGI.cur.apps"
        i = 0
        for app in apps:
            i = i + 1
            aprefix = prefix + ".%d" % i
            app.hdfExport(aprefix, hdf)
            app.fetchApp(aprefix, hdf)

        # experimental new stuff
        apps = webutil.list_apps()
        categories = {}
        user_record = self.authdb.users.lookup(self.username)
        user_apps = user_record.favorite_apps_list()

        taskids = [db_webui.path2taskid(app) for app in apps]
        actual_apps = []

        for user_app in user_apps:
            if user_app in taskids:
                actual_apps.append(user_app)
        categories["Favorites"] = actual_apps

        n = 0
        for appfn in apps:
            taskid = db_webui.path2taskid(appfn)
            n = n + 1
            prefix = "CGI.cur.available_apps.%s" % taskid
            _app = launchman.app.App(taskid)
            doc = _app.load_yaml()

            iapp = self.db.apps.lookup(taskid=taskid)
            if iapp:
                pass

            # only show apps relevant to this type of robot
            robot_type = config.get_robot_type()
            if "robot" in doc and robot_type != doc["robot"]:
                continue

            try:
                category_apps = categories[doc.get("category", "Other")]
            except KeyError:
                category_apps = []
                categories[doc.get("category", "Other")] = category_apps
            category_apps.append(taskid)

            hdf.setValue(prefix + ".taskid", taskid)
            for key, val in doc.items():
                if type(val) is list:
                    for i in range(0, len(val)):
                        hdf.setValue(prefix + "." + key + "." + str(i), val[i])
                elif val is not None:
                    hdf.setValue(prefix + "." + key, val)
                else:
                    hdf.setValue(prefix + "." + key, '')

            if user_record.is_favorite_app(taskid):
                hdf.setValue(prefix + ".favorite", "1")

        def compare_categories(a, b):
            if a[0] == "Favorites":
                return -1
            if b[0] == "Favorites":
                return 1
            else:
                return cmp(a, b)

        prefix = "CGI.cur.categories"
        i = 0
        for category, apps in sorted(categories.items(), compare_categories):
            hdf.setValue(prefix + ".%d" % i, category)
            j = 0
            for app in apps:
                hdf.setValue(prefix + ".%d.apps.%d" % (i, j), app)
                j = j + 1
            i = i + 1
示例#28
0
 def display(self, hdf):
   webutil.set_tabs(hdf, ["admin", "users"])
   #users = self.auth_db.getAllUsers()
   user_records = self.auth_db.users.fetchAllRows()
   user_records.hdfExport("CGI.cur.users", hdf)