Skip to content

Commit

Permalink
Merge pull request #11 from fredboudon/master
Browse files Browse the repository at this point in the history
fix small dev bugs
  • Loading branch information
fredboudon authored Feb 12, 2020
2 parents 17bbd5c + 19c3f03 commit 6b5fbaf
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 171 deletions.
6 changes: 4 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
platform:
- x86
- x64

environment:
matrix:
# Add here environement variables to control the Travis CI build
- CONDA_RECIPE: conda
CONDA_VERSION: 2
CONDA_VERSION: 3

install:
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
- if errorlevel 1 exit 1
- git clone https://github.com/OpenAlea/appveyor-ci.git appveyor-ci
- cd appveyor-ci
- call install.bat
Expand Down
2 changes: 2 additions & 0 deletions conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ echo "PYTHON:" ${PYTHON}
#export PYTHONPATH=${PREFIX}/lib/python${PY_VER}/site-packages/
${PYTHON} setup.py install --prefix=${PREFIX}

cp -r share `${PYTHON} -c "import os, openalea.lpy as lpy ; print(os.path.dirname(lpy.__file__))"`/..

echo
echo "****** CHECK PYTHON LIB"

Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ about:

build:
preserve_egg_dir: True
number: 3
number: 6
requirements:
build:
- binutils_impl_linux-64<2.31.0 # [linux]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
exec(fp.read(), versioninfo)

version= versioninfo['LPY_VERSION_STR']
print (pkg_name+': version = '+version)
#print (pkg_name+': version = '+version)


