SF.net SVN: avogadro: trunk

   * libavogadro/src/pluginmanager.*: Added support for

extensions.

Of course you beat me to it, which is great. One other bit that I was
considering in this effort was to make a base “Plugin” class for
Extensions, Tools, and Engines. This would encompass things like name,
description, etc. The advantage is that we could then make other
plugin styles like Colors and Gradients… etc.

Marcus and I were also discussing that it might be nice to have three
states for a plugin: not loaded, loaded into a menu, and “normal.” The
idea would be that some tools you use a lot, so you want them in the
dock, others you can stash in a menu. I think this is particularly
true for engines – most I don’t use much, but it’s nice to add
forces, etc. when I need them.

Another useful trick will be to save the current list of “known”
plugins, so when you re-launch Avogadro with new installed plugins, it
will automatically bring them up.

But I think a plugin manager is a great feature and it looks really
good right now.

Thanks!
-Geoff
(Who’s trying to stay afloat while writing a huge grant proposal.)

Hi,

On Fri, Jul 11, 2008 at 12:27 AM, Geoffrey Hutchison
geoff.hutchison@gmail.com wrote:

  * libavogadro/src/pluginmanager.*: Added support for extensions.

Of course you beat me to it, which is great. One other bit that I was
considering in this effort was to make a base “Plugin” class for Extensions,
Tools, and Engines. This would encompass things like name, description, etc.
The advantage is that we could then make other plugin styles like Colors and
Gradients… etc.

Yes, a base class would be nice to make it more generic, at the moment
the tools and extensions are quite similar, but engines are handled a
bit different because they can be renamed. At least, the code to load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some sort of
plugins that can be used as tree items in a project tree (items like
chains, residues, atoms, named selections, …)

I don’t see why we should have multiple types of ???Factory classes.
We could make a generic PluginFactory class and use it to get the
plugin type, name, description and other information which is useful
before actually creating an instance of the plugin. I’ll play around
with this and keep you up to date.

Marcus and I were also discussing that it might be nice to have three states
for a plugin: not loaded, loaded into a menu, and “normal.” The idea would
be that some tools you use a lot, so you want them in the dock, others you
can stash in a menu. I think this is particularly true for engines – most I
don’t use much, but it’s nice to add forces, etc. when I need them.

For engines this is already possible in a way. The engine plugin can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Another useful trick will be to save the current list of “known” plugins, so
when you re-launch Avogadro with new installed plugins, it will
automatically bring them up.

But I think a plugin manager is a great feature and it looks really good
right now.

Thanks, but I hope to further improve it the following days…

Thanks!
-Geoff
(Who’s trying to stay afloat while writing a huge grant proposal.)

I have vacation now, so there is plenty of time for me to work on this. :slight_smile:

