Exemplo n.º 1
0
# BOOT WIRING

from hexappmodel import App, Thing
from hexpersistence import PersistenceMock, PersistenceMock2

#app = App(PersistenceMock())
app = App(PersistenceMock2())

# UNIT TEST

app.Load()
print app.model

thing1 = app.GetThing(0)
app.AddInfoToThing(thing1, "once")
print app.model

app.New()
app.CreateThing("once")
app.CreateThing("upon a time")
app.Save()
print app.model

app.New()
print app.model

app.Load()
print app.model
Exemplo n.º 2
0
# HEXMVC BOOT WIRING v2 - assumes app and model in the same import module

from hexappmodel import App
from hexpersistence import PersistenceMock2
from hexserver import Server1
from hexmvcgui import MyWxApp
import wx

# Create Gui
wxapp = MyWxApp(redirect=False)
gui = wxapp.myframe  # arguably too wx based to be a true adapter, but as long
# as we call nothing wx specific, it acts as an adapter ok.
# Create Server
server = Server1(host="localhost", port=8081)

# Create Persistence
persistence = PersistenceMock2()

# Create Core Hexagon App and inject adapters
app = App(persistence, server, gui)
wx.CallAfter(app.Boot)

# Start Gui
wxapp.MainLoop()

print("DONE")