File: ex_02_mask_movie.py

package info (click to toggle)
sqlkit 0.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,184 kB
  • sloc: python: 17,477; sql: 166; makefile: 95; xml: 23; sh: 11
file content (35 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (2)
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
"""base/movie mask

base editing mode: mask view

Note how simple it is to define the layout. You just write the name of the
field and a label + entry will be displayed. Each database type has a
different widget that is determined by SqlMask by introspection. You can
force it as for 'image' and 'description' in the second example if
you want a different renderer (eg.: the Text instead of the Entry) or if you
want to get rid of the label (via the double '=='). Curly braces can be used
to group a set of fields.


Double click on the search icon in director_id field to mimic an 'enum' field,
i.e. all choices will be shown.

"""

## Very simple, no layout definition -> a default layout is created 
t1 = SqlMask(model.Movie, dbproxy=db)
t1.reload()


## Let's define a layout with the image on the left
lay = """
     img==image:140.200  {|
         title
         date_release
         TXS=description 
         director_id
    }
    """
t = SqlMask(model.Movie, dbproxy=db, layout=lay)
t.gui_fields.image.default_size = 250,250
t.reload()