TXLWizard.TXLConverter

Class for parsing TXL files and converting them to html / svg using TXLWriter

Classes

TXLConverter(Filename, **kwargs) Class for parsing TXL files and converting them to
TXLConverterCLI([JSONConfigurationFile, ...]) Provides a command line interface for the TXLConverter class.
class TXLWizard.TXLConverter.TXLConverter(Filename, **kwargs)[source]

Bases: object

Class for parsing TXL files and converting them to html / svg using TXLWizard.TXLWriter

Parameters:
  • Filename (str) – Path / Filename of the .txl file
  • LayersToProcess (list of int, optional) – if given, only layers in this list are processed / shown
  • **kwargs – keyword-arguments passed to the TXLWizard.TXLWriter.TXLWriter constructor.

Examples

Import required modules

>>> import TXLWizard.TXLConverter

Instatiate a TXLConverter instance, parse the TXL file and generate the HTML / SVG files. Saves the converted files to Tests/Results/TXLConverter/

>>> TXLConverterInstance = TXLWizard.TXLConverter.TXLConverter(
...     'Tests/SampleFiles/Example_Advanced_Original.txl',
...     GridWidth=500,
...     GridHeight=800,
...     LayersToProcess=[1,2,3,5]
... )
>>> TXLConverterInstance.ParseTXLFile()
>>> TXLConverterInstance.GenerateFiles('Tests/Results/TXLConverter')
GenerateFiles(TargetFolder=None)[source]

Generate the HTML / SVG files

Parameters:TargetFolder (str, optional) –

If given, the converted files are stored in the folder specified.

If not given, the converted files are stored in the same folder as the original file.

Defaults to None.

ParseTXLFile()[source]

Parses the TXL file by processing line by line. The number of references to structures is counted.

class TXLWizard.TXLConverter.TXLConverterCLI(JSONConfigurationFile='TXLConverterConfiguration.json', UpdateConfigurationFile=True, OverrideConfiguration={})[source]

Bases: object

Provides a command line interface for the TXLConverter class.

The configuration is read and stored in the JSON format in the file specified in JSONConfigurationFile.

Parameters:
  • JSONConfigurationFile (str, optional) – Path / Filename of the file where the configuration is read and stored in the JSON format. Defaults to ‘TXLConverterConfiguration.json’
  • UpdateConfigurationFile (bool, optional) – Flag whether to update the configuration file. Defaults to True.
  • OverrideConfiguration (dict, optional) – Dictionary with configuration options overriding the default / stored configuration. Defaults to {}

Examples

Import required modules

>>> import TXLWizard.TXLConverter

Start the command line interface

>>> TXLWizard.TXLConverter.TXLConverterCLI()