Exemplo n.º 1
0
 def update_description(self, index, cfg, name, displayed_name, robot_type,
                        description, images):
     '''
     Sets the values of an existing item to the given items only if the current
     value is empty.
     '''
     if index < len(self._data):
         obj = self._data[index]
         if cfg not in obj['cfgs']:
             obj['cfgs'].append(cfg)
         if not obj['name']:
             obj['name'] = name
         if not obj['displayed_name']:
             obj['displayed_name'] = displayed_name
         if not obj['type']:
             obj['type'] = robot_type
         if not obj['description']:
             obj['description'] = replace_paths(description)
         if not obj['images']:
             for image_path in images:
                 img = interpret_path(image_path)
                 if img and img[0] != os.path.sep:
                     img = os.path.join(nm.settings().PACKAGE_DIR,
                                        image_path)
                 if os.path.isfile(img):
                     obj['images'].append(QPixmap(img))
Exemplo n.º 2
0
 def test_replace_paths(self):
     text_path = "$(find fkie_node_manager_daemon)/resources/include_dummy.launch, $(find fkie_node_manager)/launch/demo_bar.launch"
     path = replace_paths(text_path)
     nm_path = os.path.dirname(self.nm_path.rstrip(os.path.sep))
     path_exp = "%s/fkie_node_manager_daemon/resources/include_dummy.launch, %s/launch/demo_bar.launch" % (
         nm_path, self.nmgr_path.rstrip(os.path.sep))
     self.assertEqual(
         path_exp, path,
         "wrong replace_paths, expected: %s, got: %s" % (path_exp, path))