本文整理汇总了Python中wx.FileConfig方法的典型用法代码示例。如果您正苦于以下问题:Python wx.FileConfig方法的具体用法?Python wx.FileConfig怎么用?Python wx.FileConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.FileConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FileConfig [as 别名]
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
示例2: CreateLocalConf
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FileConfig [as 别名]
def CreateLocalConf(self, path):
name = os.path.splitext(path)[0]
name += '.xcfg'
return wx.FileConfig(localFilename=name)
示例3: load_from_ini
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FileConfig [as 别名]
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)
示例4: save
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FileConfig [as 别名]
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()