def main(): # Initialise colorama colorama.init() valid_args = ['-n', '-n2', '-s', '-s2', '-e', '-e2', '-b', '-bf', '-bb', '-bs', '-bl', '-br'] if len(sys.argv) > 1 and sys.argv[1] not in valid_args: print_usage_info(sys.argv) if sys.argv[1] not in ['-h', '--help']: sys.exit(1) sys.exit() db_file = pick_db_file() conn, cursor = db_connection.connect(db_file) card_repository.create_table_if_not_exists(conn, cursor) if len(sys.argv) == 1: table_is_empty = card_repository.check_if_empty(cursor) if table_is_empty: print_error("You don't have any cards yet.") print_instruction( 'Create some cards by launching garrick with one of the following options first:' ) print_instruction('\t-n\tCreate cards starting in one-way mode.') print_instruction('\t-n2\tCreate cards starting in two-way mode.') print_instruction('\t-s\tCreate cards starting in single-line and one-way mode.') print_instruction('\t-s2\tCreate cards starting in single-line and two-way mode.') print_instruction('\t-e\tCreate cards starting in editor mode and in one-way mode.') print_instruction('\t-s2\tCreate cards starting in editor mode and in two-way mode.') else: review.review(conn, cursor) elif sys.argv[1] == '-n': new_cards(conn, cursor, two_way_card=False, single_line_mode=False, editor_mode=False) elif sys.argv[1] == '-n2': new_cards(conn, cursor, two_way_card=True, single_line_mode=False, editor_mode=False) elif sys.argv[1] == '-s': new_cards(conn, cursor, two_way_card=False, single_line_mode=True, editor_mode=False) elif sys.argv[1] == '-s2': new_cards(conn, cursor, two_way_card=True, single_line_mode=True, editor_mode=False) elif sys.argv[1] == '-e': new_cards(conn, cursor, two_way_card=False, single_line_mode=False, editor_mode=True) elif sys.argv[1] == '-e2': new_cards(conn, cursor, two_way_card=True, single_line_mode=False, editor_mode=True) elif sys.argv[1] == '-b': review.browse_by_regex(conn, cursor) elif sys.argv[1] == '-bf': review.browse_by_regex_front(conn, cursor) elif sys.argv[1] == '-bb': review.browse_by_regex_back(conn, cursor) elif sys.argv[1] == '-bs': review.browse_by_score(conn, cursor) elif sys.argv[1] == '-bl': review.browse_by_last_viewed(conn, cursor) elif sys.argv[1] == '-br': review.browse_by_last_viewed_reverse(conn, cursor) print_info('Kbai') db_connection.disconnect(conn, cursor)
def ask2(self, event): askFrame = self.ask_info() mainFrame = review.review(askFrame, self.word_num) v = tk.IntVar() choice1 = tk.Radiobutton(askFrame, text="choose", variable=v, value=1) choice1.place(x=100, y=110, anchor=tk.NW) choice1.select() choice2 = tk.Radiobutton(askFrame, text="type", variable=v, value=2) choice2.place(x=230, y=110, anchor=tk.NW) tk.Button(askFrame, text="Start reviewing", command=lambda: mainFrame.chooseFrame(v)).place(x=150, y=150, anchor=tk.NW)
sys.path.append('modules') import add_problem import review import json_to_csv import csv_to_json active = True os.system('color 1e') while active: print('请输入要进行的操作:') msg = ('(a=添加题目, r=复习错题, q=退出, c=从表格导入题目, ' + 'j=从数据库导出至表格) ') c = input(msg) if c == 'a': add_problem.add_problem() elif c == 'r': review.review() elif c == 'j': json_to_csv.json_to_csv() elif c == 'c': csv_to_json.csv_to_json() elif c == 'q': active = False else: print("输入不合法") continue os.system("cls")
name = 'numFaces' columns = [('Viviana', [6,8,10,12], ['delta','sum']), ('Ximena', [15,17,19,21], ['delta','sum'])] c = [28,41,54,67,87,100,113,126,146,159,172,185,205,218,231,244,264,277,290,303,323,336,349,362,382,395,408,421,441,453,466,479] c.extend([499,511,524,537,557,570,583,596,616,629,642,655,675,687,700,713]) columns.extend([('Manuela', c, ['countUnique'])]) c = [81,82,83,84,140,141,142,143,199,200,201,202,258,259,260,261,317,318,319,320,376,377,378,379,435,436,437,438,493,494,495,496] c.extend([551,552,553,554,610,611,612,613,669,670,671,672,727,728,729,730]) columns.extend([('Picassa', c, ['countUnique'])]) properties.append((name, columns)) name = 'hayCara' columns = [('Viviana', [5], []), ('Ximena', [14], []), ('EmocionesCIAE', [23], ['delta','sum']), ('Manuela', [25], ['delta','sum'])] columns.extend([('Picassa', [80,139,198,257,316,375,434,492,550,609,668,726], ['sum','delta'])]) properties.append((name, columns)) rev = review(excelFile, properties) excelRagnar = '/home/johan/proyectos/agreement_videos/PlanillaRevisionErrorRagnar_16Abril.xlsx' properties = [] name = 'hayCara' columns = [('Ragnar', [25], ['delta','sum'])] properties.append((name, columns)) name = 'numFaces' c = [28,41,54,67,87,100,113,126,146,159,172,185,205,218,231,244,264,277,290,303,323,336,349,362,382,395,408,421,441,453,466,479] c.extend([499,511,524,537,557,570,583,596,616,629,642,655,675,687,700,713]) columns = [('Ragnar', c, ['countUnique'])] properties.append((name, columns)) rev2 = review(excelRagnar, properties)
def addReview(self,tweet): newReview = REV.review(tweet) self.reviews.append(newReview)