示例#1
0
    def GET(self):
        global lang_in_use
        inputs = web.webapi.input(prev='/home/', ln='')
        if inputs.ln == 'cn':
            lang_in_use = 'zh_CN'
        elif inputs.ln == 'en':
            lang_in_use = 'en_US'
        elif inputs.ln == 'fr':
            lang_in_use = 'fr'
        elif inputs.ln == 'sk_SK':
            lang_in_use = 'sk_SK'
        elif inputs.ln == 'pt_BR':
            lang_in_use = 'pt_BR'
        elif inputs.ln == 'de_DE':
            lang_in_use = 'de_DE'
        else:
            lang_in_use = 'en_US'

        gettext.translation('messages', localedir,
                            languages=[lang_in_use]).install(True)

        seafile_rpc.set_config('lang_in_use', lang_in_use)

        default_options['lang'] = lang_in_use

        raise web.seeother(inputs.prev)
示例#2
0
    def GET(self):
        global lang_in_use
        inputs = web.webapi.input(prev='/home/', ln='')
        if inputs.ln == 'cn':
             lang_in_use = 'zh_CN'
        elif inputs.ln == 'en':
             lang_in_use =  'en_US'
        elif inputs.ln == 'fr':
             lang_in_use =  'fr'
        elif inputs.ln == 'sk_SK':
             lang_in_use =  'sk_SK'
        elif inputs.ln == 'pt_BR':
             lang_in_use = 'pt_BR'
        elif inputs.ln == 'de_DE':
             lang_in_use = 'de_DE'
        else:
             lang_in_use = 'en_US'

        gettext.translation('messages', localedir,
                            languages=[lang_in_use]).install(True)

        seafile_rpc.set_config('lang_in_use', lang_in_use)

        default_options['lang'] = lang_in_use   

        raise web.seeother(inputs.prev)
示例#3
0
文件: main.py 项目: simcuslee/seafile
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(auto_start='off', notify_sync='off')

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs['notify_sync']:
            seafile_rpc.set_config('notify_sync', inputs.notify_sync)

        raise web.seeother('/settings/')
示例#4
0
文件: main.py 项目: simcuslee/seafile
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(auto_start='off', notify_sync='off')

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs['notify_sync']:
            seafile_rpc.set_config('notify_sync', inputs.notify_sync)

        raise web.seeother('/settings/')
示例#5
0
文件: main.py 项目: hcnhjxox/seafile
    def GET(self):
        # Set language preference on the first load of home page
        global lang_in_use
        if not lang_in_use:
            lang_in_use = seafile_rpc.get_config("lang_in_use")
            if not lang_in_use:
                seafile_rpc.set_config("lang_in_use", DEFAULT_LANG)
                lang_in_use = DEFAULT_LANG

            gettext.translation("messages", localedir, languages=[lang_in_use]).install(True)

            default_options["lang"] = lang_in_use
        return self.show_repos()
示例#6
0
    def GET(self):
        # Set language preference on the first load of home page
        global lang_in_use
        if not lang_in_use:
            lang_in_use = seafile_rpc.get_config('lang_in_use')
            if not lang_in_use:
                seafile_rpc.set_config('lang_in_use', DEFAULT_LANG)
                lang_in_use = DEFAULT_LANG

            gettext.translation('messages', localedir,
                                languages=[lang_in_use]).install(True)

            default_options['lang'] = lang_in_use
        return self.show_repos()
示例#7
0
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(auto_start='off', notify_sync='off',
                                  encrypt_channel='off')

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs['notify_sync']:
            seafile_rpc.set_config('notify_sync', inputs.notify_sync)

        print inputs.encrypt_channel, current_prefs['encrypt_channel']
        if inputs.encrypt_channel != current_prefs['encrypt_channel']:
            ccnet_rpc.set_config('encrypt_channel', inputs.encrypt_channel)

        raise web.seeother('/settings/')
示例#8
0
    def GET(self):
        global lang_in_use
        if lang_in_use == 'zh_CN':
            lang_in_use = 'en_US'
        else:
            lang_in_use = 'zh_CN'

        gettext.translation('messages', localedir,
                            languages=[lang_in_use]).install(True)

        seafile_rpc.set_config('lang_in_use', lang_in_use)

        default_options['lang'] = lang_in_use
        inputs = web.webapi.input(prev='/home/')    

        raise web.seeother(inputs.prev)
