def edit_text(self):
        """激活输入框 并 输入内容"""
        explain = self.explain()  # 解释的内容
        sentence = self.sentence().split(' ')  # 句子
        print('题目:', self.sentence())
        value = strength_sentence_operate(explain)  # 数据字典

        words = value.split(' ')  # 将句子分割成单词
        word = []
        for i in range(len(words)):
            if (self.is_alphabet(words[i])) and (words[i] not in sentence):
                word.append(words[i])

        for j in range(len(word)):
            item = self.content_desc()  # 获取输入框坐标
            x = float(item[0][j]) + 80.0
            y = float(item[1][j]) + 320.0
            self.bounds.click_bounds(x, y)  # 激活输入框

            for z in range(len(word[j])):
                if j == len(word) - 1:
                    if word[j][z] in ['.', '?', '!']:  # 去掉最后的标点符号
                        break
                if z == 4 and z != len(word[j]) - 1:
                    games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                    games_keyboard(word[j][z].upper())  # 点击键盘对应 大写字母
                    games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                else:
                    if j == 2 and word[j][z] == "'":
                        games_keyboard(',')  # 第二小题  点击键盘 逗号
                    else:
                        games_keyboard(word[j][z])  # 点击键盘对应字母

        return value
    def copy_pattern(self):
        """《闪卡练习 抄写模式》 游戏过程"""
        if self.wait_check_page():  # 页面检查点
            answer = []  # return值 与结果页内容比对
            rate = self.rate()
            for i in range(int(rate)):
                Homework().rate_judge(rate, i, self.rate())  # 测试当前rate值显示是否正确
                answer.append(self.word_copy())

                self.voice_operate(i)  # 听力按钮

                word = list(self.word_copy())  # 展示的Word -- 转化为list形式
                print("第%s题,单词是:%s" % (i, self.word_copy()))

                if len(self.english_copy()) == 0:  # 抄写模式 消除全部字母
                    for j in range(len(word)):
                        if j == 4:
                            games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                            games_keyboard(word[j].upper())  # 点击键盘对应 大写字母
                        else:
                            if j == 5:
                                games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                            games_keyboard(word[j].lower())  # 点击键盘对应字母

                if i in range(1, int(rate), 2):  # 点击star按钮
                    self.click_star()
                time.sleep(4)
                print('--------------------------------')
            print('=========================================')
            return rate, answer
 def keyboard_operate(self, j, value):
     """点击键盘 具体操作"""
     if j == 4:
         games_keyboard('capslock')  # 点击键盘 切换到 大写字母
         games_keyboard(value.upper())  # 点击键盘对应 大写字母
         games_keyboard('capslock')  # 点击键盘 切换到 小写字母
     else:
         games_keyboard(value)  # 点击键盘对应字母
 def keyboard_operate(self, j, value):
     """点击键盘 具体操作"""
     if j == 4:
         games_keyboard('capslock')  # 点击键盘 切换到 大写字母
         games_keyboard(value.upper())  # 点击键盘对应 大写字母
         games_keyboard('capslock')  # 点击键盘 切换到 小写字母
     else:
         games_keyboard(value)  # 点击键盘对应字母
     Homework().next_button_judge('true')  # 测试 下一步 按钮的状态
    def dictation_pattern_no(self):
        """《单词拼写 默写模式》 游戏过程"""
        if self.word_spelling.wait_check_page():  # 页面检查点
            rate = self.word_spelling.rate()
            for i in range(int(rate)):
                explain = self.word_spelling.explain()  # 展示的解释
                if len(explain) == 3:
                    value = no_yb_operate_word(explain)
                    if len(value) == 1:
                        games_keyboard(value)  # 点击键盘对应字母
                    else:  # 'ew'
                        for k in range(len(value)):
                            games_keyboard(value[k])  # 点击键盘对应字母

                self.homework.next_button()
                self.word_spelling.click_voice()
                self.homework.next_button()
示例#6
0
    def choice_word_filling(self):
        """《选词填空》 游戏过程"""
        if self.wait_check_page():  # 页面检查点
            timestr = []
            self.prompt()  # 右上角 提示词
            content = self.prompt_content()  # 取出提示内容
            self.click_blank()  # 点击空白处 弹框消失
            word_list = content.split('   ')  # 取出单词列表
            print('待输入的单词:', word_list)

            self.font_operate()  # Aa文字大小切换按钮 切换 及状态统计

            rate = self.rate()
            for i in range(int(rate)):
                Homework().rate_judge(rate, i, self.rate())  # 测试当前rate值显示是否正确
                Homework().next_button_operate('false')  # 下一题 按钮 状态判断 加点击

                if i == 0:
                    item = self.content_desc()
                    time.sleep(2)
                    x = float(item[0][i]) + 88.0
                    y = float(item[1][i]) + 246.0
                    self.bounds.click_bounds(x, y)
                else:
                    self.click_enter_button()

                word = word_list[i]
                print('word:', word)
                if len(word_list) >= int(rate):
                    for index in range(len(word)):
                        if index == 4:
                            games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                            games_keyboard(word[index].upper())  # 点击键盘对应 大写字母
                            games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                        else:
                            games_keyboard(word[index])  # 点击键盘对应字母
                else:
                    games_keyboard('abc')  # 点击键盘对应字母

                timestr.append(self.time())  # 统计每小题的计时控件time信息

            Homework().next_button_operate('true')  # 下一题 按钮 状态判断 加点击
            Homework().now_time(timestr)  # 判断游戏界面 计时功能控件 是否在计时
            print('==================================================')
            return rate
    def spelling_paly(self,data):
        explain = self.word_explain()
        word = data[explain]

        for j in range(0,len(word)):
            if j == 4:
                games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                games_keyboard(word[j].upper())  # 点击键盘对应 大写字母
            else:
                if j == 5:
                    games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                games_keyboard(word[j].lower())  # 点击键盘对应字母
