-
Notifications
You must be signed in to change notification settings - Fork 0
/
lang_support.py.bak1
133 lines (111 loc) · 3.31 KB
/
lang_support.py.bak1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 5.5
# in conjunction with Tcl version 8.6
# Nov 03, 2020 05:11:06 PM CET platform: Windows NT
# Nov 04, 2020 12:15:22 PM CET platform: Windows NT
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
try:
from Tkinter import *
import tkMessageBox
import tkFont
import tkFileDialog
except ImportError:
from tkinter import *
from tkinter import messagebox
from tkinter import font
from tkinter import filedialog
import os
import configparser
import gettext
_ = gettext.gettext
import globals as glb
# from globals import *
def set_Tk_var():
global strPathToAqserver
strPathToAqserver = tk.StringVar()
strPathToAqserver.set('')
global strCboLanguage
strCboLanguage = tk.StringVar()
def fill_combo():
global strCboLanguage
config = configparser.ConfigParser()
fName = os.getcwd() + '\\config.ini'
config.read(fName)
languages =['English', 'Deutsch', 'Francais']
lang = ['en', 'de', 'fr']
i=0
for language in lang:
if language == config['aqconfig'] ['language']:
lng = languages[i]
i += 1
for language in languages:
# fill the trigger combobox
w.cboLanguage['values'] = (*w.cboLanguage['values'], language)
strCboLanguage.set(lng)
def set_value_config_file(file_path, section, key, value):
config = configparser.RawConfigParser()
config.read(file_path)
config.set(section,key,value)
cfgfile = open(file_path,'w')
# use following flag in case you need to avoid white space
config.write(cfgfile, space_around_delimiters=False)
cfgfile.close()
def init(top, gui, *args, **kwargs):
global w, top_level, root
w = gui
top_level = top
root = top
root.iconbitmap('./assets/aqconfig.ico')
fill_combo()
def btnCancel_LeftRelease(p1):
destroy_window()
def btnOk_LeftRelease(p1):
global strCboLanguage
# global strLanguage
languages =['English', 'Deutsch', 'Francais']
lang = ['en', 'de', 'fr']
#save to aqconfig.ini
fName = os.getcwd() + '\\config.ini'
language = strCboLanguage.get()
i=0
for language in languages:
if language == strCboLanguage.get():
lng = lang[i]
i += 1
set_value_config_file(fName, 'aqconfig', 'language',lng)
destroy_window()
def btnPathToExe_LeftClick(p1):
global strPathToAqserver
# global strPathToExe
if (py3 == 1) or (py3 == True):
myPath = filedialog.askdirectory(title = _("Get path of aqserver.exe"))
else:
myPath = filedialog.askdirectory(title = _("Get path of aqserver.exe"))
myPath = myPath + '/aqserver.exe'
myPath = myPath.replace('/', '\\')
#save to aqconfig.ini
fName = os.getcwd() + '\\config.ini'
set_value_config_file(fName, 'aqserver', 'exefile', myPath)
# global strPathToAqserver
strPathToAqserver.set(myPath)
# strPathToExe.set(myPath)
def destroy_window():
# Function which closes the window.
global top_level
top_level.destroy()
top_level = None
if __name__ == '__main__':
import lang
lang.vp_start_gui()