WIP: Redémarrage Client ! (Un premier arbre dans la fenêtre)
This commit is contained in:
parent
2df3d7a4e4
commit
317487bf15
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<transition id="ba di bou bi dou whaaa..." date="1630000000" author="Ni moi !"
|
<transition id="ba di bou bi dou whaaah..." date="1630000000" author="Ni moi !"
|
||||||
parent="11" probability="1">
|
parent="11" probability="1">
|
||||||
|
|
||||||
<arrow site="1" weight="0" x="0"/>
|
<arrow site="1" weight="0" x="0"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
26
src/main.py
26
src/main.py
|
@ -21,15 +21,35 @@
|
||||||
# ------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------- #
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
from anytree import RenderTree
|
||||||
|
import rules_tree
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GObject
|
||||||
|
|
||||||
glade_path = "../ui/GLArea.glade"
|
glade_path = "/home/jean/Gem-Graph/gem-graph-client/ui/GLArea.glade"
|
||||||
|
glade_path = "/home/jean/Gem-Graph/gem-graph-client/ui/GLArea.glade"
|
||||||
|
|
||||||
## Main window
|
## Main window
|
||||||
|
|
||||||
|
tree = rules_tree.get_tree()
|
||||||
|
|
||||||
|
toto = ''
|
||||||
|
for pre, fill, node in RenderTree(tree):
|
||||||
|
treestr = u"%s%s" % (pre, node.id)
|
||||||
|
# print(treestr.ljust(0))
|
||||||
|
toto += treestr + "\n"
|
||||||
|
|
||||||
|
# print(toto)
|
||||||
|
|
||||||
builder = Gtk.Builder()
|
builder = Gtk.Builder()
|
||||||
builder.add_from_file(glade_path)
|
builder.add_from_file(glade_path)
|
||||||
|
|
||||||
win = builder.get_object("Appwindow")
|
transit = builder.get_object("Id_Transitions")
|
||||||
win
|
transit.set_label(toto)
|
||||||
|
|
||||||
|
window = builder.get_object("GemGraphMainWindow")
|
||||||
|
# window.show_all()
|
||||||
|
|
||||||
|
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/builder.html
|
||||||
|
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/objects.html
|
|
@ -490,7 +490,7 @@ class Model:
|
||||||
self.tree.write("../models/" + name + ".xml", encoding="utf-8")
|
self.tree.write("../models/" + name + ".xml", encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
modelPath = "../models/dimers random walk.xml"
|
modelPath = "/home/jean/Gem-Graph/gem-graph-client/models/dimers random walk.xml"
|
||||||
schemaPath = "../schemas/models_0.2.1.xmls"
|
schemaPath = "/home/jean/Gem-Graph/gem-graph-client/schemas/models_0.2.1.xmls"
|
||||||
|
|
||||||
testmodel = Model(modelPath, schemaPath)
|
testmodel = Model(modelPath, schemaPath)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# https://anytree.readthedocs.io/en/latest/_modules/anytree/node/nodemixin.html
|
# https://anytree.readthedocs.io/en/latest/_modules/anytree/node/nodemixin.html
|
||||||
from anytree import NodeMixin, LevelOrderIter # , RenderTree
|
from anytree import NodeMixin, LevelOrderIter, RenderTree
|
||||||
# from newick import loads
|
# from newick import loads
|
||||||
import model
|
import model
|
||||||
|
|
||||||
|
@ -61,20 +61,21 @@ for condition_node in LevelOrderIter(root):
|
||||||
if str(condition_node.id) == transition_node.parent_id:
|
if str(condition_node.id) == transition_node.parent_id:
|
||||||
transition_node.is_adopted_by(condition_node)
|
transition_node.is_adopted_by(condition_node)
|
||||||
|
|
||||||
"""
|
|
||||||
## print tree
|
## print tree
|
||||||
|
|
||||||
for pre, fill, node in RenderTree(root):
|
if 0:
|
||||||
treestr = u"%s%s" % (pre, node.id)
|
for pre, fill, node in RenderTree(root):
|
||||||
if type(node) == TreeNode:
|
treestr = u"%s%s" % (pre, node.id)
|
||||||
print(treestr.ljust(19), node.weight, ' arrow(s) at [site', node.site,
|
if type(node) == TreeNode:
|
||||||
'in cell', node.x, end='')
|
print(treestr.ljust(19), node.weight, ' arrow(s) at [site', node.site,
|
||||||
if not node.depth == 2: # tree.depth()
|
'in cell', node.x, end='')
|
||||||
print(end=']\n')
|
if not node.depth == 3: # tree.depth()
|
||||||
else:
|
print(end=']\n')
|
||||||
print('] --> ', node.children[0].id, end='\n')
|
else:
|
||||||
|
print('] --> ', node.children[0].id, end='\n')
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
## get the tree
|
## get the tree
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
|
@ -3,14 +3,14 @@
|
||||||
<!-- This file is temporary and meant to test graphic features -->
|
<!-- This file is temporary and meant to test graphic features -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.24"/>
|
<requires lib="gtk+" version="3.24"/>
|
||||||
<object class="GtkWindow">
|
<object class="GtkWindow" id="GemGraphMainWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="hexpand">False</property>
|
<property name="hexpand">False</property>
|
||||||
<property name="vexpand">False</property>
|
<property name="vexpand">False</property>
|
||||||
<property name="window-position">center</property>
|
<property name="window-position">center</property>
|
||||||
<property name="default-width">1400</property>
|
<property name="default-width">1000</property> <!-- 1400 -->
|
||||||
<property name="default-height">160</property>
|
<property name="default-height">500</property>
|
||||||
<property name="gravity">static</property>
|
<property name="gravity">static</property>
|
||||||
<property name="has-resize-grip">True</property>
|
<property name="has-resize-grip">True</property>
|
||||||
<child>
|
<child>
|
||||||
|
@ -118,9 +118,9 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton" id="Id_Transitions">
|
||||||
<property name="label" translatable="yes">transitions </property>
|
<property name="label" translatable="yes">transitions </property>
|
||||||
<property name="width-request">700</property>
|
<property name="width-request">400</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
|
|
Loading…
Reference in New Issue