当前位置: 首页>>代码示例>>Python>>正文


Python wx.Locale方法代码示例

本文整理汇总了Python中wx.Locale方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Locale方法的具体用法?Python wx.Locale怎么用?Python wx.Locale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.Locale方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def setUpClass(cls):
        WXGladeBaseTest.setUpClass()
        xrc2wxg._write_timestamp = False

        # create an simply application
        cls.app = wx.App()
        cls.locale = wx.Locale(wx.LANGUAGE_DEFAULT)
        compat.wx_ArtProviderPush(main.wxGladeArtProvider())
        import history
        common.history = history.History()
        cls.frame = main.wxGladeFrame()

        # suppress wx error messages
        cls.nolog = wx.LogNull()

        #cls.app.SetAssertMode(0) # avoid triggering of wx assertions; sometimes needed for debugging

        # hide all windows
        #cls.frame.Hide()
        #cls.frame.hide_all() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:22,代码来源:testsupport_new.py

示例2: update_language

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def update_language(new_language):
    global locale, language
    language = new_language
    if locale:
        del locale

    locale = wx.Locale(language)
    if locale.IsOk():
        locale.AddCatalogLookupPathPrefix(os.path.join(get_module_path(), "locale"))
        locale.AddCatalog("guiminer")
    else:
        locale = None 
开发者ID:theRealTacoTime,项目名称:poclbm,代码行数:14,代码来源:guiminer.py

示例3: OnInit

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def OnInit(self):
        """Starts tray icon loop."""
        frame = wx.Frame(None)
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH_US)
        self.SetTopWindow(frame)
        TaskBarIcon(frame)
        return True 
开发者ID:hhannine,项目名称:superpaper,代码行数:9,代码来源:tray.py

示例4: getlanguageDict

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def getlanguageDict():
    languageDict = {}
    
    for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]:
        i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang))
        if i:
            languageDict[i.CanonicalName] = i.Description

    return languageDict

# -----------------------------------------------------------------------------
# m a k e P O ( )         -- Build the Portable Object file for the application --
# ^^^^^^^^^^^^^^^
# 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:16,代码来源:mki18n.py

示例5: OnInit

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def OnInit(self):
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__

        # replace text based exception handler by a graphical exception dialog
        sys.excepthook = self.graphical_exception_handler

        # use graphical implementation to show caught exceptions
        self._exception_orig = logging.exception  # Reference to original implementation of logging.exception()
        logging.exception = self.exception

        # needed for wx >= 2.3.4 to disable wxPyAssertionError exceptions
        if not config.debugging:
            self.SetAssertMode(0)

        common.init_preferences()

        self.locale = wx.Locale(wx.LANGUAGE_DEFAULT)  # avoid PyAssertionErrors
        #compat.wx_ArtProviderPush(wxGladeArtProvider())

        frame = wxGladeFrame()
        self.SetTopWindow(frame)
        self.SetExitOnFrameDelete(True)

        self.Bind(wx.EVT_IDLE, self.OnIdle)

        return True 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:29,代码来源:main.py

示例6: getlanguageDict

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def getlanguageDict():
    languageDict = {}

    for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]:
        i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang))
        if i:
            languageDict[i.CanonicalName] = i.Description

    return languageDict

# -----------------------------------------------------------------------------
# m a k e P O ( )         -- Build the Portable Object file for the application --
# ^^^^^^^^^^^^^^^
# 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:16,代码来源:update-po.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def __init__(self):
        self.onExitFuncs = []
        wx.App.__init__(self, 0)
        lang_id = LCID_TO_WX.get(kernel32.GetUserDefaultUILanguage(), None)

        if lang_id is not None:
            self.locale = wx.Locale(lang_id)

        self.shouldVeto = False
        self.firstQuery = True
        self.endSession = False
        self.frame = wx.Frame(None)
        self.hwnd = self.frame.GetHandle() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:15,代码来源:App.py

