Difference between revisions of "Refactoring Ideas"

From Avogadro - Free cross-platform molecule editor
Jump to: navigation, search
(Modularization of libavogadro)
(Modularization of libavogadro)
Line 26: Line 26:
 
For compatibility with previous versions, dummy libavogadro library linked to all components could be provided
 
For compatibility with previous versions, dummy libavogadro library linked to all components could be provided
  
* '''AvogadroCore''' - generic classes which could be used even by terminal applications to simplify access to OB and make some advanced operations with molecules.
+
=== '''AvogadroCore''' ===
 +
 
 +
Generic classes which could be used even by terminal applications to simplify access to OB and make some advanced operations with molecules.
 
<big><pre>Atom
 
<big><pre>Atom
 
Bond
 
Bond
Line 44: Line 46:
 
</pre></big>
 
</pre></big>
  
* '''AvogadroWidget''' - rendering of molecules in external apps (including Avogadro). Probably engines also go here
+
==='''AvogadroWidget''' ===
 +
 
 +
Rendering of molecules in external apps (including Avogadro). Static ("core") engine/tools also go here
 
<big><pre>
 
<big><pre>
 
Animation
 
Animation
Line 69: Line 73:
 
Also, it's needed to create class AvogadroWidget which will allow to choose what subclass of RenderWidget is used
 
Also, it's needed to create class AvogadroWidget which will allow to choose what subclass of RenderWidget is used
  
* '''AvogadroPython''' - Everything Python-related
+
==='''AvogadroPython'''===
 +
 
 +
Everything Python-related
 
<big><pre>
 
<big><pre>
 
pythonengine
 
pythonengine
Line 81: Line 87:
 
'''AvogadroPython''' should be made "optional" - while Avogadro is compiled with Python support, it should work without AvogadroPython library and load it if it's present (for Linux packaging). Maybe it can be loaded as a plugin.
 
'''AvogadroPython''' should be made "optional" - while Avogadro is compiled with Python support, it should work without AvogadroPython library and load it if it's present (for Linux packaging). Maybe it can be loaded as a plugin.
  
* '''QPeriodicTable''' (partially done in annulen/master)
+
=== '''QPeriodicTable''' (partially done in annulen/master)===
 
<big><pre>
 
<big><pre>
 
ElementDetail
 
ElementDetail
Line 90: Line 96:
 
</pre></big>
 
</pre></big>
  
* '''QPlotWidget'''
+
=== '''QPlotWidget'''===
 
<big><pre>
 
<big><pre>
 
plotaxis
 
plotaxis

Revision as of 03:09, 3 April 2010

This page contains some ideas about future refactorization of libavogadro. They may seriously break ABI (and possibly API), and should be discussed

Rendering Widget

  • Make libavogadro use abstract RenderWidget instead of GLWidget
  • Inherit GLWidget from RenderWidget and QGLWidget, move GL-independent functionality (e.g., plugin access) up to RenderWidget
  • Remove any OpenGL calls from engines, replace them by new methods of PainterDevice
  • Add minimalistic SimpleRenderWidget without OpenGL (to create images for publication, b/w images, for use on old/heavy loaded PCs, etc)
  • Create separate GLWidgets for OpenGL2, 3, 4, etc (?)
  • "On-line" POV-Ray rendering for aesthetes (???)

PlotWidget

  • Make it stronger and used by 3rd party developers - I think there are some projects interested in easy Qt way to do it without linking to KDE
  • Rename it to QPlotWidget and publish as independent library - may be some contributors will appear
  • KPlotWidget is LGPL, so we can change its license to LGPL
  • Try to merge KPlotWidget with QPlotWIdget
    • KPlotWidget didn't evolve a lot from time it was forked for Avogadro
    • so it could be simple KDE wrapper for QPlotWidget library and some KDE-specific features
    • [crazy idea] We can try to push QPlotWidget in QtGui, and KDE folks will do all work theirselves :)

Modularization of libavogadro

Libavogadro contains a lot of APIs for different purposes and tends to grow. I propose to divide it into several modules (as Qt did when moving to Qt4)

For compatibility with previous versions, dummy libavogadro library linked to all components could be provided

AvogadroCore

Generic classes which could be used even by terminal applications to simplify access to OB and make some advanced operations with molecules.

Atom
Bond
Cube
Fragment
IDList
Mesh
MeshGenerator
Molecule
MoleculeFile
NeighborList (?)
Primitive
PrimitiveList
Protein (?)
Residue
ZMatrix 

AvogadroWidget

Rendering of molecules in external apps (including Avogadro). Static ("core") engine/tools also go here

Animation
Camera
Color3f
ColorButton (?)
Cylinder_p
GLHit
GLPainter_p
GLWidget
Navigate
Painter
PainterDevice
UndoSequence

Color
Engine
Extension
DockExtension
Tool
ToolGroup

Also, it's needed to create class AvogadroWidget which will allow to choose what subclass of RenderWidget is used

AvogadroPython

Everything Python-related

pythonengine
pythonerror
pythonextension_p
pythoninterpreter
pythonscript
pythonthread_p
pythontool_p

AvogadroPython should be made "optional" - while Avogadro is compiled with Python support, it should work without AvogadroPython library and load it if it's present (for Linux packaging). Maybe it can be loaded as a plugin.

QPeriodicTable (partially done in annulen/master)

ElementDetail
ElementItem
ElementTranslator
PeriodicTableScene
PeriodicTableView

QPlotWidget

plotaxis
plotobject
plotpoint
plotwidget
  • Also, new module with basis set related files from extensions/ directory could be introduced
basisset
molpro 
mopacaux
gaussianfchk

If you think 3 latter modules are too small, they could be merged in one, e.g. AvogadroExtra. However, see my proposition about plotwidget before. Also, there are a lot of types of basis sets. Periodic table could run as standalone application (there's gelemental though)

Source Tree

Current source tree is very complicated and "overpopulated". Extensions directory looks like a dump.

  • Divide libavogadro and avogadro repositories, create a superpckage instead. It isn't actual now, but if ABI is stable, application and library releases may be done separately, especially bugfix ones. What about Windows and Mac users? They may receive such bugfixes as incremental updates (e.g., download only avogadro.exe through update manager instead of full installation procedure for new release)
  • Divide extensions into:
    • Main - live in Git of (lib)avogadro (e.g., animationextension,cartesianextension, fileimportextension, networkfetchextension, propextension, selectextension)
    • Extras:
      • Quantum - input generators, MO surfaces, basis set code
      • Crystal - unitcell, supercell (?)
      • Spectra

Of course, everything could be built together as superpackage