當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。