def accepted():
    if importCheckb and importCheckb.checkState() == qc.Qt.Checked:
        importConfigFrom15()
    else:
        i = langCombo.currentIndex()
        langCode = langCodeList[i]
        thisLangConfDir = join(langConfDir, langCode)
        # print 'Setting language', langCode
        if not os.path.isdir(confDir):
            os.mkdir(confDir, 0755)
        if os.path.isdir(thisLangConfDir):
            for fname in os.listdir(thisLangConfDir):
                src_path = join(thisLangConfDir, fname)
                dst_path = join(confDir, fname)
                if isdir(dst_path):
                    shutil.rmtree(dst_path)
                elif isfile(dst_path):
                    os.remove(dst_path)
                if isdir(src_path):
                    shutil.copytree(src_path, dst_path)
                else:
                    shutil.copy(src_path, dst_path)
        else:
            open(join(confDir, "locale.conf"), "w").write("lang=%r" % langCode)
    win.close()
示例#2
0
    langCombo.append_text(langName)

if langDefaultCode and (langDefaultCode in langCodeList):
    langCombo.set_active(langCodeList.index(langDefaultCode))
else:
    langCombo.set_active(0)

pack(langHbox, langCombo, 1, 1)
pack(win.vbox, langHbox)
win.vbox.show_all()

if win.run() == gtk.RESPONSE_OK:
    # print('RESPONSE_OK')
    if importCheckb and importCheckb.get_active():
        importConfigFrom15()
    else:
        i = langCombo.get_active()
        langCode = langCodeList[i]
        thisLangConfDir = join(langConfDir, langCode)
        # print('Setting language', langCode)
        if not os.path.isdir(confDir):
            os.mkdir(confDir, 0755)
        if os.path.isdir(thisLangConfDir):
            for fname in os.listdir(thisLangConfDir):
                src_path = join(thisLangConfDir, fname)
                dst_path = join(confDir, fname)
                # print(src_path)
                if isdir(src_path):
                    shutil.copytree(src_path, dst_path)
                else:
示例#3
0
    langCombo.append_text(langName)

if langDefaultCode and (langDefaultCode in langCodeList):
    langCombo.set_active(langCodeList.index(langDefaultCode))
else:
    langCombo.set_active(0)

pack(langHbox, langCombo, 1, 1)
pack(win.vbox, langHbox)
win.vbox.show_all()

if win.run() == gtk.RESPONSE_OK:
    #print('RESPONSE_OK')
    if importCheckb and importCheckb.get_active():
        importConfigFrom15()
    else:
        i = langCombo.get_active()
        langCode = langCodeList[i]
        thisLangConfDir = join(langConfDir, langCode)
        #print('Setting language', langCode)
        if not os.path.isdir(confDir):
            os.mkdir(confDir, 0755)
        if os.path.isdir(thisLangConfDir):
            for fname in os.listdir(thisLangConfDir):
                src_path = join(thisLangConfDir, fname)
                dst_path = join(confDir, fname)
                #print(src_path)
                if isdir(src_path):
                    shutil.copytree(src_path, dst_path)
                else: