Esempio n. 1
0
File: ivy_ui.py Progetto: ZZHGit/ivy
 def add(self, art, name=None, label=None):
     self.tab_counter += 1
     self.tabs += 1
     if name == None:
         name = "sheet_{}".format(self.tab_counter)
     if label == None:
         label = "Sheet {}".format(self.tab_counter)
     tk = self.tk
     nb = self.notebook
     if not hasattr(art, 'state_graphs'):
         art.state_graphs = []
     tab = nb.add(name, label=label)
     pw = Tix.PanedWindow(tab, orientation='horizontal')
     pw.pack(fill=BOTH, expand=1)
     frame = pw.add('f1')
     state_frame = pw.add('f2')
     hbar = Scrollbar(frame, orient=HORIZONTAL)
     hbar.pack(side=BOTTOM, fill=X)
     vbar = Scrollbar(frame, orient=VERTICAL)
     vbar.pack(side=RIGHT, fill=Y)
     gw = AnalysisGraphWidget(tk, art, frame)
     gw.state_frame = state_frame
     gw.ui_parent = self
     gw.ui_tab_name = name
     hbar.config(command=gw.xview)
     vbar.config(command=gw.yview)
     gw.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
     for sg in art.state_graphs:
         ivy_graph_ui.show_graph(sg, tk, parent=gw, frame=state_frame)
     nb.raise_page(name)
Esempio n. 2
0
 def do_try_remembered_graph(self,node,T,dlg,names):
     sel = map(int, T.curselection())
     dlg.destroy()
     if sel:
         sg = self.remembered_graphs[names[sel[0]]].copy()
         sg.parent_state = node
         sg.set_state(and_clauses(node.clauses,sg.constraints))
         self.g.state_graphs.append(sg)
         ivy_graph_ui.show_graph(sg,self.tk,parent=self)
Esempio n. 3
0
 def do_try_conjecture(self,node,T,dlg,udc):
     sel = map(int, T.curselection())
     if sel:
         conj = udc[sel[0]]
         print "type(conj) = {}".format(type(conj))
         dual = dual_clauses(conj)
         sg = self.g.concept_graph(node)
         sg.add_constraints(dual.clauses)
         ivy_graph_ui.show_graph(sg,self.tk,parent=self)
     dlg.destroy()
Esempio n. 4
0
def ui_create(art,tk,frame):
    if not hasattr(art,'state_graphs'):
        art.state_graphs = []
    hbar=Scrollbar(frame,orient=HORIZONTAL)
    hbar.pack(side=BOTTOM,fill=X)
    vbar=Scrollbar(frame,orient=VERTICAL)
    vbar.pack(side=RIGHT,fill=Y)
    gw = AnalysisGraphWidget(tk,art,frame)
    hbar.config(command=gw.xview)
    vbar.config(command=gw.yview)
    gw.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
    for sg in art.state_graphs:
        ivy_graph_ui.show_graph(sg,tk,parent=gw)
Esempio n. 5
0
def ui_create(art, tk, frame):
    if not hasattr(art, 'state_graphs'):
        art.state_graphs = []
    hbar = Scrollbar(frame, orient=HORIZONTAL)
    hbar.pack(side=BOTTOM, fill=X)
    vbar = Scrollbar(frame, orient=VERTICAL)
    vbar.pack(side=RIGHT, fill=Y)
    gw = AnalysisGraphWidget(tk, art, frame)
    hbar.config(command=gw.xview)
    vbar.config(command=gw.yview)
    gw.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
    for sg in art.state_graphs:
        ivy_graph_ui.show_graph(sg, tk, parent=gw)
Esempio n. 6
0
 def view_state(self,n,clauses):
     print "state: {}".format(clauses)
     if hasattr(self,'current_concept_graph') and self.current_concept_graph.winfo_exists():
         self.current_concept_graph.set_parent_state(n,clauses)
         return
     sg = self.g.concept_graph(n,clauses)
     self.current_concept_graph = ivy_graph_ui.show_graph(sg,self.tk,parent=self)
Esempio n. 7
0
File: ivy_ui.py Progetto: asyaf/ivy
 def view_state(self, n, clauses):
     print "state: {}".format(clauses)
     if hasattr(self, 'current_concept_graph'
                ) and self.current_concept_graph.winfo_exists():
         self.current_concept_graph.set_parent_state(n, clauses)
         return
     sg = self.g.concept_graph(n, clauses)
     self.current_concept_graph = ivy_graph_ui.show_graph(
         sg, self.tk, parent=self, frame=self.state_frame)