Here is how it works now:
The DynamicLibraryMenu class provides the following functions:
addFunction : adds a function to the functions tree.
arguments: function category, name, and icon
addMenuItem : adds a function to the function menu at the top (play button).
arguments: function name and icon
addContextMenuItem : adds a function to the context menu (mouse right button) when items of a particular family are selected; optionally shows the graphical tool.
arguments: target family, function name and icon, and whether or not to show the graphical tool
Therefore, this class simply serves to add actions and buttons to the functions tree, tool bar, and context menu. The actual actions themselves are determined by two other classes:
The LoadCLibrary class performs the following tasks:
- read and parse clibraries.txt
- setup the signals and slots that call each function specified in clibraries.txt
- place actions and toolbuttons using DynamicLibraryMenu
This class can be summarized by the following logic:
text file ---> actions group
action triggered ---> get name ---> get library name ---> new LibraryThread
The PythonTool class performs the following tasks:
- read and parse pythonscripts.txt
- host the Python interpreter thread
- setup the signals and slots that call each script specified in pythonscripts.txt
- place actions and toolbuttons using DynamicLibraryMenu
This class can be summarized by the following logic:
text file ---> actions group
action triggered ---> get name ---> get file name ---> call runPy
Rationale for the new setup:
- More modular: if a new interpreter needs to be hosted, say Ruby, then it can use the same format at the PythonTool class.
- More GUI: a C and Python program can appear in up to four places, i.e. the functions tree, the main toolbar menu, context menu, graphical tools
No comments:
Post a Comment