def jms_dir_browse(self): if self._compiling or self._loading or self._saving: return tags_dir = self.tags_dir.get() data_dir = path_replace(tags_dir, "tags", "data") jms_dir = self.jms_dir.get() if tags_dir and not jms_dir: jms_dir = data_dir dirpath = askdirectory( initialdir=jms_dir, parent=self, title="Select the folder of models to compile...") if not dirpath: return dirpath = str(Path(dirpath)) if tags_dir and data_dir and os.path.basename( dirpath).lower() == "models": object_dir = os.path.dirname(dirpath) if object_dir and is_in_dir(object_dir, data_dir): tag_path = os.path.join(object_dir, os.path.basename(object_dir)) tag_path = os.path.join(tags_dir, os.path.relpath(tag_path, data_dir)) self.gbxmodel_path.set(tag_path + ".gbxmodel") self.app_root.last_load_dir = os.path.dirname(dirpath) self.jms_dir.set(dirpath) if not self.tags_dir.get(): self.tags_dir.set( Path(path_split(self.app_root.last_load_dir, "data"), "tags"))
def data_dir_browse(self): dirpath = askdirectory(initialdir=self.data_dir.get(), parent=self, title="Select the data extraction directory") if not dirpath: return self.data_dir.set(str(Path(dirpath)))
def extract_to_browse(self): dirpath = askdirectory(initialdir=self.extract_to_dir.get(), parent=self, title="Select the directory to extract tags to") if not dirpath: return self.extract_to_dir.set(str(Path(dirpath)))
def model_animations_dir_browse(self, force=False): if not force and (self._working or self._loading): return dirpath = askdirectory( initialdir=self.model_animations_dir.get(), parent=self, title="Directory of model_animations to compress/decompress") if not dirpath: return self.app_root.last_load_dir = dirpath self.model_animations_dir.set(dirpath)
def wav_dir_browse(self): if self._compiling or self._loading or self._saving: return wav_dir = self.wav_dir.get() dirpath = askdirectory( initialdir=wav_dir, parent=self, title="Select the folder of wav files to compile...") if not dirpath: return self.app_root.last_load_dir = os.path.dirname(dirpath) self.wav_dir.set(dirpath)
def dir_browse(self): if self._scanning: return dirpath = askdirectory(initialdir=self.directory_path.get(), parent=self, title="Select directory to scan") if not dirpath: return self.app_root.last_load_dir = dirpath if not is_in_dir(dirpath, self.handler.tagsdir): print( "Specified directory is not located within the tags directory") return self.directory_path.set(dirpath)
def dir_browse(self): if self._extracting: return dirpath = askdirectory( initialdir=self.dir_path.get(), parent=self, title="Select the directory of tags to extract from") if not dirpath: return self.app_root.last_load_dir = dirpath if not is_in_dir(dirpath, self.handler.tagsdir): print('Directory "%s" is not located inside tags dir: "%s"' % (dirpath, self.handler.tagsdir)) return self.dir_path.set(dirpath)
def jma_dir_browse(self): if self._compiling or self._loading or self._saving: return tags_dir = self.tags_dir.get() # Add data to the path and then use path_replace to match the case of any # data directory that might already be here. data_dir = str( path_replace( Path(tags_dir).parent.joinpath("data"), "data", "data")) jma_dir = self.jma_dir.get() if tags_dir and not jma_dir: jma_dir = data_dir dirpath = path_normalize( askdirectory( initialdir=jma_dir, parent=self, title="Select the folder of animations to compile...")) if not dirpath: return dirpath = str(Path(dirpath)) if tags_dir and data_dir and os.path.basename( dirpath).lower() == "animations": object_dir = os.path.dirname(dirpath) if object_dir and is_in_dir(object_dir, data_dir): tag_path = os.path.join(object_dir, os.path.basename(object_dir)) tag_path = os.path.join(tags_dir, os.path.relpath(tag_path, data_dir)) self.model_animations_path.set(tag_path + ".model_animations") self.app_root.last_load_dir = os.path.dirname(dirpath) self.jma_dir.set(dirpath) if not self.tags_dir.get(): self.tags_dir.set( os.path.join(path_split(self.app_root.last_load_dir, "data"), "tags"))
def tags_dir_browse(self): if self._compiling or self._loading or self._saving: return old_tags_dir = self.tags_dir.get() tags_dir = askdirectory(initialdir=old_tags_dir, parent=self, title="Select the root of the tags directory") if not tags_dir: return tags_dir = str(Path(tags_dir)) antr_path = self.model_animations_path.get() if old_tags_dir and antr_path and not is_in_dir(antr_path, tags_dir): # adjust antr filepath to be relative to the new tags directory antr_path = os.path.join(tags_dir, os.path.relpath(antr_path, old_tags_dir)) self.model_animations_path.set(antr_path) self.app_root.last_load_dir = os.path.dirname(tags_dir) self.tags_dir.set(tags_dir)
def tags_dir_browse(self): if self._compiling or self._loading or self._saving: return old_tags_dir = self.tags_dir.get() tags_dir = askdirectory(initialdir=old_tags_dir, parent=self, title="Select the root of the tags directory") if not tags_dir: return tags_dir = path_normalize(tags_dir) mod2_path = self.gbxmodel_path.get() if old_tags_dir and mod2_path and not is_in_dir(mod2_path, tags_dir): # adjust mod2 filepath to be relative to the new tags directory mod2_path = os.path.join(tags_dir, os.path.relpath(mod2_path, old_tags_dir)) self.gbxmodel_path.set(mod2_path) self.app_root.last_load_dir = os.path.dirname(tags_dir) self.tags_dir.set(tags_dir)
def data_dir_browse(self): dirpath = askdirectory(initialdir=self.data_dir.get()) if dirpath: self.data_dir.set(dirpath)