示例8: SetupI18n

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def SetupI18n():
    # Get folder containing translation files
    localedir = os.path.join(beremiz_dir, "locale")
    # Get the default language
    langid = wx.LANGUAGE_DEFAULT
    # Define translation domain (name of translation files)
    domain = "Beremiz"

    # Define locale for wx
    loc = builtins.__dict__.get('loc', None)
    if loc is None:
        wx.LogGui.EnableLogging(False)
        loc = wx.Locale(langid)
        wx.LogGui.EnableLogging(True)
        builtins.__dict__['loc'] = loc
        # Define location for searching translation files
    loc.AddCatalogLookupPathPrefix(localedir)
    # Define locale domain
    loc.AddCatalog(domain)

    import locale
    global default_locale
    default_locale = locale.getdefaultlocale()[1]

    # sys.stdout.encoding = default_locale
    # if Beremiz_service is started from Beremiz IDE
    # sys.stdout.encoding is None (that means 'ascii' encoding').
    # And unicode string returned by wx.GetTranslation() are
    # automatically converted to 'ascii' string.
    def unicode_translation(message):
        return wx.GetTranslation(message).encode(default_locale)

    builtins.__dict__['_'] = unicode_translation
    # builtins.__dict__['_'] = wx.GetTranslation


# Life is hard... have a candy.
# pylint: disable=wrong-import-position,wrong-import-order 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:40,代码来源:Beremiz_service.py

示例9: AddCatalog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def AddCatalog(locale_dir):
    if os.path.exists(locale_dir) and os.path.isdir(locale_dir):
        domain = GetDomain(locale_dir)
        if domain is not None:
            global locale
            if locale is None:
                # Define locale for wx
                wx.LogGui.EnableLogging(False)
                locale = wx.Locale(wx.LANGUAGE_DEFAULT)
                wx.LogGui.EnableLogging(True)

            locale.AddCatalogLookupPathPrefix(locale_dir)
            locale.AddCatalog(domain) 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:15,代码来源:TranslationCatalogs.py

示例10: getlanguageDict

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def getlanguageDict():
    languageDict = {}
    getSupportedLanguageDict('Beremiz')
    if wx.VERSION >= (3, 0, 0):
        _app = wx.App()
    else:
        _app = wx.PySimpleApp()

    for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]:
        i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang))
        if i:
            languageDict[i.CanonicalName] = i.Description

    return languageDict 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:16,代码来源:mki18n.py

示例11: start

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def start(self):
			result = True
			self.help_file = self.app_name + '.htb'
			#SETUP LANGUAGE
			lang_catalog = getdefaultlocale()[0]
			list_trans = []
			current_trans = -1
			i = 0
			self.wx_coding = 'ansi'
			if wx.USE_UNICODE:
				self.wx_coding = 'unicode'
			if os.path.exists('lang/%s'%lang_catalog):
				for dir_name in os.listdir('lang'):
					if os.path.exists('lang/%s/%s_%s.mo'%(dir_name, self.app_name, self.wx_coding)):
						if dir_name == lang_catalog:
							current_trans = i
							self.help_file = 'lang/' + dir_name + '/'+ self.help_file
						list_trans.append(gettext.GNUTranslations(open('lang/%s/%s_%s.mo'%(dir_name, self.app_name, self.wx_coding), 'rb')))
						i += 1
				if len(list_trans) > 0:
					try:
						list_trans[current_trans].install(unicode = wx.USE_UNICODE)
					except:
						print print_error()
			if current_trans == -1:
				trans = gettext.NullTranslations()
				trans.install(unicode = wx.USE_UNICODE)
			# SETUP WX LANGUAGE TRANSLATION TO OS DEFAULT LANGUAGE
			# WX DIRECTORY MUST BE TO CONTAIN LANG DIRECTORY
			self.locale = wx.Locale(wx.LANGUAGE_DEFAULT)
			# CHECK EXISTS INSTANCE
			name_user = wx.GetUserId()
			name_instance = self.app_name + '::'
			self.instance_checker = wx.SingleInstanceChecker(name_instance + name_user)
			if self.instance_checker.IsAnotherRunning():
				wx.MessageBox(_('Software is already running.'), _('Warning'))
				return False
			# CREATE HTML HELP CONTROLLER
			wx.FileSystem.AddHandler(wx.ZipFSHandler())
			self.help_controller = HtmlHelpController()
			if os.path.exists(self.help_file):
				self.help_controller.AddBook(self.help_file)
			#ABOUT APPLICATION
			self.developers = [_('Max Kolosov')]
			self.copyright = _('(C) 2009 Max Kolosov')
			self.web_site = ('http://vosolok2008.narod.ru', _('Home page'))
			self.email = ('mailto:maxkolosov@inbox.ru', _('email for feedback'))
			self.license = _('BSD license')
			self.about_description = _('wxPython bass music player.')
			#CREATE MAIN FRAME
			self.main_frame = main_frame(None, wx.ID_ANY, self.app_name, app = self)
			self.SetTopWindow(self.main_frame)
			self.main_frame.Show()
			return result 
