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 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">
|
||||
|
||||
<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
|
||||
from anytree import RenderTree
|
||||
import rules_tree
|
||||
gi.require_version("Gtk", "3.0")
|
||||
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
|
||||
|
||||
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.add_from_file(glade_path)
|
||||
|
||||
win = builder.get_object("Appwindow")
|
||||
win
|
||||
transit = builder.get_object("Id_Transitions")
|
||||
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")
|
||||
|
||||
|
||||
modelPath = "../models/dimers random walk.xml"
|
||||
schemaPath = "../schemas/models_0.2.1.xmls"
|
||||
modelPath = "/home/jean/Gem-Graph/gem-graph-client/models/dimers random walk.xml"
|
||||
schemaPath = "/home/jean/Gem-Graph/gem-graph-client/schemas/models_0.2.1.xmls"
|
||||
|
||||
testmodel = Model(modelPath, schemaPath)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 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
|
||||
import model
|
||||
|
||||
|
@ -61,20 +61,21 @@ for condition_node in LevelOrderIter(root):
|
|||
if str(condition_node.id) == transition_node.parent_id:
|
||||
transition_node.is_adopted_by(condition_node)
|
||||
|
||||
"""
|
||||
|
||||
## print tree
|
||||
|
||||
for pre, fill, node in RenderTree(root):
|
||||
treestr = u"%s%s" % (pre, node.id)
|
||||
if type(node) == TreeNode:
|
||||
print(treestr.ljust(19), node.weight, ' arrow(s) at [site', node.site,
|
||||
'in cell', node.x, end='')
|
||||
if not node.depth == 2: # tree.depth()
|
||||
print(end=']\n')
|
||||
else:
|
||||
print('] --> ', node.children[0].id, end='\n')
|
||||
if 0:
|
||||
for pre, fill, node in RenderTree(root):
|
||||
treestr = u"%s%s" % (pre, node.id)
|
||||
if type(node) == TreeNode:
|
||||
print(treestr.ljust(19), node.weight, ' arrow(s) at [site', node.site,
|
||||
'in cell', node.x, end='')
|
||||
if not node.depth == 3: # tree.depth()
|
||||
print(end=']\n')
|
||||
else:
|
||||
print('] --> ', node.children[0].id, end='\n')
|
||||
|
||||
|
||||
"""
|
||||
## 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 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkWindow">
|
||||
<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">1400</property>
|
||||
<property name="default-height">160</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>
|
||||
|
@ -118,9 +118,9 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="Id_Transitions">
|
||||
<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="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
|
|
Loading…
Reference in New Issue