Python wx.FileConfig() Examples

The following are 4 code examples of wx.FileConfig(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: lang.py    From p2ptv-pi with MIT License 5 votes vote down vote up
def __init__(self, utility, system_default_locale = 'en_EN'):
        self.utility = utility
        default_filename = 'en_EN.lang'
        langpath = os.path.join(self.utility.getPath(), 'data', 'lang')
        sys.stdout.write('Setting up languages\n')
        sys.stdout.write('Default: ' + str(default_filename) + '\n')
        sys.stdout.write('System: ' + str(system_default_locale) + '\n')
        self.user_lang = None
        user_filepath = os.path.join(self.utility.getConfigPath(), 'user.lang')
        if existsAndIsReadable(user_filepath):
            self.user_lang = ConfigReader(user_filepath, 'ABC/language')
        parsed_locale = self.parse_locale(system_default_locale)
        self.local_lang_filename = parsed_locale + '.lang'
        self.local_lang = None
        local_filepath = os.path.join(langpath, self.local_lang_filename)
        if self.local_lang_filename != default_filename and existsAndIsReadable(local_filepath):
            if globalConfig.get_mode() == 'client_wx':
                import wx
                self.local_lang = wx.FileConfig(localFilename=local_filepath)
                self.local_lang.SetPath('ABC/language')
            else:
                self.local_lang = ConfigReader(local_filepath, 'ABC/language')
        self.default_lang = None
        default_filepath = os.path.join(langpath, default_filename)
        if existsAndIsReadable(default_filepath):
            self.default_lang = ConfigReader(default_filepath, 'ABC/language')
        self.cache = {}
        self.langwarning = False 
Example #2
Source File: xrced.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def CreateLocalConf(self, path):
        name = os.path.splitext(path)[0]
        name += '.xcfg'
        return wx.FileConfig(localFilename=name) 
Example #3
Source File: config.py    From InteractiveHtmlBom with MIT License 4 votes vote down vote up
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('/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) 
Example #4
Source File: config.py    From InteractiveHtmlBom with MIT License 4 votes vote down vote up
def save(self):
        f = FileConfig(localFilename=self.config_file)

        f.SetPath('/html_defaults')
        f.WriteBool('dark_mode', self.dark_mode)
        f.WriteBool('show_pads', self.show_pads)
        f.WriteBool('show_fabrication', self.show_fabrication)
        f.WriteBool('show_silkscreen', self.show_silkscreen)
        f.WriteBool('highlight_pin1', self.highlight_pin1)
        f.WriteBool('redraw_on_drag', self.redraw_on_drag)
        f.WriteInt('board_rotation', self.board_rotation)
        f.Write('checkboxes', self.checkboxes)
        f.Write('bom_view', self.bom_view)
        f.Write('layer_view', self.layer_view)
        f.WriteBool('open_browser', self.open_browser)

        f.SetPath('/general')
        bom_dest_dir = self.bom_dest_dir
        if bom_dest_dir.startswith(self.netlist_initial_directory):
            bom_dest_dir = os.path.relpath(
                    bom_dest_dir, self.netlist_initial_directory)
        f.Write('bom_dest_dir', bom_dest_dir)
        f.Write('bom_name_format', self.bom_name_format)
        f.Write('component_sort_order',
                ','.join(self.component_sort_order))
        f.Write('component_blacklist',
                ','.join(self.component_blacklist))
        f.WriteBool('blacklist_virtual', self.blacklist_virtual)
        f.WriteBool('blacklist_empty_val', self.blacklist_empty_val)
        f.WriteBool('include_tracks', self.include_tracks)
        f.WriteBool('include_nets', self.include_nets)

        f.SetPath('/extra_fields')
        f.Write('extra_fields', self._join(self.extra_fields))
        f.WriteBool('normalize_field_case', self.normalize_field_case)
        f.Write('board_variant_field', self.board_variant_field)
        f.Write('board_variant_whitelist',
                ','.join(self.board_variant_whitelist))
        f.Write('board_variant_blacklist',
                ','.join(self.board_variant_blacklist))
        f.Write('dnp_field', self.dnp_field)
        f.Flush()