diff --git a/FABulous/FABulous.py b/FABulous/FABulous.py index e4c60f5b..7afa6a03 100644 --- a/FABulous/FABulous.py +++ b/FABulous/FABulous.py @@ -823,7 +823,7 @@ def do_gen_fabric(self, *ignored): logger.info("Fabric generation complete") def do_gen_geometry(self, *vargs): - """Generates geometry of fabric for the FABulous editor by checking if fabric + """Generates geometry of fabric for FABulator by checking if fabric is loaded, and calling 'genGeometry' and passing on padding value. Default padding is '8'. @@ -869,10 +869,44 @@ def do_gen_geometry(self, *vargs): if 4 <= padding <= 32: self.fabricGen.genGeometry(padding) logger.info("Geometry generation complete") - logger.info(f"{geomFile} can now be imported into the FABulous Editor") + logger.info(f"{geomFile} can now be imported into FABulator") else: logger.error("padding has to be between 4 and 32 inclusively!") + def do_start_FABulator(self, *ignored): + """Starts FABulator if an installation can be found. + If no installation can be found, a warning is produced. + + Usage: + start_FABulator + + Parameters + ---------- + *ignored : tuple + Ignores additional arguments. + + """ + logger.info("Checking for FABulator installation") + fabulatorRoot = os.getenv("FABULATOR_ROOT") + if fabulatorRoot is None: + logger.warning("FABULATOR_ROOT environment variable not set.") + logger.warning( + "Install FABulator and set the FABULATOR_ROOT environment variable to use this feature." + ) + elif not os.path.exists(fabulatorRoot): + logger.warning( + f"FABULATOR_ROOT environment variable set to {fabulatorRoot} but the directory does not exist." + ) + else: + logger.info(f"Found FABulator installation at {fabulatorRoot}") + logger.info(f"Trying to start FABulator...") + + startupCmd = ["mvn", "-f", f"{fabulatorRoot}/pom.xml", "javafx:run"] + try: + sp.Popen(startupCmd) + except sp.SubprocessError: + logger.error("Startup of FABulator failed.") + def do_gen_bitStream_spec(self, *ignored): """Generates bitstream specification of the fabric by calling 'genBitStreamspec' and saving the specification to a binary and CSV file. diff --git a/FABulous/geometry_generator/geometry_gen.py b/FABulous/geometry_generator/geometry_gen.py index 2db1b9b6..1bbae693 100644 --- a/FABulous/geometry_generator/geometry_gen.py +++ b/FABulous/geometry_generator/geometry_gen.py @@ -40,6 +40,6 @@ def generateGeometry(self, padding: int = 8) -> None: def saveToCSV(self, fileName: str) -> None: """Saves the generated geometry into a file specified by the given file name. - This file can then be imported into the FABulous Editor. + This file can then be imported into FABulator. """ self.fabricGeometry.saveToCSV(fileName)