Commit 0757c52b authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Fix typos

parent c8d0ed60
...@@ -62,6 +62,7 @@ from __future__ import unicode_literals ...@@ -62,6 +62,7 @@ from __future__ import unicode_literals
from __future__ import print_function from __future__ import print_function
from math import sqrt from math import sqrt
from collections import defaultdict from collections import defaultdict
import itertools as it
from antlr3 import ANTLRStringStream, ANTLRFileStream, CommonTokenStream from antlr3 import ANTLRStringStream, ANTLRFileStream, CommonTokenStream
from condexpLexer import condexpLexer from condexpLexer import condexpLexer
...@@ -1663,12 +1664,10 @@ class CMacroNode(CSimpleNode): ...@@ -1663,12 +1664,10 @@ class CMacroNode(CSimpleNode):
""" """
Look for transitions pointed by mouse Look for transitions pointed by mouse
No recursive search - transitions are in current node No recursive search - transitions are in current node
""" """
for gtr in self.transitions: for trans in it.chain(*self.transitions):
for trans in gtr: if trans.is_me(mox, moy, dstyle, w_coef, h_coef):
if trans.is_me(mox, moy, dstyle, w_coef, h_coef): return trans
return trans
def resize(self, mx_virt, my_virt, handle, screen_w, screen_h, top_node): def resize(self, mx_virt, my_virt, handle, screen_w, screen_h, top_node):
"""Resize the node with the mouse """Resize the node with the mouse
...@@ -1939,12 +1938,11 @@ class CTopNode(CMacroNode): ...@@ -1939,12 +1938,11 @@ class CTopNode(CMacroNode):
ccy = ccc[1] / h_coef ccy = ccc[1] / h_coef
return (nnn, hhh, (ccx, ccy), ttt) return (nnn, hhh, (ccx, ccy), ttt)
# no subnode found: try to find a transition at top level # no subnode found: try to find a transition at top level
for trg in self.transitions: for trans in it.chain(*self.transitions):
for trans in trg: if trans.is_me(mox, moy, dstyle, w_coef, h_coef):
if trans.is_me(mox, moy, dstyle, w_coef, h_coef): ccx = 0.5 / w_coef
ccx = 0.5 / w_coef ccy = 0.5 / h_coef
ccy = 0.5 / h_coef return (self, 0, (ccx, ccy), trans)
return (self, 0, (ccx, ccy), trans)
# no subnode and no transition found # no subnode and no transition found
return (self, 0, (0, 0), None) # no handle for top node return (self, 0, (0, 0), None) # no handle for top node
...@@ -2070,9 +2068,11 @@ class CTransition(object): ...@@ -2070,9 +2068,11 @@ class CTransition(object):
return set() return set()
def is_me(self, mox, moy, dstyle, w_coef, h_coef): def is_me(self, mox, moy, dstyle, w_coef, h_coef):
""" """Tell if mouse position is closed to transition
Tell if mouse position is closed to transition
@param mox, moy: mouse coordinates in container coord (local coordinates) :param mox, moy: mouse coordinates in container coord (local coordinates)
:return: True or False
:rtype: <boolean>
""" """
v_size = self.accept(dstyle) v_size = self.accept(dstyle)
dist_max = max(v_size[0], v_size[1]) dist_max = max(v_size[0], v_size[1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment