1. Extension files¶
In many cases, generating an extension means to create a set of files to be developed. Each of these files contains the basic structure required for the extension to work, and is specialized using the specifications given to the generator.
Each extension rely on a given set of files. Some extensions are composed of a single file (the implementation), some others requires multiple files. When the extension depends on multiple related files, these files are contained in a single folder. In that situation, other files can be added at will to organize the code.
1.1. “__init__.py”¶
This is a special Python (.py) file used to perform tasks when importing the extension (used in Python to define a package).
Usually, this doesn’t have to be modified by the developer.
1.2. Implementation¶
This is the main Python (.py) file describing the extension and containing the entry points of logic.
1.3. mainform.py¶
This is a Python (.py) file describing the behavior of a form (UI). It should contain the code relative to the update of visual aspects of the UI (widgets, …) and widget slots. It calls generally on the implementation class for logic tasks to perform. For example:
@pyqtSlot()
def on_pushButton_OK_clicked(self):
# Getting the specified title in the UI
aTitle = self.ui.lineEdit_title.text()
# Calling the interface method
newROI = self.getImplementation().createROIWithTitle(aTitle)
Note
In this example, the syntax for automatic connect has been used. See Connecting Slots By Name.
By convention, the name of the main form is mainform. Other forms may be used as well.
1.4. mainform.ui¶
This is a Qt (.ui) file describing the visual design (widgets) of a form.
See How to develop a User Interface for more information.
1.5. pyuic.bat¶
This is a batch file used to generate the Python wrapper version (ui_mainform.py) of the mainform.ui file.
See How to develop a User Interface for more information.
1.6. ui_mainform.py¶
This is the Python wrapper version of the mainform.ui file. This Python file is containing the UI class defining the widgets used in the form and their initial setup. When the mainform.ui is updated, the pyuic.bat script has to be executed to update the ui_mainform.py file. After the pyuic.bat script is run, generally, the file ui_mainform.py doesn’t have to be modified manually.
See How to develop a User Interface for more information.
1.7. resource (.qrc)¶
This is a Qt (.qrc) file describing the images of a form.
See How to develop a User Interface for more information.
1.8. pyrcc.bat¶
This is a batch file used to generate the Python wrapper version (…_rc.py) of the resource (.qrc) file.
See How to develop a User Interface for more information.
1.9. resource (…_rc.py)¶
This is the Python wrapper version of the resource (.qrc) file. When the resource (.qrc) file is updated, the pyrcc.bat script has to be executed to update this Python wrapper version (…_rc.py) file. This file doesn’t have to be modified manually by the developer.
See How to develop a User Interface for more information.