Skip to content

Commit

Permalink
Merge pull request #16 from openalea/visualea
Browse files Browse the repository at this point in the history
Port to Python3 PyQt5
  • Loading branch information
pradal authored Jan 22, 2024
2 parents d2b9e82 + e290aaa commit f1456f7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conda-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
if_true: 'true'
if_false: 'false'
- name: Build and Publish
uses: openalea/[email protected].3
uses: openalea/[email protected].4
with:
conda: conda
mamba: true
mamba: false
python: ${{ matrix.python-minor-version }}
numpy: '20.0'
channels: openalea3, conda-forge
Expand Down
4 changes: 2 additions & 2 deletions src/openalea/weberpenn/mtg_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def plot(self):

root = next(g.roots_iter(scale=2))

min_length = min([f.length for f in frames.values() if
min_length = min([f.length for f in list(frames.values()) if
f.length and f.length > 0])
for vid in pre_order_turtle(g, root, p):
down = frames[vid].down
Expand Down Expand Up @@ -333,7 +333,7 @@ def create_mtg_with_axes(g):

edge_type = g.property('edge_type')
colors[2] = g.vertices(scale=max_scale)
colors[1] = [vid for vid, edge in edge_type.items() if
colors[1] = [vid for vid, edge in list(edge_type.items()) if
edge == '+' and g.scale(vid) == max_scale]
colors[1].insert(0, tree_root)

Expand Down
2 changes: 1 addition & 1 deletion src/openalea/weberpenn/tree_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def leaves(self, color=green):
leaves = server.leaves()
leaf = self.leaf
# map( lambda x: scene.add(self.leaf_shape(x,color,leaf)), leaves )
new_leaves = [self.leaf_shape(x, color, leaf) for leaf in leaves]
new_leaves = [self.leaf_shape(l, color, leaf) for l in leaves]
self._shapes.extend(new_leaves)

def leaf_shape(self, leaf, color, shape):
Expand Down
41 changes: 23 additions & 18 deletions src/openalea/weberpenn/wralea/trunk_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):

Node.__init__(self)

shape_ids= self.shapes.keys()
shape_ids= list(self.shapes.keys())
shape_ids.sort()

inputs=[ {'interface': IEnumStr(shape_ids), 'name': 'shape_id', 'value': '0 - Conical'},
Expand All @@ -48,21 +48,22 @@ def __init__(self):
self.add_output(name='trunk_params')


def __call__(self, (shape_id,
base_size,
scale,
scale_variance,
order,
ratio,
ratio_power,
leaves,
leaf_scale,
leaf_scale_x,
lobes,
lobes_variance,
flare,
base_split)):
def __call__(self, params):
"Build trunk and global parameters."
(shape_id,
base_size,
scale,
scale_variance,
order,
ratio,
ratio_power,
leaves,
leaf_scale,
leaf_scale_x,
lobes,
lobes_variance,
flare,
base_split) = params
shape_id = self.shapes[shape_id]

return dict((('shape_id', shape_id),
Expand Down Expand Up @@ -178,13 +179,17 @@ class Species(Node):

def __init__( self ):
Node.__init__(self)
_species = self.trees.keys()
_species = list(self.trees.keys())
_species.sort()

self.add_input(name='species', interface=IEnumStr(_species), value = 'Black Tupelo' )
self.add_input(
name='species',
interface=IEnumStr(_species),
value = 'Black Tupelo' )
self.add_output(name='trunk_params')

def __call__( self, (t,) ):
def __call__( self, params ):
t, = params
if t:
return self.trees[t](),

Expand Down

0 comments on commit f1456f7

Please sign in to comment.