Ejemplo n.º 1
0
 def write_config(robot_list):
     """ Write the 'component_config.py' file with the supplied settings """
     if not 'component_config.py' in bpymorse.get_texts().keys():
         bpymorse.new_text()
         bpymorse.get_last_text().name = 'component_config.py'
     cfg = bpymorse.get_text('component_config.py')
     cfg.clear()
     cfg.write('component_datastream = ' + pprint.pformat(
         Configuration._remove_entries(Configuration.datastream,
                                       robot_list)))
     cfg.write('\n')
     cfg.write('component_modifier = ' + pprint.pformat(
         Configuration._remove_entries(Configuration.modifier, robot_list)))
     cfg.write('\n')
     cfg.write('component_service = ' + pprint.pformat(
         Configuration._remove_entries(Configuration.service, robot_list)))
     cfg.write('\n')
     cleaned_overlays = {}
     for k, v in Configuration.overlay.items():
         cleaned_overlays[k] = Configuration._remove_entries(v, robot_list)
     cfg.write('overlays = ' + pprint.pformat(cleaned_overlays))
     cfg.write('\n')
     cfg.write('stream_manager = ' +
               pprint.pformat(Configuration.stream_manager))
     cfg.write('\n')
Ejemplo n.º 2
0
 def write_config(robot_list):
     """ Write the 'component_config.py' file with the supplied settings """
     if not "component_config.py" in bpymorse.get_texts().keys():
         bpymorse.new_text()
         bpymorse.get_last_text().name = "component_config.py"
     cfg = bpymorse.get_text("component_config.py")
     cfg.clear()
     cfg.write(
         "component_datastream = "
         + pprint.pformat(Configuration._remove_entries(Configuration.datastream, robot_list))
     )
     cfg.write("\n")
     cfg.write(
         "component_modifier = " + pprint.pformat(Configuration._remove_entries(Configuration.modifier, robot_list))
     )
     cfg.write("\n")
     cfg.write(
         "component_service = " + pprint.pformat(Configuration._remove_entries(Configuration.service, robot_list))
     )
     cfg.write("\n")
     cleaned_overlays = {}
     for k, v in Configuration.overlay.items():
         cleaned_overlays[k] = Configuration._remove_entries(v, robot_list)
     cfg.write("overlays = " + pprint.pformat(cleaned_overlays))
     cfg.write("\n")
     cfg.write("stream_manager = " + pprint.pformat(Configuration.stream_manager))
     cfg.write("\n")
Ejemplo n.º 3
0
    def after_renaming(self):
        def dict_to_file(dic, text):
            text.clear()
            text.write('import json \np = json.loads("' + json.dumps(dic) +
                       '")')

        if not 'parameters.py' in bpymorse.get_texts().keys():
            bpymorse.new_text()
            bpymorse.get_last_text().name = 'parameters.py'
            dict_to_file({}, bpymorse.get_text('parameters.py'))

        #text = bpymorse.get_text('parameters.py')
        # load the parameters dictionary from the file
        #parameters = json.loads(text.as_string())
        from parameters import p

        # set the Object dictionary in the parameters dictionary
        p[self.name] = self.parameters

        dict_to_file(p, bpymorse.get_text('parameters.py'))
Ejemplo n.º 4
0
 def write_config():
     """ Write the 'component_config.py' file with the supplied settings """
     if not "component_config.py" in bpymorse.get_texts().keys():
         bpymorse.new_text()
         bpymorse.get_last_text().name = "component_config.py"
     cfg = bpymorse.get_text("component_config.py")
     cfg.clear()
     cfg.write("component_datastream = " + json.dumps(Configuration.datastream, indent=1))
     cfg.write("\n")
     cfg.write("component_modifier = " + json.dumps(Configuration.modifier, indent=1))
     cfg.write("\n")
     cfg.write("component_service = " + json.dumps(Configuration.service, indent=1))
     cfg.write("\n")
     cfg.write("overlays = " + json.dumps(Configuration.overlay, indent=1))
     cfg.write("\n")
Ejemplo n.º 5
0
 def write_config():
     """ Write the 'component_config.py' file with the supplied settings """
     if not 'component_config.py' in bpymorse.get_texts().keys():
         bpymorse.new_text()
         bpymorse.get_last_text().name = 'component_config.py'
     cfg = bpymorse.get_text('component_config.py')
     cfg.clear()
     cfg.write('component_datastream = ' + json.dumps(Configuration.datastream, indent=1) )
     cfg.write('\n')
     cfg.write('component_modifier = ' + json.dumps(Configuration.modifier, indent=1) )
     cfg.write('\n')
     cfg.write('component_service = ' + json.dumps(Configuration.service, indent=1) )
     cfg.write('\n')
     cfg.write('overlays = ' + json.dumps(Configuration.overlay, indent=1) )
     cfg.write('\n')
Ejemplo n.º 6
0
 def write_config(robot_list):
     """ Write the 'component_config.py' file with the supplied settings """
     if not 'component_config.py' in bpymorse.get_texts().keys():
         bpymorse.new_text()
         bpymorse.get_last_text().name = 'component_config.py'
     cfg = bpymorse.get_text('component_config.py')
     cfg.clear()
     cfg.write('component_datastream = ' + json.dumps(
         Configuration._remove_entries(Configuration.datastream, robot_list),
         indent=1) )
     cfg.write('\n')
     cfg.write('component_modifier = ' + json.dumps(
         Configuration._remove_entries(Configuration.modifier, robot_list),
         indent=1) )
     cfg.write('\n')
     cfg.write('component_service = ' + json.dumps(
         Configuration._remove_entries(Configuration.service, robot_list),
         indent=1) )
     cfg.write('\n')
     cleaned_overlays = {}
     for k, v in Configuration.overlay.items():
         cleaned_overlays[k] = Configuration._remove_entries(v, robot_list)
     cfg.write('overlays = ' + json.dumps(cleaned_overlays, indent=1) )
     cfg.write('\n')