Warning: session_start(): open(/var/lib/php/sessions/sess_5akv1udvcn91lanebem70jjep2, 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, uniquifyValues(pairsToMultiMap(reversePairs(chessPieceImagesFromAGIBlue(lightSquares)))));
rst.trigger();
}
void update {
if (is == null) ret;
scp.setComponent(centerAndSouthWithMargin(jScroll_center(is), lblCount));
L images = map loadImage2(mapGet(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..."))));
}
}