python类install()的实例源码

test_gettext.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
test_gettext.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
gettextutils.py 文件源码 项目:eclcli 作者: nttcom 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def enable_lazy():
    """Convenience function for configuring _() to use lazy gettext

    Call this at the start of execution to enable the gettextutils._
    function to use lazy gettext functionality. This is useful if
    your project is importing _ directly instead of using the
    gettextutils.install() way of importing the _ function.
    """
    global USE_LAZY
    USE_LAZY = True
Language.py 文件源码 项目:enigma2 作者: BlackHole 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self):
        gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
        gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
        gettext.textdomain("enigma2")
        self.activeLanguage = 0
        self.catalog = None
        self.lang = {}
        self.InitLang()
        self.callbacks = []
test_gettext.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
settings.py 文件源码 项目:Worksets 作者: DozyDolphin 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def initiate_I18N(self):
        default_locale, encoding = locale.getdefaultlocale()
        self.available_languages = collections.OrderedDict()
        self.available_languages['System locale'] = default_locale
        self.available_languages['Dansk'] = 'da_DK'
        self.available_languages['English'] = 'en_US'
        gettext.install('worksets', self.LOCALE_DIR)
        self.change_language(self.language)
settings.py 文件源码 项目:Worksets 作者: DozyDolphin 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def change_language(self, language_name):
        lang_code = self.available_languages[language_name]
        language = gettext.translation('worksets', self.LOCALE_DIR, languages=[lang_code])
        language.install()
test_gettext.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
test_gettext.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
initialize.py 文件源码 项目:griffith 作者: Strit 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def i18n(self, location):
    gettext.bindtextdomain('griffith', location)
    gettext.textdomain('griffith')
    gtk.glade.bindtextdomain('griffith', location)
    gtk.glade.textdomain('griffith')
    gettext.install('griffith', location, unicode=1)
software_updation.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def install(self,DB):
        import stat
        self.backup_db(DB)
        '''output=Popen(['gksudo','rmdir','/var/21'],stdout=PIPE,stderr=PIPE)
        output = p.stdout.read()
        print output
        '''

        #print subprocess.check_call('cd /tmp/smart_school', shell=True)# IF OUT PUT 0 success, if 1, fail, 3 password error
        #print subprocess.call('gksu chmod +x /tmp/smart_school/install.sh',shell=True,stderr=subprocess.STDOUT)# IF OUT PUT 0 success, if 1, fail, 3 password error
        os.chmod('/tmp/smart_school/install.sh', stat.S_IEXEC)
        output=subprocess.call('cd /tmp/smart_school\ngksu ./install.sh',shell=True)#,stderr=subprocess.STDOUT)# IF OUT PUT 0 success, if 1, fail, 3 password error
        return output # success if out put is 0
software_updation.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self,check=True,install=False):
        """Init Worker Thread Class."""
        Thread.__init__(self)

        self.SU=software_update()
        self.check_only=check  # True if need to run functions to check for installation
        self.install_only=install
        self.stopped=False

        self.start()    # start the thread
software_updation.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def on_install(self, event):  # wxGlade: update_win.<event_handler>
        #self.play_animation('')

        if self.button_install.Label=="Check for Update":
            self.button_install.Enable(False)
            self.thread=update_thread(check=True,install=False)
            self.progress_bar.Hide()            

        elif self.button_install.Label=="Install Update":
            #intallhere
            self.button_install.Enable(False)
            self.progress_bar.Show()
            self.thread=update_thread(check=False,install=True)

        event.Skip()
SimpleGladeApp.py 文件源码 项目:gnome-connection-manager 作者: mjun 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def bindtextdomain(app_name, locale_dir=None):
    """    
    Bind the domain represented by app_name to the locale directory locale_dir.
    It has the effect of loading translations, enabling applications for different
    languages.

    app_name:
        a domain to look for translations, tipically the name of an application.

    locale_dir:
        a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
        If omitted or None, then the current binding for app_name is used.
    """    
    try:
        import locale
        import gettext
        locale.setlocale(locale.LC_ALL, "")
        gtk.glade.bindtextdomain(app_name, locale_dir)
        gettext.install(app_name, locale_dir, unicode=1)
    except (IOError,locale.Error), e:
        #force english as default locale
        try:
            os.environ["LANGUAGE"] = "en_US.UTF-8"
            locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
            gtk.glade.bindtextdomain(app_name, locale_dir)
            gettext.install(app_name, locale_dir, unicode=1)
            return
        except:
            #english didnt work, just use spanish
            try:
                __builtins__.__dict__["_"] = lambda x : x        
            except:
                __builtins__["_"] = lambda x : x
test_gettext.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        GettextBaseTest.setUp(self)
        self.localedir = os.curdir
        self.mofile = MOFILE
        gettext.install('gettext', self.localedir)
main.py 文件源码 项目:cozy 作者: geigi 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        self.ui = None

        GObject.threads_init()
        listen()

        Gtk.Application.__init__(self, application_id='com.github.geigi.cozy')

        GLib.setenv("PULSE_PROP_media.role", "music", True)

        import gettext

        locale.bindtextdomain('cozy', localedir)
        locale.textdomain('cozy')
        gettext.install('cozy', localedir)
client.py 文件源码 项目:solaris-ips 作者: oracle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __handle_client_json_api_output(out_json, op, api_inst):
        """This is the main client_json_api output handling function used for
        install, update and uninstall and so on."""

        if "errors" in out_json:
                _generate_error_messages(out_json["status"],
                    out_json["errors"], cmd=op)

        if "data" in out_json and "repo_status" in out_json["data"]:
                display_repo_failures(out_json["data"]["repo_status"])

        __display_plan_messages(api_inst, frozenset([OP_STAGE_PREP,
            OP_STAGE_EXEC]))
        return out_json["status"]
gettextutils.py 文件源码 项目:LIS-Tempest 作者: LIS 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def enable_lazy():
    """Convenience function for configuring _() to use lazy gettext

    Call this at the start of execution to enable the gettextutils._
    function to use lazy gettext functionality. This is useful if
    your project is importing _ directly instead of using the
    gettextutils.install() way of importing the _ function.
    """
    global USE_LAZY
    USE_LAZY = True
elib_intl.py 文件源码 项目:chirp_fork 作者: mach327 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def install(domain, localedir):
    '''
    :param domain: translation domain
    :param localedir: locale directory

    Installs the function _() in Python’s builtin namespace, based on
    domain and localedir. Codeset is always UTF-8.

    As seen below, you usually mark the strings in your application that are
    candidates for translation, by wrapping them in a call to the _() function,
    like this:

    .. sourcecode:: python

        import elib.intl
        elib.intl.install('myapplication', '/path/to/usr/share/locale')
        print _('This string will be translated.')

    Note that this is only one way, albeit the most convenient way,
    to make the _() function available to your application. Because it affects
    the entire application globally, and specifically Python’s built-in
    namespace, localized modules should never install _(). Instead, you should
    use :func:`elib.intl.install_module` to make _() available to your module.
    '''
    _install(domain, localedir, True)
    gettext.install(domain, localedir, unicode=True)
applications.py 文件源码 项目:mate-menu 作者: ubuntu-mate 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def add_to_desktop(self, widget, desktopEntry):
        subprocess.call(['xdg-desktop-icon', 'install', '--novendor', desktopEntry.desktopFile])


问题


面经


文章

微信
公众号

扫码关注公众号