using icons on drop downs

This commit is contained in:
Peli de Halleux 2017-12-06 22:34:11 -08:00
parent ab13cb9047
commit 162e437527
10 changed files with 154 additions and 45 deletions

View File

@ -14,7 +14,10 @@
sodipodi:docname="Touch sensor.svg"
width="36.101002"
height="36.101002"
inkscape:version="0.92.1 r15371">
inkscape:version="0.92.1 r15371"
inkscape:export-filename="C:\gh\pxt-ev3\libs\core\jres\icons\touchSensor-icon.png"
inkscape:export-xdpi="319.10471"
inkscape:export-ydpi="319.10471">
<metadata
id="metadata4576">
<rdf:RDF>
@ -36,8 +39,8 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview4574"
showgrid="false"
inkscape:zoom="7.0722208"

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,6 +1,58 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1447.52 6142.536 49.96 58.928">
<defs>
<style>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="1447.52 6142.536 58.928002 58.928"
version="1.1"
id="svg6348"
sodipodi:docname="icn_port.svg"
width="58.928001"
height="58.928001"
inkscape:export-filename="C:\gh\pxt-ev3\libs\core\jres\icons\portB.png"
inkscape:export-xdpi="156.39424"
inkscape:export-ydpi="156.39424"
inkscape:version="0.92.1 r15371">
<metadata
id="metadata6352">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview6350"
showgrid="false"
inkscape:zoom="4.0048872"
inkscape:cx="24.98"
inkscape:cy="29.464001"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg6348" />
<defs
id="defs6343">
<style
id="style6341">
.cls-1 {
fill: #eaeaea;
}
@ -10,8 +62,28 @@
}
</style>
</defs>
<g id="icn_port" transform="translate(1447.52 6142.536)">
<path id="Path_8" data-name="Path 8" class="cls-1" d="M0-143.939H49.96v58.928H0Z" transform="translate(0 143.939)"/>
<path id="Path_9" data-name="Path 9" class="cls-2" d="M0-63.321V-91.143H17.114v-6.912H21.83v-9.159H34.753V-98.4h5.064v35.08H31.784v7.43h-2.62V-63.4H27.179v7.507H24.973V-63.4h-2.16v7.507h-2.1V-63.4H18.861v7.507h-2.1V-63.4H14.942v7.507H12.478V-63.4H10.8v7.507H8.282V-63.35Z" transform="translate(5.253 109.807)"/>
</g>
<path
style="fill:#eaeaea;stroke-width:1.08854139"
inkscape:connector-curvature="0"
d="m 1447.5095,6142.536 h 59.1987 v 58.928 h -59.1987 z"
class="cls-1"
data-name="Path 8"
id="Path_8" />
<path
style="fill:#a8a9a8"
inkscape:connector-curvature="0"
d="M 1457.257,6189.022 V 6161.2 h 17.114 v -6.912 h 4.716 v -9.159 h 12.923 v 8.814 h 5.064 v 35.08 h -8.033 v 7.43 h -2.62 v -7.51 h -1.985 v 7.507 h -2.206 v -7.507 h -2.16 v 7.507 h -2.1 v -7.507 h -1.852 v 7.507 h -2.1 v -7.507 h -1.819 v 7.507 h -2.464 v -7.507 h -1.678 v 7.507 h -2.518 v -7.457 z"
class="cls-2"
data-name="Path 9"
id="Path_9" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:consolas;-inkscape-font-specification:consolas;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
x="1475.2291"
y="6185.2339"
id="text10060"><tspan
sodipodi:role="line"
id="tspan10058"
x="1475.2291"
y="6185.2339">B</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 729 B

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -13,8 +13,8 @@
"LightCondition.Dark|block": "dark",
"LightIntensityMode.Ambient|block": "ambient light",
"LightIntensityMode.Reflected|block": "reflected light",
"sensors.ColorSensor.color|block": "`icons.colorSensor` %color| color",
"sensors.ColorSensor.light|block": "`icons.colorSensor` %color|%mode",
"sensors.ColorSensor.color|block": "`icons.colorSensor` %sensor| color",
"sensors.ColorSensor.light|block": "`icons.colorSensor` %sensor|%mode",
"sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected color %color",
"sensors.ColorSensor.onLightChanged|block": "on `icons.colorSensor` %sensor|%mode|%condition",
"sensors.color1|block": "1",

View File