cheers,
Tim

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the moment
the tools and extensions are quite similar, but engines are handled a
bit different because they can be renamed. At least, the code to load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some sort of
plugins that can be used as tree items in a project tree (items like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine, Extension
classes is good for simple reason of “simplicity.” So, I think it’s
fine to merge the factories and have a base class as long as you keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is functionality but I
think if we are missing functionality there are better ways to implement
it.

For engines this is already possible in a way. The engine plugin can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added multiple
times and so technically disabled. But, I understand if you didn’t want
it in the list then you might want to disable it. shrug


Donald

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the moment
the tools and extensions are quite similar, but engines are handled a
bit different because they can be renamed. At least, the code to load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some sort of
plugins that can be used as tree items in a project tree (items like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine, Extension
classes is good for simple reason of “simplicity.” So, I think it’s
fine to merge the factories and have a base class as long as you keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is functionality but I
think if we are missing functionality there are better ways to implement
it.

We should definably keep the Tool, Engine and Extension classes, but
to make it easier to add addional plugin types a generic Plugin and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine plugin can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added multiple
times and so technically disabled. But, I understand if you didn’t want
it in the list then you might want to disable it. shrug


Donald

Hi,

In svn there is now a base Plugin class from which Engines, Tools,
Extensions and ColorPlugins are derived. I added the ColorPlugin class
because I had trouble with making Color a derived class from Plugin,
and therefore QObject. However, If you prefer to use the Color class
as plugin directly, feel free to change it.

The plugins are now loaded from main.cpp after the QApplication is
created. The PluginFactory class now requires a name() and
description() function that will be used by the PluginManager. There
are macros (like we already had for Engines) to make this easier:

AVOGADRO_TOOL_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_EXTENSION_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_COLOR_FACTORY( className, tr(“Name”), tr(“Description”) )

and for engines:

AVOGADRO_ENGINE( tr(“Name”) )
AVOGADRO_TOOL_FACTORY( className, tr(“Description”) ) // name from
AVOGADRO_ENGINE reused…

We could also add AVOGADRO_TOOL( tr(“Toolname”) ), … so that you
don’t have to set the name twice for tools, extensions and colors
(once for the Tool, once for the PluginFactory).

The plugin manager itself, uses a PluginItem class for its models.
This is where the enabled/disabled state which is also used by
QSettings is stored. Extending this class to hold additional
information could lead to the “tab tools” vs. “menu tools”
settings.

In general, polishing the way we handle plugins shoudl now be much
easer I hope…

cheers,
Tim
PS: Since its a big commit, do not hesitate to ask questions.
Explaining all details and problems I encountered would make this mail
too long…

On Fri, Jul 11, 2008 at 6:46 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the moment
the tools and extensions are quite similar, but engines are handled a
bit different because they can be renamed. At least, the code to load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some sort of
plugins that can be used as tree items in a project tree (items like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine, Extension
classes is good for simple reason of “simplicity.” So, I think it’s
fine to merge the factories and have a base class as long as you keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is functionality but I
think if we are missing functionality there are better ways to implement
it.

We should definably keep the Tool, Engine and Extension classes, but
to make it easier to add addional plugin types a generic Plugin and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine plugin can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added multiple
times and so technically disabled. But, I understand if you didn’t want
it in the list then you might want to disable it. shrug


Donald

I Tim.

I get the following error while trying to compile the latest sources:
“[ 8%] Generating elementcolor.moc
/Users/ricard/svn/avogadro/trunk/libavogadro/src/colors/elementcolor.h:
73: Error: Undefined interface
make[2]: *** [libavogadro/src/elementcolor.moc] Error 1
make[1]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/all] Error 2
make: *** [all] Error 2”.

This is on a Mac. Same thing occurs on a linux Fedora box.

I upgraded openbabel before recompiling Avogadro.

Louis

Le 12 juil. 08 à 03:20, Tim Vandermeersch a écrit :

Hi,

In svn there is now a base Plugin class from which Engines, Tools,
Extensions and ColorPlugins are derived. I added the ColorPlugin class
because I had trouble with making Color a derived class from Plugin,
and therefore QObject. However, If you prefer to use the Color class
as plugin directly, feel free to change it.

The plugins are now loaded from main.cpp after the QApplication is
created. The PluginFactory class now requires a name() and
description() function that will be used by the PluginManager. There
are macros (like we already had for Engines) to make this easier:

AVOGADRO_TOOL_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_EXTENSION_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_COLOR_FACTORY( className, tr(“Name”), tr(“Description”) )

and for engines:

AVOGADRO_ENGINE( tr(“Name”) )
AVOGADRO_TOOL_FACTORY( className, tr(“Description”) ) // name from
AVOGADRO_ENGINE reused…

We could also add AVOGADRO_TOOL( tr(“Toolname”) ), … so that you
don’t have to set the name twice for tools, extensions and colors
(once for the Tool, once for the PluginFactory).

The plugin manager itself, uses a PluginItem class for its models.
This is where the enabled/disabled state which is also used by
QSettings is stored. Extending this class to hold additional
information could lead to the “tab tools” vs. “menu tools”
settings.

In general, polishing the way we handle plugins shoudl now be much
easer I hope…

cheers,
Tim
PS: Since its a big commit, do not hesitate to ask questions.
Explaining all details and problems I encountered would make this mail
too long…

On Fri, Jul 11, 2008 at 6:46 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch <tim.vandermeersch@gmail.com

:
Yes, a base class would be nice to make it more generic, at the
moment
the tools and extensions are quite similar, but engines are
handled a
bit different because they can be renamed. At least, the code to
load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some
sort of
plugins that can be used as tree items in a project tree (items
like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine,
Extension
classes is good for simple reason of “simplicity.” So, I think it’s
fine to merge the factories and have a base class as long as you
keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is functionality
but I
think if we are missing functionality there are better ways to
implement
it.

We should definably keep the Tool, Engine and Extension classes, but
to make it easier to add addional plugin types a generic Plugin and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine plugin
can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be
nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added
multiple
times and so technically disabled. But, I understand if you
didn’t want
it in the list then you might want to disable it. shrug


Donald


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

I made some added some headers and made some changes which cmake
doesn’t seem to notice because we use *.cpp, *.h, … To fix this run
cmake again and also copy the headers to your
/usr/(local/)include/avogadro folder

cmake . sudo cp libavogadro/src/.h /usr/local/include/avogadro
$ sudo cp avogadro/src/
.h /usr/local/include/avogadro

We should fix the build scripts to look for <avogadro/xxx.h> include
files in the libavogadro/src/ dir…

Hope this helps,
Tim

On Sat, Jul 12, 2008 at 1:42 PM, Louis Ricard
louis.ricard@polytechnique.edu wrote:

I Tim.

I get the following error while trying to compile the latest sources:
“[ 8%] Generating elementcolor.moc
/Users/ricard/svn/avogadro/trunk/libavogadro/src/colors/elementcolor.h:73:
Error: Undefined interface
make[2]: *** [libavogadro/src/elementcolor.moc] Error 1
make[1]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/all] Error 2
make: *** [all] Error 2”.

This is on a Mac. Same thing occurs on a linux Fedora box.

I upgraded openbabel before recompiling Avogadro.

Louis

Le 12 juil. 08 à 03:20, Tim Vandermeersch a écrit :

Hi,

In svn there is now a base Plugin class from which Engines, Tools,
Extensions and ColorPlugins are derived. I added the ColorPlugin class
because I had trouble with making Color a derived class from Plugin,
and therefore QObject. However, If you prefer to use the Color class
as plugin directly, feel free to change it.

The plugins are now loaded from main.cpp after the QApplication is
created. The PluginFactory class now requires a name() and
description() function that will be used by the PluginManager. There
are macros (like we already had for Engines) to make this easier:

AVOGADRO_TOOL_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_EXTENSION_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_COLOR_FACTORY( className, tr(“Name”), tr(“Description”) )

and for engines:

AVOGADRO_ENGINE( tr(“Name”) )
AVOGADRO_TOOL_FACTORY( className, tr(“Description”) ) // name from
AVOGADRO_ENGINE reused…

We could also add AVOGADRO_TOOL( tr(“Toolname”) ), … so that you
don’t have to set the name twice for tools, extensions and colors
(once for the Tool, once for the PluginFactory).

The plugin manager itself, uses a PluginItem class for its models.
This is where the enabled/disabled state which is also used by
QSettings is stored. Extending this class to hold additional
information could lead to the “tab tools” vs. “menu tools”
settings.

In general, polishing the way we handle plugins shoudl now be much
easer I hope…

cheers,
Tim
PS: Since its a big commit, do not hesitate to ask questions.
Explaining all details and problems I encountered would make this mail
too long…

On Fri, Jul 11, 2008 at 6:46 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch
tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the moment
the tools and extensions are quite similar, but engines are handled a
bit different because they can be renamed. At least, the code to load
the plugins is now in one location which should hopefully help when
implementing this base plugin class. I’d also like to add some sort of
plugins that can be used as tree items in a project tree (items like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine, Extension
classes is good for simple reason of “simplicity.” So, I think it’s
fine to merge the factories and have a base class as long as you keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is functionality but I
think if we are missing functionality there are better ways to implement
it.

We should definably keep the Tool, Engine and Extension classes, but
to make it easier to add addional plugin types a generic Plugin and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine plugin can
be enabled/disabled with the plugin manager and you can also choose
which engines are actually in your list. However, it would be nice to
have something similar for tools. This idea could also be used for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added multiple
times and so technically disabled. But, I understand if you didn’t want
it in the list then you might want to disable it. shrug


Donald


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

Thanks! It finally works after exporting
“CPPFLAGS= -I/usr/local/include/avogadro”.

Can now start exploring

Louis

Le 12 juil. 08 à 13:49, Tim Vandermeersch a écrit :

I made some added some headers and made some changes which cmake
doesn’t seem to notice because we use *.cpp, *.h, … To fix this run
cmake again and also copy the headers to your
/usr/(local/)include/avogadro folder

cmake . sudo cp libavogadro/src/.h /usr/local/include/avogadro
$ sudo cp avogadro/src/
.h /usr/local/include/avogadro

We should fix the build scripts to look for <avogadro/xxx.h> include
files in the libavogadro/src/ dir…

Hope this helps,
Tim

On Sat, Jul 12, 2008 at 1:42 PM, Louis Ricard
louis.ricard@polytechnique.edu wrote:

I Tim.

I get the following error while trying to compile the latest sources:
“[ 8%] Generating elementcolor.moc
/Users/ricard/svn/avogadro/trunk/libavogadro/src/colors/
elementcolor.h:73:
Error: Undefined interface
make[2]: *** [libavogadro/src/elementcolor.moc] Error 1
make[1]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/all]
Error 2
make: *** [all] Error 2”.

This is on a Mac. Same thing occurs on a linux Fedora box.

I upgraded openbabel before recompiling Avogadro.

Louis

Le 12 juil. 08 à 03:20, Tim Vandermeersch a écrit :

Hi,

In svn there is now a base Plugin class from which Engines, Tools,
Extensions and ColorPlugins are derived. I added the ColorPlugin
class
because I had trouble with making Color a derived class from Plugin,
and therefore QObject. However, If you prefer to use the Color class
as plugin directly, feel free to change it.

The plugins are now loaded from main.cpp after the QApplication is
created. The PluginFactory class now requires a name() and
description() function that will be used by the PluginManager. There
are macros (like we already had for Engines) to make this easier:

AVOGADRO_TOOL_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_EXTENSION_FACTORY( className, tr(“Name”),
tr(“Description”) )
AVOGADRO_COLOR_FACTORY( className, tr(“Name”), tr(“Description”) )

and for engines:

AVOGADRO_ENGINE( tr(“Name”) )
AVOGADRO_TOOL_FACTORY( className, tr(“Description”) ) // name from
AVOGADRO_ENGINE reused…

We could also add AVOGADRO_TOOL( tr(“Toolname”) ), … so that you
don’t have to set the name twice for tools, extensions and colors
(once for the Tool, once for the PluginFactory).

The plugin manager itself, uses a PluginItem class for its models.
This is where the enabled/disabled state which is also used by
QSettings is stored. Extending this class to hold additional
information could lead to the “tab tools” vs. “menu tools”
settings.

In general, polishing the way we handle plugins shoudl now be much
easer I hope…

cheers,
Tim
PS: Since its a big commit, do not hesitate to ask questions.
Explaining all details and problems I encountered would make this
mail
too long…

On Fri, Jul 11, 2008 at 6:46 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch
tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the
moment
the tools and extensions are quite similar, but engines are
handled a
bit different because they can be renamed. At least, the code
to load
the plugins is now in one location which should hopefully help
when
implementing this base plugin class. I’d also like to add some
sort of
plugins that can be used as tree items in a project tree (items
like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine,
Extension
classes is good for simple reason of “simplicity.” So, I think
it’s
fine to merge the factories and have a base class as long as you
keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is
functionality but I
think if we are missing functionality there are better ways to
implement
it.

We should definably keep the Tool, Engine and Extension classes,
but
to make it easier to add addional plugin types a generic Plugin and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in
libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine
plugin can
be enabled/disabled with the plugin manager and you can also
choose
which engines are actually in your list. However, it would be
nice to
have something similar for tools. This idea could also be used
for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added
multiple
times and so technically disabled. But, I understand if you
didn’t want
it in the list then you might want to disable it. shrug


Donald


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source
project,
along with a healthy diet, reduces your potential for chronic
lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

Error. Read CXXFLAGS.
L.
Le 12 juil. 08 à 16:38, Louis Ricard a écrit :

Thanks! It finally works after exporting
“CPPFLAGS= -I/usr/local/include/avogadro”.

Can now start exploring

Louis

Le 12 juil. 08 à 13:49, Tim Vandermeersch a écrit :

I made some added some headers and made some changes which cmake
doesn’t seem to notice because we use *.cpp, *.h, … To fix this run
cmake again and also copy the headers to your
/usr/(local/)include/avogadro folder

cmake . sudo cp libavogadro/src/.h /usr/local/include/avogadro
$ sudo cp avogadro/src/
.h /usr/local/include/avogadro

We should fix the build scripts to look for <avogadro/xxx.h> include
files in the libavogadro/src/ dir…

Hope this helps,
Tim

On Sat, Jul 12, 2008 at 1:42 PM, Louis Ricard
louis.ricard@polytechnique.edu wrote:

I Tim.

I get the following error while trying to compile the latest
sources:
“[ 8%] Generating elementcolor.moc
/Users/ricard/svn/avogadro/trunk/libavogadro/src/colors/
elementcolor.h:73:
Error: Undefined interface
make[2]: *** [libavogadro/src/elementcolor.moc] Error 1
make[1]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/all]
Error 2
make: *** [all] Error 2”.

This is on a Mac. Same thing occurs on a linux Fedora box.

I upgraded openbabel before recompiling Avogadro.

Louis

Le 12 juil. 08 à 03:20, Tim Vandermeersch a écrit :

Hi,

In svn there is now a base Plugin class from which Engines, Tools,
Extensions and ColorPlugins are derived. I added the ColorPlugin
class
because I had trouble with making Color a derived class from
Plugin,
and therefore QObject. However, If you prefer to use the Color
class
as plugin directly, feel free to change it.

The plugins are now loaded from main.cpp after the QApplication is
created. The PluginFactory class now requires a name() and
description() function that will be used by the PluginManager.
There
are macros (like we already had for Engines) to make this easier:

AVOGADRO_TOOL_FACTORY( className, tr(“Name”), tr(“Description”) )
AVOGADRO_EXTENSION_FACTORY( className, tr(“Name”),
tr(“Description”) )
AVOGADRO_COLOR_FACTORY( className, tr(“Name”), tr(“Description”) )

and for engines:

AVOGADRO_ENGINE( tr(“Name”) )
AVOGADRO_TOOL_FACTORY( className, tr(“Description”) ) // name from
AVOGADRO_ENGINE reused…

We could also add AVOGADRO_TOOL( tr(“Toolname”) ), … so that you
don’t have to set the name twice for tools, extensions and colors
(once for the Tool, once for the PluginFactory).

The plugin manager itself, uses a PluginItem class for its models.
This is where the enabled/disabled state which is also used by
QSettings is stored. Extending this class to hold additional
information could lead to the “tab tools” vs. “menu tools”
settings.

In general, polishing the way we handle plugins shoudl now be much
easer I hope…

cheers,
Tim
PS: Since its a big commit, do not hesitate to ask questions.
Explaining all details and problems I encountered would make this
mail
too long…

On Fri, Jul 11, 2008 at 6:46 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Fri, Jul 11, 2008 at 6:09 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

(Fri, Jul 11, 2008 at 03:04:14AM +0200) Tim Vandermeersch
tim.vandermeersch@gmail.com:

Yes, a base class would be nice to make it more generic, at the
moment
the tools and extensions are quite similar, but engines are
handled a
bit different because they can be renamed. At least, the code
to load
the plugins is now in one location which should hopefully help
when
implementing this base plugin class. I’d also like to add some
sort of
plugins that can be used as tree items in a project tree (items
like
chains, residues, atoms, named selections, …)

A base class is nice but in my thinking today (as a cautionary
statement) I still believe that having separate Tool, Engine,
Extension
classes is good for simple reason of “simplicity.” So, I think
it’s
fine to merge the factories and have a base class as long as you
keep
the separation of classes. Once you allow people to put a Tool,
Extension, and Engine all in one class you’re just asking for
unmanageable complexity. Although, the trade off is
functionality but I
think if we are missing functionality there are better ways to
implement
it.

We should definably keep the Tool, Engine and Extension classes,
but
to make it easier to add addional plugin types a generic Plugin
and
PluginFactory would help. I already got this working here for the
tools and colors (with element color statically linked in
libavogadro
like the bsdy engine).

For engines this is already possible in a way. The engine
plugin can
be enabled/disabled with the plugin manager and you can also
choose
which engines are actually in your list. However, it would be
nice to
have something similar for tools. This idea could also be used
for
extensions by letting the user edit the menu bar items.

Well, engines are a different beast because they can be added
multiple
times and so technically disabled. But, I understand if you
didn’t want
it in the list then you might want to disable it. shrug


Donald


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source
project,
along with a healthy diet, reduces your potential for chronic
lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic
lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options


Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

On Saturday 12 July 2008 07:49:56 Tim Vandermeersch wrote:

I made some added some headers and made some changes which cmake
doesn’t seem to notice because we use *.cpp, *.h, … To fix this run
cmake again and also copy the headers to your
/usr/(local/)include/avogadro folder

cmake . sudo cp libavogadro/src/.h /usr/local/include/avogadro
$ sudo cp avogadro/src/
.h /usr/local/include/avogadro

We should fix the build scripts to look for <avogadro/xxx.h> include
files in the libavogadro/src/ dir…

This should not be necessary. Avogadro does look for include files in
libavogadro/include - headers that are expected to be available should have
pseudo headers in that directory. Otherwise you can include local headers.
Please do not change the build system. If anything we need to improve the
build system to not include headers that are not in the include directory.
Probably manually writing the list of headers to install would be the best
approach in order to only install headers that contain public API.

On Sat, Jul 12, 2008 at 5:15 PM, Marcus D. Hanwell marcus@cryos.org wrote:

On Saturday 12 July 2008 07:49:56 Tim Vandermeersch wrote:

I made some added some headers and made some changes which cmake
doesn’t seem to notice because we use *.cpp, *.h, … To fix this run
cmake again and also copy the headers to your
/usr/(local/)include/avogadro folder

cmake . sudo cp libavogadro/src/.h /usr/local/include/avogadro
$ sudo cp avogadro/src/
.h /usr/local/include/avogadro

We should fix the build scripts to look for <avogadro/xxx.h> include
files in the libavogadro/src/ dir…

This should not be necessary. Avogadro does look for include files in
libavogadro/include - headers that are expected to be available should have
pseudo headers in that directory. Otherwise you can include local headers.
Please do not change the build system. If anything we need to improve the
build system to not include headers that are not in the include directory.
Probably manually writing the list of headers to install would be the best
approach in order to only install headers that contain public API.

You are wright, I should have added the pseudo headers…

After downloading the new source, I am a little confused why we have
both a Color, and a ColorPlugin which is simply a glass with a widget
and a pointer to a Color. It just seems a bit redundant. Couldn’t we
have simply a Color be an interface as a plugin and then have a
ColorFactory and be done with it?


Donald

On Sat, Jul 12, 2008 at 6:57 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

After downloading the new source, I am a little confused why we have
both a Color, and a ColorPlugin which is simply a glass with a widget
and a pointer to a Color. It just seems a bit redundant. Couldn’t we
have simply a Color be an interface as a plugin and then have a
ColorFactory and be done with it?

Yes, I briefly explained this in one of my previous mails. My main
objective was to get all plugins to use the Plugin and PluginFactory
classes. However, I encountered some problems when making Color a
derived class from Plugin (which itself is derived from QObject). The
Color::operator=(const QColor &color) didn’t seem to work. It is
possible (even likely) that this can be fixed but I didn’t want to
make too much changes to the Color class before everything
compiled/worked again. I agree on the fact that it’s a bit redundant
and will have a look at this now…

Tim

Well, I’m sending this to everyone after starting to get my hands back
into the API.

It seems like the code is already starting to decay. For a simple
example, there are these functions like staticType, staticName, type,
name, typeName (exaggerating here) and some of them don’t even appear to
have a reason.

There is no reason that Color can’t be a subclass of Plugin. As long as
Color isn’t a subclass of any other QObject (which it isn’t) then there
is no problem. The problem is that Color has a function:

virtual QString type() const { return “Virtual Base Class”; }

and Plugin has a function:

virtual int type() const = 0;

So there are two things each plugin needs based on my experience with
Engines:

– A plugin now needs to return a type (Plugin::EngineType,
Plugin::ColorType… etc enumeration of all our types of plugins).

– A plugin must return a static name (Ball and Stick, Vanderwall, Color
by Element, etc)

– A plugin must return a name (if a plugin got renamed).

And now that i’m thinking about this, we really should let ::name() be
the static name (Ball and Stick, Vanderwall) and we should have an
::alias for any specific class that needs renaming.

  1. tools, extensions don’t need to ever be renamed. you will never
    create more than one tool (maybe we will add this later).

  2. engines, colors need aliases because you might create more than one
    and then need them to be named different. (My Color By Element 1, My
    Engine 1, etc etc)

There is no reason to need a string counterpart for each enumeration
of type. If something is compiled to use an enumeration
Plugin::EngineType then the UI and the coders do not need a function to
tell them that this translates to “Engines” or something like that.

I decided that the one thing I wanted to do once I got back was to audit
the code and clean it up. I definitely don’t want to take out features
or stuff like that, I just want to try to organize and make things much
more efficient, not that it isn’t, I’m just seeing some things I hope is
OK.


Donald

(Sat, Jul 12, 2008 at 07:22:16PM +0200) Tim Vandermeersch tim.vandermeersch@gmail.com:

On Sat, Jul 12, 2008 at 6:57 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

After downloading the new source, I am a little confused why we have
both a Color, and a ColorPlugin which is simply a glass with a widget
and a pointer to a Color. It just seems a bit redundant. Couldn’t we
have simply a Color be an interface as a plugin and then have a
ColorFactory and be done with it?

Yes, I briefly explained this in one of my previous mails. My main
objective was to get all plugins to use the Plugin and PluginFactory
classes. However, I encountered some problems when making Color a
derived class from Plugin (which itself is derived from QObject). The
Color::operator=(const QColor &color) didn’t seem to work. It is
possible (even likely) that this can be fixed but I didn’t want to
make too much changes to the Color class before everything
compiled/worked again. I agree on the fact that it’s a bit redundant
and will have a look at this now…

Tim

On Sat, Jul 12, 2008 at 7:36 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

Well, I’m sending this to everyone after starting to get my hands back
into the API.

It seems like the code is already starting to decay. For a simple
example, there are these functions like staticType, staticName, type,
name, typeName (exaggerating here) and some of them don’t even appear to
have a reason.

There is no reason that Color can’t be a subclass of Plugin. As long as
Color isn’t a subclass of any other QObject (which it isn’t) then there
is no problem. The problem is that Color has a function:

virtual QString type() const { return “Virtual Base Class”; }

and Plugin has a function:

virtual int type() const = 0;

That wasn’t really the problem, the problem really was the Color’s
copy operator=. Plugin is derived from QObject and QObject’s operator=
is private. The thing here is that we use color in a different way
(not with pointers), so appending a Color to a QList (in
ribbonengine.cpp for example) requires the Color::operator=. Another
“special” feature of Color is that you can create a valid Color
without any plugins (e.g. the Color(r,g,b,a) constructor).

So there are two things each plugin needs based on my experience with
Engines:

– A plugin now needs to return a type (Plugin::EngineType,
Plugin::ColorType… etc enumeration of all our types of plugins).

– A plugin must return a static name (Ball and Stick, Vanderwall, Color
by Element, etc)

– A plugin must return a name (if a plugin got renamed).

And now that i’m thinking about this, we really should let ::name() be
the static name (Ball and Stick, Vanderwall) and we should have an
::alias for any specific class that needs renaming.

sounds good…

  1. tools, extensions don’t need to ever be renamed. you will never
    create more than one tool (maybe we will add this later).

  2. engines, colors need aliases because you might create more than one
    and then need them to be named different. (My Color By Element 1, My
    Engine 1, etc etc)

There is no reason to need a string counterpart for each enumeration
of type. If something is compiled to use an enumeration
Plugin::EngineType then the UI and the coders do not need a function to
tell them that this translates to “Engines” or something like that.

I was planning on using this to detect plugin types dynamically in the
plugin manager dialog…

I decided that the one thing I wanted to do once I got back was to audit
the code and clean it up. I definitely don’t want to take out features
or stuff like that, I just want to try to organize and make things much
more efficient, not that it isn’t, I’m just seeing some things I hope is
OK.

On Sat, Jul 12, 2008 at 8:18 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Sat, Jul 12, 2008 at 7:36 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

Well, I’m sending this to everyone after starting to get my hands back
into the API.

It seems like the code is already starting to decay. For a simple
example, there are these functions like staticType, staticName, type,
name, typeName (exaggerating here) and some of them don’t even appear to
have a reason.

There is no reason that Color can’t be a subclass of Plugin. As long as
Color isn’t a subclass of any other QObject (which it isn’t) then there
is no problem. The problem is that Color has a function:

virtual QString type() const { return “Virtual Base Class”; }

and Plugin has a function:

virtual int type() const = 0;

That wasn’t really the problem,

To clarify: I know this is the first compile error you get when adding
: public Plugin to class Color, but once these issues are solved you
get the errors about the operator=.

the problem really was the Color’s
copy operator=. Plugin is derived from QObject and QObject’s operator=
is private. The thing here is that we use color in a different way
(not with pointers), so appending a Color to a QList (in
ribbonengine.cpp for example) requires the Color::operator=. Another
“special” feature of Color is that you can create a valid Color
without any plugins (e.g. the Color(r,g,b,a) constructor).

So there are two things each plugin needs based on my experience with
Engines:

– A plugin now needs to return a type (Plugin::EngineType,
Plugin::ColorType… etc enumeration of all our types of plugins).

– A plugin must return a static name (Ball and Stick, Vanderwall, Color
by Element, etc)

– A plugin must return a name (if a plugin got renamed).

And now that i’m thinking about this, we really should let ::name() be
the static name (Ball and Stick, Vanderwall) and we should have an
::alias for any specific class that needs renaming.

sounds good…

  1. tools, extensions don’t need to ever be renamed. you will never
    create more than one tool (maybe we will add this later).

  2. engines, colors need aliases because you might create more than one
    and then need them to be named different. (My Color By Element 1, My
    Engine 1, etc etc)

There is no reason to need a string counterpart for each enumeration
of type. If something is compiled to use an enumeration
Plugin::EngineType then the UI and the coders do not need a function to
tell them that this translates to “Engines” or something like that.

I was planning on using this to detect plugin types dynamically in the
plugin manager dialog…

I decided that the one thing I wanted to do once I got back was to audit
the code and clean it up. I definitely don’t want to take out features
or stuff like that, I just want to try to organize and make things much
more efficient, not that it isn’t, I’m just seeing some things I hope is
OK.

OK, so I’ve done some thinking.

It seems to me that the problem is really that “Plugin” is a subclass of
QObject and in a way that’s a bad assumption. It is not necissarily
true that each plugin will need to be of type QObject and if so, just
like Engines, Tools, Extensions, we can define that in the header file.

How about if we try making Plugin a template class as-is and then
subclass QObject at the Engines, Tools, and Extensions level?

I’m going to start some hacking today and cleanup to see where I get.


Donald

(Sat, Jul 12, 2008 at 08:20:54PM +0200) Tim Vandermeersch tim.vandermeersch@gmail.com:

On Sat, Jul 12, 2008 at 8:18 PM, Tim Vandermeersch
tim.vandermeersch@gmail.com wrote:

On Sat, Jul 12, 2008 at 7:36 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

Well, I’m sending this to everyone after starting to get my hands back
into the API.

It seems like the code is already starting to decay. For a simple
example, there are these functions like staticType, staticName, type,
name, typeName (exaggerating here) and some of them don’t even appear to
have a reason.

There is no reason that Color can’t be a subclass of Plugin. As long as
Color isn’t a subclass of any other QObject (which it isn’t) then there
is no problem. The problem is that Color has a function:

virtual QString type() const { return “Virtual Base Class”; }

and Plugin has a function:

virtual int type() const = 0;

That wasn’t really the problem,

To clarify: I know this is the first compile error you get when adding
: public Plugin to class Color, but once these issues are solved you
get the errors about the operator=.

the problem really was the Color’s
copy operator=. Plugin is derived from QObject and QObject’s operator=
is private. The thing here is that we use color in a different way
(not with pointers), so appending a Color to a QList (in
ribbonengine.cpp for example) requires the Color::operator=. Another
“special” feature of Color is that you can create a valid Color
without any plugins (e.g. the Color(r,g,b,a) constructor).

So there are two things each plugin needs based on my experience with
Engines:

– A plugin now needs to return a type (Plugin::EngineType,
Plugin::ColorType… etc enumeration of all our types of plugins).

– A plugin must return a static name (Ball and Stick, Vanderwall, Color
by Element, etc)

– A plugin must return a name (if a plugin got renamed).

And now that i’m thinking about this, we really should let ::name() be
the static name (Ball and Stick, Vanderwall) and we should have an
::alias for any specific class that needs renaming.

sounds good…

  1. tools, extensions don’t need to ever be renamed. you will never
    create more than one tool (maybe we will add this later).

  2. engines, colors need aliases because you might create more than one
    and then need them to be named different. (My Color By Element 1, My
    Engine 1, etc etc)

There is no reason to need a string counterpart for each enumeration
of type. If something is compiled to use an enumeration
Plugin::EngineType then the UI and the coders do not need a function to
tell them that this translates to “Engines” or something like that.

I was planning on using this to detect plugin types dynamically in the
plugin manager dialog…

I decided that the one thing I wanted to do once I got back was to audit
the code and clean it up. I definitely don’t want to take out features
or stuff like that, I just want to try to organize and make things much
more efficient, not that it isn’t, I’m just seeing some things I hope is
OK.

On Sat, Jul 12, 2008 at 11:23 PM, Donald Ephraim Curtis
d@milkbox.net wrote:

OK, so I’ve done some thinking.

It seems to me that the problem is really that “Plugin” is a subclass of
QObject and in a way that’s a bad assumption. It is not necissarily
true that each plugin will need to be of type QObject and if so, just
like Engines, Tools, Extensions, we can define that in the header file.

How about if we try making Plugin a template class as-is and then
subclass QObject at the Engines, Tools, and Extensions level?

This is probably the best solution, I wasn’t sure if a plugin had to
be derived from QObject.

I’m going to start some hacking today and cleanup to see where I get.

Are you going to fix the plugin stuff? If so, I’ll continue doing
something else… There is no point in doing the same thing.

cheers,
Tim