Check-in [7dbfdf9c42]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Reimplement _attributes. Start example.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:7dbfdf9c429e8a188ac1dc4e443d592bf7a5c5484fc1c4dc4e13c57c959f40ea
User & Date: gwlester 2018-02-05 05:26:54
Context
2018-02-05
21:09
Working example and correction to _setAttribute logic (fix for [ff08074318]). check-in: 36b5f24ce8 user: gwlester tags: trunk, Release_0.5.3
05:26
Reimplement _attributes. Start example. check-in: 7dbfdf9c42 user: gwlester tags: trunk
2018-02-04
07:24
Implemented Feature Request [ff08074318] -- provide access to class attributes. check-in: 2059d531f3 user: gwlester tags: trunk
Changes

Added examples/pistill.tcl.



































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" ${1+"$@"}

##
## Emit help message and exit
##
proc EmitHelp {} {
    puts stderr {

Runs camera for specific time, and take JPG capture at end if requested

usage: pistill.tcl [options] outputFileName

Image parameter commands:
    -?, --help	: This help information
    -w, --width	: Set image width <size>
    -h, --height	: Set image height <size>
    -q, --quality	: Set jpeg quality <0 to 100>
    -r, --raw	: Add raw bayer data to jpeg metadata
    -t, --timeout	: Time (in ms) before takes picture and shuts down (if not specified, set to 5s)
    -th, --thumb	: Set thumbnail parameters (x:y:quality) or none
    -e, --encoding	: Encoding to use for output file (jpg, bmp, gif, png)
    -x, --exif	: EXIF tag to apply to captures (format as 'key=value') or none
    -md, --mode	: Force sensor mode. 0=auto. See docs for other modes available
    -sh, --sharpness	: Set image sharpness (-100 to 100)
    -co, --contrast	: Set image contrast (-100 to 100)
    -br, --brightness	: Set image brightness (0 to 100)
    -sa, --saturation	: Set image saturation (-100 to 100)
    -ISO, --ISO	: Set capture ISO
    -vs, --vstab	: Turn on video stabilisation
    -ev, --ev	: Set EV compensation - steps of 1/6 stop
    -ex, --exposure	: Set exposure mode (see below)
    -fli, --flicker	: Set flicker avoid mode (see below)
    -awb, --awb	: Set AWB mode (see Notes)
    -ifx, --imxfx	: Set image effect (see below)
    -cfx, --colfx	: Set colour effect (U:V)
    -mm, --metering	: Set metering mode (see below)
    -rot, --rotation	: Set image rotation (0-359)
    -hf, --hflip	: Set horizontal flip
    -vf, --vflip	: Set vertical flip
    -roi, --roi	: Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])
    -ss, --shutter	: Set shutter speed in microseconds
    -awbg, --awbgains	: Set AWB gains - AWB mode must be off
    -drc, --drc	: Set DRC Level (see below)
    -st, --stats	: Force recomputation of statistics on stills capture pass
    -ag, --analoggain	: Set the analog gain (floating point)
    -dg, --digitalgain	: Set the digtial gain (floating point)

Exposure mode options :
    off, auto, night, nightpreview, backlight, spotlight, sports, snow, beach,
    verylong, fixedfps, antishake or fireworks

Flicker avoid mode options :
    off, auto, 50hz or 60hz

AWB mode options :
    off, auto, sun, cloud, shade, tungsten, fluorescent, incandescent, flash or
    horizon

Image Effect mode options :
    none, negative, solarise, sketch, denoise, emboss, oilpaint, hatch, gpen,
    pastel, watercolour, film, blur, saturation, colourswap, washedout,
    posterise, colourpoint, colourbalance or cartoon

Metering Mode options :
    average, spot, backlit or matrix

Dynamic Range Compression (DRC) options :
    off, low, med or high

    }
    exit 1
}

proc ProcessOptions {argList} {

}

package require pyman
pyman import -namespace ::picamera picamera

switch -exact $argc {
    0 {
        EmitHelp
    }
    1 {
        set ofn [lindex $argv 0]
    }
    default {
        set ofn [lindex $argv end]
        ProcessOptions [lrnage $argv 0 end-1]
    }
}

set camera [::picamera::PiCamera new]
$camera capture $ofn

Changes to src/pyman.tcl.

131
132
133
134
135
136
137

138
139
140
141
142
143
144
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
                                if {[string index $name 0] eq "_"} {
                                    ##
                                    ## Skip private and magic attributes
                                    ##
                                    continue
                                }


                                if {[string match {<property object at *} $value]} {
                                    ##
                                    ## Property that we can read/set
                                    ##
                                    dict set Attributes type $name property
                                    dict lappend Attributes properties $name
                                } elseif {[string match {<*} $value]} {
................................................................................

                            ::oo::objdefine [self] deletemethod init
                        }

                        method _attributes {{pattern {*}}} {
                            classvariable Attributes

                            return [dict get $Attributes list]
                        }

                        method _getAttribute {attribute} {
                            classvariable Attributes
                            variable pythonObject

                            if {![dict exists $Attributes type $attribute]} {







>







 







|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                                if {[string index $name 0] eq "_"} {
                                    ##
                                    ## Skip private and magic attributes
                                    ##
                                    continue
                                }

                                dict lappend Attributes list $name
                                if {[string match {<property object at *} $value]} {
                                    ##
                                    ## Property that we can read/set
                                    ##
                                    dict set Attributes type $name property
                                    dict lappend Attributes properties $name
                                } elseif {[string match {<*} $value]} {
................................................................................

                            ::oo::objdefine [self] deletemethod init
                        }

                        method _attributes {{pattern {*}}} {
                            classvariable Attributes

                            return [lsort [dict keys [dict get $Attributes type] $pattern]]
                        }

                        method _getAttribute {attribute} {
                            classvariable Attributes
                            variable pythonObject

                            if {![dict exists $Attributes type $attribute]} {