def producePSM():
    '''发布口算题保存.docx文件'''
    print(psm_type)#打印测试
    if len(psm_type) == 0:
        print('还没有添加口算题到列表中哈!')  # 打印测试
        messagebox.showinfo("提示", "还没有添加口算题到列表中哈!")
    else:
        #循环生成每套题
        for i in range(int(psm_entry.get())):
            templist = []
            for l in psm_type:
                g = Generator(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8],l[9],l[10])
                templist = templist + g.generate_data()
            random.shuffle(templist)
            print(templist)
            psm_list.append(templist)
        #为生成的文件起名
        psm_title.clear()
        for i in range(int(psm_entry.get())):
            psm_title.append(psmtitVar.get())
        print(psm_title)
        subtit = psmtit1Var.get()

        pp = PrintPreview(psm_list, psm_title,subtit, col=int(psmcol_entry.get()))
        pp.produce()#生成docx
        psm_list.clear()#清空打印列表。
        movdocx()
        messagebox.showinfo("成功提示","文件发布成功,保存在docx目录下,请查看!")
Example #2
0
    def producePSM(self, e):
        '''发布口算题保存.docx文件'''
        # print(self.psm_type)  # 打印测试
        if len(self.psm_type) == 0:
            print('还没有添加口算题到列表中哈!')  # 打印测试
            wx.MessageBox('还没有添加口算题到列表中哈!', '提示',
                          wx.OK | wx.ICON_INFORMATION)
        else:
            # 循环生成每套题

            for i in range(int(self.text_ctrl_2.GetValue())):
                templist = []
                for l in self.psm_type:
                    print(l)
                    g = Generator(l[0], l[1], l[2], l[3], l[4],
                                  l[5], l[6], l[7], l[8], l[9], l[10])
                    templist = templist + g.generate_data()
                random.shuffle(templist)
                print(templist)
                self.psm_list.append(templist)
                # 为生成的文件起名r
                self.psm_title.clear()

            for i in range(int(self.text_ctrl_2.GetValue())):
                self.psm_title.append(self.text_ctrl_4.GetValue())
            # print(self.psm_title)
            subtit = self.text_ctrl_5.GetValue()

            pp = PrintPreview(self.psm_list, self.psm_title,
                              subtit, col=int(self.text_ctrl_3.GetValue()),docxpath=self.config.c.get('config','docx')+os.sep)
            pp.produce()  # 生成docx
            self.psm_list.clear()  # 清空打印列表。
            # self.movdocx()
            wx.MessageBox('文件发布成功,保存在'+self.config.c.get('config','docx')+'目录下,请查看!!', '成功提示',
                          wx.OK | wx.ICON_INFORMATION)