Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | change help output |
---|---|
Timelines: | family | ancestors | descendants | both | testing |
Files: | files | file ages | folders |
SHA1: | 153cc0adaf63e39d3642b6d7c3c418ce68b1ae3a |
User & Date: | zorro 2012-09-13 18:40:26 |
Context
2012-09-15
| ||
10:31 | add 'encoding' in export/import check-in: f0f548322f user: zorro tags: testing | |
2012-09-13
| ||
18:40 | change help output check-in: 153cc0adaf user: zorro tags: testing | |
18:09 | change DB-structure check-in: cf35d5c40f user: zorro tags: testing | |
Changes
Changes to condt.py.
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
...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
valid = True if self.user_id else False return valid def __del__(self): self.connect.close() class Condt(BaseConDict): """Condt - class for ConDict""" COMMANDS = {'.help': {'desc': 'list commands', 'command': None}, '.chname': {'desc': 'change current user name', 'command': None}, '.chpassword': {'desc': 'change current password', 'command': None}, '.list': {'desc': 'list users words', 'command': None}, '.en': {'desc': 'dictionary mode English to Russian', 'command': None}, '.ru': {'desc': 'dictionary mode Russian to English', 'command': None}, '.add': {'desc': 'add new words', 'command': None}, '.connect': {'desc': 'test connection', 'command': None}, '.export': {'desc': 'export user dictionary to CSV file (UTF-8)', 'command': None}, '.import': {'desc': 'import user dictionary from CSV file (UTF-8, start row=2)', 'command': None}, '.edit': {'desc': 'edit words', 'command': None}, '.delete': {'desc': 'delete words', 'command': None}, '.exit': {'desc': 'quit from program', 'command': None}, '.test': {'desc': 'start test (default en)', 'command': None}, '.testru': {'desc': 'start ru-test', 'command': None}, '.testmix': {'desc': 'start en-ru test', 'command': None}, } def __init__(self, name, dbfile, ctest=10): super().__init__(name, dbfile) self.__pcounter = 3 self.ctest = ctest self.init_command() self.user_id = self.get_user() ................................................................................ command, arg = get_command(command) if command not in self.COMMANDS.keys(): return None result = self.COMMANDS[command]['command'](arg) return result def command_help(self, arg=None): for key, item in self.COMMANDS.items(): print("{0:.<30}{1}".format(key, item['desc'])) return '.help' def command_exit(self, arg=None): return 0 def command_chname(self, arg=None): cur = self.connect.cursor() while(True): |
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
>
>
>
>
>
>
>
>
|
|
|
|
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
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
valid = True if self.user_id else False return valid def __del__(self): self.connect.close() class Condt(BaseConDict): """Condt - class for ConDict""" COMMANDS = {'.help': {'desc': 'list commands', 'command': None, 'full': 'output list commands'}, '.chname': {'desc': 'change current user name', 'command': None, 'full': 'change current info: login and name'}, '.chpassword': {'desc': 'change current password', 'command': None, 'full': 'change password for current password'}, '.list': {'desc': 'list users words', 'command': None, 'full': 'list user words/patterns, ".list" or ".list pattern"'}, '.en': {'desc': 'dictionary mode English to Russian', 'command': None, 'full': 'yandex translate English to Russian'}, '.ru': {'desc': 'dictionary mode Russian to English', 'command': None, 'full': 'yandex translate Russian to English'}, '.add': {'desc': 'add new words', 'command': None, 'full': 'add new word/pattern'}, '.connect': {'desc': 'test connection', 'command': None, 'full': 'test internet connection'}, '.export': {'desc': 'export user dictionary', 'command': None, 'full': 'export user dictionary to CSV file, encoding UTF-8'}, '.import': {'desc': 'import user dictionary', 'command': None, 'full': 'import user dictionary form CSV file, encoding UTF-8'}, '.edit': {'desc': 'edit words', 'command': None, 'full': 'edit word/pattern, search by ID ".edit ID"'}, '.delete': {'desc': 'delete words', 'command': None, 'full': 'delete word/pattern, search by ID, ".delete ID"'}, '.exit': {'desc': 'quit from program', 'command': None, 'full': 'quit form program'}, '.test': {'desc': 'start test (default en)', 'command': None, 'full': 'test'}, '.testru': {'desc': 'start ru-test', 'command': None, 'full': 'test'}, '.testmix': {'desc': 'start en-ru test', 'command': None, 'full': 'test'}, } def __init__(self, name, dbfile, ctest=10): super().__init__(name, dbfile) self.__pcounter = 3 self.ctest = ctest self.init_command() self.user_id = self.get_user() ................................................................................ command, arg = get_command(command) if command not in self.COMMANDS.keys(): return None result = self.COMMANDS[command]['command'](arg) return result def command_help(self, arg=None): if arg: s = '.' + arg result = self.COMMANDS.get(s) if result: print("'{0}'\t{1}".format(s,result['full'])) else: print('not found, use ".help"') else: for key, item in self.COMMANDS.items(): print("{0:.<30}{1}".format(key, item['desc'])) return 'help' def command_exit(self, arg=None): return 0 def command_chname(self, arg=None): cur = self.connect.cursor() while(True): |
Changes to db.sql.
1 2 3 4 5 6 7 8 9 |
CREATE TABLE "progress" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "translate_id" INTEGER NOT NULL , "all" INTEGER DEFAULT 0, "error" INTEGER DEFAULT 0); CREATE TABLE "term" ("token" VARCHAR(40) PRIMARY KEY NOT NULL UNIQUE , "en" VARCHAR NOT NULL ); CREATE TABLE "translate" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "term" VARCHAR(40) NOT NULL , "user_id" INTEGER NOT NULL , "rus" VARCHAR NOT NULL, "created" DATETIME NOT NULL DEFAULT (CURRENT_TIMESTAMP) ); CREATE TABLE "user" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "name" VARCHAR NOT NULL UNIQUE , "password" VARCHAR NOT NULL , "full" TEXT); CREATE INDEX "created" ON "translate" ("created" DESC); CREATE INDEX "progress_result" ON "progress" ("all" ASC, "error" ASC); CREATE INDEX "progress_translate" ON "progress" ("translate_id" ASC); CREATE UNIQUE INDEX "user_name" ON "user" ("name" ASC); CREATE INDEX "user_passwod" ON "user" ("password" ASC); |
> > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
CREATE TABLE "progress" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "translate_id" INTEGER NOT NULL , "all" INTEGER DEFAULT 0, "error" INTEGER DEFAULT 0); CREATE TABLE "result" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "test_id" INTEGER NOT NULL , "number" INTEGER NOT NULL, "en" VARCHAR, "ru" VARCHAR, "er" BOOL); CREATE TABLE "term" ("token" VARCHAR(40) PRIMARY KEY NOT NULL UNIQUE , "en" VARCHAR NOT NULL ); CREATE TABLE "test" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "user_id" INTEGER NOT NULL, "name" VARCHAR(64) NOT NULL, "created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "finished" DATETIME); CREATE TABLE "translate" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "term" VARCHAR(40) NOT NULL , "user_id" INTEGER NOT NULL , "rus" VARCHAR NOT NULL, "created" DATETIME NOT NULL DEFAULT (CURRENT_TIMESTAMP) ); CREATE TABLE "user" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "name" VARCHAR NOT NULL UNIQUE , "password" VARCHAR NOT NULL , "full" TEXT); CREATE INDEX "created" ON "translate" ("created" DESC); CREATE INDEX "progress_result" ON "progress" ("all" ASC, "error" ASC); CREATE INDEX "progress_translate" ON "progress" ("translate_id" ASC); CREATE INDEX "result_test" ON "result" ("test_id" ASC, "number" ASC, "er" DESC); CREATE INDEX "term_token" ON "term" ("en" ASC); CREATE INDEX "test_user" ON "test" ("user_id" ASC, "created" DESC); CREATE INDEX "translate_rus" ON "translate" ("term" ASC, "user_id" ASC, "rus" ASC); CREATE INDEX "translate_term" ON "translate" ("term" ASC, "user_id" ASC); CREATE UNIQUE INDEX "user_name" ON "user" ("name" ASC); CREATE INDEX "user_passwod" ON "user" ("password" ASC); |
Changes to db.sqlite.
cannot compute difference between binary files