@ -100,6 +100,8 @@ namespace sensors {
//% block="on `icons.colorSensor` %sensor|detected color %color"
//% blockId=colorOnColorDetected
//% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=100 blockGap=8
//% group="Color Sensor"
@ -113,12 +115,14 @@ namespace sensors {
/**
* Get the current color from the color sensor.
* @param color the color sensor to query the request
* @param sensor the color sensor to query the request
*/
//% help=sensors/color-sensor/color
//% block="`icons.colorSensor` %color| color"
//% block="`icons.colorSensor` %sensor| color"
//% blockId=colorGetColor
//% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=99
//% group="Color Sensor"
@ -136,6 +140,8 @@ namespace sensors {
//% block="on `icons.colorSensor` %sensor|%mode|%condition"
//% blockId=colorOnLightChanged
//% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=89 blockGap=8
//% group="Color Sensor"
@ -146,12 +152,14 @@ namespace sensors {
/**
* Measures the ambient or reflected light value from 0 (darkest) to 100 (brightest).
* @param color the color sensor port
* @param sensor the color sensor port
*/
//% help=sensors/color-sensor/light
//% block="`icons.colorSensor` %color|%mode"
//% block="`icons.colorSensor` %sensor|%mode"
//% blockId=colorLight
//% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=88
//% group="Color Sensor"
@ -171,15 +179,15 @@ namespace sensors {
}
}
//% whenUsed block="1" weight=95 fixedInstance
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1
export const color1: ColorSensor = new ColorSensor(1)
//% whenUsed block="3" weight=90 fixedInstance
//% whenUsed block="3" weight=90 fixedInstance jres=icons.port3
export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="2" weight=90 fixedInstance
//% whenUsed block="2" weight=90 fixedInstance jres=icons.port2
export const color2: ColorSensor = new ColorSensor(2)
//% whenUsed block="4" weight=90 fixedInstance
//% whenUsed block="4" weight=90 fixedInstance jres=icons.port4
export const color4: ColorSensor = new ColorSensor(4)
}

View File

@ -154,7 +154,7 @@ namespace brick {
//% blockId=scren_image_picker block="%image" shim=TD_ID
//% image.fieldEditor="imagedropdown"
//% image.fieldOptions.columns=6
//% block.fieldOptions.hasSearchBar=true
//% image.fieldOptions.hasSearchBar=true
//% group="Screen" weight=0 blockHidden=1
export function _imagePicker(image: Image): Image {
return image;

View File

@ -27,6 +27,8 @@ namespace sensors {
//% block="`icons.gyroSensor` %sensor|angle"
//% blockId=gyroGetAngle
//% parts="gyroscope"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Gyro Sensor"
@ -43,6 +45,8 @@ namespace sensors {
//% block="`icons.gyroSensor` %sensor|rotation rate"
//% blockId=gyroGetRate
//% parts="gyroscope"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Gyro Sensor"
@ -52,15 +56,15 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="1"
//% fixedInstance whenUsed block="1" jres=icons.port1
export const gyro1: GyroSensor = new GyroSensor(1)
//% fixedInstance whenUsed block="2" weight=95
//% fixedInstance whenUsed block="2" weight=95 jres=icons.port2
export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="3"
//% fixedInstance whenUsed block="3" jres=icons.port3
export const gyro3: GyroSensor = new GyroSensor(3)
//% fixedInstance whenUsed block="4"
//% fixedInstance whenUsed block="4" jres=icons.port4
export const gyro4: GyroSensor = new GyroSensor(4)
}

View File

@ -2,8 +2,8 @@
"InfraredSensorEvent.ObjectDetected|block": "object detected",
"InfraredSensorEvent.ObjectNear|block": "object near",
"sensors.InfraredSensor.onEvent|block": "on `icons.infraredSensor` %sensor|%event",
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %infrared|proximity",
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %infrared|remote command",
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %sensor|proximity",
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %sensor|remote command",
"sensors.InfraredSensor.waitUntil|block": "wait until `icons.infraredSensor` %sensor| %event",
"sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed",
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event",

View File

@ -192,6 +192,8 @@ namespace sensors {
//% block="on `icons.infraredSensor` %sensor|%event"
//% blockId=infraredOn
//% parts="infraredsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=100 blockGap=8
//% group="Infrared Sensor"
@ -206,6 +208,8 @@ namespace sensors {
//% block="wait until `icons.infraredSensor` %sensor| %event"
//% blockId=infraredwait
//% parts="infraredsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Infrared Sensor"
@ -215,12 +219,14 @@ namespace sensors {
/**
* Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)
* @param ir the infrared sensor
* @param sensor the infrared sensor
*/
//% help=input/infrared/proximity
//% block="`icons.infraredSensor` %infrared|proximity"
//% block="`icons.infraredSensor` %sensor|proximity"
//% blockId=infraredGetProximity
//% parts="infrared"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Infrared Sensor"
@ -231,12 +237,14 @@ namespace sensors {
/**
* Get the remote commandreceived the infrared sensor.
* @param ir the infrared sensor
* @param sensor the infrared sensor
*/
//% help=input/infrared/remote-command
//% block="`icons.infraredSensor` %infrared|remote command"
//% block="`icons.infraredSensor` %sensor|remote command"
//% blockId=infraredGetRemoteCommand
//% parts="infrared"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Infrared Sensor"
@ -252,16 +260,16 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="1"
//% fixedInstance whenUsed block="1" jres=icons.port1
export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
//% fixedInstance whenUsed block="2"
//% fixedInstance whenUsed block="2" jres=icons.port2
export const infraredSensor2: InfraredSensor = new InfraredSensor(2)
//% fixedInstance whenUsed block="3"
//% fixedInstance whenUsed block="3" jres=icons.port3
export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
//% fixedInstance whenUsed block="4"
//% fixedInstance whenUsed block="4" jres=icons.port4
export const infraredSensor4: InfraredSensor = new InfraredSensor(4)

View File

@ -44,6 +44,8 @@ namespace sensors {
//% help=input/touch-sensor/on-event
//% blockId=touchEvent block="on `icons.touchSensor` %sensor|%event"
//% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Touch Sensor"
@ -59,6 +61,8 @@ namespace sensors {
//% help=input/touch-sensor/wait-until
//% blockId=touchWaitUntil block="wait until `icons.touchSensor` %sensor|%event"
//% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=98 blockGap=8
//% group="Touch Sensor"
@ -74,6 +78,8 @@ namespace sensors {
//% block="`icons.touchSensor` %sensor|is pressed"
//% blockId=touchIsPressed
//% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=81 blockGap=8
//% group="Touch Sensor"
@ -89,6 +95,8 @@ namespace sensors {
//% block="`icons.touchSensor` %sensor|was pressed"
//% blockId=touchWasPressed
//% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=81 blockGap=8
//% group="Touch Sensor"
@ -97,12 +105,12 @@ namespace sensors {
}
}
//% whenUsed block="1" weight=95 fixedInstance
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1
export const touchSensor1: TouchSensor = new TouchSensor(1)
//% whenUsed block="2" weight=95 fixedInstance
//% whenUsed block="2" weight=95 fixedInstance jres=icons.port2
export const touchSensor2: TouchSensor = new TouchSensor(2)
//% whenUsed block="3" weight=95 fixedInstance
//% whenUsed block="3" weight=95 fixedInstance jres=icons.port3
export const touchSensor3: TouchSensor = new TouchSensor(3)
//% whenUsed block="4" weight=95 fixedInstance
//% whenUsed block="4" weight=95 fixedInstance jres=icons.port4
export const touchSensor4: TouchSensor = new TouchSensor(4)
}

View File

@ -45,6 +45,8 @@ namespace sensors {
//% blockId=ultrasonicOn
//% block="on `icons.ultrasonicSensor` %sensor|%event"
//% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=100 blockGap=8
//% group="Ultrasonic Sensor"
@ -59,6 +61,8 @@ namespace sensors {
//% block="wait until `icons.ultrasonicSensor` %sensor| %event"
//% blockId=ultrasonicWait
//% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Ultrasonic Sensor"
@ -74,6 +78,8 @@ namespace sensors {
//% block="`icons.ultrasonicSensor` %sensor|distance"
//% blockId=sonarGetDistance
//% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Ultrasonic Sensor"
@ -84,15 +90,15 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="1"
//% fixedInstance whenUsed block="1" jres=icons.port1
export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
//% fixedInstance whenUsed block="4"
//% fixedInstance whenUsed block="4" jres=icons.port4
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
//% fixedInstance whenUsed block="2"
//% fixedInstance whenUsed block="2" jres=icons.port2
export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
//% fixedInstance whenUsed block="3"
//% fixedInstance whenUsed block="3" jres=icons.port3
export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
}