def save_file(self): root_folder = self.GetTopLevelParent().get_root_folder() text = self.__get_selected_tab_text() if text.startswith(self.CHANGED_PREFIX): self.__set_selected_tab_text(text[1:]) save_file(self.__file_path, self.txt_content.GetValue()) formatted_exc = check_file_for_errors(self.__file_path, root_folder) if formatted_exc: show_error_dialog(self, formatted_exc, u'File contains errors')
def prepare_folder(cls, path): if os.path.isdir(path): files_and_folders = os.listdir(path) for folder in [cls.PO_FOLDER, cls.TESTS_FOLDER, cls.REPORTS]: if folder not in files_and_folders: os.mkdir(os.path.join(path, folder)) save_file(os.path.join(path, cls.PO_FOLDER, cls.INIT_PY), u'') else: raise Exception(u"'%s' is not a folder." % path)
def prepare_folder(cls, path): if os.path.isdir(path): files_and_folders = os.listdir(path) for folder in [cls.PO_FOLDER, cls.TESTS_FOLDER, cls.REPORTS]: if folder not in files_and_folders: os.mkdir(os.path.join(path, folder)) save_file(os.path.join(path, cls.PO_FOLDER, cls.INIT_PY), u"") else: raise Exception(u"'%s' is not a folder." % path)
def save(self, new_folder=None): if new_folder: py_filename = os.path.basename(self.file_path) img_filename = os.path.basename(self.img_path) self.file_path = os.path.abspath(os.path.join(new_folder, py_filename)) self.img_path = os.path.abspath(os.path.join(new_folder, self.IMAGE_FOLDER, img_filename)) safe_create_path(self.file_path) safe_create_path(self.img_path) save_file(self.file_path, self._get_file_content()) save_file(self.img_path, self.img_as_png, False)