Compare commits
51 Commits
stable
...
dev/archéo
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | 52a1315eb2 | |
Jean Sirmai | be2fe2e451 | |
Jean Sirmai | 317487bf15 | |
Jean Sirmai | 2df3d7a4e4 | |
Jean Sirmai | be49924523 | |
Jean Sirmai | 124b314271 | |
Jean Sirmai | fbb0dfcfb6 | |
Jean Sirmai | cf5ff788fa | |
Jean Sirmai | 648072f59d | |
Jean Sirmai | ae6981a624 | |
Jean Sirmai | 75c63e8e24 | |
Jean Sirmai | 5751a6cd72 | |
Jean Sirmai | 29c8d0c127 | |
Jean Sirmai | a78e3f7bb6 | |
Jean Sirmai | fe668f3720 | |
Jean Sirmai | 93f4a5e2e2 | |
Jean Sirmai | e364b97cbf | |
Jean Sirmai | 46db1e5ad6 | |
Jean Sirmai | 4cec4b1855 | |
Jean Sirmai | 9e327a2643 | |
Jean Sirmai | 5f70690871 | |
Jean Sirmai | ef03bd717b | |
Jean Sirmai | 0e226e5cc8 | |
Jean Sirmai | 8a7f97f53a | |
Jean Sirmai | 5a52450ae1 | |
Jean Sirmai | f230ad3a73 | |
Jean Sirmai | 768e3ca8a3 | |
Jean Sirmai | 5277401f81 | |
Jean Sirmai | 3cb73c7abb | |
Jean Sirmai | c796b06451 | |
Jean Sirmai | ea93bd0aad | |
Jean Sirmai | f445d4d534 | |
Jean Sirmai | 5b1e27d670 | |
Jean Sirmai | d430332c3f | |
Jean Sirmai | a009d0e402 | |
Jean Sirmai | 7e6f5023a1 | |
Jean Sirmai | 3517e73de4 | |
Jean Sirmai | 9261bc03cf | |
Jean Sirmai | 71ddf7dd3d | |
Jean Sirmai | 0fd3966433 | |
Jean Sirmai | f068ca6731 | |
Jean Sirmai | 393303dbc5 | |
Jean Sirmai | c684bab6e3 | |
Jean Sirmai | 0f436bd8d6 | |
Adrien Bourmault | de7f61e156 | |
Adrien Bourmault | 5b9a7dbdfe | |
Adrien Bourmault | 929fc53e2c | |
Adrien Bourmault | 0b140a54c6 | |
Adrien Bourmault | fd24472805 | |
Adrien Bourmault | e0bb902ab8 | |
Adrien Bourmault | 221d95f4dc |
|
@ -8,4 +8,4 @@ stages:
|
|||
flake8:
|
||||
stage: Static Analysis
|
||||
script:
|
||||
- flake8 --max-line-length=120 --ignore=E402,E266, src/*.py
|
||||
- flake8 --max-line-length=120 --ignore=E402,E266,W503 src/*.py
|
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gem-graph-model version="0.2.1">
|
||||
<identity>
|
||||
<name>Modèle de test</name>
|
||||
|
||||
<owner>Léontine Patinette</owner>
|
||||
<identity>
|
||||
<name>Chrysalide</name>
|
||||
|
||||
<owner>Léontine qui patine</owner>
|
||||
|
||||
<owner_id>2</owner_id>
|
||||
|
||||
|
@ -11,10 +12,10 @@
|
|||
|
||||
<version>1.0</version>
|
||||
|
||||
<g_ref id="Cause" date="1630000000" author="toujours" lang="en">Ref</g_ref>
|
||||
<g_ref id="diff" date="1630000000" author="Léontine" lang="en">Qui ça ?'</g_ref>
|
||||
</identity>
|
||||
|
||||
<parameters id="texte" date="0" author="Léontine Trottine.">
|
||||
<parameters id="texte" date="0" author="Léontine qui trottine.">
|
||||
<simulation>
|
||||
<max_thread>0</max_thread>
|
||||
<max_cycles>9</max_cycles>
|
||||
|
@ -27,7 +28,7 @@
|
|||
<!-- loop_on_max="true" anything moved beyond max reenters at the zero of space-->
|
||||
<!-- loop_on_max="false" anything moved beyond max is lost-->
|
||||
|
||||
<dimension x="29"/>
|
||||
<dimension x="20"/>
|
||||
|
||||
<!-- Site_multiplicity = number of sites in a space unit. -->
|
||||
<!-- Each site points towards a neighbouring space unit. -->
|
||||
|
@ -52,21 +53,24 @@
|
|||
|
||||
<!-- Saved space description (initial space is sequence 0) -->
|
||||
|
||||
<savedstates id="texte" date="1630000000" author="Qui courrait dans l'herbe'">
|
||||
<state id="initial" date="1630000000" author="Une souris verte">
|
||||
<states id="texte" date="1630000000" author="Here, states are spaces.">
|
||||
<space id="initial" date="1630000000" author="Une souris verte,">
|
||||
<arrow site="0" weight="6" x="0"/>
|
||||
<arrow site="1" weight="1" x="0"/>
|
||||
<arrow site="2" weight="1" x="1"/>
|
||||
<arrow site="1" weight="1" x="10"/>
|
||||
<arrow site="2" weight="1" x="11"/>
|
||||
<arrow site="1" weight="1" x="20"/>
|
||||
<arrow site="2" weight="1" x="21"/>
|
||||
<arrow site="2" weight="7" x="1"/>
|
||||
<arrow site="1" weight="3" x="6"/>
|
||||
<arrow site="2" weight="1" x="7"/>
|
||||
<arrow site="1" weight="4" x="14"/>
|
||||
<arrow site="0" weight="8" x="14"/>
|
||||
<arrow site="2" weight="5" x="15"/>
|
||||
<arrow site="1" weight="2" x="17"/>
|
||||
<arrow site="2" weight="7" x="18"/>
|
||||
<arrow site="2" weight="9" x="20"/>
|
||||
<arrow site="0" weight="4" x="20"/>
|
||||
|
||||
<!-- Three dimers 1-1 are drawn in the global space
|
||||
at locations (0,1) (10,11) and (20,21) -->
|
||||
</space>
|
||||
|
||||
</state>
|
||||
|
||||
</savedstates>
|
||||
</states>
|
||||
|
||||
<!-- Model transitions definition (rules) -->
|
||||
<!-- In this version : <xs:sequence minOccurs="0" maxOccurs="unbounded">-->
|
||||
|
@ -76,15 +80,15 @@
|
|||
|
||||
<condition site="1" weight="1" node_id="1" parent="0" x="0"/>
|
||||
<condition site="2" weight="1" node_id="2" parent="1" x="1"/>
|
||||
<!-- as soon as conditions 1 and 2 are satisfied, a dimer is identified at atation (0,1). -->
|
||||
<!-- if conditions 1 and 2 are satisfied, a dimer is identified at loc (0,1). -->
|
||||
|
||||
<condition site="1" weight="0" node_id="3" parent="2" x="2"/>
|
||||
<!-- as soon as condition 3 is satisfied,
|
||||
the neighbouring space unit to East of the dimer is empty
|
||||
<!-- if condition 3 is satisfied,
|
||||
the neighbouring space unhit to East of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to East. -->
|
||||
|
||||
<condition site="2" weight="0" node_id="4" parent="2" x="-1"/>
|
||||
<!-- as soon as condition 4 is satisfied,
|
||||
<!-- if condition 4 is satisfied,
|
||||
the neighbouring space unit to West of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to West. -->
|
||||
|
|
@ -0,0 +1 @@
|
|||
('(b,(c,(d,(e,(f,g))h)i)a)')[0]
|
|
@ -1,83 +0,0 @@
|
|||
<gem-graph-model version="0.2">
|
||||
<!-- Model identity informations -->
|
||||
<identity>
|
||||
<name>Modèle de test</name>
|
||||
<owner>Gaston Lagaffe</owner>
|
||||
<owner_id>2</owner_id>
|
||||
<date>1629830000</date>
|
||||
<version>1.0</version>
|
||||
<g_ref id="texte" date="1629830000" author="Jean" lang="en">Ref</g_ref>
|
||||
</identity>
|
||||
<!-- Model parameters -->
|
||||
<parameters id="texte" date="0" author="Gaston Lagaffe">
|
||||
<simulation>
|
||||
<max_thread>0</max_thread>
|
||||
<max_cycles>9</max_cycles>
|
||||
</simulation>
|
||||
<space-param>
|
||||
<dimension>
|
||||
<!-- loop_on_zero="true" anything moved before zero reenters at the end of space-->
|
||||
<!-- loop_on_zero="false" anything moved before zero is lost-->
|
||||
<!-- loop_on_max="true" anything moved beyond max reenters at the zero of space-->
|
||||
<!-- loop_on_max="false" anything moved beyond max is lost-->
|
||||
<axis name="x" size="29"/>
|
||||
<axis name="y" size="0"/>
|
||||
<axis name="z" size="0"/>
|
||||
</dimension>
|
||||
<!-- Site_multiplicity = number of sites in a space unit. -->
|
||||
<!-- Each site points towards a neighbouring space unit. -->
|
||||
<!-- Several arrows can be stacked in the same site. -->
|
||||
<site_multiplicity>3</site_multiplicity>
|
||||
</space-param>
|
||||
</parameters>
|
||||
<!-- Model objects definition -->
|
||||
<objects id="texte" date="1629830000" author="Jean Sirmai">
|
||||
<object id="dimer 1-1" date="1629830000" author="Jean Sirmai">
|
||||
<arrow x="0" y="0" z="0" site="1" weight="1"/>
|
||||
<arrow x="1" y="0" z="0" site="2" weight="1"/>
|
||||
</object>
|
||||
</objects>
|
||||
<!-- Saved space description (initial space is sequence 0) -->
|
||||
<savestates id="texte" date="1629830000" author="THE MATRIX">
|
||||
<space id="initial" date="1629830000" author="Jean Sirmai" sequence="0">
|
||||
<arrow x="0" y="0" z="0" site="1" weight="1"/>
|
||||
<arrow x="1" y="0" z="0" site="2" weight="1"/>
|
||||
<arrow x="10" y="0" z="0" site="1" weight="1"/>
|
||||
<arrow x="11" y="0" z="0" site="2" weight="1"/>
|
||||
<arrow x="20" y="0" z="0" site="1" weight="1"/>
|
||||
<arrow x="21" y="0" z="0" site="2" weight="1"/>
|
||||
<!-- Three dimers 1-1 are drawn in the global space
|
||||
at locations (0,1) (10,11) and (20,21) -->
|
||||
</space>
|
||||
</savestates>
|
||||
<!-- Model transitions definition (rules) -->
|
||||
<!-- In this version : <xs:sequence minOccurs="0" maxOccurs="unbounded">-->
|
||||
<!-- Transitions should be edited by hand and written in a 'human-readable' format -->
|
||||
<conditions id="random walk of dimers" date="1629822222" author="Jean">
|
||||
<condition x="0" y="0" z="0" site="1" weight="1" node_id="1" parent="0"/>
|
||||
<condition x="1" y="0" z="0" site="2" weight="1" node_id="2" parent="1"/>
|
||||
<!-- as soon as conditions 1 and 2 are satisfied, a dimer is identified at location (0,1). -->
|
||||
<condition x="2" y="0" z="0" site="1" weight="0" node_id="3" parent="2"/>
|
||||
<!-- as soon as condition 3 is satisfied,
|
||||
the neighbouring space unit to East of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to East. -->
|
||||
<condition x="-1" y="0" z="0" site="2" weight="0" node_id="4" parent="2"/>
|
||||
<!-- as soon as condition 4 is satisfied,
|
||||
the neighbouring space unit to West of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to West. -->
|
||||
</conditions>
|
||||
<transitions>
|
||||
<transition id="move_a_dimer_to_east" date="1629811111" author="Jean" parent="3" probability="1">
|
||||
<arrow x="0" y="0" z="0" site="1" weight="0"/>
|
||||
<arrow x="1" y="0" z="0" site="2" weight="0"/>
|
||||
<arrow x="1" y="0" z="0" site="1" weight="1"/>
|
||||
<arrow x="2" y="0" z="0" site="2" weight="1"/>
|
||||
</transition>
|
||||
<transition id="move_a_dimer_to_west" date="1629811112" author="Jean" parent="4" probability="1">
|
||||
<arrow x="0" y="0" z="0" site="1" weight="0"/>
|
||||
<arrow x="1" y="0" z="0" site="2" weight="0"/>
|
||||
<arrow x="0" y="0" z="0" site="2" weight="1"/>
|
||||
<arrow x="-1" y="0" z="0" site="1" weight="1"/>
|
||||
</transition>
|
||||
</transitions>
|
||||
</gem-graph-model>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- https://www.freeformatter.com/xml-validator-xsd.html -->
|
||||
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
<xs:attribute name="pp" type="xs:string"/>
|
||||
<xs:attribute name="rank" type="xs:string"/>
|
||||
|
||||
<!--<proposition id="00" parent="None">a text</proposition>-->
|
||||
|
||||
<xs:element name="p">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute ref="id" use="required"/>
|
||||
<xs:attribute ref="pp" use="required"/>
|
||||
<xs:attribute ref="rank" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="p"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="version" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- https://www.freeformatter.com/xml-validator-xsd.html -->
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
<xs:attribute name="node_id" type="xs:integer"/>
|
||||
<xs:attribute name="parent" type="xs:integer"/>
|
||||
<xs:attribute name="date" type="xs:integer"/>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="lang" type="xs:string"/>
|
||||
<xs:attribute name="owner" type="xs:string"/>
|
||||
<xs:attribute name="owner_id" type="xs:integer"/>
|
||||
<xs:attribute name="author" type="xs:string"/>
|
||||
<xs:attribute name="version" type="xs:string"/>
|
||||
<xs:attribute name="probability" type="xs:integer"/>
|
||||
<xs:attribute name="site" type="xs:integer" default="0"/>
|
||||
<xs:attribute name="weight" type="xs:integer" default="0"/>
|
||||
|
||||
<!-- As it may be understand as 'time',
|
||||
name "t" should not be used as an axis name :
|
||||
in space phases models, time cannot be an axis -->
|
||||
|
||||
<xs:attribute name="u" type="xs:integer"/>
|
||||
<xs:attribute name="v" type="xs:integer"/>
|
||||
<xs:attribute name="w" type="xs:integer"/>
|
||||
<xs:attribute name="x" type="xs:integer"/>
|
||||
<xs:attribute name="y" type="xs:integer"/>
|
||||
<xs:attribute name="z" type="xs:integer"/>
|
||||
|
||||
<xs:attributeGroup name="id_date_author">
|
||||
<xs:attribute ref="id"/>
|
||||
<xs:attribute ref="date"/>
|
||||
<xs:attribute ref="author"/>
|
||||
</xs:attributeGroup>
|
||||
|
||||
<xs:element name="g_ref">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="lang" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="quote" substitutionGroup="g_ref"/>
|
||||
|
||||
<xs:element name="dimension">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="arrow">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="site" use="required"/>
|
||||
<xs:attribute ref="weight" use="required"/>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="condition">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="site" use="required"/>
|
||||
<xs:attribute ref="weight" use="required"/>
|
||||
<xs:attribute ref="node_id" use="required"/>
|
||||
<xs:attribute ref="parent" use="required"/>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="space">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="object" substitutionGroup="space"/>
|
||||
|
||||
<xs:element name="transition">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element minOccurs="0" ref="quote"/>
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="parent" use="required"/>
|
||||
<xs:attribute ref="probability" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="gem-graph-model">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="identity">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="owner" type="xs:string"/>
|
||||
<xs:element name="owner_id" type="xs:integer"/>
|
||||
<xs:element name="date" type="xs:integer"/>
|
||||
<xs:element name="version" type="xs:float"/>
|
||||
<xs:element ref="g_ref" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="parameters">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
|
||||
<xs:element name="simulation">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="max_thread" type="xs:integer"/>
|
||||
<xs:element name="max_cycles" type="xs:integer"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="space-param">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element ref="dimension"/>
|
||||
<xs:element name="site_multiplicity" type="xs:integer"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="objects">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="object"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="states">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="space"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="conditions">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element minOccurs="0" ref="quote"/>
|
||||
<xs:element ref="condition"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="transitions">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="transition"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
<xs:attribute ref="version" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -10,18 +10,21 @@
|
|||
<xs:attribute name="owner" type="xs:string"/>
|
||||
<xs:attribute name="owner_id" type="xs:integer"/>
|
||||
<xs:attribute name="author" type="xs:string"/>
|
||||
<xs:attribute name="version" type="xs:float"/>
|
||||
<xs:attribute name="version" type="xs:string"/>
|
||||
<xs:attribute name="probability" type="xs:integer"/>
|
||||
<xs:attribute name="site" type="xs:integer" default="0"/>
|
||||
<xs:attribute name="weight" type="xs:integer" default="0"/>
|
||||
|
||||
<!-- As it may be understand as 'time',
|
||||
name "t" should not be used as an axis name :
|
||||
in space phases models, time cannot be an axis -->
|
||||
|
||||
<xs:attribute name="u" type="xs:integer"/>
|
||||
<xs:attribute name="v" type="xs:integer"/>
|
||||
<xs:attribute name="w" type="xs:integer"/>
|
||||
<xs:attribute name="x" type="xs:integer"/>
|
||||
<xs:attribute name="y" type="xs:integer"/>
|
||||
<xs:attribute name="z" type="xs:integer"/>
|
||||
<xs:attribute name="t" type="xs:integer"/>
|
||||
|
||||
|
||||
<xs:attributeGroup name="id_date_author">
|
||||
<xs:attribute ref="id"/>
|
||||
|
@ -33,8 +36,8 @@
|
|||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="lang" use="required"/>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="lang" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
|
@ -50,7 +53,6 @@
|
|||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
@ -64,7 +66,6 @@
|
|||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
@ -80,11 +81,10 @@
|
|||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="state">
|
||||
<xs:element name="space">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="arrow"/>
|
||||
|
@ -93,7 +93,7 @@
|
|||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="object" substitutionGroup="state"/>
|
||||
<xs:element name="object" substitutionGroup="space"/>
|
||||
|
||||
<xs:element name="transition">
|
||||
<xs:complexType>
|
||||
|
@ -112,14 +112,14 @@
|
|||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="identity">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="owner" type="xs:string"/>
|
||||
<xs:element name="owner_id" type="xs:integer"/>
|
||||
<xs:element name="date" type="xs:integer"/>
|
||||
<xs:element name="version" type="xs:float"/>
|
||||
<xs:element ref="g_ref" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="owner" type="xs:string"/>
|
||||
<xs:element name="owner_id" type="xs:integer"/>
|
||||
<xs:element name="date" type="xs:integer"/>
|
||||
<xs:element name="version" type="xs:float"/>
|
||||
<xs:element ref="g_ref" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
@ -159,10 +159,10 @@
|
|||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="savedstates">
|
||||
<xs:element name="states">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="state"/>
|
||||
<xs:element ref="space"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
|
@ -170,7 +170,7 @@
|
|||
|
||||
<xs:element name="conditions">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element minOccurs="0" ref="quote"/>
|
||||
<xs:element ref="condition"/>
|
||||
</xs:sequence>
|
||||
|
@ -180,7 +180,7 @@
|
|||
|
||||
<xs:element name="transitions">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="transition"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
@ -191,3 +191,4 @@
|
|||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- https://www.freeformatter.com/xml-validator-xsd.html -->
|
||||
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
<xs:attribute name="pp" type="xs:string"/>
|
||||
<xs:attribute name="rank" type="xs:string"/>
|
||||
|
||||
<!--<proposition id="00" parent="None">a text</proposition>-->
|
||||
|
||||
<xs:element name="p">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute ref="id" use="required"/>
|
||||
<xs:attribute ref="pp" use="required"/>
|
||||
<xs:attribute ref="rank" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="p"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="version" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/python3
|
||||
import gi
|
||||
import files_addr
|
||||
import rules_tree
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from lxml import etree # r = Resolver()
|
||||
from anytree import NodeMixin, RenderTree, Resolver, AsciiStyle, LevelOrderIter
|
||||
|
||||
class Window(Gtk.Window):
|
||||
|
||||
def create_editable_tree(self, store, tree):
|
||||
Gtk_node = [None] * 10
|
||||
sketch = ''
|
||||
nb = 0
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
if node.is_root:
|
||||
Gtk_node[nb] = store.append(parent=None, row=[0, 'root ' + str(node.id)])
|
||||
sketch += u"%s%s" % (pre + '᠇', ' node ' + str(node.id) + ' (root)\n')
|
||||
else:
|
||||
nb += 1
|
||||
if node.is_leaf:
|
||||
Gtk_node[nb] = store.append(parent = Gtk_node[node.parent.id],
|
||||
row = [nb, str(node.id)])
|
||||
sketch += u"%s%s" % (pre, str(node.id) + '\n')
|
||||
else:
|
||||
Gtk_node[nb] = store.append(parent = Gtk_node[node.parent.id],
|
||||
row = [nb, 'node ' + str(node.id)])
|
||||
sketch += u"%s%s" % (pre + '᠇', ' node' + str(node.id) + '\n')
|
||||
sketch += "\n"
|
||||
print(sketch)
|
||||
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(title="Minimal Tree View")
|
||||
tree = rules_tree.get_tree()
|
||||
|
||||
self.my_tree_store = Gtk.TreeStore(int, str)
|
||||
self.create_editable_tree(self.my_tree_store, tree)
|
||||
|
||||
self.current_filter_button = None
|
||||
self.language_filter = self.my_tree_store.filter_new()
|
||||
|
||||
self.treeview = Gtk.TreeView(model=self.language_filter)
|
||||
for i, column_title in enumerate(["Row", "Path"]):
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
|
||||
self.treeview.append_column(column)
|
||||
|
||||
self.scrollable_treelist = Gtk.ScrolledWindow()
|
||||
self.scrollable_treelist.add(self.treeview)
|
||||
|
||||
self.tree_viewport = Gtk.Viewport()
|
||||
self.tree_viewport.add(self.scrollable_treelist)
|
||||
self.tree_viewport.set_size_request(300, 200)
|
||||
self.add(self.tree_viewport)
|
||||
|
||||
win = Window()
|
||||
win.connect("destroy", Gtk.main_quit)
|
||||
win.show_all()
|
||||
#Gtk.main()
|
|
@ -0,0 +1,248 @@
|
|||
# import measures.MeasuresManager
|
||||
# import rule.FormulasManager
|
||||
# import rule.FormulasManagerAccess
|
||||
# import session.ViewControls
|
||||
# import state.StateManager
|
||||
# import state.StateManagerLocal
|
||||
# import views.MODEL
|
||||
# import views.ViewsManagerAccess
|
||||
|
||||
# @see MonoThread
|
||||
class Formula():
|
||||
def getFormula():
|
||||
return 0
|
||||
|
||||
def doActions():
|
||||
pass
|
||||
|
||||
|
||||
class ViewControls():
|
||||
|
||||
def isDoSelected():
|
||||
return True
|
||||
|
||||
def execDo():
|
||||
pass
|
||||
|
||||
|
||||
class ViewsManagerAccess():
|
||||
pass
|
||||
|
||||
|
||||
class StateManagerLocal():
|
||||
def getReferenceOrientation_1():
|
||||
pass
|
||||
|
||||
|
||||
class FormulasManager():
|
||||
def iterateToFindAFormula():
|
||||
return 1
|
||||
|
||||
def getFormula(formula_key):
|
||||
return 0
|
||||
|
||||
|
||||
class MeasuresManager():
|
||||
def startMeasuringAFormulaEffect(formula_key):
|
||||
pass
|
||||
|
||||
def endMeasuringAFormulaEffect(formula_key):
|
||||
pass
|
||||
|
||||
|
||||
class SingleTransition:
|
||||
'''
|
||||
SingleTransition is a loop with one interruption and two instructions:
|
||||
if (session.MainView.isStartStopButtonSelected())
|
||||
state.StateManagerLocal.chooseLocalOrigin(false)
|
||||
new SingleTransition(true)
|
||||
'''
|
||||
|
||||
is_done = False
|
||||
elapsed = ''
|
||||
present = 0
|
||||
selected_formula = -1
|
||||
undoStackSize = 100 # used by ViewControls (for image of the buffer state)
|
||||
formula = [0, 1, 2]
|
||||
x = []
|
||||
y = []
|
||||
z = []
|
||||
o = [0, 1, 2]
|
||||
DO_UNDO_REDO_comment = False
|
||||
|
||||
def __init__(self):
|
||||
self.present = 0
|
||||
# if (step_by_step) StateManagerLocal.circlePresentState()
|
||||
if ViewControls.isDoSelected():
|
||||
self.execute_do(self.prepare_do(False))
|
||||
elif ViewControls.isUndoSelected():
|
||||
SingleTransition.execute_undo(SingleTransition.prepare_undo(False))
|
||||
elif ViewControls.isRedoSelected():
|
||||
SingleTransition.execute_redo(SingleTransition.prepare_redo(False))
|
||||
# if (ViewControls.undo_buffer < undoStackSize): do something
|
||||
# ViewControls.setTimeBufferBar(ViewControls.undo_buffer)
|
||||
# MainView.addElapsedTime() Clock should be independent from any view
|
||||
|
||||
def prepare_do(self, step_by_step) :
|
||||
# ThreadsManager.addCycle() > nb_cycles ++ < no formula may be applied
|
||||
selected_formula = FormulasManager.iterateToFindAFormula()
|
||||
return selected_formula
|
||||
|
||||
def execute_do(self, formula_key):
|
||||
# formula.doActions()
|
||||
# print(" execute_do: formula key=" + formula_key +" ")
|
||||
if formula_key < 0:
|
||||
if StateManagerLocal.comment_origins:
|
||||
print("execute_do failure: formula key=", formula_key)
|
||||
return
|
||||
|
||||
MeasuresManager.startMeasuringAFormulaEffect(formula_key)
|
||||
# print("execute_do "+ FormulasManager.formula.get(formula_key).name)
|
||||
# TODO FormulasManager.getFormula().get(formula_key).doActions()
|
||||
# for (i = 0 i < action.length i++): action[i].doAction ()
|
||||
# StateManagerLocal.endRule(action_swap, action_name)}
|
||||
MeasuresManager.endMeasuringAFormulaEffect(formula_key)
|
||||
self.writePresentState(formula_key)
|
||||
self.present += 1
|
||||
if self.present == self.undoStackSize:
|
||||
self.present = 0
|
||||
# MainView.setStartStopButtonSelected(False)
|
||||
# if (present == 1):
|
||||
# MainView.setStartStopButtonSelected(False)
|
||||
# out.println("MonoThread.execute_do > stop ! (present == 1)")
|
||||
ViewControls.execDo()
|
||||
# doRepaint()
|
||||
if self.DO_UNDO_REDO_comment:
|
||||
self.comment_do()
|
||||
|
||||
def prepare_undo(self, step_by_step):
|
||||
# MonoTest.present-- return MonoTest.f[MonoTest.present]
|
||||
if (ViewControls.isUndoBufferEmpty()):
|
||||
print("prepare_undo stop !")
|
||||
# undo_buffer is always >= 0
|
||||
else:
|
||||
self.present -= 1
|
||||
if self.present == -1:
|
||||
self.present = self.undoStackSize - 1
|
||||
ViewControls.execUndo()
|
||||
|
||||
self.formula_key = self.readPresentState(step_by_step)
|
||||
# if (step_by_step) StateManagerLocal.circlePresentState()
|
||||
return self.formula_key
|
||||
|
||||
def execute_undo(self, formula_key):
|
||||
# formula.unDoActions() {for (i = 0 i < action.length i++) ...}
|
||||
FormulasManager.getFormula().get(formula_key).unDoActions()
|
||||
# for (i = 0 i < action.length i++) action[i].doAction ()
|
||||
# StateManagerLocal.endRule(action_swap, action_name)
|
||||
ViewControls.setRedoSelected()
|
||||
# StateManagerLocal.circlePresentState()
|
||||
# ThreadsManager.removeEfficientCycle() {nb_effective_cycles --}
|
||||
self.doRepaint()
|
||||
if self.DO_UNDO_REDO_comment:
|
||||
self.comment_undo()
|
||||
|
||||
def prepare_redo(self, step_by_step):
|
||||
# return MonoThread
|
||||
# Test.f[MonoThreadTest.pStateManagerLocalresent]
|
||||
self.formula_key = self.readPresentState(step_by_step)
|
||||
# ThreadsManager.addEfficientCycle() # {nb_effective_cycles ++}
|
||||
# if (step_by_step) StateManagerLocal.circlePresentState()
|
||||
return self.formula_key
|
||||
|
||||
def execute_redo(self, formula_key):
|
||||
# formula.doActions() {for (i = 0 i < action.length i++) ...}
|
||||
# the redo_buffer is always >= 0
|
||||
# (if the re_do buffer is empty, the re_do button is deactivated)
|
||||
if not ViewControls.isRedoBufferEmpty():
|
||||
FormulasManager.getFormula().get(formula_key).doActions()
|
||||
# {for (i = 0 i < action.length i++) action[i].doAction()
|
||||
# StateManagerLocal.endRule(action_swap, action_name)}
|
||||
self.present += 1
|
||||
if self.present == self.undoStackSize:
|
||||
self.present = 0
|
||||
ViewControls.execRedo()
|
||||
|
||||
ViewControls.setUndoSelected()
|
||||
self.doRepaint()
|
||||
if self.DO_UNDO_REDO_comment:
|
||||
self.comment_redo()
|
||||
|
||||
def writePresentState(self, formula_key):
|
||||
# x[present] = StateManagerLocal.local_space_origin_X ...
|
||||
self.formula[self.present] = formula_key
|
||||
self.o[self.present] = StateManagerLocal.getReferenceOrientation_1()
|
||||
'''
|
||||
switch(StateManager.space_dimension) { # no break in this switch
|
||||
case THREE: z[present] = (byte) StateManagerLocal.local_space_origin_Z
|
||||
case TWO: y[present] = (byte) StateManagerLocal.local_space_origin_Y
|
||||
case ONE: x[present] = (byte) StateManagerLocal.local_space_origin_X
|
||||
default: }
|
||||
'''
|
||||
|
||||
def readPresentState(self, step_by_step):
|
||||
# StateManagerLocal.local_space_origin_X = x [present] ...
|
||||
'''
|
||||
switch(StateManager.space_dimension) { # no break in this switch
|
||||
case THREE : StateManagerLocal.local_space_origin_Z = z[present]
|
||||
case TWO : StateManagerLocal.local_space_origin_Y = y[present]
|
||||
case ONE : StateManagerLocal.local_space_origin_X = x[present]
|
||||
default: }
|
||||
'''
|
||||
StateManagerLocal.setReferenceOrientation_1(self.o[self.present])
|
||||
return self.formula[self.present]
|
||||
|
||||
def doRepaint(self):
|
||||
# plus tard !
|
||||
# ViewsManagerAccess.getView(MODEL.SPACE, "MonoThread.",
|
||||
# "execute_do_undo_redo()").repaint()
|
||||
pass
|
||||
|
||||
def comment_do(self) :
|
||||
if self.present == 0:
|
||||
self.present = self.undoStackSize
|
||||
print(" do -----> ", self.present,
|
||||
" (", ViewControls.undo_buffer - 1,
|
||||
"+1=", ViewControls.undo_buffer, " /",
|
||||
ViewControls.redo_buffer,
|
||||
" -", ViewControls.redo_buffer, ") xyzo (",
|
||||
self.x[self.present - 1], ",",
|
||||
self.y[self.present - 1], ",",
|
||||
self.z[self.present - 1], ") ",
|
||||
self.o[self.present - 1], " f=",
|
||||
self.formula[self.present - 1])
|
||||
if self.present == self.undoStackSize:
|
||||
self.present = 0
|
||||
|
||||
def comment_undo(self):
|
||||
# present ++ if (present == stack_size) present = 0
|
||||
# This comment is triggered after present was decreased of one unit
|
||||
print(" undo <--| ", self.present,
|
||||
" (", (ViewControls.undo_buffer + 1),
|
||||
"-1=", ViewControls.undo_buffer + " /",
|
||||
ViewControls.redo_buffer - 1, "+1=",
|
||||
ViewControls.redo_buffer, ") ", "xyzo (",
|
||||
self.x[self.present], ",",
|
||||
self.y[self.present], ",",
|
||||
self.z[self.present], ") ",
|
||||
self.o[self.present], " f=",
|
||||
self.formula[self.present])
|
||||
|
||||
def comment_redo(self):
|
||||
if self.present == 0:
|
||||
self.present = self.undoStackSize
|
||||
print(" redo |--> ", self.present,
|
||||
" (" + (ViewControls.undo_buffer - 1),
|
||||
"+1=" + ViewControls.undo_buffer + " /",
|
||||
ViewControls.redo_buffer + 1, "-1=",
|
||||
ViewControls.redo_buffer, ") xyzo (",
|
||||
self.x[self.present - 1], ",",
|
||||
self.y[self.present - 1], ",",
|
||||
self.z[self.present - 1], ") ",
|
||||
self.o[self.present - 1], " f=",
|
||||
self.formula[self.present - 1])
|
||||
if self.present == self.undoStackSize:
|
||||
self.present = 0
|
||||
|
||||
|
||||
SingleTransition()
|
|
@ -0,0 +1,18 @@
|
|||
class XXX:
|
||||
|
||||
present = 8
|
||||
|
||||
def __init__(self):
|
||||
self.present = 0
|
||||
print(self.present,
|
||||
'UnboundLocalError: local variable referenced before assignment')
|
||||
|
||||
def do_something(self):
|
||||
# instance.present = 5
|
||||
# self.present = 7
|
||||
pass
|
||||
|
||||
|
||||
instance = XXX()
|
||||
instance.do_something()
|
||||
print(XXX.present, instance.present)
|
|
@ -0,0 +1,16 @@
|
|||
glade_path = "/home/jean/Gem-Graph/gem-graph-client/ui/GLArea.glade"
|
||||
modelPath = "/home/jean/Gem-Graph/gem-graph-client/models/dimers random walk.user.xml"
|
||||
schemaPath = "/home/jean/Gem-Graph/gem-graph-client/schemas/models_0.2.1.xmls"
|
||||
|
||||
# les deux fichiers suivants pour me guider dans la fabrication d'un arbre "dynamique"
|
||||
schemaExPath = "/home/jean/Gem-Graph/gem-graph-client/schemas/model_ex.xmls"
|
||||
treeExPath = "/home/jean/Gem-Graph/gem-graph-client/ui/tree.ex"
|
||||
|
||||
|
||||
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/treeview.html#the-model
|
||||
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/builder.html
|
||||
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/objects.html
|
||||
# https://anytree.readthedocs.io/en/latest/_modules/anytree/node/nodemixin.html
|
||||
|
||||
# from newick import loads
|
||||
|
77
src/main.py
77
src/main.py
|
@ -21,33 +21,76 @@
|
|||
# ------------------------------------------------------------------------- #
|
||||
|
||||
import gi
|
||||
from anytree import RenderTree, LevelOrderIter
|
||||
import rules_tree
|
||||
import files_addr
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from lxml import etree
|
||||
from gi.repository import GObject
|
||||
|
||||
def create_editable_tree(store, tree):
|
||||
Gtk_node = [None] * 10
|
||||
sketch = ''
|
||||
nb = 0
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
if node.is_root:
|
||||
Gtk_node[nb] = store.append(parent=None, row=[0, 'root ' + str(node.id)])
|
||||
sketch += u"%s%s" % (pre + '᠇', ' node ' + str(node.id) + ' (root)\n')
|
||||
else:
|
||||
nb += 1
|
||||
if node.is_leaf:
|
||||
Gtk_node[nb] = store.append(parent = Gtk_node[node.parent.id],
|
||||
row = [nb, str(node.id)])
|
||||
sketch += u"%s%s" % (pre, str(node.id) + '\n')
|
||||
else:
|
||||
Gtk_node[nb] = store.append(parent = Gtk_node[node.parent.id],
|
||||
row = [nb, 'node ' + str(node.id)])
|
||||
sketch += u"%s%s" % (pre + '᠇', ' node' + str(node.id) + '\n')
|
||||
sketch += "\n"
|
||||
print(sketch)
|
||||
|
||||
|
||||
modelPath = "../models/dimers random walk.xml"
|
||||
schemPath = "../schemas/models_0.2.xmls"
|
||||
|
||||
tree = etree.parse(modelPath)
|
||||
|
||||
## Main window
|
||||
|
||||
store = Gtk.TreeStore(str, str)
|
||||
|
||||
class MyWindow(Gtk.Window):
|
||||
tree = rules_tree.get_tree()
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(title="Hello World")
|
||||
sketch = '------'
|
||||
my_tree_store = Gtk.TreeStore(int, str)
|
||||
create_editable_tree(my_tree_store, tree)
|
||||
|
||||
self.button = Gtk.Button(label="Click Here")
|
||||
self.button.connect("clicked", self.on_button_clicked)
|
||||
self.add(self.button)
|
||||
current_filter_button = None
|
||||
language_filter = my_tree_store.filter_new()
|
||||
|
||||
def on_button_clicked(self, widget):
|
||||
print("Hello World")
|
||||
treeview = Gtk.TreeView(model=language_filter)
|
||||
for i, column_title in enumerate(["Row", "Path"]):
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
|
||||
treeview.append_column(column)
|
||||
|
||||
scrollable_treelist = Gtk.ScrolledWindow()
|
||||
scrollable_treelist.add(treeview)
|
||||
|
||||
win = MyWindow()
|
||||
win.connect("destroy", Gtk.main_quit)
|
||||
win.show_all()
|
||||
Gtk.main()
|
||||
tree_viewport = Gtk.Viewport()
|
||||
tree_viewport.add(scrollable_treelist)
|
||||
tree_viewport.set_size_request(300, 200)
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(files_addr.glade_path)
|
||||
|
||||
transit = builder.get_object("Id_Transitions")
|
||||
transit.set_label(sketch)
|
||||
|
||||
transit.add(tree_viewport)
|
||||
|
||||
window = builder.get_object("GemGraphMainWindow")
|
||||
# window.show_all()
|
||||
|
||||
"""
|
||||
treestr = ''
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
treestr = u"%s%s" % (pre, node.id)
|
||||
treestr += treestr + "\n"
|
||||
"""
|
|
@ -0,0 +1,498 @@
|
|||
from lxml import etree
|
||||
import datetime as DT
|
||||
import files_addr
|
||||
|
||||
|
||||
|
||||
## Identity
|
||||
|
||||
|
||||
class G_ref:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
||||
def get_id(self):
|
||||
return self.node.get("id")
|
||||
|
||||
def set_id(self, id):
|
||||
self.node.attrib["id"] = id
|
||||
|
||||
def get_author(self):
|
||||
return self.node.get("author")
|
||||
|
||||
def set_author(self, author):
|
||||
self.node.attrib["author"] = author
|
||||
|
||||
def get_date(self):
|
||||
return DT.datetime.fromtimestamp(int(self.node.get("date")))
|
||||
|
||||
def set_date(self, date):
|
||||
self.node.attrib["date"] = str(int(date.timestamp()))
|
||||
|
||||
def get_lang(self):
|
||||
return self.node.get("lang")
|
||||
|
||||
def set_lang(self, lang):
|
||||
if(len(lang) > 2):
|
||||
print("lang must be 2 characters")
|
||||
return
|
||||
self.node.attrib["lang"] = lang
|
||||
|
||||
def get_text(self):
|
||||
return self.node.textdimension().get_axis
|
||||
|
||||
def set_text(self, text):
|
||||
self.node.text = text
|
||||
|
||||
|
||||
class Identity:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "name"):
|
||||
self.__name = child
|
||||
if(child.tag == "owner"):
|
||||
self.__owner = child
|
||||
if(child.tag == "owner_id"):
|
||||
self.__owner_id = child
|
||||
if(child.tag == "date"):
|
||||
self.__date = child
|
||||
if(child.tag == "version"):
|
||||
self.__version = child
|
||||
if(child.tag == "g_ref"):
|
||||
self.__g_ref = child
|
||||
|
||||
def get_g_ref(self):
|
||||
return G_ref(self.__g_ref)
|
||||
|
||||
def get_name(self):
|
||||
return self.__name.text
|
||||
|
||||
def set_name(self, text):
|
||||
self.__name.text = text
|
||||
|
||||
def get_owner(self):
|
||||
return self.__owner.text
|
||||
|
||||
def set_owner(self, text):
|
||||
self.__owner.text = text
|
||||
|
||||
def get_owner_id(self):
|
||||
return self.__owner_id.text
|
||||
|
||||
def set_owner_id(self, text):
|
||||
self.__owner_id.text = text
|
||||
|
||||
def get_date(self):
|
||||
return DT.datetime.fromtimestamp(int(self.__date.text))
|
||||
|
||||
def set_date(self, date):
|
||||
self.__date.text = str(int(date.timestamp()))
|
||||
|
||||
def get_version(self):
|
||||
return self.__version.text
|
||||
|
||||
def set_version(self, text):
|
||||
self.__version.text = text
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
class Simulation:
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "max_thread"):
|
||||
self.__max_thread = child
|
||||
if(child.tag == "max_cycles"):
|
||||
self.__max_cycles = child
|
||||
|
||||
def get_max_thread(self):
|
||||
return int(self.__max_thread.text)
|
||||
|
||||
def set_max_thread(self, value):
|
||||
if(not isinstance(value, int)):
|
||||
print("max_thread must be an int")
|
||||
return
|
||||
self.__max_thread.text = str(value)
|
||||
|
||||
def get_max_cycles(self):
|
||||
return int(self.__max_cycles.text)
|
||||
|
||||
def set_max_cycles(self, value):
|
||||
if(not isinstance(value, int)):
|
||||
print("max_cycles must be an int")
|
||||
return
|
||||
self.__max_cycles.text = str(value)
|
||||
|
||||
|
||||
class Spaceparam:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "dimension"):
|
||||
self.__dimension = Dimension(child)
|
||||
if(child.tag == "site_multiplicity"):
|
||||
self.__site_multiplicity = child
|
||||
|
||||
def get_site_multiplicity(self):
|
||||
return self.__site_multiplicity.text
|
||||
|
||||
def set_site_multiplicity(self, value):
|
||||
self.__site_multiplicity.text = str(value)
|
||||
|
||||
def get_dimension(self):
|
||||
return self.__dimension
|
||||
|
||||
def set_dimension(self, value):
|
||||
self.__dimension = str(value) # TODO Assert
|
||||
|
||||
|
||||
class Axis:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
||||
def get_name(self):
|
||||
return self.node.attrib["name"]
|
||||
|
||||
def set_name(self, value):
|
||||
pass # TODO (The user can create a complete model from scratch.)
|
||||
|
||||
def get_size(self):
|
||||
return int(self.node.attrib["size"])
|
||||
|
||||
def set_size(self, value):
|
||||
pass # TODO (The user can create a complete model from scratch.)
|
||||
|
||||
|
||||
class Dimension:
|
||||
__axis = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
||||
def get_x(self):
|
||||
return int(self.node.get("x"))
|
||||
|
||||
def set_x(self, value):
|
||||
self.node.attrib["x"] = value # TODO Assert
|
||||
|
||||
def get_y(self):
|
||||
return int(self.node.get("y"))
|
||||
|
||||
def set_y(self, value):
|
||||
pass
|
||||
|
||||
# TODO z, u, v, w,...
|
||||
|
||||
|
||||
class Parameters:
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "simulation"):
|
||||
self.simulation = Simulation(child)
|
||||
if(child.tag == "space-param"):
|
||||
self.spaceparam = Spaceparam(child)
|
||||
|
||||
def get_id(self):
|
||||
return self.node.attrib["id"]
|
||||
|
||||
def set_id(self, text):
|
||||
self.node.attrib["id"] = text
|
||||
|
||||
def get_author(self):
|
||||
return self.node.attrib["author"]
|
||||
|
||||
def set_author(self, text):
|
||||
self.node.attrib["author"] = text
|
||||
|
||||
def get_date(self):
|
||||
return self.node.attrib["date"]
|
||||
|
||||
def set_date(self, text):
|
||||
self.node.attrib["date"] = text
|
||||
|
||||
## Objects
|
||||
|
||||
|
||||
class Object:
|
||||
|
||||
__arrows = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "arrow"):
|
||||
self.__arrows.append(Arrow(child))
|
||||
|
||||
def get_arrow(self, i):
|
||||
return self.__arrows[i]
|
||||
|
||||
def set_arrow(self, i, value):
|
||||
self.__arrows[i] = value # TODO Assert
|
||||
|
||||
|
||||
class Objects:
|
||||
__objects = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "object"):
|
||||
self.__objects.append(Object(child))
|
||||
|
||||
def get_object(self, i):
|
||||
return self.__objects[i]
|
||||
|
||||
def set_object(self, i, Object):
|
||||
self.__objects[i] = Object # TODO Assert
|
||||
|
||||
|
||||
## States
|
||||
|
||||
|
||||
class Space:
|
||||
__arrows = []
|
||||
nb_occupied_sites = 0
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "arrow"):
|
||||
self.nb_occupied_sites += 1
|
||||
self.__arrows.append(Arrow(child))
|
||||
|
||||
def get_arrow(self, i):
|
||||
return self.__arrows[i]
|
||||
|
||||
def get_nb_occupied_sites(self):
|
||||
return self.nb_occupied_sites
|
||||
|
||||
def get_weight(self, cell, site):
|
||||
return 4096
|
||||
|
||||
|
||||
class States:
|
||||
__space = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "space"):
|
||||
self.__space.append(Space(child))
|
||||
|
||||
def get_space(self, i):
|
||||
return self.__space[i]
|
||||
|
||||
|
||||
## Conditions Tree
|
||||
|
||||
class TreeNode(object):
|
||||
|
||||
def __init__(self, id, parent, x, site, weight):
|
||||
self.id = id
|
||||
self.parent = parent
|
||||
self.ch = []
|
||||
self.x = x
|
||||
# TODO self.y = y,...
|
||||
self.site = site
|
||||
self.weight = weight
|
||||
|
||||
def id(self):
|
||||
return id
|
||||
|
||||
def add_child(self, ch_id):
|
||||
self.ch.append(ch_id)
|
||||
self.ch = sorted(self.ch, key=id)
|
||||
|
||||
|
||||
## Conditions
|
||||
|
||||
|
||||
class Condition:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
||||
def get_coord(self, axis):
|
||||
# print(self.node.get(axis))
|
||||
return int(self. node.get(axis))
|
||||
|
||||
def set_coord(self, axis, value):
|
||||
self.node.attrib[axis] = str(value)
|
||||
|
||||
def get_site(self):
|
||||
return int(self.node.get("site"))
|
||||
|
||||
def set_site(self, site):
|
||||
self.node.attrib["site"] = str(site)
|
||||
|
||||
def get_weight(self):
|
||||
return int(self.node.get("weight"))
|
||||
|
||||
def set_weight(self, weight):
|
||||
self.node.attrib["weight"] = str(weight)
|
||||
|
||||
def get_self_id(self):
|
||||
return int(self.node.get("node_id"))
|
||||
|
||||
def set_self_id(self, node_id):
|
||||
self.node.attrib["node_id"] = str(node_id)
|
||||
|
||||
def get_parent_id(self):
|
||||
return int(self.node.get("parent"))
|
||||
|
||||
def set_parent_id(self, parent):
|
||||
self.node.attrib["parent"] = str(parent)
|
||||
|
||||
|
||||
class Conditions:
|
||||
__conditions = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "condition"):
|
||||
self.__conditions.append(Condition(child))
|
||||
|
||||
def get_one(self, i):
|
||||
return self.__conditions[i]
|
||||
|
||||
def get_all(self):
|
||||
return self.__conditions
|
||||
|
||||
|
||||
class Transition:
|
||||
__arrows = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "arrow"):
|
||||
self.__arrows.append(Arrow(child))
|
||||
|
||||
def get_id(self):
|
||||
return self.node.attrib["id"]
|
||||
|
||||
def get_date(self):
|
||||
return self.node.attrib["date"]
|
||||
|
||||
def get_author(self):
|
||||
return self.node.attrib["author"]
|
||||
|
||||
def get_parent_id(self):
|
||||
return self.node.attrib["parent"]
|
||||
|
||||
def get_probability(self):
|
||||
return self.node.attrib["probability"]
|
||||
|
||||
def get_arrow(self, i):
|
||||
return self.__arrows[i]
|
||||
|
||||
|
||||
class Transitions:
|
||||
__transitions = []
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
for child in node:
|
||||
if(child.tag == "transition"):
|
||||
self.__transitions.append(Transition(child))
|
||||
|
||||
def get_one(self, i):
|
||||
return self.__transitions[i]
|
||||
|
||||
def get_all(self):
|
||||
return self.__transitions
|
||||
|
||||
|
||||
## Model
|
||||
|
||||
|
||||
class Arrow:
|
||||
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
||||
def get_coord(self, axis):
|
||||
return int(self.node.get(axis))
|
||||
|
||||
def set_coord(self, axis, value):
|
||||
self.node.attrib[axis] = str(value)
|
||||
|
||||
def get_site(self):
|
||||
return int(self.node.get("site"))
|
||||
|
||||
def set_site(self, site):
|
||||
self.node.attrib["site"] = str(site)
|
||||
|
||||
def get_weight(self):
|
||||
return int(self.node.get("weight"))
|
||||
|
||||
def set_weight(self, weight):
|
||||
self.node.attrib["weight"] = str(weight)
|
||||
|
||||
|
||||
class Model:
|
||||
|
||||
def __init__(self, modelpath, schemapath):
|
||||
schema = etree.parse(schemapath)
|
||||
xmlschema = etree.XMLSchema(schema)
|
||||
self.parser = etree.XMLParser(
|
||||
remove_blank_text=True,
|
||||
remove_pis=True,
|
||||
compact=True,
|
||||
schema=xmlschema)
|
||||
self.tree = etree.parse(modelpath, self.parser)
|
||||
self.node = self.tree.getroot()
|
||||
self.create_all_leaves()
|
||||
|
||||
def create_all_leaves(self):
|
||||
for child in self.node:
|
||||
if(isinstance(child.tag, str)):
|
||||
if(child.tag == "identity"):
|
||||
self.__identity = child
|
||||
if(child.tag == "parameters"):
|
||||
self.__parameters = child
|
||||
if(child.tag == "objects"):
|
||||
self.__objects = child
|
||||
if(child.tag == "states"):
|
||||
self.__states = child
|
||||
if(child.tag == "conditions"):
|
||||
self.__conditions = child
|
||||
if(child.tag == "transitions"):
|
||||
self.__transitions = child
|
||||
|
||||
def get_space(self, space_id, x_val, site_val):
|
||||
pass
|
||||
# return testmodel.get_states().get_space(space_id).
|
||||
# get_weight(x_val, site_val)
|
||||
|
||||
def get_identity(self):
|
||||
return Identity(self.__identity)
|
||||
|
||||
def get_parameters(self):
|
||||
return Parameters(self.__parameters)
|
||||
|
||||
def get_objects(self):
|
||||
return Objects(self.__objects)
|
||||
|
||||
def get_states(self):
|
||||
return States(self.__states)
|
||||
|
||||
def get_tree(self):
|
||||
return self.tree
|
||||
|
||||
def get_conditions(self):
|
||||
return Conditions(self.__conditions)
|
||||
|
||||
def get_transitions(self):
|
||||
return Transitions(self.__transitions)
|
||||
|
||||
def save_as(self, name):
|
||||
self.tree.write("../models/" + name + ".xml", encoding="utf-8")
|
||||
|
||||
|
||||
testmodel = Model(files_addr.modelPath, files_addr.schemaPath)
|
|
@ -0,0 +1,18 @@
|
|||
# https://evolution.genetics.washington.edu/phylip/newicktree.html
|
||||
# import io
|
||||
import newick
|
||||
# from newick import loads
|
||||
|
||||
tree = newick.loads('(b,(c,(d,(e,(f,g))h)i)a)')[0]
|
||||
|
||||
print(tree.ascii_art())
|
||||
'''
|
||||
from newick import loads
|
||||
|
||||
newick.loads('[a comment](a,b)c;', strip_comments=True)[0].newick '(a,b)c'
|
||||
|
||||
with io.open('../models/newick_first', encoding='utf8') as fp:
|
||||
trees = loads(fp)
|
||||
print(tree.ascii_art())
|
||||
print(trees[0].name, [n.name for n in trees[0].descendants])
|
||||
'''
|
|
@ -0,0 +1,69 @@
|
|||
from anytree import NodeMixin, LevelOrderIter, RenderTree
|
||||
import model
|
||||
|
||||
|
||||
# TODO Contrôles de cohérence des données
|
||||
# 1) node_id <> pas de doublons
|
||||
# 2) tout node doit avoir un node_parent_id (assess 'is_node' ?)
|
||||
# Process
|
||||
# 1) lors de l'adoption, le parent doit être une feuille et exister
|
||||
|
||||
|
||||
class TreeNode(NodeMixin):
|
||||
def __init__(self, id, parent_id, weight, site, x, y, z):
|
||||
super(TreeNode, self).__init__()
|
||||
self.id = id
|
||||
self.enonce = str(id)
|
||||
self.parent_id = parent_id
|
||||
self.parent = None
|
||||
self.weight = weight
|
||||
self.site = site
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
|
||||
def is_adopted_by(self, parent_node):
|
||||
self.parent = parent_node
|
||||
# print('orphan node ', self.id, ' is adopted by node ', parent_node.id)
|
||||
|
||||
|
||||
conditions_set = set()
|
||||
transitions_set = set()
|
||||
root = None
|
||||
|
||||
for i in range(0, len(model.testmodel.get_conditions().get_all())):
|
||||
condition = model.testmodel.get_conditions().get_one(i)
|
||||
tmp = TreeNode(condition.get_self_id(),
|
||||
condition.get_parent_id(),
|
||||
condition.get_weight(),
|
||||
condition.get_site(),
|
||||
condition.get_coord("x"),
|
||||
None, None)
|
||||
conditions_set.add(tmp)
|
||||
if tmp.parent_id == 0:
|
||||
root = tmp
|
||||
|
||||
for i in range(0, len(model.testmodel.get_transitions().get_all())):
|
||||
transition = model.testmodel.get_transitions().get_one(i)
|
||||
transitions_set.add(TreeNode(
|
||||
transition.get_id(),
|
||||
transition.get_parent_id(),
|
||||
None, None, None, None, None))
|
||||
|
||||
for i in conditions_set:
|
||||
for j in conditions_set:
|
||||
if (i != j) & (i.parent_id == j.id):
|
||||
i.is_adopted_by(j)
|
||||
|
||||
for condition_node in LevelOrderIter(root):
|
||||
if condition_node.is_leaf:
|
||||
for transition_node in transitions_set:
|
||||
if str(condition_node.id) == transition_node.parent_id:
|
||||
transition_node.is_adopted_by(condition_node)
|
||||
|
||||
|
||||
## get the tree
|
||||
|
||||
|
||||
def get_tree():
|
||||
return root
|
|
@ -0,0 +1,7 @@
|
|||
uniform vec2 resolution;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(gl_FragCoord.x / resolution.x,1,1,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
void main()
|
||||
{
|
||||
gl_Position = ftransform();
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
"""
|
||||
STRUCTURES DE DONNÉES
|
||||
|
||||
1) STOCKAGE
|
||||
--------
|
||||
- XML
|
||||
Chaque espace est stocké sous forme d'une séquence d'arrows.
|
||||
Chaque arrow associe
|
||||
- les coordonnées d'une cellule,
|
||||
- le n° d'un site, et
|
||||
- un 'poids', égal au nombre de flèches présentes dans ce site.
|
||||
|
||||
Seuls les sites contenant des flèches sont mentionnés dans cette séquence.
|
||||
Par convention, les autres sites sont supposés vides.
|
||||
|
||||
2) TRAVAIL
|
||||
-------
|
||||
- si la taille de l'espace est constante,
|
||||
et le nombre maximal de flèches par site peu élevé,
|
||||
alors, l'espace peut être représenté par une string
|
||||
sinon par une liste.
|
||||
|
||||
- Le but de ces structure est:
|
||||
* la visualisation (lors de l'exécution des transitions et des undo/redo).
|
||||
* l'édition de l'espace.
|
||||
|
||||
DISCUSSION
|
||||
|
||||
Les éléments d'interêt pour le moteur graphique
|
||||
sont dans le tableau des sites contenant des flèches.
|
||||
Ce tableau est créé par lxml lors de la lecture (parsing) du fichier XML.
|
||||
Il est lu / écrit par des fonctions en C
|
||||
qui peuvent aller d'une case à l'autre par de simples additions.
|
||||
|
||||
Cependant, ce tableau ne répertorie que les sites occupés.
|
||||
Pour qu'il puisse être accédé rapidement, il faut l'indexer.
|
||||
|
||||
Puis, pour construire une image, il faut calculer la localisation de
|
||||
chaque point occupé de l'image à partir des coordonnées de chaque site occupé.
|
||||
NB Les sites non mentionnés dans ce tableau sont supposés vides.
|
||||
|
||||
---
|
||||
|
||||
Dans le cas d'un espace de taille constante (cas le plus fréquent),
|
||||
un tableau de tout l'espace (et pas seulement des sites occupés) permettrait
|
||||
d'accéder au contenu de chaque site en une seule étape, par un calcul simple
|
||||
identique à celui effectué pour produire l'image.
|
||||
|
||||
Cette représentation pourrait améliorer la lisibilité des algorithmes d'édition.
|
||||
NB Lors de l'édition, aucune optimisation graphique n'est nécessaire.
|
||||
|
||||
|
||||
Si un deuxième tableau est utilisé,
|
||||
alors, des recopies périodiques dans le tableau lxml seront nécessaires.
|
||||
|
||||
"""
|
||||
|
||||
import model
|
||||
|
||||
sp = model.testmodel.get_states().get_space(0)
|
||||
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
|
||||
sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
|
||||
occupied = int(model.testmodel.get_states().get_space(0).nb_occupied_sites)
|
||||
|
||||
|
||||
print("\nspace size =", size, " nb de sites par cellule =", sites,
|
||||
" nb de sites occupés dans l'ensemble de l' l'espace =",
|
||||
occupied, end='\n')
|
||||
|
||||
view = ' | '
|
||||
|
||||
# TODO Contrôles de cohérence des données
|
||||
# condition et arrow
|
||||
# 1) weight < weight_max (à définir)
|
||||
# 2) arrow.site < site_multiplicity
|
||||
# 3) arrow.x < space-param.dimension.x (idem autres axes)
|
||||
# condition
|
||||
# 1) parent <= condition.node_id max value (donc deux lectures)
|
||||
# 2) pas de node sans un node_parent_id
|
||||
|
||||
|
||||
coord = ' ' * sites + ' '
|
||||
|
||||
for n in range(0, size + 1):
|
||||
for s in range(0, sites):
|
||||
arr = 0
|
||||
for a in range(0, occupied):
|
||||
if (
|
||||
sp.get_arrow(a).get_coord("x") == n
|
||||
and sp.get_arrow(a).get_site() == s
|
||||
):
|
||||
arr = sp.get_arrow(a).get_weight()
|
||||
if arr > 0:
|
||||
view += str(arr) + ' '
|
||||
else:
|
||||
view += '. '
|
||||
|
||||
view += ' | '
|
||||
|
||||
if n < 10:
|
||||
coord += str(n) + ' ' + ' ' * sites * 2
|
||||
else:
|
||||
coord += str(n) + ' ' + ' ' * sites * 2
|
||||
|
||||
print(view)
|
||||
print(coord)
|
|
@ -0,0 +1,29 @@
|
|||
from anytree import RenderTree
|
||||
import rules_tree
|
||||
|
||||
tree = rules_tree.get_tree()
|
||||
|
||||
any_node = tree.children[1].children[0]
|
||||
print('\nproperties of node: ', any_node.id)
|
||||
print('type: ', type(any_node))
|
||||
print('len(path): ', len(any_node.path))
|
||||
print('nb children: ', len(any_node.children))
|
||||
# print('descendants[0]: ', any_node.descendants[0])
|
||||
print('depth ', any_node.depth)
|
||||
print('is_leaf ', any_node.is_leaf)
|
||||
print('is_root ', any_node.is_root)
|
||||
print('height ', any_node.height)
|
||||
print('parent ', any_node.parent)
|
||||
print('nb ancestors ', len(any_node.ancestors))
|
||||
print('nb anchestors ', len(any_node.anchestors))
|
||||
print('siblings ', any_node.siblings)
|
||||
print('nb (subtree.leaves) ', len(any_node.leaves), '\n')
|
||||
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
if node.path[len(node.path) - 1].is_leaf:
|
||||
print('at depth', len(node.path),
|
||||
'is rule', node.path[len(node.path) - 1].parent_id,
|
||||
'whose path (tracked by conditions weights) is:', end=' ')
|
||||
for i in range(0, len(node.path) - 1):
|
||||
print(node.path[i].weight, ',', end='')
|
||||
print(' transition is:', node.path[len(node.path) - 1].id)
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
# from ete2 import Tree
|
||||
from anytree import RenderTree
|
||||
import rules_tree
|
||||
|
||||
tree = rules_tree.get_tree()
|
||||
|
||||
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
treestr = u"%s%s" % (pre, node.id)
|
||||
print(treestr.ljust(0))
|
||||
'''
|
||||
any_node = tree.children[1].children[0].children[0]
|
||||
print('\nproperties of node: ', any_node.id)
|
||||
print('type: ', type(any_node))
|
||||
print('len(path): ', len(any_node.path))
|
||||
print('nb children: ', len(any_node.children))
|
||||
print('descendants[0]: ', any_node.descendants[0])
|
||||
print('depth ', any_node.depth)
|
||||
print('is_leaf ', any_node.is_leaf)
|
||||
print('is_root ', any_node.is_root)
|
||||
print('height ', any_node.height)
|
||||
print('parent ', any_node.parent)
|
||||
print('nb ancestors ', len(any_node.ancestors))
|
||||
print('nb anchestors ', len(any_node.anchestors))
|
||||
print('siblings ', any_node.siblings)
|
||||
print('nb (subtree.leaves) ', len(any_node.leaves), '\n')
|
||||
'''
|
||||
'''
|
||||
print()
|
||||
for pre, fill, node in RenderTree(tree):
|
||||
if node.path[len(node.path) - 1].is_leaf:
|
||||
print('at depth', len(node.path),
|
||||
'is rule', node.path[len(node.path) - 1].parent_id,
|
||||
'whose path (tracked by conditions weights) is:', end=' ')
|
||||
for i in range(0, len(node.path) - 1):
|
||||
print(node.path[i].weight, ',', end='')
|
||||
print(' transition is:', node.path[len(node.path) - 1].id)
|
||||
|
||||
print('\nNext step: learn how to use the Newick format.')
|
||||
# http://etetoolkit.org/docs/2.3/tutorial/tutorial_trees.html
|
||||
'''
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">button</property>
|
||||
<property name="use-action-appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,226 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<!-- This file is temporary and meant to test graphic features -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkWindow" id="GemGraphMainWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">False</property>
|
||||
<property name="vexpand">False</property>
|
||||
<property name="window-position">center</property>
|
||||
<property name="default-width">1000</property> <!-- 1400 -->
|
||||
<property name="default-height">500</property>
|
||||
<property name="gravity">static</property>
|
||||
<property name="has-resize-grip">True</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">tout ce qui est sous la 'header bar'</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">Image 1D + contrôles</property>
|
||||
<property name="height-request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="height-request">60</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">1</property>
|
||||
<property name="margin-end">1</property>
|
||||
<property name="margin-top">1</property>
|
||||
<property name="margin-bottom">1</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixbuf">espace 1D projet.jpg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="height-request">32</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Zoom</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Filtres</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Apparences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">tout ce qui est sous l'image 1D et ses contrôles</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="Id_Transitions">
|
||||
<property name="label" translatable="yes">transitions </property>
|
||||
<property name="width-request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">objets</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="can-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Salut ! Je suis la nouvelle barre de commandes.</property>
|
||||
<property name="title" translatable="yes">Gem-graph</property>
|
||||
<property name="has-subtitle">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">utilisateur (préférences)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="mon_bouton">
|
||||
<property name="label" translatable="yes">modèle (load / save)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="toggled" handler="tilt" object="__glade_Hi" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">états / transitions</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">monitoring et contrôles / éditions</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,226 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<!-- This file is temporary and meant to test graphic features -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">False</property>
|
||||
<property name="vexpand">False</property>
|
||||
<property name="window-position">center</property>
|
||||
<property name="default-width">1860</property>
|
||||
<property name="default-height">160</property>
|
||||
<property name="gravity">static</property>
|
||||
<property name="has-resize-grip">True</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">tout ce qui est sous la 'header bar'</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">Image 1D + contrôles</property>
|
||||
<property name="height-request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="height-request">60</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">1</property>
|
||||
<property name="margin-end">1</property>
|
||||
<property name="margin-top">1</property>
|
||||
<property name="margin-bottom">1</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixbuf">espace 1D projet.jpg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="height-request">32</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Zoom</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Filtres</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Apparences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="name">tout ce qui est sous l'image 1D et ses contrôles</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">transitions </property>
|
||||
<property name="width-request">700</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">objets</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="can-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Salut ! Je suis la nouvelle barre de commandes.</property>
|
||||
<property name="title" translatable="yes">Gem-graph</property>
|
||||
<property name="has-subtitle">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">utilisateur (préférences)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="mon_bouton">
|
||||
<property name="label" translatable="yes">modèle (load / save)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<signal name="toggled" handler="tilt" object="__glade_Hi" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">états / transitions</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">monitoring et contrôles / éditions</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root version="0.2.1">
|
||||
<p rank="0" id="0" pp="0">condition 0 = ROOT</p>
|
||||
<p rank="0" id="1" pp="0">condition 1</p>
|
||||
<p rank="0" id="2" pp="1">condition 2</p>
|
||||
<p rank="1" id="3" pp="1">condition 3</p>
|
||||
<p rank="0" id="E" pp="2">move_a_dimer_to_east</p>
|
||||
<p rank="0" id="W" pp="3">move_a_dimer_to_west</p>
|
||||
</root>
|
Loading…
Reference in New Issue