Friday, November 27, 2009

gnuplot

Having a high-quality plotting tool is necessary for TinkerCell, so gnuplot seemed like the right choice. gnuplot has a scripting interface and can provide a large variety of graphs. The GnuplotTool plugin generates script files and pipes them into the gnuplot executable. So, the only work that is done is generating the scripts. The plugin also provides a scripting window where users can plot more advanced plots (anything allowed by gnuplot).

GnuplotTool and the default (old) Plot Tool provide the same functionality. When one has been loaded, the other cannot load. So, the one that loads first wins (this depends on which plugin was created first). Disabling one of these plugins from the settings menu would be ideal way to choose one of them.



The right picture above is from TinkerCell. The left picture shows some demo plots using gnuplot (not done in TinkerCell...yet).

Wednesday, November 25, 2009

Small change to ConsoleWindow class

Some changes in the Core library:

The ConsoleWindow was a static item, allowing calls such as:

ConsoleWindow::message("hello");
ConsoleWindow::error("parse error");


ConsoleWindow is no longer static. It belongs with MainWindow. So, the above calls are replaced with:

if (console())
{
console()->message("hello");
console()->error("parse error");
}

The console() function exists in MainWindow, Tool, GraphicsScene, NetworkWindow, and TextEditor. All of these functions call MainWindow's console() function, so they return the same pointer. However, if there are two MainWindow instances, then each will contain a different console....in case that some day there is some need to create two main windows.

Additionally, a new function, "eval", has been added, which current can be used to evaluate a Python expression because the Python plugin controls the console at the present.

console()->eval("print 1+2");


Wednesday, September 30, 2009

New Layout


New options for docking the widget: either Dock Widgets or Tool Box Widgets. Users can use Settings menu to change the default view.

Changes to the Parts/Connections Catalog: Tabbed View (shown above) or the normal Tree View. Settings menu has the option to flip between the two.

Sunday, September 27, 2009

C API : Callback functions


The C API now provides a way for C programs to respond to changes in the model. The following code will set "f" as a callback function:

void f();

void tc_main()
{
tc_callback( f );
}

The callback function will be triggered whenever the dataChanged() signal is emitted, which indicates that one of the following has occurred: items inserted or deleted, some table value has changed, an item has been renamed.

Wednesday, September 23, 2009

Plug-in-able Plot Window


The PlotTool class, which is the default plotting window in TinkerCell, has been modified to accept a variety of PlotWidgets. The current set of PlotWidgets include:

Plot2DWidget -- for drawing normal 2D graphs using Qwt
Plot3DWidget -- for drawing 3D surface plots using Qwt3D
PlotTextWidget -- for displaying information as text

All of the above classes inherit from PlotWidget

PlotWidget requires that each subclass define a data() method, which returns the current data shown in the graph. The PlotTool also requests the current PlotWidget to export the data in one of many formats (given as a string argument). The PlotWidget class will take care of exporting data as text, but it will handle any of the other export types.


Adding new plot types requires defining a new class that inherits from PlotWidget and overriding the data() and the exportData() methods. The PlotTool may need to be modified in order to add functions specific for plotting using the new widget. Each PlotWidget also comes with its own toolbar (variable names toolBar). This is automatically loaded by the PlotTool whenever a new PlotWidget is selected.

Monday, August 24, 2009

3D plotter and 2-way steady state analysis



The PlotTool now contains Plot2DWidget and Plot3DWidget, which are used for plotting 2D and 3D graphs. The "runsteadystate" C program now provides 2-parameter steady state analysis. See diagram below.

Wednesday, August 19, 2009

Some changes worth noting...

The class OutputWindow has been changed to ConsoleWindow, which makes more sense.

ItemHandle can be "hidden" from the SymbolsTable by setting visible=false. The SymbolsTable stores all the objects in the network, so this is a way of using a handle without making it part of the network itself. 

Saturday, August 15, 2009

TextParser class

The TextParser class is the parent class for all parser tools, such as the Antimony parser tool. This class listens to events in the text editor and responds accordingly. This parent class simply provides a basic structure for other parser tools.

activate ()
set this parser as the current parser

deactivate ()
this parser is no longer the current parser

parse (TextEditor *)
this parser has been requested to parse the text inside the given text editor

textChanged (TextEditor *, const QString &, const QString &, const QString &)
some text inside this editor has been changed

lineChanged (TextEditor *, int, const QString &)
the cursor has moved to a different line

validSyntax (bool)
signal indicating invalid syntax

setParser (TextParser *)
set the text parser for all text editors. The current text parser can be obtained using

currentParser();
The current text parser that is being used (can be 0 if none).

Sunday, July 19, 2009

Antimony Parser


new class: CodeEditor (Core library)
Core Editor is designed to be the base class for any coding/scripting widget. It is borrowed from Qt's example set.

new plug-in: AntimonyTool
The AntimonyTool uses libAntimony to parse the text in the current TextEditor and calls setItems(...) in the current TextEditor upon
parsing.

Result: parse with antimony and get all the other features of TinkerCell that work at the handles level. This would include all the C and Python functions.

Drawback: this parser is dependent on the other plug-ins, e.g. the StoichiometryTool and BasicInformationTool. The parser assumes the existence of data tables named "Rates", "Numerical Attributes", and "Stoichiometry".




Users can build models using text or graphics, side by side.

Saturday, July 18, 2009

Significant changes to Core library : the TextEditor

Here was the idea that forced a remodelling of the Core library:

What if TinkerCell could support two method of model construction: graphical (drawing) and text-based (scripting)

The resulting design is summarized by the picture to the right. Here are the major modifications:

  1. A new class, NetworkWindow, has been created. This class is an MDI widget that is used to create the subwindows in the main window.  The NetworkWindow contains two important members: history stack and symbols table
  2. Each NetworkWindow can contain either a GraphicsScene or a TextEditor (new class). 
  3. The GraphicsScene and the TextEditor use their parent NetworkWindow's history stack and symbols table. 
  4. Just as GraphicsScene uses graphics items, TextEditor uses TextItem
  5. The MainWindow has three signals for indicating that items are inserted or removed. One is the old itemsInserted and itemsRemoved which is connected to GraphicsScene. The second is the same but for TextEditor. The third is generic to GraphicsScene or TextEditor: this signal just contains the handles that have been inserted. Therefore, plug-ins that only need to worry about the handles can listen to this last signal. These plug-ins would work whether the user is using text mode or graphics mode.
The TextEditor is a very simple class (contrary to GraphicsScene). TextEditor does NOT parse the text. The parsing MUST be done by a plug-in. The parser plug-in is expected to listen to the signals in TextEditor and respond by calling the insertItem and removeItem methods in TextEditor. 
TextEditor also uses a special undo command that is a composite command. This composite command changes the text along with the other change that it is meant to do (e.g. data changed). The push() method in TextEditor automatically creates this new composite command from the given command. 


Plug-ins modified:

Tools such as StoichiometryTool and other data-related tool not listen to the generic itemsInserted and itemsRemoved signals. This means that the tools would also work the same when user is using TextEditor or GraphicsScene -- convenient!