开发者ID:Wyliodrin,项目名称:pybass,代码行数:56,代码来源:wx_bass_control.py

示例12: start

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Locale [as 别名]
def start(self):
			result = True
			self.help_file = self.app_name + '.htb'
			#SETUP LANGUAGE
			lang_catalog = getdefaultlocale()[0]
			list_trans = []
			current_trans = -1
			i = 0
			if os.path.exists('lang/%s'%lang_catalog):
				for dir_name in os.listdir('lang'):
					if os.path.exists('lang/%s/%s.mo'%(dir_name, self.app_name)):
						if dir_name == lang_catalog:
							current_trans = i
							self.help_file = 'lang/' + dir_name + '/'+ self.help_file
						list_trans.append(gettext.GNUTranslations(open('lang/%s/%s.mo'%(dir_name, self.app_name), 'rb')))
						i += 1
				if len(list_trans) > 0:
					try:
						list_trans[current_trans].install(unicode = True)#wx.USE_UNICODE
					except:
						print_error()
			if current_trans == -1:
				trans = gettext.NullTranslations()
				trans.install(unicode = True)#wx.USE_UNICODE
			# SETUP WX LANGUAGE TRANSLATION TO OS DEFAULT LANGUAGE
			# WX DIRECTORY MUST BE TO CONTAIN LANG DIRECTORY
			self.locale = wx.Locale(wx.LANGUAGE_DEFAULT)
			# CHECK EXISTS INSTANCE
			name_user = wx.GetUserId()
			name_instance = self.app_name + '::'
			self.instance_checker = wx.SingleInstanceChecker(name_instance + name_user)
			if self.instance_checker.IsAnotherRunning():
				wx.MessageBox(_('Software is already running.'), _('Warning'))
				return False
			# CREATE HTML HELP CONTROLLER
			#~ wx.FileSystem.AddHandler(wx.ZipFSHandler())
			self.help_controller = HtmlHelpController()
			if os.path.exists(self.help_file):
				self.help_controller.AddBook(self.help_file)
			#ABOUT APPLICATION
			self.developers = [_('Maxim Kolosov')]
			self.copyright = _('(C) 2013 Max Kolosov')
			self.web_site = ('http://pybass.sf.net', _('Home page'))
			self.email = ('mailto:pyirrlicht@gmail.com', _('email for feedback'))
			self.license = _('BSD license')
			self.about_description = _('wxPython bass music player.')
			#CREATE MAIN FRAME
			self.main_frame = main_frame(None, wx.ID_ANY, self.app_name, app = self)
			self.SetTopWindow(self.main_frame)
			self.main_frame.Show()
			return result 
开发者ID:Wyliodrin,项目名称:pybass,代码行数:53,代码来源:wx_ctrl_phoenix.py


注:本文中的wx.Locale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。