def getstr(s): lang = wx.Locale.GetCanonicalName(wx.GetLocale()) if (lang not in strtab): tab = strtab['default'] else: tab = strtab[lang] return tab[s]
def OnExec(self,e): lang = wx.Locale.GetCanonicalName(wx.GetLocale()) merge_npth = True if self.mergeNpth.GetValue() else False use_aux_origin = True if self.useAuxOrigin.GetValue() else False excellon_format = (EXCELLON_WRITER.DECIMAL_FORMAT, EXCELLON_WRITER.SUPPRESS_LEADING)[self.zeros.GetSelection()] Exec() wx.MessageBox(getstr('COMPLETE',lang)%zip_fname, 'Gerber Zip', wx.OK|wx.ICON_INFORMATION) e.Skip()
def getstr(s): lang = wx.Locale.GetCanonicalName(wx.GetLocale()) tab = strtab['default'] if (lang in strtab): tab = strtab[lang] else: for x in strtab: if lang[0:3] in x: tab = strtab[x] return tab[s]
def GetInfo(index, cat=wx.LOCALE_CAT_DEFAULT): locale = wx.GetLocale() res = GetLocaleInfo(locale.CanonicalName.replace('_', '-'), index, cat) if not res and index in ( wx.LOCALE_SHORT_DATE_FMT, wx.LOCALE_LONG_DATE_FMT, wx.LOCALE_TIME_FMT, wx.LOCALE_DATE_TIME_FMT ): return GetInfoDefaults(index) return res
def __init__(self, parent): lang = wx.Locale.GetCanonicalName(wx.GetLocale()) wx.Dialog.__init__(self, parent, id=-1, title='Gerber-Zip') self.panel = wx.Panel(self) self.description = wx.StaticText(self.panel, wx.ID_ANY, getstr('DESC',lang), pos=(20,10)) self.mergeNpth = wx.CheckBox(self.panel, wx.ID_ANY, getstr('MERGE',lang), pos=(30,40)) self.useAuxOrigin = wx.CheckBox(self.panel, wx.ID_ANY, getstr('AUXORIG',lang), pos=(30,60)) self.zeros = wx.RadioBox(self.panel,wx.ID_ANY, getstr('ZEROS',lang), pos=(30,90), choices=[getstr('DECIMAL',lang), getstr('SUPPRESS',lang)], style=wx.RA_HORIZONTAL) self.execbtn = wx.Button(self.panel, wx.ID_ANY, getstr('EXEC',lang), pos=(30,150)) self.clsbtn = wx.Button(self.panel, wx.ID_ANY, getstr('CLOSE',lang), pos=(170,150)) self.mergeNpth.SetValue(merge_npth) self.useAuxOrigin.SetValue(use_aux_origin) self.clsbtn.Bind(wx.EVT_BUTTON, self.OnClose) self.execbtn.Bind(wx.EVT_BUTTON, self.OnExec)
def 程序_取环境语言缩写(): "返回实力: zh_CN 更多环境语言方法参考:https://wxpython.org/Phoenix/docs/html/wx.Locale.html#wx-locale" return wx.GetLocale().GetName()
def 程序_取环境语言名称(): "返回示例: Chinese (Simplified) 更多环境语言方法参考:https://wxpython.org/Phoenix/docs/html/wx.Locale.html#wx-locale" return wx.GetLocale().GetLocale()
def 程序_系统环境是否支持中文(): "返回True或False 更多环境语言方法参考:https://wxpython.org/Phoenix/docs/html/wx.Language.enumeration.html#wx-language" return wx.GetLocale().IsAvailable(wx.LANGUAGE_CHINESE)
def test_intlGetLocaleFunc(self): # check that this function exists l = wx.GetLocale()