示例#8
0
    def copy_pattern(self):
        """《闪卡练习 抄写模式》 游戏过程"""
        answer = []
        if self.flash_card.wait_check_page():  # 页面检查点
            rate = self.flash_card.rate()
            for i in range(int(rate)):
                self.flash_card.click_voice()  # 听力按钮
                explain = self.flash_card.explain_copy()  # 展示的翻译
                word = self.flash_card.word_copy()  # 展示的单词
                if len(explain) == 3:
                    value = yb_operate_word(explain)
                    answer.append(value)
                    if len(value) == 1 and value == word.lower():
                        games_keyboard(value)  # 点击键盘对应字母
                    elif len(value) == 2 and value == word.lower():
                        for k in range(len(value)):
                            games_keyboard(value[k])  # 点击键盘对应字母
                else:
                    print("第几题:%s" % (i + 1),
                          "单词是:%s" % self.flash_card.word_copy().text)
                    for j in range(len(word)):
                        games_keyboard(word[j])  # 点击键盘对应字母

                if i in range(1, int(rate), 2):  # 点击star按钮
                    self.flash_card.click_star()
                time.sleep(1)
        return answer
示例#9
0
    def dictation_pattern_core(self):
        """单词拼写 - 《默写模式》游戏过程"""
        explain = self.explain ()  # 题目
        value = self.common.get_word_by_explain (explain)

        self.homework.next_button_operate ('false')  # 下一题 按钮 判断加 点击操作
        if self.dictation_word_judge ():  # 默写模式 - 字母未全部消除
            print ('★★★ Error - 单词拼写 默写模式 - 字母未全部消除')

        hint = self.hint_button ()  # 提示按钮

        if self.get.enabled (hint) == 'true':
            hint.click ()  # 点击 提示按钮
            if self.get.enabled (self.hint_button ()) != 'false':
                print ('★★★ Error - 点击后提示按钮enabled属性错误')

            if self.dictation_word_judge ():  # 出现首字母提示
                word = self.dictation_word ()
                if len (word) == 1:
                    if word == value[0]:
                        print ('点击提示出现首字母提示', word)
                    else:
                        print('点击提示出现首字母提示', word)
                        print ("★★★ Error - 首字母提示错误")
                else:
                    print ('★★★ Error - 提示字母不为一个')
            else:
                print ("★★★ Error - 首字母提示未出现")
        else:
            print ('★★★ Error - 提示按钮enabled属性错误')

        games_keyboard ('backspace')
        for j in range (0, len (value)):
            self.keyboard_operate (j, value[j])  # 点击键盘 具体操作

        answer = self.finish_word ()  # 我的答案
        self.homework.next_button_operate ('true')  # 下一题 按钮 状态判断 加点击
        self.result_operate (answer, self.mine_answer ())  # 下一步按钮后的答案页面 测试
        self.homework.click_voice ()
        self.homework.next_button_operate ('true')  # 下一题 按钮 状态判断 加点击
示例#10
0
 def copy_word(self):
     print("============================")
     self.click_voice()  # 听力按钮
     time.sleep(1)
     word = list(self.word_copy())  # 展示的Word -- 转化为list形式
     print("单词是:%s" % (self.word_copy()),",解释是:%s" % (self.copy_explain()))
     if len(self.english_copy()) == 0:  # 抄写模式 消除全部字母
         for j in range(0,len(word)):
             if j == 4:
                 games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                 games_keyboard(word[j].upper())  # 点击键盘对应 大写字母
             else:
                 if j == 5:
                     games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                 games_keyboard(word[j].lower())  # 点击键盘对应字母
         time.sleep(3)
示例#11
0
 def copy_word_core(self, word):
     """闪卡练习 抄写模式 主要步骤"""
     self.homework.click_voice()  # 听力按钮
     time.sleep(1)
     word_explain = self.explain_copy()
     print("单词:%s\n解释:%s" % (word, word_explain))
     if len(self.english_copy()) == 0:  # 抄写模式 消除全部字母
         for j in range(0, len(word)):
             if j == 4:
                 games_keyboard('capslock')  # 点击键盘 切换到 大写字母
                 games_keyboard(word[j].upper())  # 点击键盘对应 大写字母
             else:
                 if j == 5:
                     games_keyboard('capslock')  # 点击键盘 切换到 小写字母
                 games_keyboard(word[j].lower())  # 点击键盘对应字母
         time.sleep(3)
     print('--------------------------')