示例#9
0
文件: main.py 项目: hcnhjxox/seafile
    def GET(self):
        global lang_in_use
        inputs = web.webapi.input(prev="/home/", ln="")
        if inputs.ln == "cn":
            lang_in_use = "zh_CN"
        elif inputs.ln == "en":
            lang_in_use = "en_US"
        elif inputs.ln == "fr":
            lang_in_use = "fr"
        elif inputs.ln == "sk_SK":
            lang_in_use = "sk_SK"
        else:
            lang_in_use = "en_US"

        gettext.translation("messages", localedir, languages=[lang_in_use]).install(True)

        seafile_rpc.set_config("lang_in_use", lang_in_use)

        default_options["lang"] = lang_in_use

        raise web.seeother(inputs.prev)
示例#10
0
文件: main.py 项目: swpd/seafile
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(auto_start='off',
                                  notify_sync='off',
                                  encrypt_channel='off',
                                  upload_limit='',
                                  download_limit='')

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs['notify_sync']:
            seafile_rpc.set_config('notify_sync', inputs.notify_sync)

        if inputs.encrypt_channel != current_prefs['encrypt_channel']:
            ccnet_rpc.set_config('encrypt_channel', inputs.encrypt_channel)

        if not inputs.upload_limit:
            upload_limit = 0
        else:
            try:
                upload_limit = int(inputs.upload_limit) * 1024
            except:
                upload_limit = 0

        if not inputs.download_limit:
            download_limit = 0
        else:
            try:
                download_limit = int(inputs.download_limit) * 1024
            except:
                download_limit = 0

        if upload_limit != current_prefs['upload_limit']:
            seafile_rpc.set_upload_rate_limit(upload_limit)

        if download_limit != current_prefs['download_limit']:
            seafile_rpc.set_download_rate_limit(download_limit)

        raise web.seeother('/settings/')
示例#11
0
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(auto_start='off', notify_sync='off',
                                  encrypt_channel='off',
                                  upload_limit='', download_limit='')

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs['notify_sync']:
            seafile_rpc.set_config('notify_sync', inputs.notify_sync)

        if inputs.encrypt_channel != current_prefs['encrypt_channel']:
            ccnet_rpc.set_config('encrypt_channel', inputs.encrypt_channel)

        if not inputs.upload_limit:
            upload_limit = 0
        else:
            try:
                upload_limit = int(inputs.upload_limit) * 1024
            except:
                upload_limit = 0

        if not inputs.download_limit:
            download_limit = 0
        else:
            try:
                download_limit = int(inputs.download_limit) * 1024
            except:
                download_limit = 0

        if upload_limit != current_prefs['upload_limit']:
            seafile_rpc.set_upload_rate_limit(upload_limit)

        if download_limit != current_prefs['download_limit']:
            seafile_rpc.set_download_rate_limit(download_limit)

        raise web.seeother('/settings/')
示例#12
0
文件: main.py 项目: hcnhjxox/seafile
    def POST(self):
        current_prefs = get_current_prefs()
        inputs = web.webapi.input(
            auto_start="off", notify_sync="off", encrypt_channel="off", upload_limit="", download_limit=""
        )

        applet_rpc.set_auto_start(inputs.auto_start)

        if inputs.notify_sync != current_prefs["notify_sync"]:
            seafile_rpc.set_config("notify_sync", inputs.notify_sync)

        if inputs.encrypt_channel != current_prefs["encrypt_channel"]:
            ccnet_rpc.set_config("encrypt_channel", inputs.encrypt_channel)

        if not inputs.upload_limit:
            upload_limit = 0
        else:
            try:
                upload_limit = int(inputs.upload_limit) * 1024
            except:
                upload_limit = 0

        if not inputs.download_limit:
            download_limit = 0
        else:
            try:
                download_limit = int(inputs.download_limit) * 1024
            except:
                download_limit = 0

        if upload_limit != current_prefs["upload_limit"]:
            seafile_rpc.set_upload_rate_limit(upload_limit)

        if download_limit != current_prefs["download_limit"]:
            seafile_rpc.set_download_rate_limit(download_limit)

        raise web.seeother("/settings/")