Improves descriptor log
This commit is contained in:
@ -55,7 +55,9 @@ class MainApplication(GridFrame):
|
||||
self.slipList.update(slipnodes, key=lambda s:s.activation,
|
||||
formatter=lambda s : '{}: {}'.format(s.name, round(s.activation, 2)))
|
||||
self.codeletList.update(codelets, key=lambda c:c.urgency, formatter= lambda s : '{}: {}'.format(s.name, round(s.urgency, 2)))
|
||||
self.objectList.update(objects, formatter=lambda s : '{}'.format(', '.join(map(str, s.descriptions))))
|
||||
get_descriptors = lambda s : ', '.join('({}={})'.format(d.descriptionType.name, d.descriptor.name) for d in s.descriptions)
|
||||
self.objectList.update(objects, formatter=lambda s : '{}: {}'.format(s, get_descriptors(s)))
|
||||
'''
|
||||
if len(objects) > 0:
|
||||
print('Descriptions:')
|
||||
for obj in objects:
|
||||
@ -64,6 +66,7 @@ class MainApplication(GridFrame):
|
||||
print(' {}:'.format(description))
|
||||
print(' {}'.format(description.descriptionType.name))
|
||||
print(' {}'.format(description.descriptor.name))
|
||||
'''
|
||||
|
||||
def reset_with_strings(self, initial, modified, target):
|
||||
self.primary.reset_with_strings(initial, modified, target)
|
||||
|
||||
@ -3,7 +3,7 @@ import tkinter.ttk as ttk
|
||||
|
||||
from .gridframe import GridFrame
|
||||
|
||||
font1Size = 16
|
||||
font1Size = 32
|
||||
font1 = ('Helvetica', font1Size)
|
||||
|
||||
class WorkspaceCanvas(GridFrame):
|
||||
@ -11,6 +11,8 @@ class WorkspaceCanvas(GridFrame):
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
GridFrame.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.chars = []
|
||||
|
||||
self.initial = ''
|
||||
self.modified = ''
|
||||
self.target = ''
|
||||
@ -20,6 +22,7 @@ class WorkspaceCanvas(GridFrame):
|
||||
|
||||
self.canvas = tk.Canvas(self, background='black')
|
||||
self.add(self.canvas, 0, 0)
|
||||
|
||||
GridFrame.configure(self)
|
||||
|
||||
def update(self, copycat):
|
||||
@ -29,6 +32,7 @@ class WorkspaceCanvas(GridFrame):
|
||||
|
||||
if self.changed:
|
||||
self.canvas.delete('all')
|
||||
del self.chars[:]
|
||||
self.add_text()
|
||||
|
||||
def add_text(self):
|
||||
@ -40,6 +44,7 @@ class WorkspaceCanvas(GridFrame):
|
||||
if sequence is None:
|
||||
sequence = ''
|
||||
for char in sequence:
|
||||
self.chars.append((char, (x, y)))
|
||||
self.canvas.create_text(x, y, text=char, anchor=tk.NW, font=font1, fill='white')
|
||||
x += font1Size
|
||||
return x, y
|
||||
|
||||
Reference in New Issue
Block a user