Acces to db made easy

- Prev: Utilities
- Next: Printing

# Field Widgets

Each field is represented using a proper gtk widget. Table and Mask need two different objects, a cell renderer for tables and a widget from module sqlkit.widgets.mask.miniwidgets for masks.

Cell renderers and function to represent the data are defined in sqlkit.widgets.table.columns.

Widgets defined in sqlkit.widgets.mask.miniwidgets are just interfaces (or proxies) to other gtk widgets.

## Image Viewer

class `sqlkit.layout.image_widget.``ImageWidget`

  Image Widget suitable for basic image viewing. Inherits from VBox

  `sb`(txt)

    Push info on Status Bar

  `scale_pixbuf`(pixbuf, w=None, h=None)

    scale pixbuf image with the same ratio so that it fits into self.w/self.h

    Parameters:

    - pixbuf – a gtk.gdk.Pixbuf object
    - w – the desired width
    - h – the desired height

  `set_image`(image_path)

    set rendered image

    Parameters: | image_path – the path of the image

  `set_pixbuf`(pixbuf)

    Set the image via the pixbuf

    Parameters: | pixbuf – the gtk.gdk.Pixbuf

  `set_stock`(stock_id, size=<enum GTK_ICON_SIZE_DIALOG of type GtkIconSize>)

    Set the image via the stock-id

    Parameters:

    - stock-id – a stock-id
    - size – the desired image (default: ICON_SIZE_DIALOG)

  `show_image`(action=None)

    Open another window that will show the same image with at a different zooming. Setup callback to keep the new window updated by the first one.

### Properties

imageViewer has the following properties:

image: | the image path currently rendered
scale: | possible values AUTOREDUCTION, SCALE. If True the image should autoscale. If value is AUTOREDUCTION the image is never enlarged over its natural size
width: | the with of the gtk.Image widget
height: | the height og the gtk.Image widget
scale_factor: | the current scale factor between render image and thumbnail

### Signals

ImageViewer has the following signals:

image-selected:

The image has been selected for upload. Callback:

`on_image_selected(widget, filename, new_filename):`

  Parameters:

  - widget – the widget that issued the signal
  - fielname – the filename that has been selected
  - new_filename – a preferred filename as suggested by the user if any

image-displayed:

The image has been displayed

`on_image_displayed(widget, pixbuf_full, pixbuf):`

  Parameters:

  - widget – the widget that issued the signal
  - pixbuf_full – the pixbuf rendered from the file
  - pixbuf – the scaled pixbuf

image-deleted:

the image has been deleted

`on_image_deleted(widget, filename):`

  Parameters:

  - widget – the widget that issued the signal
  - fielname – the filename that has been deleted

## DateEdit

class `sqlkit.layout.dateedit.``DateEdit`

  basic gtk widget to edit data

  `set_date`(new_date, from_focus_out=False)

    new_date is a datetime.date object. Can be set by: - do_set_property - focus_out_event - popup click

class `sqlkit.layout.dateedit.``DateTimeEdit`