# cmake build directory
Expand Down
2 changes: 1 addition & 1 deletion share/extension/mtgaxiom/evalrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def plotresult(i=0, j=101,step = 1):
for i,v in enumerate(lres):
nres[i].append(v[1])
mres.append(sum([j for i,j in lres])/nbcurve)
print maxofmin
print(maxofmin)
for y in nres:
mpl.plot(x,y)
mpl.plot(x,mres,linewidth=2)
Expand Down
2 changes: 1 addition & 1 deletion share/extension/mtgaxiom/mtgcompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def getpropforsubtree(mtg,root,initialmtg,initialroot,matched,rebuildclasses = '
nbmatched = len(matched)
return 2*nbmatched/float(nbelements1+nbelements2)
nbtotelem = nbelements1+nbelements2-nbmatched
print root,nbmatched,nbelements1,nbelements2,nbmatched/float(nbtotelem)
print (root,nbmatched,nbelements1,nbelements2,nbmatched/float(nbtotelem))
return nbmatched/float(nbtotelem)

2 changes: 1 addition & 1 deletion share/extension/mtgaxiom/mtgimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def nodelength(i):

gul = [sum([nodelength(i) for i in ui]) for ui in gu]
avg_length_gu = mean(gul)
print '**', avg_length_gu, min(gul), max(gul)
print('**', avg_length_gu, min(gul), max(gul))
leavesly = [g.parent(i[-1]) for i in gu]

def last_year_ancestors(i):
Expand Down
2 changes: 1 addition & 1 deletion share/tutorial/lpy-paper12-examples/code2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def main():
lsys = Lsystem("lsystem1.lpy")
print lsys.dr # This would print 0.02
print (lsys.dr) # This would print 0.02
lsys.axiom = Lstring("Apex(2)",lsys)
lstring = lsys.axiom
timer = Sequencer(0.1)
Expand Down
2 changes: 1 addition & 1 deletion share/tutorial/lpy-paper12-examples/code4.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def simulation():

lsystem = ComposedLsystem([a,a2b,b,b2a],[a2c,c])
lstring = lsystem.axiom
print lstring
print (lstring)
lsystem.animate(nbsteps = 10)


Expand Down
2 changes: 1 addition & 1 deletion src/cpp/axialtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "lpy_parser.h"
#include "tracker.h"
#include "matching.h"
#include "lpy_python.h"
#include <plantgl/python/pyseq_iterator.h>

using namespace boost::python;

Expand Down
66 changes: 0 additions & 66 deletions src/cpp/lpy_python.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions src/cpp/lpy_python.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/cpp/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
#include "patternmodule.h"
#include "matching.h"
#include "lsyscontext.h"
#include "lpy_python.h"
#include "lpy_parser.h"
#include "tracker.h"
#include "packedargs.h"
#include <strstream>
#include <plantgl/math/util_vector.h>
#include <plantgl/python/pyseq_iterator.h>

using namespace boost::python;
LPY_USING_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion src/openalea/lpy/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version_number__ = 0x030000
__version_number__ = 0x030002
__revision_str__=""


Expand Down
35 changes: 15 additions & 20 deletions src/openalea/lpy/gui/generate_ui.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
# Generate GUI if necessary
try:
import openalea.lpy.gui.py2exe_release
py2exe_release = True
except:
py2exe_release = False
from os.path import dirname, exists, join
ldir = dirname(__file__)
release = exists(join(ldir,'py2exe_release.py'))

if not py2exe_release:
import compile_ui as ui
# from . import compile_ui as ui
if not release:
print("Generate Ui - imported")
import os.path
ldir = os.path.dirname(__file__)
import compile_ui as ui
print("Generate Ui")
ui.check_ui_generation(os.path.join(ldir, 'lpymainwindow.ui'))
ui.check_ui_generation(os.path.join(ldir, 'debugger_ui.ui'))
ui.check_ui_generation(os.path.join(ldir, 'debugger_right_ui.ui'))
ui.check_ui_generation(os.path.join(ldir, 'logindialog.ui'))
ui.check_ui_generation(os.path.join(ldir, 'logdialog.ui'))
ui.check_rc_generation(os.path.join(ldir, 'lpyresources.qrc'))
ui.check_ui_generation(os.path.join(ldir, 'killsimulationwidget.ui'))
ui.check_ui_generation(os.path.join(ldir, 'lpyprefwidget.ui'))
ui.check_ui_generation(os.path.join(ldir, 'scalarmetaedit.ui'))
ui.check_ui_generation(os.path.join(ldir, 'scalarfloatmetaedit.ui'))
ui.check_rc_generation(join(ldir, 'lpyresources.qrc'))
ui.check_ui_generation(join(ldir, 'lpymainwindow.ui'))
ui.check_ui_generation(join(ldir, 'debugger_ui.ui'))
ui.check_ui_generation(join(ldir, 'debugger_right_ui.ui'))
ui.check_ui_generation(join(ldir, 'logindialog.ui'))
ui.check_ui_generation(join(ldir, 'logdialog.ui'))
ui.check_ui_generation(join(ldir, 'killsimulationwidget.ui'))
ui.check_ui_generation(join(ldir, 'lpyprefwidget.ui'))
ui.check_ui_generation(join(ldir, 'scalarmetaedit.ui'))
ui.check_ui_generation(join(ldir, 'scalarfloatmetaedit.ui'))
del ldir
pass
13 changes: 7 additions & 6 deletions src/openalea/lpy/gui/lpydock.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def initDocks(lpywidget):
lpywidget.profilerDock.hide()
#interpreter dock
if lpywidget.withinterpreter :
try:
set_shell_widget(lpywidget)
except:
lpywidget.withinterpreter = False
lpywidget.interpreter = None
lpywidget.interpreterDock.hide()
#try:
set_shell_widget(lpywidget)
#except:
# lpywidget.withinterpreter = False
# lpywidget.interpreter = None
# lpywidget.interpreterDock.hide()

if lpywidget.withinterpreter:
action = lpywidget.interpreterDock.toggleViewAction()
Expand All @@ -98,6 +98,7 @@ def initDocks(lpywidget):
lpywidget.interpreter = None

def initShell(lpywidget):
return
lpywidget.interpreter.locals['window'] = lpywidget
lpywidget.shell.run_code('from openalea.plantgl.all import *')
lpywidget.shell.run_code('from openalea.lpy import *')
5 changes: 5 additions & 0 deletions src/openalea/lpy/gui/lpyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from qtconsole.inprocess import QtInProcessKernelManager
# from .streamredirection import GraphicalStreamRedirection
import sys, tempfile

class LpyShellWidget(RichJupyterWidget): #, GraphicalStreamRedirection):

Expand All @@ -12,6 +13,10 @@ def __init__(self, parent=None):
If no parent widget has been specified, it is possible to
exit the interpreter by Ctrl-D.
"""
if sys.executable.endswith('pythonw.exe'):
lpylog = open(tempfile.gettempdir() + '/lpylog.txt', 'w')
sys.stdout = lpylog
sys.stderr = lpylog

RichJupyterWidget.__init__(self, parent)

Expand Down
7 changes: 2 additions & 5 deletions src/openalea/lpy/gui/lpystudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,8 @@ def errorEvent(self,exc_info):
fnames = ['<string>',self.currentSimulation().getBaseName()]
if st[0] in fnames :
self.codeeditor.hightlightError(st[1])
elif t == SyntaxError:
lst = v.message.split(':')
if len(lst) >= 3 and lst[0] in fnames:
self.codeeditor.hightlightError(int(lst[1]))
elif v.filename in fnames:
elif t == SyntaxError:
if v.filename in fnames:
self.codeeditor.hightlightError(v.lineno)
def endErrorEvent(self,answer):
if self.debugger.running:
Expand Down
2 changes: 1 addition & 1 deletion src/openalea/lpy/gui/objectpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def drawTextIn(self, text, x, y, width, below = False, color = None):
tratio = mtw / float(tw)
lt = len(text)
nbchar = int(lt * tratio) -3
text = text[0:nbchar/2]+'...'+text[lt-nbchar/2:]
text = text[0:int(nbchar/2)]+'...'+text[int(lt-nbchar/2):]
tw = fm.width(text)
px = (mtw-tw) / 2
py = width-1-fm.descent()
Expand Down
4 changes: 2 additions & 2 deletions src/openalea/lpy/gui/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def save(self):

def saveas(self):
bckupname = self.getBackupName()
qfname = QFileDialog.getSaveFileName(self.lpywidget,"Save L-Py file",self.fname if self.fname else '.',"Py Lsystems Files (*.lpy);;All Files (*.*)")
if qfname:
qfname, mfilter = QFileDialog.getSaveFileName(self.lpywidget,"Save L-Py file",self.fname if self.fname else '.',"Py Lsystems Files (*.lpy);;All Files (*.*)")
if qfname :
fname = str(qfname[0])
if not os.path.exists(fname):
self.readonly = False
Expand Down
2 changes: 0 additions & 2 deletions travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ before_script:

script:
- source script.sh
- conda install nose
- cd test; nosetests -v

after_success:
- source after_success.sh
Expand Down

0 comments on commit 6b5fbaf

Please sign in to comment.