MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / initProject

Function initProject

SLiCAP/SLiCAP.py:106–213  ·  view source on GitHub ↗

Initializes a SLiCAP project. - Copies the directory structure from the templates subdirectory to the project directory in cases it has not yet been created. - Creates index.html in the html directory with the project name in the title bar - Compiles the system librarie

(name, notebook=False, report_dirs=True)

Source from the content-addressed store, hash-verified

104 return
105
106def initProject(name, notebook=False, report_dirs=True):
107 """
108 Initializes a SLiCAP project.
109
110 - Copies the directory structure from the templates subdirectory to the
111 project directory in cases it has not yet been created.
112 - Creates index.html in the html directory with the project name in the
113 title bar
114 - Compiles the system libraries
115 - Creates or updates 'SLiCAPconfigure.py' in the project directory
116
117 :param name: Name of the project: appears on the main html index page.
118 :type name: str
119
120 :param notebook: True if SLiCAP runs from a Jupyter notebook, defaults to False
121 :type notebook: Bool
122
123 :param create_dirs: True will create but not overwrite the SLiCAP directory
124 structure. Defaults to True
125 :type create_dirs: Bool
126
127 :return: None
128 :rtype: NoneType
129
130 :Example:
131
132 >>> import SLiCAP as sl
133 >>> # At the first run it will create a 'SLiCAP.ini' file in the SLiCAP
134 >>> # home folder: '~/SLiCAP/'.
135 >>> # To this end it searches for installed applications.
136 >>> # Under MSwindows this may take a while.
137 >>> sl.initProject('my first SLiCAP project')
138 >>> # At the first run this will create a 'SLiCAP.ini' file in the SLiCAP
139 >>> # project folder: './'. Once created it will only reset some values.
140 >>> # This function also resets the netlist parser and (re)creates the
141 >>> # system library objects.
142 >>> sl.ini.dump()
143 >>> # Prints the SLiCAP global settings obtained from both ini files.
144
145 """
146 # Read the project data from the project configuration file
147 project_config = ini._read_project_config()
148 # Adjust image sizes for notebooks (image font size equals notebook font size)
149 ini.notebook = notebook
150 if notebook:
151 # These values will not be stored
152 ini.axis_width = 4
153 ini.axis_height = 3
154 ini.plot_fontsize = 9
155 ini.line_width = 1
156 # Define the project title
157 ini.project_title = name
158 ini.project_title = name
159 project_config['project']['title'] = ini.project_title
160 ini.last_updated = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
161 project_config['project']['last_updated'] = ini.last_updated
162 # Create the project directories if they do not yet exist
163 _makeDir(ini.cir_path)

Callers 2

SLiCAPkicad.pyFile · 0.90
Manual.pyFile · 0.90

Calls 4

_startHTMLFunction · 0.90
_initializeParserFunction · 0.90
_makeDirFunction · 0.85
_copyNotOverwriteFunction · 0.85

Tested by

no test coverage detected