def load_from_ini(self): """Init from config file if it exists.""" if not os.path.isfile(self.config_file): return f = FileConfig(localFilename=self.config_file) f.SetPath('/general') self.gcode_dest_dir = f.Read('gcode_dest_dir', self.gcode_dest_dir) self.gcode_name_format = f.Read('gcode_name_format', self.gcode_name_format) self.laser_x_width = f.Read('laser_x_width', str(self.laser_x_width)) self.laser_y_width = f.Read('laser_x_width', str(self.laser_y_width)) self.laser_pad_passes = f.Read('laser_pad_passes', str(self.laser_pad_passes)) self.laser_pad_intensity = f.Read('laser_pad_intensity', str(self.laser_pad_intensity)) self.laser_border_intensity = f.Read('laser_border_intensity', str(self.laser_border_intensity)) self.laser_speed = f.Read('laser_speed', str(self.laser_speed)) self.laser_border_speed = f.Read('laser_border_speed', str(self.laser_border_speed)) self.component_blacklist = self._split( f.Read('component_blacklist', ','.join(self.component_blacklist))) self.blacklist_virtual = f.ReadBool('blacklist_virtual', self.blacklist_virtual) self.blacklist_empty_val = f.ReadBool('blacklist_empty_val', self.blacklist_empty_val)
def __init__(self, version): """Init from config file if it exists.""" self.version = version if not os.path.isfile(self.config_file): return f = FileConfig(localFilename=self.config_file) f.SetPath('/html_defaults') self.dark_mode = f.ReadBool('dark_mode', self.dark_mode) self.show_pads = f.ReadBool('show_pads', self.show_pads) self.show_fabrication = f.ReadBool( 'show_fabrication', self.show_fabrication) self.show_silkscreen = f.ReadBool( 'show_silkscreen', self.show_silkscreen) self.highlight_pin1 = f.ReadBool('highlight_pin1', self.highlight_pin1) self.redraw_on_drag = f.ReadBool('redraw_on_drag', self.redraw_on_drag) self.board_rotation = f.ReadInt('board_rotation', self.board_rotation) self.checkboxes = f.Read('checkboxes', self.checkboxes) self.bom_view = f.Read('bom_view', self.bom_view) self.layer_view = f.Read('layer_view', self.layer_view) self.open_browser = f.ReadBool('open_browser', self.open_browser) f.SetPath('/general') self.bom_dest_dir = f.Read('bom_dest_dir', self.bom_dest_dir) self.bom_name_format = f.Read('bom_name_format', self.bom_name_format) self.component_sort_order = self._split(f.Read( 'component_sort_order', ','.join(self.component_sort_order))) self.component_blacklist = self._split(f.Read( 'component_blacklist', ','.join(self.component_blacklist))) self.blacklist_virtual = f.ReadBool( 'blacklist_virtual', self.blacklist_virtual) self.blacklist_empty_val = f.ReadBool( 'blacklist_empty_val', self.blacklist_empty_val) self.include_tracks = f.ReadBool('include_tracks', self.include_tracks) self.include_nets = f.ReadBool('include_nets', self.include_nets) f.SetPath('/extra_fields') self.extra_fields = self._split(f.Read( 'extra_fields', self._join(self.extra_fields))) self.normalize_field_case = f.ReadBool( 'normalize_field_case', self.normalize_field_case) self.board_variant_field = f.Read( 'board_variant_field', self.board_variant_field) self.board_variant_whitelist = self._split(f.Read( 'board_variant_whitelist', ','.join(self.board_variant_whitelist))) self.board_variant_blacklist = self._split(f.Read( 'board_variant_blacklist', ','.join(self.board_variant_blacklist))) self.dnp_field = f.Read('dnp_field', self.dnp_field)
def load_from_ini(self): """Init from config file if it exists.""" if not os.path.isfile(self.config_file): return f = FileConfig(localFilename=self.config_file) f.SetPath('/general') self.output_dest_dir = f.Read('output_dest_dir', self.output_dest_dir) self.output_name_format = f.Read('output_name_format', self.output_name_format) f.SetPath("/layers") for index in range(len(self.layers)): l = self.layers[index] l.enabled = f.ReadBool(f'layer{l.id}_enabled', l.enabled) l.ext = f.Read(f'layer{l.id}_ext', l.ext)