|
From: <mor...@us...> - 2008-10-02 16:53:20
|
Revision: 3139
http://ecell.svn.sourceforge.net/ecell/?rev=3139&view=rev
Author: moriyoshi
Date: 2008-10-02 16:53:01 +0000 (Thu, 02 Oct 2008)
Log Message:
-----------
* Merge from branch
Modified Paths:
--------------
ecell3/trunk/ecell/libecs/Makefile.am
ecell3/trunk/ecell/libemc/Makefile.am
Modified: ecell3/trunk/ecell/libecs/Makefile.am
===================================================================
--- ecell3/trunk/ecell/libecs/Makefile.am 2008-10-02 16:51:46 UTC (rev 3138)
+++ ecell3/trunk/ecell/libecs/Makefile.am 2008-10-02 16:53:01 UTC (rev 3139)
@@ -17,7 +17,7 @@
INCLUDES = -I$(top_srcdir) $(DMTOOL_INCLUDE) $(INCLTDL)
lib_LTLIBRARIES = libecs.la
-AM_CXXFLAGS = @CXXFLAGS@
+AM_CXXFLAGS = $(CXXFLAGS)
libecs_la_LDFLAGS= -version-info 2:0:0 -no-undefined
libecs_la_LIBADD= -lstdc++ $(LIBLTDL) $(GSL_LIBADD) scripting/libecs-scripting.la
Modified: ecell3/trunk/ecell/libemc/Makefile.am
===================================================================
--- ecell3/trunk/ecell/libemc/Makefile.am 2008-10-02 16:51:46 UTC (rev 3138)
+++ ecell3/trunk/ecell/libemc/Makefile.am 2008-10-02 16:53:01 UTC (rev 3139)
@@ -15,7 +15,7 @@
INCLUDES = -I${top_srcdir} ${DMTOOL_INCLUDE} ${INCLTDL}
lib_LTLIBRARIES = libemc.la
-AM_CXXFLAGS = @CXXFLAGS@
+AM_CXXFLAGS = $(CXXFLAGS)
libemc_la_LDFLAGS= -version-info 2:0:0 -no-undefined
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mor...@us...> - 2008-10-10 09:57:22
|
Revision: 3187
http://ecell.svn.sourceforge.net/ecell/?rev=3187&view=rev
Author: moriyoshi
Date: 2008-10-10 09:53:00 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
* Merge from branch.
Modified Paths:
--------------
ecell3/trunk/ecell/Makefile.am
ecell3/trunk/ecell/configure.in
ecell3/trunk/ecell/frontend/session-monitor/Makefile.am
ecell3/trunk/ecell/frontend/session-monitor/setup.py
ecell3/trunk/ecell/pyecell/ecell/Session.py
ecell3/trunk/ecell/pyecell/ecell/config.py.in
Added Paths:
-----------
ecell3/trunk/ecell/frontend/
ecell3/trunk/ecell/frontend/Makefile.am
ecell3/trunk/ecell/frontend/session-monitor/
Removed Paths:
-------------
ecell3/trunk/ecell/session-monitor/
Modified: ecell3/trunk/ecell/Makefile.am
===================================================================
--- ecell3/trunk/ecell/Makefile.am 2008-10-10 09:42:51 UTC (rev 3186)
+++ ecell3/trunk/ecell/Makefile.am 2008-10-10 09:53:00 UTC (rev 3187)
@@ -1,9 +1,6 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = libecs libemc pyecs pyecell bin dm
-if ENABLE_GUI
-SUBDIRS += session-monitor
-endif
+SUBDIRS = libecs libemc pyecs pyecell bin dm frontend
ECELL_DIRNAME=@ECELL_DIRNAME@
Modified: ecell3/trunk/ecell/configure.in
===================================================================
--- ecell3/trunk/ecell/configure.in 2008-10-10 09:42:51 UTC (rev 3186)
+++ ecell3/trunk/ecell/configure.in 2008-10-10 09:53:00 UTC (rev 3187)
@@ -307,9 +307,10 @@
pyecell/ecell/config.py
pyecs/Makefile
pyecs/setup.py
- session-monitor/Makefile
- session-monitor/plugins/Makefile
- session-monitor/glade/Makefile
+ frontend/Makefile
+ frontend/session-monitor/Makefile
+ frontend/session-monitor/plugins/Makefile
+ frontend/session-monitor/glade/Makefile
])
AC_CONFIG_FILES([bin/ecell3-dmc], [chmod +x bin/ecell3-dmc])
AC_OUTPUT
Property changes on: ecell3/trunk/ecell/frontend
___________________________________________________________________
Added: svn:ignore
+ Makefile
Makefile.in
Added: ecell3/trunk/ecell/frontend/Makefile.am
===================================================================
--- ecell3/trunk/ecell/frontend/Makefile.am (rev 0)
+++ ecell3/trunk/ecell/frontend/Makefile.am 2008-10-10 09:53:00 UTC (rev 3187)
@@ -0,0 +1,4 @@
+SUBDIRS =
+if ENABLE_GUI
+SUBDIRS += session-monitor
+endif
Property changes on: ecell3/trunk/ecell/frontend/Makefile.am
___________________________________________________________________
Added: svn:mime-type
+ text/x-makefile
Added: svn:eol-style
+ native
Modified: ecell3/trunk/ecell/frontend/session-monitor/Makefile.am
===================================================================
--- ecell3/trunk/ecell/session-monitor/Makefile.am 2008-08-15 23:39:58 UTC (rev 3137)
+++ ecell3/trunk/ecell/frontend/session-monitor/Makefile.am 2008-10-10 09:53:00 UTC (rev 3187)
@@ -1,6 +1,7 @@
SUBDIRS = glade plugins
-PYTHON_ = env PYTHONPATH=$(srcdir)/../pyecell $(PYTHON)
+PYTHON_ = env PYTHONPATH=$(top_srcdir)/pyecell sysconfdir=$(sysconfdir) datarootdir=$(datarootdir) libdir=$(libdir) $(PYTHON)
+
EXTRA_DIST = \
ecell/ui/__init__.py\
ecell/ui/osogo/AboutSessionMonitor.py\
@@ -44,25 +45,11 @@
ecell3-session-monitor
all-local:
- sysconfdir=$(sysconfdir) \
- datarootdir=$(datarootdir) \
- libdir=$(libdir) \
$(PYTHON_) setup.py config
- sysconfdir=$(sysconfdir) \
- datarootdir=$(datarootdir) \
- libdir=$(libdir) \
$(PYTHON_) setup.py build
mostlyclean-local:
- sysconfdir=$(sysconfdir) \
- datarootdir=$(datarootdir) \
- libdir=$(libdir) \
$(PYTHON_) setup.py clean
install-exec-local:
- DESTDIR=$(DESTDIR); \
- sysconfdir=$(sysconfdir) \
- datarootdir=$(datarootdir) \
- libdir=$(libdir) \
- $(PYTHON_) setup.py install -f --prefix=$(PREFIX) $${DESTDIR:+--root }$${DESTDIR}
-
+ $(PYTHON_) setup.py install -f --prefix=$(PREFIX) $(if $(DESTDIR),--root $(DESTDIR), )
Modified: ecell3/trunk/ecell/frontend/session-monitor/setup.py
===================================================================
--- ecell3/trunk/ecell/session-monitor/setup.py 2008-08-15 23:39:58 UTC (rev 3137)
+++ ecell3/trunk/ecell/frontend/session-monitor/setup.py 2008-10-10 09:53:00 UTC (rev 3187)
@@ -13,8 +13,8 @@
os.path.join( os.path.dirname( __file__ ), 'plugins', '*' ) )
setup(
- name = 'ecell.ui.osogo',
- version = "3.1.105",
+ name = 'ecell.session-monitor',
+ version = config.version,
description = 'E-Cell Osogo -- Session Monitor',
author = 'E-Cell project',
author_email = 'in...@e-...',
Modified: ecell3/trunk/ecell/pyecell/ecell/Session.py
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/Session.py 2008-10-10 09:42:51 UTC (rev 3186)
+++ ecell3/trunk/ecell/pyecell/ecell/Session.py 2008-10-10 09:53:00 UTC (rev 3187)
@@ -26,7 +26,6 @@
#
#END_HEADER
-import string
import eml
import sys
import os
@@ -137,7 +136,7 @@
<eml>
''' % ( time.asctime( time.localtime() ) , self.getCurrentTime() )
aString = anEml.asString()
- aBuffer = string.join( string.split( aString, '<eml>\n' ), aCurrentInfo )
+ aBuffer = aCurrentInfo.join( aString.split( '<eml>\n' ) )
aFileObject = open( aModel, 'w' )
aFileObject.write( aBuffer )
aFileObject.close()
Modified: ecell3/trunk/ecell/pyecell/ecell/config.py.in
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/config.py.in 2008-10-10 09:42:51 UTC (rev 3186)
+++ ecell3/trunk/ecell/pyecell/ecell/config.py.in 2008-10-10 09:53:00 UTC (rev 3187)
@@ -28,7 +28,7 @@
import sys
__all__ = (
- 'package',
+ 'PACKAGE',
'per_app_dir_name',
'version',
'version_info',
@@ -39,7 +39,10 @@
'bin_dir',
'lib_dir',
'data_dir',
+ 'datarootdir',
+ 'doc_dir',
'conf_dir',
+ 'builtin_dm_dir',
'dm_path'
)
@@ -51,7 +54,7 @@
else:
return os.path.abspath( sys.argv[0] )
-package = "@PACKAGE@"
+PACKAGE = "@PACKAGE@"
per_app_dir_name = "@ECELL_DIRNAME@"
version = "@VERSION@"
version_info = {
@@ -106,20 +109,31 @@
_lib_dir = os.path.join( prefix, 'lib' )
lib_dir = os.path.join( _lib_dir, per_app_dir_name )
-_data_dir = '''@datarootdir@'''
-_data_dir = expand_shell_variables( _data_dir, locals() )
-if len( _data_dir ) == 0 or not os.path.isdir( _data_dir ):
- _data_dir = os.path.join( prefix, 'share' )
-data_dir = os.path.join( _data_dir, per_app_dir_name )
+datarootdir = '''@datarootdir@'''
+datarootdir = expand_shell_variables( datarootdir, locals() )
+if len( datarootdir ) == 0 or not os.path.isdir( datarootdir ):
+ datarootdir = os.path.join( prefix, 'share' )
+data_dir = '''@datadir@'''
+data_dir = expand_shell_variables( data_dir, locals() )
+if len( data_dir ) == 0 or not os.path.isdir( data_dir ):
+ data_dir = os.path.join( datarootdir, per_app_dir_name )
+
_conf_dir = '''@sysconfdir@'''
_conf_dir = expand_shell_variables( _conf_dir, locals() )
if len( _conf_dir ) == 0 or not os.path.isdir( _conf_dir ):
_conf_dir = os.path.join( prefix, 'etc' )
conf_dir = os.path.join( _conf_dir, per_app_dir_name )
+doc_dir = '''@docdir@'''
+doc_dir = expand_shell_variables( doc_dir, locals() )
+if len( doc_dir ) == 0 or not os.path.isdir( doc_dir ):
+ doc_dir = os.path.join( datarootdir, 'doc' )
+
+builtin_dm_dir = os.path.join( lib_dir, 'dms' )
+
if os.environ.has_key( 'ECELL3_DM_PATH' ):
dm_path = os.environ[ 'ECELL3_DM_PATH' ].split( os.pathsep )
else:
dm_path = []
-dm_path += [ os.path.join( lib_dir, 'modules' ) ]
+dm_path += [ builtin_dm_dir ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mor...@us...> - 2008-10-14 07:18:43
|
Revision: 3208
http://ecell.svn.sourceforge.net/ecell/?rev=3208&view=rev
Author: moriyoshi
Date: 2008-10-14 07:18:33 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
* Merge from branch.
Modified Paths:
--------------
ecell3/trunk/ecell/Makefile.am
ecell3/trunk/ecell/acinclude.m4
ecell3/trunk/ecell/configure.ac.in
ecell3/trunk/ecell/pyecell/Makefile.am
ecell3/trunk/ecell/pyecell/setup.py.in
Added Paths:
-----------
ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
ecell3/trunk/ecell/pyecell/ecell/ecs.py
ecell3/trunk/ecell/pyecell/ecell/emc.py
Removed Paths:
-------------
ecell3/trunk/ecell/pyecs/
Modified: ecell3/trunk/ecell/Makefile.am
===================================================================
--- ecell3/trunk/ecell/Makefile.am 2008-10-14 07:14:30 UTC (rev 3207)
+++ ecell3/trunk/ecell/Makefile.am 2008-10-14 07:18:33 UTC (rev 3208)
@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = libecs libemc pyecs pyecell bin dm frontend
+SUBDIRS = libecs libemc pyecell bin dm frontend
ECELL_DIRNAME = @ECELL_DIRNAME@
Modified: ecell3/trunk/ecell/acinclude.m4
===================================================================
--- ecell3/trunk/ecell/acinclude.m4 2008-10-14 07:14:30 UTC (rev 3207)
+++ ecell3/trunk/ecell/acinclude.m4 2008-10-14 07:18:33 UTC (rev 3208)
@@ -119,62 +119,6 @@
])
-dnl numpy package.
-dnl find arrayobject.h.
-dnl
-AC_DEFUN([ECELL_CHECK_NUMPY], [
- AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
-
- AC_ARG_WITH(numpy-includes,
- AC_HELP_STRING([--with-numpy-includes=DIR],
- [specify the numpy header location]),
- [NUMPY_INCLUDE_DIR=$withval],
- [NUMPY_INCLUDE_DIR=]
- )
-
- AC_MSG_CHECKING([for numpy include directory])
- if test -z "$NUMPY_INCLUDE_DIR"; then
- if ! NUMPY_INCLUDE_DIR=`$PYTHON -c "import numpy; print numpy.get_include();"`; then
- py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
- pydir=python${PYTHON_VERSION}
- numpy_include="site-packages/numpy/core/include"
- EXT_GUESS= \
- "${py_prefix}/Lib/${numpy_include}" \
- "${py_prefix}/lib/${pydir}/${numpy_include}" \
- "${py_prefix}/lib64/${pydir}/${numpy_include}" \
- "/usr/lib/${pydir}/${numpy_include}" \
- "/usr/lib64/${pydir}/${numpy_include}" \
- "/usr/local/lib/${pydir}/${numpy_include}" \
- "/usr/local/lib64/${pydir}/${numpy_include}" \
- "${prefix}/include" \
- "/usr/include/${pydir}" \
- "/usr/local/include" \
- "/opt/numpy/include"
- NUMPY_INCLUDE_DIR=""
- for ac_dir in $EXT_GUESS ; do
- if test -f ${ac_dir}/numpy/arrayobject.h ; then
- NUMPY_INCLUDE_DIR=`(cd $ac_dir ; pwd)`
- fi
- done
- fi
- fi
- if test -z "${NUMPY_INCLUDE_DIR}"; then
- AC_MSG_RESULT([not found in ${EXT_GUESS}.])
- else
- AC_MSG_RESULT(${NUMPY_INCLUDE_DIR})
- fi
- ac_save_CPPFLAGS="${CPPFLAGS}"
- CPPFLAGS="-I${NUMPY_INCLUDE_DIR} ${PYTHON_INCLUDES}"
- AC_CHECK_HEADERS([numpy/arrayobject.h], [], [
- AC_MSG_ERROR([no usable NumPy headers were found. please check the installation of NumPy package.])
- ], [
-#include <Python.h>
- ])
- CPPFLAGS="${ac_save_CPPFLAGS}"
- AC_SUBST(NUMPY_INCLUDE_DIR)
-])
-
-
AC_DEFUN([ECELL_CHECK_MATH_HEADER], [
STD_MATH_HEADER=
@@ -323,3 +267,40 @@
;;
esac
])
+
+AC_DEFUN([ECELL_CHECK_BOOST], [
+ AC_CHECK_HEADER([boost/config.hpp], [
+ AC_DEFINE(HAVE_BOOST, 1, [Define to 1 if Boost C++ library is installed])
+ ifelse([$1], [],, [$1])
+ ], [
+ ifelse([$2], [],, [$2])
+ ])
+])
+
+AC_DEFUN([ECELL_CHECK_BOOST_PYTHON], [
+ AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+ AC_CHECK_HEADER([boost/python.hpp], [
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS -lboost_python $PYTHON_LIBS"
+ AC_MSG_CHECKING([for Boost.Python runtime library avaiability])
+ AC_TRY_LINK([
+#include <boost/python/module.hpp>
+ ], [
+boost::python::detail::init_module("dummy", 0);
+ ], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_BOOST_PYTHON, 1, [Define to 1 if Boost.Python is available])
+ ifelse([$1], [],, [$1])
+ ], [
+ AC_MSG_RESULT([no])
+ ifelse([$2], [],, [$2])
+ ])
+ LIBS="$ac_save_LIBS"
+ ], [
+ ifelse([$2], [],, [$2])
+ ])
+ CPPFLAGS="$ac_save_CPPFLAGS"
+])
+
Modified: ecell3/trunk/ecell/configure.ac.in
===================================================================
--- ecell3/trunk/ecell/configure.ac.in 2008-10-14 07:14:30 UTC (rev 3207)
+++ ecell3/trunk/ecell/configure.ac.in 2008-10-14 07:18:33 UTC (rev 3208)
@@ -137,7 +137,6 @@
dnl
ECELL_CHECK_GSL
-
AM_CHECK_PYMOD(numpy,,,[AC_MSG_ERROR([could not find Python numpy module])])
AM_CHECK_PYMOD(xml,,,[AC_MSG_ERROR([could not find Python xml module])])
@@ -224,7 +223,8 @@
AM_CONDITIONAL([HAVE_PYTHON_LIB], [test ! -z "$PYTHON_LIBS"])
AC_SUBST([PYTHON_LIBS])
-ECELL_CHECK_NUMPY
+ECELL_CHECK_BOOST(, [AC_MSG_ERROR([could not find Boost C++ library])])
+ECELL_CHECK_BOOST_PYTHON(, [AC_MSG_ERROR([could not find Boost.Python library])])
AC_MSG_CHECKING( if use of compiler specific features are allowed )
@@ -305,8 +305,6 @@
pyecell/Makefile
pyecell/setup.py
pyecell/ecell/config.py
- pyecs/Makefile
- pyecs/setup.py
frontend/Makefile
frontend/session-monitor/Makefile
frontend/session-monitor/plugins/Makefile
Modified: ecell3/trunk/ecell/pyecell/Makefile.am
===================================================================
--- ecell3/trunk/ecell/pyecell/Makefile.am 2008-10-14 07:14:30 UTC (rev 3207)
+++ ecell3/trunk/ecell/pyecell/Makefile.am 2008-10-14 07:18:33 UTC (rev 3208)
@@ -30,6 +30,8 @@
ecell/convertEML2SBML.py \
ecell/convertSBML2EML.py \
ecell/convertSBMLFunctions.py \
+ ecell/ecs.py \
+ ecell/emc.py \
ecell/ecs_constants.py \
ecell/ecssupport.py \
ecell/em.py \
Copied: ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp (from rev 3192, ecell3/trunk/ecell/pyecs/PyEcs.cpp)
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp (rev 0)
+++ ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp 2008-10-14 07:18:33 UTC (rev 3208)
@@ -0,0 +1,673 @@
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+//
+// This file is part of the E-Cell System
+//
+// Copyright (C) 1996-2008 Keio University
+// Copyright (C) 2005-2008 The Molecular Sciences Institute
+//
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+//
+//
+// E-Cell System is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// E-Cell System is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with E-Cell System -- see the file COPYING.
+// If not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//END_HEADER
+//
+// written by Koichi Takahashi <sh...@e-...> for
+// E-Cell Project.
+//
+
+
+#include <signal.h>
+#include <string.h>
+
+#include <boost/cast.hpp>
+#include <boost/python.hpp>
+#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
+
+#include <numpy/arrayobject.h>
+
+#include "libecs/libecs.hpp"
+#include "libecs/Process.hpp"
+#include "libecs/Exceptions.hpp"
+#include "libecs/Polymorph.hpp"
+#include "libecs/DataPointVector.hpp"
+#include "libecs/VariableReference.hpp"
+#include "libemc/libemc.hpp"
+#include "libemc/Simulator.hpp"
+
+using namespace libecs;
+using namespace libemc;
+namespace python = boost::python;
+
+class Polymorph_to_python
+{
+public:
+
+ static PyObject* convert( libecs::PolymorphCref aPolymorph )
+ {
+ switch( aPolymorph.getType() )
+ {
+ case libecs::Polymorph::REAL :
+ return PyFloat_FromDouble( aPolymorph.asReal() );
+ case libecs::Polymorph::INTEGER :
+ return PyInt_FromLong( aPolymorph.asInteger() );
+ case libecs::Polymorph::POLYMORPH_VECTOR :
+ return PolymorphVector_to_PyTuple( aPolymorph.asPolymorphVector() );
+ case libecs::Polymorph::STRING :
+ case libecs::Polymorph::NONE :
+ default: // should this default be an error?
+ return PyString_FromString( aPolymorph.asString().c_str() );
+ }
+ }
+
+ static PyObject*
+ PolymorphVector_to_PyTuple( libecs::PolymorphVectorCref aVector )
+ {
+ libecs::PolymorphVector::size_type aSize( aVector.size() );
+
+ PyObject* aPyTuple( PyTuple_New( aSize ) );
+
+ for( size_t i( 0 ) ; i < aSize ; ++i )
+ {
+ PyTuple_SetItem( aPyTuple, i,
+ Polymorph_to_python::convert( aVector[i] ) );
+ }
+
+ return aPyTuple;
+ }
+
+
+};
+
+
+class DataPointVectorSharedPtr_to_python
+{
+public:
+
+ static PyObject*
+ convert( const libecs::DataPointVectorSharedPtr& aVectorSharedPtr )
+ {
+ // here starts an ugly C hack :-/
+
+ libecs::DataPointVectorCref aVector( *aVectorSharedPtr );
+
+ int aDimensions[2] = { aVector.getSize(),
+ aVector.getElementSize() / sizeof( double ) };
+
+
+ PyArrayObject* anArrayObject( reinterpret_cast<PyArrayObject*>
+ ( PyArray_FromDims( 2, aDimensions,
+ PyArray_DOUBLE ) ) );
+
+ memcpy( anArrayObject->data, aVector.getRawArray(),
+ aVector.getSize() * aVector.getElementSize() );
+
+ return PyArray_Return( anArrayObject );
+ }
+
+};
+
+
+class register_Polymorph_from_python
+{
+public:
+
+ register_Polymorph_from_python()
+ {
+ python::converter::
+ registry::insert( &convertible, &construct,
+ python::type_id<libecs::Polymorph>() );
+ }
+
+ static void* convertible( PyObject* aPyObject )
+ {
+ // always passes the test for efficiency. overload won't work.
+ return aPyObject;
+ }
+
+ static void construct( PyObject* aPyObjectPtr,
+ python::converter::
+ rvalue_from_python_stage1_data* data )
+ {
+ void* storage( ( ( python::converter::
+ rvalue_from_python_storage<libecs::Polymorph>*)
+ data )->storage.bytes );
+
+ new (storage) libecs::Polymorph( Polymorph_from_python( aPyObjectPtr ) );
+ data->convertible = storage;
+ }
+
+
+ static const libecs::Polymorph
+ Polymorph_from_python( PyObject* aPyObjectPtr )
+ {
+ if( PyFloat_Check( aPyObjectPtr ) )
+ {
+ return PyFloat_AS_DOUBLE( aPyObjectPtr );
+ }
+ else if( PyInt_Check( aPyObjectPtr ) )
+ {
+ return PyInt_AS_LONG( aPyObjectPtr );
+ }
+ else if ( PyTuple_Check( aPyObjectPtr ) )
+ {
+ return to_PolymorphVector( aPyObjectPtr );
+ }
+ else if( PyList_Check( aPyObjectPtr ) )
+ {
+ return to_PolymorphVector( PyList_AsTuple( aPyObjectPtr ) );
+ }
+ else if( PyString_Check( aPyObjectPtr ) )
+ {
+ return libecs::Polymorph( PyString_AsString( aPyObjectPtr ) );
+ }
+ // conversion is failed. ( convert with repr() ? )
+ PyErr_SetString( PyExc_TypeError,
+ "Unacceptable type of an object in the tuple." );
+ python::throw_error_already_set();
+ // never get here: the following is for suppressing warnings
+ return libecs::Polymorph();
+ }
+
+
+ static const libecs::PolymorphVector
+ to_PolymorphVector( PyObject* aPyObjectPtr )
+ {
+ std::size_t aSize( PyTuple_GET_SIZE( aPyObjectPtr ) );
+
+ libecs::PolymorphVector aVector;
+ aVector.reserve( aSize );
+
+ for ( std::size_t i( 0 ); i < aSize; ++i )
+ {
+ aVector.
+ push_back( Polymorph_from_python( PyTuple_GET_ITEM( aPyObjectPtr,
+ i ) ) );
+ }
+
+ return aVector;
+ }
+
+};
+
+class PolymorphMap_to_python
+{
+public:
+static PyObject* convert(const libecs::PolymorphMap& aPolymorphMapCref )
+{
+ //Polymorph_to_python aPolymorphConverter;
+ PyObject * aPyDict(PyDict_New());
+ libecs::PolymorphMap aPolymorphMap( aPolymorphMapCref );
+ for (libecs::PolymorphMap::iterator i=aPolymorphMap.begin();
+ i!=aPolymorphMap.end();++i)
+ {
+ PyDict_SetItem( aPyDict, PyString_FromString( i->first.c_str() ),
+ Polymorph_to_python::convert( i->second ) );
+
+ }
+ return aPyDict;
+}
+
+};
+
+
+// exception translators
+
+//void translateException( libecs::ExceptionCref anException )
+//{
+// PyErr_SetString( PyExc_RuntimeError, anException.what() );
+//}
+
+void translateException( const std::exception& anException )
+{
+ PyErr_SetString( PyExc_RuntimeError, anException.what() );
+}
+
+
+static PyObject* getLibECSVersionInfo()
+{
+ PyObject* aPyTuple( PyTuple_New( 3 ) );
+
+ PyTuple_SetItem( aPyTuple, 0, PyInt_FromLong( libecs::getMajorVersion() ) );
+ PyTuple_SetItem( aPyTuple, 1, PyInt_FromLong( libecs::getMinorVersion() ) );
+ PyTuple_SetItem( aPyTuple, 2, PyInt_FromLong( libecs::getMicroVersion() ) );
+
+ return aPyTuple;
+}
+
+// module initializer / finalizer
+static struct _
+{
+ inline _()
+ {
+ if (!libecs::initialize())
+ {
+ throw std::runtime_error( "Failed to initialize libecs" );
+ }
+ }
+
+ inline ~_()
+ {
+ libecs::finalize();
+ }
+} _;
+
+class PythonCallable
+{
+public:
+
+ PythonCallable( PyObject* aPyObjectPtr )
+ :
+ thePyObject( python::handle<>( aPyObjectPtr ) )
+ {
+ // this check isn't needed actually, because BPL does this automatically
+ if( ! PyCallable_Check( thePyObject.ptr() ) )
+ {
+ PyErr_SetString( PyExc_TypeError, "Callable object must be given" );
+ python::throw_error_already_set();
+ }
+ }
+
+ virtual ~PythonCallable()
+ {
+ ; // do nothing
+ }
+
+protected:
+
+ python::object thePyObject;
+};
+
+
+class PythonEventChecker
+ :
+ public PythonCallable,
+ public libemc::EventChecker
+{
+public:
+
+ PythonEventChecker( PyObject* aPyObjectPtr )
+ :
+ PythonCallable( aPyObjectPtr )
+ {
+ ; // do nothing
+ }
+
+ virtual ~PythonEventChecker() {}
+
+ virtual bool operator()( void ) const
+ {
+ // check signal
+ // PyErr_CheckSignals();
+
+ // check event.
+ // this is faster than just 'return thePyObject()', unfortunately..
+ PyObject* aPyObjectPtr( PyObject_CallFunction( thePyObject.ptr(), NULL ) );
+ const bool aResult( PyObject_IsTrue( aPyObjectPtr ) );
+ Py_DECREF( aPyObjectPtr );
+
+ return aResult;
+ }
+
+};
+
+class PythonEventHandler
+ :
+ public PythonCallable,
+ public libemc::EventHandler
+{
+public:
+
+ PythonEventHandler( PyObject* aPyObjectPtr )
+ :
+ PythonCallable( aPyObjectPtr )
+ {
+ ; // do nothing
+ }
+
+ virtual ~PythonEventHandler() {}
+
+ virtual void operator()( void ) const
+ {
+ PyObject_CallFunction( thePyObject.ptr(), NULL );
+
+ // faster than just thePyObject() ....
+ }
+
+};
+
+
+class register_EventCheckerSharedPtr_from_python
+{
+public:
+
+ register_EventCheckerSharedPtr_from_python()
+ {
+ python::converter::
+ registry::insert( &convertible, &construct,
+ python::type_id<libemc::EventCheckerSharedPtr>() );
+ }
+
+ static void* convertible( PyObject* aPyObjectPtr )
+ {
+ if( PyCallable_Check( aPyObjectPtr ) )
+ {
+ return aPyObjectPtr;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ static void
+ construct( PyObject* aPyObjectPtr,
+ python::converter::rvalue_from_python_stage1_data* data )
+ {
+ void* storage( ( ( python::converter::
+ rvalue_from_python_storage<libecs::Polymorph>*)
+ data )->storage.bytes );
+
+ new (storage)
+ libemc::EventCheckerSharedPtr( new PythonEventChecker( aPyObjectPtr ) );
+
+ data->convertible = storage;
+ }
+
+};
+
+
+
+class register_EventHandlerSharedPtr_from_python
+{
+public:
+
+ register_EventHandlerSharedPtr_from_python()
+ {
+ python::converter::
+ registry::insert( &convertible, &construct,
+ python::type_id<libemc::EventHandlerSharedPtr>() );
+ }
+
+ static void* convertible( PyObject* aPyObjectPtr )
+ {
+ if( PyCallable_Check( aPyObjectPtr ) )
+ {
+ return aPyObjectPtr;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ static void construct( PyObject* aPyObjectPtr,
+ python::converter::
+ rvalue_from_python_stage1_data* data )
+ {
+ void* storage( ( ( python::converter::
+ rvalue_from_python_storage<libecs::Polymorph>*)
+ data )->storage.bytes );
+
+ new (storage)
+ libemc::EventHandlerSharedPtr( new PythonEventHandler( aPyObjectPtr ) );
+
+ data->convertible = storage;
+ }
+};
+
+BOOST_PYTHON_MODULE( _ecs )
+{
+ using namespace boost::python;
+
+ if (!libecs::initialize())
+ {
+ throw std::runtime_error( "Failed to initialize libecs" );
+ }
+
+ // without this it crashes when Logger::getData() is called. why?
+ import_array();
+
+ // functions
+
+ to_python_converter< Polymorph, Polymorph_to_python >();
+ to_python_converter< DataPointVectorSharedPtr,
+ DataPointVectorSharedPtr_to_python >();
+ to_python_converter< PolymorphMap, PolymorphMap_to_python>();
+
+ register_Polymorph_from_python();
+
+ register_exception_translator<Exception> ( &translateException );
+ register_exception_translator<std::exception>( &translateException );
+
+ register_EventCheckerSharedPtr_from_python();
+ register_EventHandlerSharedPtr_from_python();
+
+ def( "getLibECSVersionInfo", &getLibECSVersionInfo );
+ def( "getLibECSVersion", &libecs::getVersion );
+
+ def( "setDMSearchPath", &libecs::setDMSearchPath );
+ def( "getDMSearchPath", &libecs::getDMSearchPath );
+
+ class_<VariableReference>( "VariableReference", no_init )
+
+ // properties
+ .add_property( "Coefficient",
+ &VariableReference::getCoefficient ) // read-only
+ .add_property( "MolarConc",
+ &VariableReference::getMolarConc ) // read-only
+ .add_property( "Name",
+ &VariableReference::getName ) // read-only
+ .add_property( "NumberConc",
+ &VariableReference::getNumberConc ) // read-only
+ .add_property( "IsFixed",
+ &VariableReference::isFixed ) // read-only
+ .add_property( "IsAccessor",
+ &VariableReference::isAccessor ) // read-only
+ .add_property( "Value",
+ &VariableReference::getValue,
+ &VariableReference::setValue )
+ .add_property( "Velocity",
+ &VariableReference::getVelocity )
+
+ // methods
+ .def( "addValue", &VariableReference::addValue )
+ .def( "getSuperSystem", // this should be a property, but not supported
+ &VariableReference::getSuperSystem,
+ python::return_value_policy<python::reference_existing_object>() )
+ ;
+
+ class_<Process, bases<>, Process, boost::noncopyable>
+ ( "Process", no_init )
+
+ // properties
+ .add_property( "Activity",
+ &Process::getActivity,
+ &Process::setActivity )
+ .add_property( "Priority",
+ &Process::getPriority )
+ .add_property( "StepperID",
+ &Process::getStepperID )
+
+ // methods
+ .def( "addValue", &Process::addValue )
+ .def( "getPositiveVariableReferenceOffset",
+ &Process::getPositiveVariableReferenceOffset )
+ .def( "getSuperSystem", // this can be a property, but not supported
+ &Process::getSuperSystem,
+ python::return_value_policy<python::reference_existing_object>() )
+ .def( "getVariableReference", // this should be a property
+ &Process::getVariableReference,
+ python::return_internal_reference<>() )
+ .def( "getVariableReferenceVector", // this should be a property
+ &Process::getVariableReferenceVector,
+ python::return_value_policy<python::reference_existing_object>() )
+ .def( "getZeroVariableReferenceOffset",
+ &Process::getZeroVariableReferenceOffset )
+ .def( "setFlux", &Process::setFlux )
+ ;
+
+
+ class_<System, bases<>, System, boost::noncopyable>( "System", no_init )
+
+ // properties
+ .add_property( "Size",
+ &System::getSize )
+ .add_property( "SizeN_A",
+ &System::getSizeN_A )
+ .add_property( "StepperID",
+ &System::getStepperID )
+ // methods
+ .def( "getSuperSystem", // this should be a property, but not supported
+ &System::getSuperSystem,
+ python::return_value_policy<python::reference_existing_object>() )
+ ;
+
+
+
+ class_<VariableReferenceVector>( "VariableReferenceVector" )
+ //, bases<>, VariableReferenceVector>
+
+ .def( vector_indexing_suite<VariableReferenceVector>() )
+ ;
+
+
+ // Simulator class
+ class_<Simulator>( "Simulator" )
+ .def( init<>() )
+ .def( "getClassInfo",
+ ( const libecs::PolymorphMap
+ ( libemc::Simulator::* )( libecs::StringCref, libecs::StringCref ) )
+ &libemc::Simulator::getClassInfo )
+ .def( "getClassInfo",
+ ( const libecs::PolymorphMap
+ ( libemc::Simulator::* )( libecs::StringCref, libecs::StringCref,
+ const libecs::Integer ) )
+ &libemc::Simulator::getClassInfo )
+ // Stepper-related methods
+ .def( "createStepper",
+ &libemc::Simulator::createStepper )
+ .def( "deleteStepper",
+ &libemc::Simulator::deleteStepper )
+ .def( "getStepperList",
+ &libemc::Simulator::getStepperList )
+ .def( "getStepperPropertyList",
+ &libemc::Simulator::getStepperPropertyList )
+ .def( "getStepperPropertyAttributes",
+ &libemc::Simulator::getStepperPropertyAttributes )
+ .def( "setStepperProperty",
+ &libemc::Simulator::setStepperProperty )
+ .def( "getStepperProperty",
+ &libemc::Simulator::getStepperProperty )
+ .def( "loadStepperProperty",
+ &libemc::Simulator::loadStepperProperty )
+ .def( "saveStepperProperty",
+ &libemc::Simulator::saveStepperProperty )
+ .def( "getStepperClassName",
+ &libemc::Simulator::getStepperClassName )
+
+ // Entity-related methods
+ .def( "createEntity",
+ &libemc::Simulator::createEntity )
+ .def( "deleteEntity",
+ &libemc::Simulator::deleteEntity )
+ .def( "getEntityList",
+ &libemc::Simulator::getEntityList )
+ .def( "isEntityExist",
+ &libemc::Simulator::isEntityExist )
+ .def( "getEntityPropertyList",
+ &libemc::Simulator::getEntityPropertyList )
+ .def( "setEntityProperty",
+ &libemc::Simulator::setEntityProperty )
+ .def( "getEntityProperty",
+ &libemc::Simulator::getEntityProperty )
+ .def( "loadEntityProperty",
+ &libemc::Simulator::loadEntityProperty )
+ .def( "saveEntityProperty",
+ &libemc::Simulator::saveEntityProperty )
+ .def( "getEntityPropertyAttributes",
+ &libemc::Simulator::getEntityPropertyAttributes )
+ .def( "getEntityClassName",
+ &libemc::Simulator::getEntityClassName )
+
+ // Logger-related methods
+ .def( "getLoggerList",
+ &libemc::Simulator::getLoggerList )
+ .def( "createLogger",
+ ( void ( libemc::Simulator::* )( libecs::StringCref ) )
+ &libemc::Simulator::createLogger )
+ .def( "createLogger",
+ ( void ( libemc::Simulator::* )( libecs::StringCref,
+ libecs::Polymorph ) )
+ &libemc::Simulator::createLogger )
+ .def( "getLoggerData",
+ ( const libecs::DataPointVectorSharedPtr
+ ( libemc::Simulator::* )( libecs::StringCref ) const )
+ &libemc::Simulator::getLoggerData )
+ .def( "getLoggerData",
+ ( const libecs::DataPointVectorSharedPtr
+ ( libemc::Simulator::* )( libecs::StringCref,
+ libecs::RealCref,
+ libecs::RealCref ) const )
+ &libemc::Simulator::getLoggerData )
+ .def( "getLoggerData",
+ ( const libecs::DataPointVectorSharedPtr
+ ( libemc::Simulator::* )( libecs::StringCref,
+ libecs::RealCref,
+ libecs::RealCref,
+ libecs::RealCref ) const )
+ &libemc::Simulator::getLoggerData )
+ .def( "getLoggerStartTime",
+ &libemc::Simulator::getLoggerStartTime )
+ .def( "getLoggerEndTime",
+ &libemc::Simulator::getLoggerEndTime )
+ .def( "getLoggerMinimumInterval",
+ &libemc::Simulator::getLoggerMinimumInterval )
+ .def( "setLoggerMinimumInterval",
+ &libemc::Simulator::setLoggerMinimumInterval )
+ .def( "getLoggerPolicy",
+ &libemc::Simulator::getLoggerPolicy )
+ .def( "setLoggerPolicy",
+ &libemc::Simulator::setLoggerPolicy )
+ .def( "getLoggerSize",
+ &libemc::Simulator::getLoggerSize )
+
+ // Simulation-related methods
+ .def( "getCurrentTime",
+ &libemc::Simulator::getCurrentTime )
+ .def( "getNextEvent",
+ &libemc::Simulator::getNextEvent )
+ .def( "stop",
+ &libemc::Simulator::stop )
+ .def( "step",
+ ( void ( libemc::Simulator::* )( void ) )
+ &libemc::Simulator::step )
+ .def( "step",
+ ( void ( libemc::Simulator::* )( const libecs::Integer ) )
+ &libemc::Simulator::step )
+ .def( "run",
+ ( void ( libemc::Simulator::* )() )
+ &libemc::Simulator::run )
+ .def( "run",
+ ( void ( libemc::Simulator::* )( const libecs::Real ) )
+ &libemc::Simulator::run )
+ .def( "setEventChecker",
+ &libemc::Simulator::setEventChecker )
+ .def( "setEventHandler",
+ &libemc::Simulator::setEventHandler )
+ ;
+
+}
Property changes on: ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: ecell3/trunk/ecell/pyecell/ecell/ecs.py (from rev 3192, ecell3/trunk/ecell/pyecs/ecell/ecs.py)
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/ecs.py (rev 0)
+++ ecell3/trunk/ecell/pyecell/ecell/ecs.py 2008-10-14 07:18:33 UTC (rev 3208)
@@ -0,0 +1,42 @@
+#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+#
+# This file is part of the E-Cell System
+#
+# Copyright (C) 1996-2008 Keio University
+# Copyright (C) 2005-2008 The Molecular Sciences Institute
+#
+#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+#
+#
+# E-Cell System is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# E-Cell System is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with E-Cell System -- see the file COPYING.
+# If not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#END_HEADER
+import os
+
+if os.name != "nt":
+ import sys
+ try:
+ import DLFCN
+
+ # RTLD_GLOBAL is needed so that rtti across dynamic modules can work
+ # RTLD_LAZY may be needed so that the system can resolve dependency among
+ # dynamic modules after dlopened it
+
+ sys.setdlopenflags( DLFCN.RTLD_LAZY | DLFCN.RTLD_GLOBAL )
+ except:
+ None
+
+from ecell._ecs import *
Copied: ecell3/trunk/ecell/pyecell/ecell/emc.py (from rev 3192, ecell3/trunk/ecell/pyecs/ecell/emc.py)
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/emc.py (rev 0)
+++ ecell3/trunk/ecell/pyecell/ecell/emc.py 2008-10-14 07:18:33 UTC (rev 3208)
@@ -0,0 +1,28 @@
+#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+#
+# This file is part of the E-Cell System
+#
+# Copyright (C) 1996-2008 Keio University
+# Copyright (C) 2005-2008 The Molecular Sciences Institute
+#
+#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+#
+#
+# E-Cell System is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# E-Cell System is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with E-Cell System -- see the file COPYING.
+# If not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#END_HEADER
+
+from ecell.ecs import *
Modified: ecell3/trunk/ecell/pyecell/setup.py.in
===================================================================
--- ecell3/trunk/ecell/pyecell/setup.py.in 2008-10-14 07:14:30 UTC (rev 3207)
+++ ecell3/trunk/ecell/pyecell/setup.py.in 2008-10-14 07:18:33 UTC (rev 3208)
@@ -1,8 +1,23 @@
#!/usr/bin/env python
import sys
-from distutils.core import setup, Extension
+from numpy.distutils.core import setup, Extension
+include_dirs = [
+ '@DMTOOL_INCLUDE_DIR@',
+ os.environ['INCLTDL'][2:],
+ '@top_srcdir@',
+ '@top_srcdir@/libecs',
+ '@top_srcdir@/libemc',
+ ]
+
+common_libraries = [
+ os.environ.get('BOOST_PYTHON_LIB_NAME', 'boost_python'),
+ 'gsl'
+ ]
+
+ecell_staging_home = '@abs_top_builddir@/tmp'
+
setup(
name = 'E-Cell',
version = @ECELL_VERSION_STRING@,
@@ -33,6 +48,14 @@
sources = [ 'ecell/_tableio.c' ],
define_macros = sys.platform == 'win32' and
[ ('WIN32','1'), ('_WIN32','1') ]
- )
- ]
+ ),
+ Extension(
+ 'ecell._ecs',
+ include_dirs = include_dirs,
+ library_dirs = [ ecell_staging_home + os.environ['libdir'] ],
+ libraries = common_libraries + [ 'ecs', 'emc' ],
+ define_macros = sys.platform == 'win32' and
+ [ ('BOOST_ALL_NO_LIB', '1'), ('WIN32','1'), ('_WIN32','1'), ('__STDC__', 1), ('_WIN32_WINNT', 0x500) ],
+ sources = [ 'ecell/_ecs.cpp' ] ),
+ ]
)
This was sent by the SourceForge.ne...
[truncated message content] |
|
From: <mor...@us...> - 2010-05-21 09:42:45
|
Revision: 3837
http://ecell.svn.sourceforge.net/ecell/?rev=3837&view=rev
Author: moriyoshi
Date: 2010-05-21 09:42:38 +0000 (Fri, 21 May 2010)
Log Message:
-----------
Remove initializeStepInterval() in favor of virtualized Stepper::setStepInterval()
Modified Paths:
--------------
ecell3/trunk/ecell/dm/FluxDistributionStepper.cpp
ecell3/trunk/ecell/dm/TauLeapStepper.cpp
ecell3/trunk/ecell/libecs/DifferentialStepper.hpp
ecell3/trunk/ecell/libecs/Stepper.hpp
Modified: ecell3/trunk/ecell/dm/FluxDistributionStepper.cpp
===================================================================
--- ecell3/trunk/ecell/dm/FluxDistributionStepper.cpp 2010-05-21 08:52:11 UTC (rev 3836)
+++ ecell3/trunk/ecell/dm/FluxDistributionStepper.cpp 2010-05-21 09:42:38 UTC (rev 3837)
@@ -91,7 +91,7 @@
Epsilon( 1e-6 ),
theIrreversibleFlag( false )
{
- initializeStepInterval( INF );
+ DifferentialStepper::setStepInterval( INF );
}
~FluxDistributionStepper()
Modified: ecell3/trunk/ecell/dm/TauLeapStepper.cpp
===================================================================
--- ecell3/trunk/ecell/dm/TauLeapStepper.cpp 2010-05-21 08:52:11 UTC (rev 3836)
+++ ecell3/trunk/ecell/dm/TauLeapStepper.cpp 2010-05-21 09:42:38 UTC (rev 3837)
@@ -108,7 +108,7 @@
calculateTau();
- initializeStepInterval( getTau() );
+ DifferentialStepper::setStepInterval( getTau() );
FOR_ALL( GillespieProcessVector, theGillespieProcessVector )
{
Modified: ecell3/trunk/ecell/libecs/DifferentialStepper.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/DifferentialStepper.hpp 2010-05-21 08:52:11 UTC (rev 3836)
+++ ecell3/trunk/ecell/libecs/DifferentialStepper.hpp 2010-05-21 09:42:38 UTC (rev 3837)
@@ -58,10 +58,6 @@
INHERIT_PROPERTIES( Stepper );
// FIXME: load/save ??
- PROPERTYSLOT( Real, StepInterval,
- &DifferentialStepper::initializeStepInterval,
- &DifferentialStepper::getStepInterval );
-
PROPERTYSLOT_GET_NO_LOAD_SAVE( Real, NextStepInterval );
PROPERTYSLOT_SET_GET_NO_LOAD_SAVE( Real, TolerableStepInterval );
PROPERTYSLOT_GET_NO_LOAD_SAVE( Integer, Stage );
@@ -118,9 +114,9 @@
return theTolerableStepInterval;
}
- void initializeStepInterval( Real aStepInterval )
+ virtual void setStepInterval( Real aStepInterval )
{
- setStepInterval( aStepInterval );
+ Stepper::setStepInterval( aStepInterval );
setTolerableStepInterval( aStepInterval );
setNextStepInterval( aStepInterval );
}
Modified: ecell3/trunk/ecell/libecs/Stepper.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/Stepper.hpp 2010-05-21 08:52:11 UTC (rev 3836)
+++ ecell3/trunk/ecell/libecs/Stepper.hpp 2010-05-21 09:42:38 UTC (rev 3837)
@@ -146,7 +146,7 @@
@return the step interval of this Stepper
*/
- GET_METHOD( Real, StepInterval )
+ virtual GET_METHOD( Real, StepInterval )
{
const Real aNextTime( getNextTime() );
const Real aCurrentTime( getCurrentTime() );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mor...@us...> - 2010-06-26 01:27:36
|
Revision: 3841
http://ecell.svn.sourceforge.net/ecell/?rev=3841&view=rev
Author: moriyoshi
Date: 2010-06-26 01:27:30 +0000 (Sat, 26 Jun 2010)
Log Message:
-----------
* Fix a few more build issues.
Modified Paths:
--------------
ecell3/trunk/ecell/dm/ODEStepper.cpp
ecell3/trunk/ecell/libecs/PropertySlot.hpp
ecell3/trunk/ecell/libecs/Variable.hpp
Modified: ecell3/trunk/ecell/dm/ODEStepper.cpp
===================================================================
--- ecell3/trunk/ecell/dm/ODEStepper.cpp 2010-06-17 06:54:24 UTC (rev 3840)
+++ ecell3/trunk/ecell/dm/ODEStepper.cpp 2010-06-26 01:27:30 UTC (rev 3841)
@@ -139,17 +139,17 @@
Real estimateLocalError( Real const aStepInterval );
void initializeRadauIIA( VariableVector::size_type );
- std::pair< bool, Real > calculateRadauIIA( Real const aStepInterval, Real const aPreviousStepInterval );
- void updateInternalStateRadauIIA( Real const aStepInterval );
+ std::pair< bool, Real > calculateRadauIIA( Real aStepInterval, Real aPreviousStepInterval );
+ void updateInternalStateRadauIIA( Real aStepInterval );
- void initializeTolerance( Real value )
+ void initializeTolerance( libecs::Param<Real>::type value )
{
setTolerance( value ); // AdaptiveDifferentialStepper::
rtoler = 0.1 * pow( getTolerance(), 2.0 / 3.0 );
atoler = rtoler * getAbsoluteToleranceFactor();
}
- void initializeAbsoluteToleranceFactor( Real value )
+ void initializeAbsoluteToleranceFactor( libecs::Param<Real>::type value )
{
setAbsoluteToleranceFactor( value ); // AdaptiveDifferentialStepper::
atoler = rtoler * getAbsoluteToleranceFactor();
@@ -619,7 +619,7 @@
return sqrt( aNorm / ( 3 * theSystemSize ) );
}
-std::pair< bool, Real > ODEStepper::calculateRadauIIA( Real const aStepInterval, Real const aPreviousStepInterval )
+std::pair< bool, Real > ODEStepper::calculateRadauIIA( Real aStepInterval, Real aPreviousStepInterval )
{
Real aNewStepInterval;
Real aNorm( 0. );
Modified: ecell3/trunk/ecell/libecs/PropertySlot.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/PropertySlot.hpp 2010-06-17 06:54:24 UTC (rev 3840)
+++ ecell3/trunk/ecell/libecs/PropertySlot.hpp 2010-06-26 01:27:30 UTC (rev 3841)
@@ -179,8 +179,8 @@
typedef SlotType ( T::* GetMethodPtr )() const;
ConcretePropertySlot( String const& aName,
- const SetMethodPtr aSetMethodPtr,
- const GetMethodPtr aGetMethodPtr )
+ SetMethodPtr aSetMethodPtr,
+ GetMethodPtr aGetMethodPtr )
: theName( aName ),
theType( PropertySlotBase::TypeToTypeCode< SlotType_ >::value ),
theSetMethodPtr( SetMethod( aSetMethodPtr ) ),
Modified: ecell3/trunk/ecell/libecs/Variable.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/Variable.hpp 2010-06-17 06:54:24 UTC (rev 3840)
+++ ecell3/trunk/ecell/libecs/Variable.hpp 2010-06-26 01:27:30 UTC (rev 3841)
@@ -176,7 +176,7 @@
}
- void loadValue( Real aValue )
+ void loadValue( Param<Real>::type aValue )
{
theValue = aValue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mor...@us...> - 2011-01-20 11:56:11
|
Revision: 3892
http://ecell.svn.sourceforge.net/ecell/?rev=3892&view=rev
Author: moriyoshi
Date: 2011-01-20 11:56:01 +0000 (Thu, 20 Jan 2011)
Log Message:
-----------
* Make session monitor reloadable.
Modified Paths:
--------------
ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/FullPNQueue.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/GtkSessionMonitor.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/InterfaceWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/LoggerWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoPluginManager.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoPluginWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/Plot.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/VariableReferenceEditor.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/opengui.py
ecell3/trunk/ecell/frontend/session-monitor/glade/EntityListWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/BargraphWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/DigitalWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/TracerWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/VariableWindow.py
ecell3/trunk/ecell/pyecell/ecell/EntityStub.py
ecell3/trunk/ecell/pyecell/ecell/LoggerStub.py
ecell3/trunk/ecell/pyecell/ecell/ObjectStub.py
ecell3/trunk/ecell/pyecell/ecell/Session.py
ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
ecell3/trunk/ecell/pyecell/ecell/ecs.py
ecell3/trunk/ecell/pyecell/ecell/ecssupport.py
ecell3/trunk/ecell/pyecell/ecell/eml.py
ecell3/trunk/ecell/pyecell/ecell/emparser.py
ecell3/trunk/ecell/pyecell/ecell3-session.in
Removed Paths:
-------------
ecell3/trunk/ecell/frontend/session-monitor/glade/FullPNQueue.glade
Modified: ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py
===================================================================
--- ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -578,9 +578,8 @@
aFullPN = createFullPN( aFullPNString )
- aPropertyName = aFullPN[3]
- aFullID = createFullIDString( convertFullPNToFullID( aFullPN ) )
- anEntityPropertyNode = self.__getEntityPropertyNode( aFullID, aPropertyName )
+ aFullID, aPropertyName = convertFullPNToFullID( aFullPN )
+ anEntityPropertyNode = self.__getEntityPropertyNode( createFullIDString( aFullID ), aPropertyName )
return self.__createValueList( anEntityPropertyNode )
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -27,6 +27,7 @@
from random import *
from numpy import *
+from ecell.ecssupport import *
import gtk
import gtk.gdk
@@ -48,7 +49,7 @@
DP_MAX = 4
DP_MIN = 3
-class DataGenerator:
+class DataGenerator( object ):
'''
DataGenerator class
get new data from the source, Logger or Core,
@@ -72,7 +73,7 @@
def hasLogger( self, aFullPNString ):
- return aFullPNString in self.__theSession.theSimulator.getLoggerList()
+ return aFullPNString in self.__theSession.getLoggerList()
@@ -83,12 +84,13 @@
dataList = zeros( (0,5), LOGGER_TYPECODE )
xAxis = aDataSeries.getXAxis()
fullPNString = aDataSeries.getFullPNString()
- currentTime = self.__theSession.theSimulator.getCurrentTime()
+ aFullID, aPropertyName = convertFullPNToFullID( createFullPN( fullPNString ) )
+ currentTime = self.__theSession.getCurrentTime()
if xAxis == "Time":
if not self.hasLogger( fullPNString ):
- currentValue = self.__theSession.theSimulator.getEntityProperty( fullPNString )
+ currentValue = self.__theSession.getEntityProperty( fullPNString )
dataList = zeros( (1,5), LOGGER_TYPECODE )
dataList[0][0] = currentTime
dataList[0][1] = currentValue
@@ -98,14 +100,17 @@
else:
dataList = aDataSeries.getAllData()
- lastTime = dataList[ len( dataList) -1 ][0]
+ if len( dataList ) > 0:
+ lastTime = dataList[ -1 ][ 0 ]
+ else:
+ lastTime = 0.
dataRange = currentTime - lastTime
requiredResolution = dataPointWidth
- if (dataRange/ requiredResolution)>100:
- requiredResolution = dataRange/100
+ if (dataRange / requiredResolution) > 100:
+ requiredResolution = dataRange / 100
dataList = self.theLoggerAdapter.getData( fullPNString,
- lastTime, currentTime,requiredResolution )
+ lastTime, currentTime, requiredResolution )
# I havent yet updated the new logger code from CVS, but isn't changed to getDigest?
@@ -117,8 +122,8 @@
else: #xaxis is fullpn, so this dataseries is used for phase plotting
- x = self.__theSession.theSimulator.getEntityProperty( xAxis )
- y = self.__theSession.theSimulator.getEntityProperty( fullPNString )
+ x = self.__theSession.getEntityProperty( xAxis )
+ y = self.__theSession.getEntityProperty( fullPNString )
dataList = zeros( (1,5), LOGGER_TYPECODE )
dataList[0][0] = x
dataList[0][1] = y
@@ -164,36 +169,34 @@
aRandom = Random()
if self.hasLogger( fullPNString ) and self.hasLogger( xAxis ):
- aSimulator = self.__theSession.theSimulator
- yStartTime = aSimulator.getLoggerStartTime( fullPNString )
- yWalker = LoggerWalker( aSimulator, fullPNString )
- xWalker = LoggerWalker( aSimulator, xAxis )
- xSize = aSimulator.getLoggerSize( xAxis )
-
+ yStartTime = self.theLoggerAdapter.getStartTime( fullPNString )
+ xAxisLogger = self.theLoggerAdapter.getLogger( xAxis )
+ yWalker = LoggerWalker( self.theLoggerAdapter.getLogger( fullPNString ) )
+ xWalker = LoggerWalker( xAxisLogger )
xstartpoint = xWalker.findPrevious( yStartTime )
- if xstartpoint != 1:
+ if xstartpoint is not -1:
writeCache = zeros( ( CACHE_INCREMENT, 5 ) )
writeIndex = 0
readIndex = 0
xPoint = xWalker.getNext()
- while xPoint != 1:
- if aRandom.randint( 0, xSize ) < HISTORY_SAMPLE:
+ while xPoint is not 1:
+ if aRandom.randint( 0, xAxisLogger.getSize() ) < HISTORY_SAMPLE:
aTime = xPoint[DP_TIME]
yPoint1 = yWalker.findPrevious( aTime )
- if yPoint1 == 1:
+ if yPoint1 is 1:
break
newDataPoint = zeros( ( 5 ) )
newDataPoint[DP_TIME] = xPoint[DP_VALUE]
if yPoint1[DP_TIME] != aTime:
while True:
- yPoint2 = yWalker.getNext( )
- if yPoint2 == 1:
+ yPoint2 = yWalker.getNext()
+ if yPoint2 is 1:
break
if yPoint2[DP_TIME] > yPoint1[DP_TIME]:
break
- if yPoint2 == 1:
+ if yPoint2 is 1:
break
# interpolate
lowerTime = yPoint1[DP_TIME]
@@ -262,48 +265,44 @@
aCachedLogger.update()
- def getData( self, fullPNString, start, end, interval ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- ret = self.theCachedLoggerDict[ fullPNString ].getData( start, end, interval )
- return ret
+ def getData( self, fullPNString, start, end, interval=None ):
+ return self.getLogger( fullPNString ).getData( start, end, interval )
-
def getStartTime( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getStartTime( )
+ return self.getLogger( fullPNString ).getStartTime()
def getEndTime( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getEndTime( )
+ return self.getLogger( fullPNString ).getEndTime()
def getSize( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getSize( )
+ return getLogger( fullPNString ).getSize()
-class CachedLogger:
+ def getLogger( self, fullPNString ):
+ aLogger = self.theCachedLoggerDict.get( fullPNString, None )
+ if aLogger is None:
+ aLogger = self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
+ return aLogger
+
+class CachedLogger( object ):
def __init__( self, aSession, fullPNString ):
- self.theFullPNString = fullPNString
- self.theSimulator = aSession.theSimulator
- if fullPNString not in self.theSimulator.getLoggerList():
- aSession.createLoggerWithPolicy( fullPNString )
+ self.theLoggerStub = aSession.createLoggerStub( fullPNString )
+ if fullPNString not in aSession.getLoggerList():
+ self.theLoggerStub.setLoggerPolicy( aSession.getLogPolicyParameters() )
+ self.theLoggerStub.create()
self.theLoggerCacheList = []
self.cachedTill = 0.0
self.update()
def update( self ):
# calculate how many points should be read
- loggerSize = self.theSimulator.getLoggerSize( self.theFullPNString )
- startTime = self.theSimulator.getLoggerStartTime( self.theFullPNString )
- endTime = self.theSimulator.getLoggerEndTime( self.theFullPNString )
+ loggerSize = self.theLoggerStub.getSize()
+ startTime = self.theLoggerStub.getStartTime()
+ endTime = self.theLoggerStub.getEndTime()
if loggerSize == 0:
averageDistance = -1
else:
@@ -320,19 +319,17 @@
readStart = self.cachedTill
if startTime == endTime:
+ dataPoints = self.theLoggerStub.getData()
- dataPoints = self.theSimulator.getLoggerData( self.theFullPNString )
-
valueColumn = take( dataPoints , (1, ), 1 )
dataPoints = concatenate( ( dataPoints, valueColumn, valueColumn, valueColumn ) , 1 )
self.theLoggerCacheList[0].addPoints( dataPoints )
else:
- while ( readStart < endTime ):
-
+ while readStart < endTime:
readEnd = min( readFrame, endTime - readStart ) + readStart
- dataPoints = self.theSimulator.getLoggerData( self.theFullPNString, readStart, readEnd )
+ dataPoints = self.theLoggerStub.getData( readStart, readEnd )
valueColumn = take( dataPoints , (1, ), 1 )
dataPoints = concatenate( ( dataPoints, valueColumn, valueColumn, valueColumn ) , 1 )
@@ -351,45 +348,41 @@
i += 1
- def getData( self, start, end, interval ):
- if interval == 0:
- vectorLength = 1
- else:
+ def getData( self, start, end, interval=None ):
+ if interval is not None:
+ if start == end:
+ return ndarray( shape=( 0, 5 ) )
vectorLength = int( ( end - start ) / interval )
- i = len( self.theLoggerCacheList ) -1
- while i >= 0:
- aDistance = self.theLoggerCacheList[i].getAverageDistance()
- cacheStart = self.theLoggerCacheList[i].getStartTime()
- cacheEnd = self.theLoggerCacheList[i].getEndTime()
- if aDistance > 0 and \
- self.theLoggerCacheList[i].getSize() > vectorLength and \
- aDistance <= interval /3 :
+ i = len( self.theLoggerCacheList ) -1
+ while i >= 0:
+ aDistance = self.theLoggerCacheList[i].getAverageDistance()
+ cacheStart = self.theLoggerCacheList[i].getStartTime()
+ cacheEnd = self.theLoggerCacheList[i].getEndTime()
+ if aDistance > 0 and \
+ self.theLoggerCacheList[i].getSize() > vectorLength and \
+ aDistance <= interval / 3:
# start >= cacheStart and end<= cacheEnd and
# return self.theLoggerCacheList[i].getData( start, end, interval )
- a=self.theLoggerCacheList[i].getData( start, end, interval )
- return a
- i -= 1
- # use logger
+ return self.theLoggerCacheList[i].getData( start, end, interval )
+ i -= 1
+ return array( self.theLoggerStub.getData( start, end, interval ), copy=False)
+ else:
+ return array( self.theLoggerStub.getData( start, end ), copy=False )
-# return self.theSimulator.getLoggerData(self.theFullPNString, start, end, interval )
- a=self.theSimulator.getLoggerData(self.theFullPNString, start, end, interval )
- return a
-
-
def getStartTime( self ):
- return self.theSimulator.getLoggerStartTime(self.theFullPNString)
+ return self.theLoggerStub.getStartTime()
def getEndTime( self ):
- return self.theSimulator.getLoggerEndTime(self.theFullPNString)
+ return self.theLoggerStub.getEndTime()
def getSize( self ):
- return self.theSimulator.getLoggerSize(self.theFullPNString)
+ return self.theLoggerStub.getSize()
-class LoggerCache:
+class LoggerCache( object ):
def __init__( self ):
self.theCache = zeros( ( 0, 5 ), LOGGER_TYPECODE )
@@ -453,12 +446,7 @@
def getData( self, start, end, interval ):
-
- vectorLength = ( end - start ) / interval
-
- if vectorLength > int( vectorLength ):
- vectorLength += 1
- vectorLength = int(vectorLength )
+ vectorLength = int( ceil( ( end - start ) / interval ) )
aVector = zeros( ( vectorLength, 5 ), LOGGER_TYPECODE )
timeCounter = start
lastPoint = self.theCache[ self.cacheEnd - 1 ]
@@ -499,17 +487,15 @@
return 0
-class LoggerWalker:
-
- def __init__( self, aSimulator, aFullPN):
- self.theSimulator = aSimulator
- self.theFullPN = aFullPN
- self.theStart = aSimulator.getLoggerStartTime( aFullPN )
- self.theEnd = aSimulator.getLoggerEndTime( aFullPN )
- size = aSimulator.getLoggerSize( aFullPN )
+class LoggerWalker( object ):
+ def __init__( self, aLogger ):
+ self.theLogger = aLogger
+ self.theStart = aLogger.getStartTime()
+ self.theEnd = aLogger.getEndTime()
+ size = aLogger.getSize()
self.theAvgDistance = ( self.theEnd - self.theStart ) / size
self.cachedTill = -1
- self.theCache = zeros( ( 0,5 ) )
+ self.theCache = zeros( ( 0, 5 ) )
self.index = 0
self.__readCache()
@@ -523,8 +509,8 @@
else:
readStart = self.cachedTill
readEnd = min( self.theAvgDistance * int(READ_CACHE/2), self.theEnd - self.cachedTill ) + readStart
- newPoints = self.theSimulator.getLoggerData( self.theFullPN, readStart, readEnd )
- if len( self.theCache) > 0:
+ newPoints = self.theLogger.getData( readStart, readEnd )
+ if len( self.theCache ) > 0:
halfIndex = int(len(self.theCache) /2 )
self.index = len( self.theCache ) - halfIndex
self.theCache = concatenate( ( self.theCache[ halfIndex: ], newPoints ) )
@@ -562,4 +548,4 @@
# smaller then what logger contains
return -1
self.index = nextIndex
- return self.getNext( )
+ return self.getNext()
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -88,6 +88,8 @@
self.thePropertyWindow = None
self.thePluginInstanceSelection = None
+ self.theAssociatedSession = None
+
def openWindow( self ):
@@ -100,21 +102,13 @@
# add handers
self.addHandlers( {
- # system tree
- # 'on_system_tree_cursor_changed' :\
- # self.updateSystemSelection,\
- 'on_system_tree_button_press_event' : self.popupMenu,\
- # entity list
- # 'on_process_tree_cursor_changed': self.selectProcess,\
- # 'on_variable_tree_cursor_changed':self.selectVariable,\
-
- 'on_view_button_clicked': self.createPluginWindow,\
- 'on_variable_tree_button_press_event': self.popupMenu,\
- 'on_process_tree_button_press_event': self.popupMenu,\
+ 'on_system_tree_button_press_event' : self.popupMenu,
+ 'on_view_button_clicked': self.createPluginWindow,
+ 'on_variable_tree_button_press_event': self.popupMenu,
+ 'on_process_tree_button_press_event': self.popupMenu,
# search
- 'on_search_button_clicked': self.pushSearchButton,\
- 'on_search_entry_key_press_event':\
- self.keypressOnSearchEntry,\
+ 'on_search_button_clicked': self.pushSearchButton,
+ 'on_search_entry_key_press_event': self.keypressOnSearchEntry,
'on_clear_button_clicked': self.pushClearButton,
'on_search_scope_changed': self.searchScopeChanged
} )
@@ -131,51 +125,36 @@
# initialize components
# --------------------------------------------
self.__initializeSystemTree()
- self.systemTreeConstructed = False
- if self.theSession.theModelWalker != None:
- self.reconstructSystemTree()
-
self.__initializeProcessTree()
self.__initializeVariableTree()
self.__initializeSelection()
self.__initializePluginWindowOptionMenu()
- aFullPN = convertFullIDToFullPN( createFullID ( 'System::/' ) )
- self.theQueue = FullPNQueue( self["navigator_area"] , [ aFullPN ] )
-
- self.theQueue.registerCallback( self.doSelection )
+ self.theQueue = None
self.__initializePropertyWindow()
self.__initializePopupMenu()
- # --------------------------------------------
- # initialize buffer
- # --------------------------------------------
self.theSelectedEntityList = []
self.theSelectedPluginInstanceList = []
- # --------------------------------------------
- # initialize Add to Board button
- # --------------------------------------------
self.CloseOrder = False
self.updateButtons()
-
-
-
-
-
def updateButtons( self ):
- if ( self.theSession.theModelWalker != None ):
+ if self.theSession.theSession is not None:
self['search_button'].set_sensitive(True)
self['view_button'].set_sensitive(True)
self['search_entry'].set_sensitive(True)
self['plugin_optionmenu'].set_sensitive(True)
-
+ self['backbutton'].set_sensitive(False)
+ self['forwardbutton'].set_sensitive(False)
else:
- self['search_button'].set_sensitive(0)
- self['view_button'].set_sensitive(0)
- self['search_entry'].set_sensitive(0)
- self['plugin_optionmenu'].set_sensitive(0)
+ self['search_button'].set_sensitive(False)
+ self['view_button'].set_sensitive(False)
+ self['search_entry'].set_sensitive(False)
+ self['plugin_optionmenu'].set_sensitive(False)
+ self['backbutton'].set_sensitive(False)
+ self['forwardbutton'].set_sensitive(False)
def getQueue( self ):
@@ -330,13 +309,9 @@
def __initializePropertyWindow( self ):
if self.thePropertyWindow != None:
return
- self.thePropertyWindow= self.thePluginManager.createInstance(
- 'PropertyWindow',\
- [(SYSTEM, '', '/', '')],\
- rootWidget= 'top_frame',\
- parent= self )
-
- if ( self.theStatusbar != None ):
+ self.thePropertyWindow = self.thePluginManager.createInstance(
+ 'PropertyWindow', [], rootWidget='top_frame', parent=self )
+ if self.theStatusbar is not None:
self.thePropertyWindow.setStatusBar( self.theStatusbar )
aPropertyWindowTopVBox = self.thePropertyWindow['top_frame']
@@ -470,23 +445,21 @@
Returns None
[Note]:creates and adds submenu that includes menus of PluginWindow instances
"""
- # When right button is pressed
+ # When left button is pressed
if anEvent.type == gtk.gdk._2BUTTON_PRESS:
-
aSelectedRawFullPNList = self.__getSelectedRawFullPNList()
aPluginWindowType = self['plugin_optionmenu'].get_children()[0].get()
# When no FullPN is selected, displays error message.
if aSelectedRawFullPNList != None:
if len( aSelectedRawFullPNList ) == 0:
-
aMessage = 'No entity is selected.'
aDialog = ConfirmWindow(OK_MODE,aMessage,'Error!')
self.thePropertyWindow.showMessageOnStatusBar(aMessage)
return False
#self.theQueue.pushFullPNList( aSelectedRawFullPNList )
- self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.theFullPNList() )
+ self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.getFullPNList() )
@@ -541,23 +514,18 @@
self.thePopupMenu.popup(None,None,None,anEvent.button,anEvent.time)
-# def reset( self ):
-#
-# self.reconstructSystemTree()
-# self.reconstructLists()
-# self.update()
-
-
def update( self ):
"""overwrite superclass's method
updates this window and property window
Returns None
"""
- if self.theSession.theModelWalker == None:
- return
- elif not self.systemTreeConstructed:
+ if self.theSession.theSession is not self.theAssociatedSession:
self.reconstructSystemTree()
-
+ self.theQueue = FullPNQueue( ( self[ "backbutton" ], self[ "forwardbutton" ] ) )
+ self.theQueue.registerCallback( self.doSelection )
+ self.theQueue.pushFullPNList( [ convertFullIDToFullPN( createFullID ( 'System::/' ) ) ] )
+ self.updateButtons()
+
# updates this window
if not self.exists():
return
@@ -571,13 +539,11 @@
self.thePluginInstanceSelection.update()
self.updateLists()
+ self.theAssociatedSession = self.theSession.theSession
-
def constructSystemTree( self, parent, fullID ):
-
# System tree
-
newlabel = fullID[ID]
systemStore = self.systemTree.get_model()
@@ -603,18 +569,17 @@
def reconstructSystemTree( self ):
-
rootSystemFullID = createFullID( 'System::/' )
- self.constructSystemTree( None, rootSystemFullID )
- self.systemTreeConstructed = True
+ self.donotHandle = True
+ self.theSysTreeStore.clear()
+ self.donotHandle = False
+ if self.theSession.theSession:
+ self.constructSystemTree( None, rootSystemFullID )
+ self.reconstructLists()
-
def reconstructLists( self ):
selectedSystemList = self.getSelectedSystemList()
-
- if len( selectedSystemList ) == 0:
- return
if self.entitySelected:
return
# Variable list
@@ -638,14 +603,13 @@
typeID = ENTITYTYPE_DICT[ type ]
fullIDList = []
- for systemFullID in systemList:
+ if self.theSession.theSession is not None:
+ for systemFullID in systemList:
+ systemPath = createSystemPathFromFullID( systemFullID )
- systemPath = createSystemPathFromFullID( systemFullID )
+ idList = self.theSession.getEntityList( type, systemPath )
+ fullIDList += [ ( typeID, systemPath, id ) for id in idList ]
- idList = self.theSession.getEntityList( type, systemPath )
- fullIDList += [ ( typeID, systemPath, id ) for id in idList ]
-
-
entityStore = view.get_model()
# clear the store
@@ -654,7 +618,7 @@
entityStore.clear()
self.donotHandle = donotHandle
- # columnList = view.get_columns()
+ # columnList = view.get_columns()
# re-create the list
for fullID in fullIDList:
@@ -693,21 +657,19 @@
def doSelection( self, aFullPNList ):
- if self.theSession.theModelWalker == None:
- return
self.doSelectSystem( aFullPNList )
self.doSelectProcess( aFullPNList )
self.doSelectVariable( aFullPNList )
def doSelectSystem( self, aFullPNList ):
-
targetFullIDList = []
if aFullPNList[0][TYPE] != SYSTEM:
targetFullIDList += [ createFullIDFromSystemPath( aFullPN[SYSTEMPATH] ) for aFullPN in aFullPNList ]
else:
for aFullPN in aFullPNList:
- targetFullIDList.append( convertFullPNToFullID( aFullPN ) )
+ aFullID, _ = convertFullPNToFullID( aFullPN )
+ targetFullIDList.append( aFullID )
# if to slow there should be a check whether this is needed in all cases
donotHandle = self.donotHandle
@@ -719,11 +681,11 @@
#doselection
targetPath = createSystemPathFromFullID( targetFullID )
anIter = self.getSysTreeIter( targetPath )
+ if anIter is not None:
+ aPath = self.theSysTreeStore.get_path( anIter )
+ self.__expandRow( aPath )
+ self.theSysSelection.select_iter( anIter )
- aPath = self.theSysTreeStore.get_path( anIter )
- self.__expandRow( aPath )
- self.theSysSelection.select_iter( anIter )
-
self.donotHandle = donotHandle
self.reconstructLists()
@@ -851,7 +813,7 @@
for systemFullID in systemFullIDList:
fullPNList.append( convertFullIDToFullPN( systemFullID ) )
self.donotHandle = True
- self.theQueue.pushFullPNList( fullPNList )
+ self.theQueue.pushFullPNList( fullPNList )
self.donotHandle = False
@@ -889,6 +851,8 @@
This method updates property values shown in the list of
Variables and Processes.
'''
+ if self.theSession.theSession is None:
+ return
self.updateEntityList( 'Process', self.processTree.get_model(),\
self.PROCESS_COLUMN_LIST,\
@@ -939,7 +903,6 @@
def selectProcess( self, selection ):
-
if self.donotHandle:
return
self.entitySelected = True
@@ -951,7 +914,7 @@
# get selected items
selection.selected_foreach(self.process_select_func)
- if len(self.theSelectedFullPNList)>0:
+ if len( self.theSelectedFullPNList ) > 0:
self.donotHandle = True
self.theQueue.pushFullPNList( self.theSelectedFullPNList )
self.donotHandle = False
@@ -973,7 +936,7 @@
# get selected items
selection.selected_foreach(self.variable_select_func)
- if len(self.theSelectedFullPNList)>0:
+ if len( self.theSelectedFullPNList ) > 0:
self.donotHandle = True
self.theQueue.pushFullPNList( self.theSelectedFullPNList )
self.donotHandle = False
@@ -1047,7 +1010,7 @@
...
[truncated message content] |
|
From: <mor...@us...> - 2011-01-24 12:46:23
|
Revision: 3893
http://ecell.svn.sourceforge.net/ecell/?rev=3893&view=rev
Author: moriyoshi
Date: 2011-01-24 12:46:14 +0000 (Mon, 24 Jan 2011)
Log Message:
-----------
* Overhaul.
Modified Paths:
--------------
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoUtil.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py
ecell3/trunk/ecell/frontend/session-monitor/glade/EntityListWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/glade/MainWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/glade/StepperWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/BargraphWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.py
ecell3/trunk/ecell/pyecell/ecell/StepperStub.py
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-24 12:46:14 UTC (rev 3893)
@@ -884,7 +884,6 @@
def updateListLabels( self ):
-
self.__updateViewLabel( 'Variable', self['variable_label'],\
self.variableTree )
self.__updateViewLabel( 'Process', self['process_label'],\
@@ -893,15 +892,11 @@
self.systemTree )
def __updateViewLabel( self, type, label, view ):
-
shownCount = len( view.get_model() )
selectedCount = view.get_selection().count_selected_rows()
- labelText = type + ' (' + str( selectedCount ) + '/' + \
- str( shownCount ) + ')'
- label.set_text( labelText )
+ labelText = '<b>%s</b> (%d / %d)' % (type, selectedCount, shownCount )
+ label.set_markup( labelText )
-
-
def selectProcess( self, selection ):
if self.donotHandle:
return
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py 2011-01-24 12:46:14 UTC (rev 3893)
@@ -57,13 +57,17 @@
import ecell.ui.osogo.MessageWindow as MessageWindow
class SimulationButton:
- def __init__( self ):
+ def __init__( self, container ):
self.startImage = os.path.join(
config.GLADEFILE_PATH, "icon_start.png" )
self.stopImage = os.path.join(
config.GLADEFILE_PATH, "icon_stop.png" )
- self.image = gtk.Image()
- self.image.set_from_file( self.startImage )
+ for widget in container.get_children():
+ if isinstance( widget, gtk.Image ):
+ self.image = widget
+ elif isinstance( widget, gtk.Label ):
+ self.label = widget
+
self.__currentState = 'stop'
self.image.show()
@@ -75,11 +79,12 @@
def setCurrentState( self, aCurrentState ):
self.__currentState = aCurrentState
-
if ( self.__currentState == 'run' ):
self.image.set_from_file( self.stopImage )
+ self.label.set_text( 'Stop' )
elif ( self.__currentState == 'stop' ):
self.image.set_from_file( self.startImage )
+ self.label.set_text( 'Start' )
class LogoAnimation:
iconList = (
@@ -194,11 +199,8 @@
# create SimulationButton
# -------------------------------------
- self.SimulationButton = SimulationButton()
- self['SimulationButton'].add( self.SimulationButton.getCurrentImage() )
- self['SimulationButtonLabel'].set_text('Start')
+ self.SimulationButton = SimulationButton( self['SimulationButton'] )
-
# ---------------------------
# create logo button
# ---------------------------
@@ -341,22 +343,6 @@
"""
pass
- def __resizeVertically( self, height ): #gets entitylistarea or messagebox height
- """__resizeVertically
- Return None
- """
-
- # gets fix components height
- menu_height=self['handlebox22'].get_child_requisition()[1]
- toolbar_height=self['handlebox19'].get_child_requisition()[1]
-
- # gets window_width
- window_width=self['MainWindow'].get_size()[0]
-
- # resizes
- window_height=menu_height+toolbar_height+height
- self['MainWindow'].resize(window_width,window_height)
-
def __setMenuAndButtonsStatus( self, aDataLoadedStatus ):
"""sets initial widgets status
aDataLoadedStatus -- the status of loading data
@@ -652,27 +638,25 @@
if self.theSession.theRunningFlag:
# stop simulation temporarily
self.theSession.stop()
-
running_flag = True
- # If there is no logger data, exit this program.
- if len(self.theSession.getLoggerList()) != 0:
- aMessage = 'Are you sure you want to quit?'
- aTitle = 'Question'
- # Popup confirm window, and check user request
- aDialog = ConfirmWindow(1,aMessage,aTitle)
+ if self.theSession.theSession is not None:
+ # If there is no logger data, exit this program.
+ if len(self.theSession.getLoggerList()) != 0:
+ aMessage = 'Are you sure you want to quit?'
+ aTitle = 'Question'
+ # Popup confirm window, and check user request
+ aDialog = ConfirmWindow(1,aMessage,aTitle)
- # ok is pressed
-
- if aDialog.return_result() != OK_PRESSED:
- if running_flag:
- self.theSession.run()
- return True
+ # ok is pressed
+
+ if aDialog.return_result() != OK_PRESSED:
+ if running_flag:
+ self.theSession.run()
+ return True
self.setStopState()
-
self.close()
-
self.theSession.QuitGUI()
return True
@@ -688,9 +672,7 @@
OsogoWindow.close( self )
def setStartState( self ):
-
self.SimulationButton.setCurrentState( 'run' )
- self['SimulationButtonLabel'].set_text('Stop')
if self.logoMovable:
self.logoAnimation.start()
@@ -700,7 +682,6 @@
def setStopState( self ):
self.SimulationButton.setCurrentState( 'stop' )
- self['SimulationButtonLabel'].set_text('Start')
self.logoAnimation.stop()
self.setTempTime()
@@ -923,10 +904,6 @@
if self.theToolbarVisible:
self['toolbar_handlebox'].hide()
self.theToolbarVisible = False
-
- if self.theMessageWindowVisible == False and \
- self.theEntityListWindowVisible == False:
- self.__resizeVertically( 0 )
else:
self['toolbar_handlebox'].show()
self.theToolbarVisible = True
@@ -937,10 +914,6 @@
if self.theStatusbarVisible:
self['statusbar'].hide()
self.theStatusbarVisible = False
-
- if self.theMessageWindowVisible == False and \
- self.theEntityListWindowVisible == False:
- self.__resizeVertically( 0 )
else:
self['statusbar'].show()
self.theStatusbarVisible = True
@@ -1036,16 +1009,9 @@
if anObject.get_active():
self.theMessageWindowVisible = True
self.showMessageWindow()
- self.__resizeVertically( self.theMessageWindow.getActualSize()[1] )
- # hide
else:
self.theMessageWindowVisible = False
self.hideMessageWindow()
-
- if self.theEntityListWindowVisible:
- self.__resizeVertically( self['entitylistarea'].get_allocation()[3] )
- else:
- self.__resizeVertically( 0 )
self.updateButtons()
@@ -1053,17 +1019,10 @@
if arg[0].get_active():
self.theEntityListWindowVisible = True
self['entitylistarea'].show()
- self.__resizeVertically( self['entitylistarea'].get_allocation()[3] )
-
else:
self.theEntityListWindowVisible = False
self['entitylistarea'].hide()
- if self.theMessageWindowVisible:
- self.__resizeVertically( self.theMessageWindow.getActualSize()[1] )
- else:
- self.__resizeVertically( 0 )
-
def __displayAbout ( self, *args ):
# show about information
self.createAboutSessionMonitor()
@@ -1124,7 +1083,8 @@
delete this window.
Returns True
"""
- return self.__deleted( *arg )
+ pass
+ #return self.__deleted( *arg )
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoUtil.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoUtil.py 2011-01-20 11:56:01 UTC (rev 3892)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoUtil.py 2011-01-24 12:46:14 UTC (rev 3893)
@@ -47,20 +47,6 @@
SINGLE = 0
MULTIPLE = 1
-# ----------------------------------------------------------------------
-# decodeAttribute
-#
-# anAttribute : an attribute ( TRUE or FALSE )
-#
-# return -> '+' or '-'
-# ----------------------------------------------------------------------
-def decodeAttribute(anAttribute):
-
- if anAttribute:
- return '+'
- else:
- return '-'
-
# end of decodeAttribute
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py 2011-01-24 12:46:14 UTC (rev 3893)
@@ -10,7 +10,7 @@
#
# E-Cell System is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
+# License as published by the Free Software Foundation either
# version 2 of the License, or (at your option) any later version.
#
# E-Cell System is distributed in the hope that it will be useful,
@@ -53,468 +53,325 @@
import copy
class StepperWindow(OsogoWindow):
- """StepperWindow
- - displayes all stepper property
- - user can change each stepper property
- """
+ """StepperWindow
+ - displayes all stepper property
+ - user can change each stepper property
+ """
- # ==========================================================================
- def __init__( self, aSession ):
- """Constructor
- aSession --- the reference of session
- aSession --- the reference of Session
- """
+ # ==========================================================================
+ def __init__( self, aSession ):
+ """Constructor
+ aSession --- the reference of session
+ aSession --- the reference of Session
+ """
- # calls superclass's constructor
- OsogoWindow.__init__( self, aSession, 'StepperWindow.glade' )
+ # calls superclass's constructor
+ OsogoWindow.__init__( self, aSession, 'StepperWindow.glade' )
- self.theSession = aSession
+ self.theSession = aSession
- # ==========================================================================
- def openWindow(self):
+ # ==========================================================================
+ def openWindow(self):
+ OsogoWindow.openWindow(self)
+ # initializes attributes
+ self.theSelectedStepperID = None # selected stepperID (str)
+ self.theFirstPropertyIter = {} # key:iter(TreeIter) value:None
+ self.theSelectedPath = {} # key:aStepperID(str) value:Path
+ self.thePropertyMap = {}
+ aListStore = gtk.ListStore( gobject.TYPE_STRING )
+ self['stepper_id_list'].set_model( aListStore )
+ column=gtk.TreeViewColumn('Stepper',gtk.CellRendererText(),text=0)
+ self['stepper_id_list'].append_column(column)
- OsogoWindow.openWindow(self)
+ aPropertyModel = gtk.ListStore(
+ gobject.TYPE_STRING,
+ gobject.TYPE_STRING,
+ gobject.TYPE_BOOLEAN,
+ gobject.TYPE_BOOLEAN )
+ self['property_list'].set_model(aPropertyModel)
- # initializes attributes
- self.theSelectedStepperID = None # selected stepperID (str)
- self.theFirstPropertyIter = {} # key:iter(TreeIter) value:None
- self.theSelectedPath = {} # key:aStepperID(str) value:Path
- self.thePropertyMap = {}
+ column=gtk.TreeViewColumn( 'Property',gtk.CellRendererText(),\
+ text=PROPERTY_INDEX )
+ column.set_resizable(True)
+ self['property_list'].append_column(column)
- aListStore = gtk.ListStore( gobject.TYPE_STRING )
- self['stepper_id_list'].set_model( aListStore )
- column=gtk.TreeViewColumn('Stepper',gtk.CellRendererText(),text=0)
- self['stepper_id_list'].append_column(column)
+ renderer = gtk.CellRendererText()
+ renderer.connect( 'edited', self.__updateProperty )
+ column=gtk.TreeViewColumn( 'Value', renderer,\
+ text=VALUE_INDEX, editable=SET_INDEX, sensitive=SET_INDEX )
+ column.set_resizable(True)
+ self['property_list'].append_column(column)
- aPropertyModel=gtk.ListStore( gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING)
- self['property_list'].set_model(aPropertyModel)
- column=gtk.TreeViewColumn( 'Property',gtk.CellRendererText(),\
- text=PROPERTY_INDEX )
- column.set_resizable(True)
- self['property_list'].append_column(column)
- column=gtk.TreeViewColumn( 'Value',gtk.CellRendererText(),\
- text=VALUE_INDEX )
- column.set_resizable(True)
- self['property_list'].append_column(column)
- column=gtk.TreeViewColumn( 'Get',gtk.CellRendererText(),\
- text=GET_INDEX )
- column.set_resizable(True)
- self['property_list'].append_column(column)
- column=gtk.TreeViewColumn( 'Set',gtk.CellRendererText(),\
- text=SET_INDEX )
- column.set_resizable(True)
- self['property_list'].append_column(column)
-
+ column=gtk.TreeViewColumn( 'Get',gtk.CellRendererToggle(),\
+ active=GET_INDEX )
+ column.set_resizable(True)
+ self['property_list'].append_column(column)
- # adds handlers
- self.addHandlers({ \
- 'on_stepper_id_list_select' : self.__selectStepperID, # StepperID list
- 'on_property_list_select_row' : self.__selectProperty, # Property list
- 'on_update_button_clicked' : self.__updateProperty, # update button
- 'on_close_button_clicked' : self.deleted, # close button
- })
+ column=gtk.TreeViewColumn( 'Set',gtk.CellRendererToggle(),\
+ active=SET_INDEX )
+ column.set_resizable(True)
+ self['property_list'].append_column(column)
+
+ # adds handlers
+ self.addHandlers({ \
+ 'on_stepper_id_list_select' : self.__selectStepperID, # StepperID list
+ 'on_close_button_clicked' : self.deleted, # close button
+ })
- aModel = self['stepper_id_list'].get_model()
- aModel.clear()
- aFirstIter = None
- #for aValue in self.theStepperIDList:
- for aValue in self.theSession.getStepperList():
- anIter = aModel.append()
- if aFirstIter == None:
- aFirstIter = anIter
- aModel.set( anIter, 0, aValue )
+ aModel = self['stepper_id_list'].get_model()
+ aModel.clear()
- self[self.__class__.__name__].show_all()
+ aFirstIter = None
+ #for aValue in self.theStepperIDList:
+ for aValue in self.theSession.getStepperList():
+ anIter = aModel.append()
+ if aFirstIter == None:
+ aFirstIter = anIter
+ aModel.set( anIter, 0, aValue )
- self['stepper_id_list'].get_selection().select_iter(aFirstIter)
- self.__selectStepperID(None)
+ self[self.__class__.__name__].show_all()
- def close( self ):
- self.theSelectedPath = {}
- OsogoWindow.close(self)
+ self['stepper_id_list'].get_selection().select_iter(aFirstIter)
+ self.__selectStepperID(None)
+ def close( self ):
+ self.theSelectedPath = {}
+ OsogoWindow.close(self)
- # ==========================================================================
- def selectStepperID( self, aStepperID ):
- """ selects StepperID on screen and displays its property list
- if StepperID exists returns True, else returns False
- """
- anIter=self['stepper_id_list'].get_model().get_iter_first()
- while True:
- if anIter == None:
- return False
- aTitle = self['stepper_id_list'].get_model().get_value(anIter, 0 )
- if aTitle == aStepperID:
- aPath = self['stepper_id_list'].get_model().get_path ( anIter )
- self['stepper_id_list'].set_cursor( aPath, None, False )
- break
- anIter=self['stepper_id_list'].get_model().iter_next(anIter)
- self.__selectStepperID( None )
- return False
-
+ # ==========================================================================
+ def selectStepperID( self, aStepperID ):
+ """ selects StepperID on screen and displays its property list
+ if StepperID exists returns True, else returns False
+ """
+ anIter=self['stepper_id_list'].get_model().get_iter_first()
+ while True:
+ if anIter == None:
+ return False
+ aTitle = self['stepper_id_list'].get_model().get_value(anIter, 0 )
+ if aTitle == aStepperID:
+ aPath = self['stepper_id_list'].get_model().get_path ( anIter )
+ self['stepper_id_list'].set_cursor( aPath, None, False )
+ break
+ anIter=self['stepper_id_list'].get_model().iter_next(anIter)
+ self.__selectStepperID( None )
+ return False
- # ==========================================================================
- def __selectStepperID( self, *arg ):
- """selects stepper ID
- Return None
- """
+
- # When window is not created, does nothing.
- if not self.exists():
- return None
+ # ==========================================================================
+ def __selectStepperID( self, *arg ):
+ """selects stepper ID
+ Return None
+ """
- # --------------------------------------------------
- # Creates selected StepperSub
- # --------------------------------------------------
- iter = self['stepper_id_list'].get_selection().get_selected()[1]
- # aStepperID is selected stepper id
- aStepperID = self['stepper_id_list'].get_model().get_value(iter,0)
-
- # When same StepperID is selected, does nothing
- if self.theSelectedStepperID != None and aStepperID == self.theSelectedStepperID:
- return None
- self.theSelectedStepperID = aStepperID
- self.thePropertyMap = {}
- # aStepperStub is selected StepperStub of selected stepper
- aStepperStub = self.theSession.StepperStub( aStepperID )
+ # When window is not created, does nothing.
+ if not self.exists():
+ return None
+ # --------------------------------------------------
+ # Creates selected StepperSub
+ # --------------------------------------------------
+ iter = self['stepper_id_list'].get_selection().get_selected()[1]
+ # aStepperID is selected stepper id
+ aStepperID = self['stepper_id_list'].get_model().get_value(iter,0)
+
+ # When same StepperID is selected, does nothing
+ if self.theSelectedStepperID != None and aStepperID == self.theSelectedStepperID:
+ return None
+ self.theSelectedStepperID = aStepperID
+ self.thePropertyMap = {}
+ # aStepperStub is selected StepperStub of selected stepper
+ aStepperStub = self.theSession.createStepperStub( aStepperID )
-
- # updates property list
- aPropertyModel=self['property_list'].get_model()
- aPropertyModel.clear()
+ # updates property list
+ aPropertyModel = self['property_list'].get_model()
+ aPropertyModel.clear()
- # creats list of ClassName's row
- aList = [ 'ClassName', ]
+ # creats list of ClassName's row
+ aList = [ 'ClassName', ]
- # value
- aClassName = aStepperStub.getClassname( )
- aList.append( str(aClassName) )
- self.thePropertyMap[ 'ClassName'] = str( aClassName )
+ # value
+ aClassName = aStepperStub.getClassname( )
+ aList.append( str(aClassName) )
+ self.thePropertyMap[ 'ClassName' ] = str( aClassName )
- # gettable and settable
- aList.append( decodeAttribute( True ) ) # gettable is '+'
- aList.append( decodeAttribute( False ) ) # settable is '-'
+ # gettable and settable
+ aList.append( True ) # gettable is '+'
+ aList.append( False ) # settable is '-'
- # sets this list to TreeModel
- iter = aPropertyModel.append()
- for i in range(0,4):
- aPropertyModel.set_value(iter,i,aList[i])
-
- self.theFirstPropertyIter[aStepperID] = iter
+ # sets this list to TreeModel
+ iter = aPropertyModel.append()
+ for i in range(0, 4):
+ aPropertyModel.set_value(iter, i, aList[i])
+
+ self.theFirstPropertyIter[aStepperID] = iter
- # --------------------------------------------------
- # sets all propertys' row other than ClassName
- # --------------------------------------------------
- for aProperty in aStepperStub.getPropertyList():
+ # --------------------------------------------------
+ # sets all propertys' row other than ClassName
+ # --------------------------------------------------
+ for aProperty in aStepperStub.getPropertyList():
- # property
- aList = [ aProperty, ] # first element
+ # property
+ aList = [ aProperty, ] # first element
- # gettable and settable
- anAttribute = aStepperStub.getPropertyAttributes( aProperty )
- # value
- if anAttribute[GETABLE] == 0:
- continue
- aValue = aStepperStub.getProperty( aProperty )
- self.thePropertyMap[ aProperty ] = aValue
+ # gettable and settable
+ anAttribute = aStepperStub.getPropertyAttributes( aProperty )
+ # value
+ if anAttribute[GETABLE] == 0:
+ continue
+ aValue = aStepperStub.getProperty( aProperty )
+ self.thePropertyMap[ aProperty ] = aValue
- aValueString = str( aValue )
- # second element
- aList.append( shortenString( aValueString,\
- MAX_STRING_NUMBER) )
+ aValueString = str( aValue )
+ # second element
+ aList.append( shortenString( aValueString,\
+ MAX_STRING_NUMBER) )
- aList.append( decodeAttribute(anAttribute[GETABLE]) ) # third element
- aList.append( decodeAttribute(anAttribute[SETTABLE]) ) # forth element
+ aList.append( anAttribute[GETABLE] ) # third element
+ aList.append( anAttribute[SETTABLE] ) # forth element
- # sets this list to TreeModel
- iter = aPropertyModel.append( )
- #anIterListElement = [iter]
- for i in range(0,4):
- aPropertyModel.set_value(iter,i,aList[i])
+ # sets this list to TreeModel
+ iter = aPropertyModel.append()
+ #anIterListElement = [iter]
+ for i in range(0,4):
+ aPropertyModel.set_value(iter, i, aList[i])
- self.update()
+ self.update()
- if self.theSelectedPath.has_key(aStepperID):
- aPath = self.theSelectedPath[aStepperID]
- self['property_list'].get_selection().select_path(aPath)
- else:
- aPath = (0,)
- self.theSelectedPath[aStepperID] = aPath
- self['property_list'].get_selection().select_path(aPath)
+ if self.theSelectedPath.has_key(aStepperID):
+ aPath = self.theSelectedPath[aStepperID]
+ self['property_list'].get_selection().select_path(aPath)
+ else:
+ aPath = (0,)
+ self.theSelectedPath[aStepperID] = aPath
+ self['property_list'].get_selection().select_path(aPath)
- self.__selectProperty()
+ # ==========================================================================
+ def selectProperty(self, aPropertyName):
+ """ selects PropertyName on screen
+ if PropertyName exists returns True, else returns False
+ """
+ anIter=self['property_list'].get_model().get_iter_first()
+ while True:
+ if anIter == None:
+ return False
+ aTitle = self['property_list'].get_model().get_value(anIter, PROPERTY_INDEX )
+ if aTitle == aPropertyName:
+ aPath = self['property_list'].get_model().get_path ( anIter )
+ self['property_list'].set_cursor( aPath, None, False )
+ break
+ anIter=self['property_list'].get_model().iter_next(anIter)
- # ==========================================================================
- def selectProperty(self, aPropertyName):
- """ selects PropertyName on screen
- if PropertyName exists returns True, else returns False
- """
- anIter=self['property_list'].get_model().get_iter_first()
+ return False
- while True:
- if anIter == None:
- return False
- aTitle = self['property_list'].get_model().get_value(anIter, PROPERTY_INDEX )
- if aTitle == aPropertyName:
- aPath = self['property_list'].get_model().get_path ( anIter )
- self['property_list'].set_cursor( aPath, None, False )
- break
- anIter=self['property_list'].get_model().iter_next(anIter)
+ # ==========================================================================
+ # ==========================================================================
+ def __updateProperty( self, renderer, path, aValue, *kwarg ):
+ """updates property
+ Return None
+ """
- self.__selectProperty( None )
- return False
+ # --------------------------------------------------
+ # creates selected StepperSub
+ # --------------------------------------------------
+ iter = self['stepper_id_list'].get_selection().get_selected()[1]
+ aStepperID = self['stepper_id_list'].get_model().get_value(iter,0)
+ aStepperStub = self.theSession.createStepperStub( aStepperID )
+ # gets selected property row
+ aPropertyModel = self['property_list'].get_model()
+ iter = aPropertyModel.get_iter(path)
+ # -----------------------------------------------------------
+ # get a property name from property list
+ # -----------------------------------------------------------
+ aPropertyName = aPropertyModel.get_value( iter, PROPERTY_INDEX )
- # ==========================================================================
- def __selectProperty( self, *arg ):
- """when a property is selected, calls this method.
- updates
- Returns None
- """
+ # converts value type
+ anOldValue = aStepperStub.getProperty( aPropertyName )
- # If Window is closed, do nothing.
- if not self.exists():
- return None
+ # ---------------------------------------------------
+ # checks float and int type of inputted value
+ # does not check str. ( not needed )
+ # ---------------------------------------------------
+ # float
+ if type(anOldValue) == float:
+ try:
+ aValue = float(aValue)
+ except:
+ # displays confirm window
+ anErrorMessage = "Input float value."
+ aDialog = ConfirmWindow(OK_MODE,"Can't set property!\n" + anErrorMessage,'Error!')
+ return None
- # --------------------------------------------------
- # Creates selected StepperSub
- # --------------------------------------------------
- iter_stepper = self['stepper_id_list'].get_selection().get_selected()[1]
- aStepperID = self['stepper_id_list'].get_model().get_value(iter_stepper,0)
- aStepperStub = self.theSession.createStepperStub( aStepperID )
+ # int
+ if type(anOldValue) == int:
+ try:
+ aValue = int(aValue)
+ except:
+ # displays confirm window
+ anErrorMessage = "Input int value."
+ aDialog = ConfirmWindow(OK_MODE,"Can't set property!\n" + anErrorMessage,'Error!')
+ return None
- # --------------------------------------------------
- # gets selected property name
- # --------------------------------------------------
- iter = self['property_list'].get_selection().get_selected()[1]
- # When nothing is selected, does nothing.
- if iter == None:
- return None
- aPropertyName = self['property_list'].get_model().get_value( iter, PROPERTY_INDEX )
- self.theSelectedPath[aStepperID]=self['property_list'].get_model().get_path(iter)
+ # sets new value
+ try:
+ aStepperStub.setProperty( aPropertyName, aValue )
+ aPropertyModel.set_value( iter, VALUE_INDEX, aValue )
+ except:
- # --------------------------------------------------
- # sets value to value_entry
- # --------------------------------------------------
- aValue = None
+ # displays error message to MessageWindow
+ anErrorMessage = '\n'.join( trace...
[truncated message content] |
|
From: <mor...@us...> - 2011-02-18 05:14:15
|
Revision: 3897
http://ecell.svn.sourceforge.net/ecell/?rev=3897&view=rev
Author: moriyoshi
Date: 2011-02-18 05:14:08 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Expose simulator object to the expressions in PythonProcess.
Modified Paths:
--------------
ecell3/trunk/ecell/libecs/Model.hpp
ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
Modified: ecell3/trunk/ecell/libecs/Model.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/Model.hpp 2011-02-10 04:23:12 UTC (rev 3896)
+++ ecell3/trunk/ecell/libecs/Model.hpp 2011-02-18 05:14:08 UTC (rev 3897)
@@ -73,7 +73,7 @@
void setup();
- ~Model();
+ virtual ~Model();
/**
Initialize the whole model.
Modified: ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
===================================================================
--- ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp 2011-02-10 04:23:12 UTC (rev 3896)
+++ ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp 2011-02-18 05:14:08 UTC (rev 3897)
@@ -2817,6 +2817,11 @@
};
};
+AbstractSimulator* Entity_getModel(Entity const& entity)
+{
+ return dynamic_cast<AbstractSimulator*>(entity.getModel());
+}
+
BOOST_PYTHON_MODULE( _ecs )
{
DataPointVectorWrapper< DataPoint >::__class_init__();
@@ -2970,6 +2975,12 @@
py::class_< Entity, py::bases<>, Entity, boost::noncopyable >
( "Entity", py::no_init )
// properties
+ .add_property( "model",
+ py::make_function( &Entity_getModel,
+ return_existing_object() ) )
+ .add_property( "simulator",
+ py::make_function( &Entity_getModel,
+ return_existing_object() ) )
.add_property( "superSystem",
py::make_function( &Entity::getSuperSystem,
return_existing_object() ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|