Warning: session_start(): open(/var/lib/php/sessions/sess_lrgg5lofaven1suni13loceeqp, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule PieceDatabase {
S piece = "white king";
bool lightSquares;
transient Map map = new Map;
transient SingleComponentPanel scp;
transient ImageSurface is;
transient JLabel lblCount;
transient ReliableSingleThread rst = dm_rst(module(), r update);
start-thread {
for (bool lightSquares : ll(false, true))
map.put(lightSquares, chessPieceImagesFromAGIBlue(lightSquares));
rst.trigger();
}
void update {
if (map == null || is == null) ret;
scp.setComponent(centerAndSouthWithMargin(jScroll_center(is), lblCount));
L images = map.get(lightSquares).get(replaceObject(piece, "empty square", "empty"));
is.setImage(mergeBufferedImagesHorizontally(images));
setText(lblCount, nImages(images));
}
visualize {
is = jImageSurface();
lblCount = jCenteredLabel();
ret withComputing(rst, northAndCenterWithMargins(
jline(
withLabel("Show images for:", main.onChange(rst, dm_comboBox piece(replace(ai_chessPieces(), "empty", "empty square")))),
dm_checkBox("Light squares", 'lightSquares)),
scp = singleComponentPanel(jCenteredLabel("Loading..."))));
}
}