In order to unify the theme for MEDM screens, I'll have to make many combinations of rectangles, polygons, and invisible related-screen buttons.
Everytime I change the size of the block, I have to modify the size of this combination. It is impossile for me.
So, I made a script to replace a certain type of rectangles with a combination of the objects with the same (or related) size.
The script is here (so far)
/opt/rtcds/caltech/c1/medm/c1lsc/master/generateLSCscreen/rect_replace.py
Usage:
cat C1LSC_OVERVIEW_ADC.adl | ./rect_replace.py > tmp.adl
Description:
The script takes stdin and spits the result to stdout. It parses a given ADL file. When a "rectangle" object
with Channel A with a string "REPLACE_XXXX", it replaces it with the objects predefined as "XXXX".
So far, there is only "TYPE1" for the predefinition. It actually takes another argument to specify the
path of the related screen to open when the block is clicked. The path should be filled in "Channel B"
slot of the original rectangle. (See Attachment 1)
The "TYPE1" style has the function calls as indicated below. place_rect is to place a rectangle object. You can
specify the filling method and color. place_rel_disp is to place an invisible button with the link to the specified
path by strOpt. place_polygon places a polygon. The cordinate array for the polygon is described with
the relative positions from the specified position.
place_rect(rect_x-4, rect_y-4, rect_w+7, rect_h+7, "outline", 0) # outline white box
place_rel_disp(rect_x, rect_y, rect_w, rect_h, strOpt, 0, 14) # invisible button
place_rect(rect_x, rect_y, rect_w, rect_h, "fill", 3) # main gray box
place_rect(rect_x+3, rect_y, rect_w-6, 3, "fill", 0) # top white rim
place_rect(rect_x, rect_y, 3, rect_h-3, "fill", 0) # left white rim
place_rect(rect_x+rect_w-3 , rect_y, 3, rect_h, "fill", 10) # right gray rim
place_rect(rect_x, rect_y+rect_h-3, rect_w-3, 3, "fill", 10) # bottom gray rim
place_polygon(rect_x+rect_w-3,rect_y,3,3, "fill", 0, [[0,0],[2,0],[0,2],[0,0]]) # top-right white triangle
place_polygon(rect_x,rect_y+rect_h-3,3,3, "fill", 0, [[0,0],[2,0],[0,2],[0,0]]) # bottom-left white triangle
|