def copy_files_to_general_folder(filenamedocx): docxpath = get_path_to_file_to_string(filenamedocx) filenamepdf = get_name_pdf_from_docx(filenamedocx) docxpathgen = settings.get_general_acts_path_folder() + filenamedocx pdfpath = settings.get_local_acts_path_folder() + filenamepdf pdfpathgen = settings.get_general_acts_path_folder() + filenamepdf shutil.copyfile(docxpath, docxpathgen) shutil.copyfile(pdfpath, pdfpathgen)
def get_number_act(): filelist = os.listdir(settings.get_general_acts_path_folder()) numacts = [] nextnumact = '' for i in range(len(filelist)): if '.docx' in filelist[i]: numacts.append(int(filelist[i].split('_')[0][3:])) numacts.sort(reverse=True) for i in range(len(numacts)): # print(i, numacts[i]) if 0 <= (numacts[i] - numacts[i + 1]) <= 2: nextnumact = str(numacts[i] + 1) break return nextnumact
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) #Обьявление главного сайзера: self.mainsizer = wx.BoxSizer(wx.VERTICAL) #Блок 1, виджеты для указания пути к папке локальных актов-------------------------------------------------- self.mainsizer.Add(wx.StaticText(self, wx.ID_ANY, label="Путь к папке с локальными актами:"), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.folderactssizer = wx.BoxSizer(wx.HORIZONTAL) self.mainsizer.Add(self.folderactssizer, flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.tc_actloc_path = wx.StaticText(self, id=ID_MD_PATHDIRACTLOC, style=wx.ST_ELLIPSIZE_START, label=settings.get_local_acts_path_folder()) self.folderactssizer.Add(self.tc_actloc_path, proportion=1) self.folderactssizer.Add(wx.Button(self, id=ID_MD_CHOSDIRLOC, label='...'), flag=wx.EXPAND | wx.LEFT, border=10) # Блок 2, виджеты для указания пути к папке общих актов------------------------------------------------------ self.mainsizer.Add(wx.StaticText(self, wx.ID_ANY, label="Путь к папке с общими актами:"), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.folderactssizer2 = wx.BoxSizer(wx.HORIZONTAL) self.mainsizer.Add(self.folderactssizer2, flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.tc_act_path = wx.StaticText(self, id=ID_MD_PATHDIRACT, style=wx.ST_ELLIPSIZE_START, label=settings.get_general_acts_path_folder()) self.folderactssizer2.Add(self.tc_act_path, proportion=1) self.folderactssizer2.Add(wx.Button(self, id=ID_MD_CHOSDIR, label='...'), flag=wx.EXPAND | wx.LEFT, border=10) #Блок 3, виджеты дляуказания пути к шаблону docx self.mainsizer.Add(wx.StaticText(self, wx.ID_ANY, label="Путь к файлу шаблона docx:"), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.tmpldocx_path_sizer = wx.BoxSizer(wx.HORIZONTAL) self.mainsizer.Add(self.tmpldocx_path_sizer, flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.tc_tmpl_docxfile_path = wx.StaticText(self, id=ID_MD_PATHFILETEMPLDOCX, style=wx.ST_ELLIPSIZE_START, label=settings.get_docx_templ_path()) self.tmpldocx_path_sizer.Add(self.tc_tmpl_docxfile_path, proportion=1) self.tmpldocx_path_sizer.Add(wx.Button(self, id=ID_MD_CHOSFILETMPLDOCX, label='...'), flag=wx.EXPAND | wx.LEFT, border=10) #Добавление главного сайзера с виджетами в окно self.SetSizer(self.mainsizer) #Назначение кнопок и функций self.Bind(wx.EVT_BUTTON, self.choosediractsloc, id=ID_MD_CHOSDIRLOC) self.Bind(wx.EVT_BUTTON, self.choosediracts, id=ID_MD_CHOSDIR) self.Bind(wx.EVT_BUTTON, self.choosefiletmpldocx, id=ID_MD_CHOSFILETMPLDOCX)
def openFolderActs(self, event): os.startfile(os.path.realpath(settings.get_general_acts_path_folder()))