update test sketch
This commit is contained in:
parent
c12f7e8f5b
commit
4826861967
26
Window.py
26
Window.py
@ -4,6 +4,10 @@ import gtk
|
||||
from Sketch import Sketch
|
||||
from SketchWidget import SketchWidget
|
||||
|
||||
from Line import Line
|
||||
from Circle import Circle
|
||||
from Connect import Connect
|
||||
|
||||
class Window:
|
||||
def __init__(self, title):
|
||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
@ -12,6 +16,28 @@ class Window:
|
||||
self.window.connect("destroy", self.destroy_event)
|
||||
|
||||
s = Sketch()
|
||||
l1 = Line(0, 1, 1, 1)
|
||||
s.shapes.append(l1)
|
||||
l2 = Line(1, 1, 1, 0)
|
||||
s.shapes.append(l2)
|
||||
l3 = Line(1, 0, 0, 0)
|
||||
s.shapes.append(l3)
|
||||
l4 = Line(0, 0, 0, 1)
|
||||
s.shapes.append(l4)
|
||||
c = Circle(0, 0, 0.3)
|
||||
s.shapes.append(c)
|
||||
|
||||
s.constraints.append(Connect(l1, 1, l2, 0))
|
||||
s.constraints.append(Connect(l2, 1, l3, 0))
|
||||
s.constraints.append(Connect(l3, 1, l4, 0))
|
||||
s.constraints.append(Connect(l4, 1, l1, 0))
|
||||
|
||||
s.constraints.append(Connect(c, 1, l2, 0))
|
||||
s.constraints.append(Connect(c, 4, l3, 1))
|
||||
|
||||
s.solve()
|
||||
|
||||
|
||||
sw = SketchWidget(s)
|
||||
self.window.add(sw.widget)
|
||||
self.window.show_all()
|
||||
|
Loading…
x
Reference in New Issue
Block a user