
| Current Path : /home/ift/52_procpy/dataninja/test/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //home/ift/52_procpy/dataninja/test/graphproc.py |
# coding: utf8
import os,re,sys
import procpy
import procpy.graphproc
import procpy.storeproc
import sqlite3
try:
import tkinter
except:
pip.main(["install","tkinter"])
#**************************************************************************
class dict2obj(object):
def __init__(self, d):
self.__dict__ = d
class Graphproc (object):
def __init__ (self,*pars):
self.__class__.__dict__[pars[0]](self,pars[1:])
#**************************************************************************
def test (self,*pars):
app = tkinter.Tk()
try:
os.unlink("test1.db")
except:
pass
dbh = sqlite3.connect("test1.db")
dbh.row_factory = sqlite3.Row
dbh.execute("create table entries " +
"(OBJID text unique," +
"____LOCKED____ text default 0," +
"____REPEAT____ text default 1," +
"____CHILDS____ text default NULL," +
"____PARENT____ text default NULL," +
"____LEVEL____ text default 0," +
"SLEEP text default NULL," +
"PRODUCTION text default ''," +
"STARTTIME text default 0," +
"DURATION text default 0," +
"JUMP text default NULL)" )
dbh.execute("create index OBJID_IDX on entries (OBJID)")
dbh.execute("create index ____LOCKED_____IDX on entries (____LOCKED____)")
dbh.execute("create index ____PARENT_____IDX on entries (____PARENT____)")
dbh.execute("create index ____LEVEL_____IDX on entries (____LEVEL____)")
dbh.execute("create index PRODUCTION_IDX on entries (PRODUCTION)")
dbh.commit()
dbtable = "entries"
anw = procpy.graphproc.Graphproc(procpy.storeproc.Storeproc(app=app,
dbh=dbh,dbtable=dbtable),width=2000, height=1500)
anw.config(classname="GraphModel123")
anw.storeproc.notifier = anw
anw.pack(expand=tkinter.TRUE,fill=tkinter.BOTH)
app.bind("<Delete>",anw.graphmodel.delete_highlighted_element)
app.bind("<Escape>",anw.graphmodel.unhighlight_block)
app.mainloop()
#**************************************************************************
def autotest (self,*pars):
app = tkinter.Tk()
anwendung = procpy.graphproc.Graphproc(procpy.storeproc.Storeproc(app=app),width=1200,height=850)
anwendung.pack(expand=tkinter.TRUE,fill=tkinter.BOTH)
anwendung.event_generate("<Button-1>",x=100, y=100)
anwendung.event_generate("<ButtonRelease-1>",x=100, y=100)
# anwendung.event_generate("<B1-Motion>",x=100, y=100)
anwendung.event_generate("<Button-1>",x=100, y=100)
anwendung.event_generate("<ButtonRelease-1>",x=100, y=100)
# d = {'x': 50, 'y': 100}
# bl = dict2obj(d)
# anwendung.graphmodel.create_block_event(bl)
# print dir(anwendung.graphmodel.blocks[0])
# d = {'x': 27, 'y': 15, 'x_root': 566, 'y_root': 133}
# bl = dict2obj(d)
# procpy.block.Block(anwendung.graphmodel.blocks[0].canvas,anwendung.graphmodel.blocks[0].bbox).press_button_event(bl)
# i = procpy.block.Block('','')
# be(1,bl)
app.mainloop()
#**************************************************************************
if __name__ == "__main__":
Graphproc(*tuple(sys.argv[1:]))