In [ ]:
from beakerx import *
from beakerx.object import beakerx
mapList = [
{"a":1, "b":2, "c":3},
{"a":4, "b":5, "c":6},
{"a":7, "b":8, "c":5}
]
display1 = TableDisplay(mapList)
def plusOne(row, column, tabledisplay):
tabledisplay.values[row][column] = int(tabledisplay.values[row][column]) + 1
display1.addContextMenuItem("plusOne", plusOne)
display1.addContextMenuItem("tag1ByStr", "tag1");
display1
In [ ]:
details = display1.details
print(str(details.row) + ':' + str(details.col) + '=' + str(display1.values[details.row][details.col]))
In [ ]:
%%groovy
// cell1 expected result
Image("../../resources/img/python/tableActions/cell1_case1.png")
In [ ]:
%%groovy
// cell1 expected result after menu action
Image("../../resources/img/python/tableActions/cell1_case2.png")
In [ ]:
display1a = TableDisplay(mapList)
def runTagFunc(row, column, tabledisplay):
beakerx.runByTag("tag1a")
display1a.addContextMenuItem("runTagFunc", runTagFunc)
display1a
In [ ]:
details = display1a.details
print(str(details.row) + ':' + str(details.col) + '=' + str(display1a.values[details.row][details.col]))
In [ ]:
display2 = TableDisplay(mapList)
def dclick(row, column, tabledisplay):
tabledisplay.values[row][column] = int(tabledisplay.values[row][column]) + 1
display2.setDoubleClickAction(dclick)
display2
In [ ]:
%%groovy
// cell2 expected result
Image("../../resources/img/python/tableActions/cell2_case1.png")
In [ ]:
%%groovy
// cell2 expected result after doubleAction click
Image("../../resources/img/python/tableActions/cell2_case2.png")
In [ ]:
display3 = TableDisplay(mapList)
display3.setDoubleClickAction("tag3")
display3
In [ ]:
details = display3.details
print(str(details.row) + ':' + str(details.col) + '=' + str(display3.values[details.row][details.col]))
In [ ]:
%%groovy
// cell3 expected result
Image("../../resources/img/python/tableActions/cell3_case1.png")
In [ ]:
from beakerx.object import beakerx
def dclick(row, column, tabledisplay):
beakerx.runByTag("tag4")
display4 = TableDisplay(mapList)
display4.setDoubleClickAction(dclick)
display4
In [ ]:
details = display4.details
print(str(details.row) + ':' + str(details.col) + '=' + str(display4.values[details.row][details.col]))
In [ ]:
%%groovy
// cell4 expected result
Image("../../resources/img/python/tableActions/cell4_case1.png")