GUIData reference

guidata

GUIData reference

dataset

The guidata.dataset package provides the core features for data set display and editing with automatically generated graphical user interfaces.

dataset.dataitems

The guidata.dataset.dataitems module contains implementation for concrete DataItems.

class guidata.dataset.dataitems.BoolItem(text=u'', label=u'', default=None, help=u'')[source]
Construct a boolean data item
  • text [string]: form’s field name (optional)
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

type

alias of bool

class guidata.dataset.dataitems.ButtonItem(label, callback, icon=None, default=None, help=u'')[source]
Construct a simple button that calls a method when hit
  • label [string]: text shown on the button

  • callback [function]: function with four parameters (dataset, item, value, parent)
    • dataset [DataSet]: instance of the parent dataset
    • item [DataItem]: instance of ButtonItem (i.e. self)
    • value [unspecified]: value of ButtonItem (default ButtonItem value or last value returned by the callback)
    • parent [QObject]: button’s parent widget
  • icon [QIcon or string]: icon show on the button (optional) (string: icon filename as in guidata/guiqwt image search paths)

  • default [unspecified]: default value passed to the callback (optional)

  • help [string]: text shown in button’s tooltip (optional)

The value of this item is unspecified but is passed to the callback along with the whole dataset. The value is assigned the callback`s return value.

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.ChoiceItem(label, choices, default=<class 'guidata.dataset.dataitems.FirstChoice'>, help=u'')[source]
Construct a data item for a list of choices.
  • label [string]: name
  • choices [list, tuple or function]: string list or (key, label) list function of two arguments (item, value) returning a list of tuples (key, label, image) where image is an icon path, a QIcon instance or a function of one argument (key) returning a QIcon instance
  • default [-]: default label or default key (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)[source]

Override DataItem method

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.ColorItem(label, default=None, notempty=None, wordwrap=False, help=u'')[source]
Construct a color data item
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)

Color values are encoded as hexadecimal strings or Qt color names

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)

Override DataItem method

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.DateItem(label, default=None, help=u'')[source]
Construct a date data item.
  • text [string]: form’s field name (optional)
  • label [string]: name
  • default [datetime.date]: default value (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

type

alias of date

class guidata.dataset.dataitems.DictItem(label, default=None, help=u'')[source]
Construct a dictionary data item
  • label [string]: name
  • default [dict]: default value (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.DirectoryItem(label, default=None, notempty=None, wordwrap=False, help=u'')[source]
Construct a path data item for a directory.
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)

Override DataItem method

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.FileOpenItem(label, formats=u'*', default=None, basedir=None, all_files_first=False, help=u'')[source]
Construct a path data item for a file to be opened
  • label [string]: name
  • formats [string (or string list)]: wildcard filter
  • default [string]: default value (optional)
  • basedir [string]: default base directory (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)

Override DataItem method

get_auto_help(instance)

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.FileSaveItem(label, formats=u'*', default=None, basedir=None, all_files_first=False, help=u'')[source]
Construct a path data item for a file to be saved
  • label [string]: name
  • formats [string (or string list)]: wildcard filter
  • default [string]: default value (optional)
  • basedir [string]: default base directory (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)[source]

Override DataItem method

get_auto_help(instance)[source]

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.FilesOpenItem(label, formats=u'*', default=None, basedir=None, all_files_first=False, help=u'')[source]
Construct a path data item for multiple files to be opened.
  • label [string]: name
  • formats [string (or string list)]: wildcard filter
  • default [string]: default value (optional)
  • basedir [string]: default base directory (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)[source]

Override DataItem method

get_auto_help(instance)

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)[source]

Serialize this item

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

type

alias of list

class guidata.dataset.dataitems.FloatArrayItem(label, default=None, help=u'', format=u'%.3f', transpose=False, minmax=u'all')[source]
Construct a float array data item
  • label [string]: name
  • default [numpy.ndarray]: default value (optional)
  • help [string]: text shown in tooltip (optional)
  • format [string]: formatting string (example: ‘%.3f’) (optional)
  • transpose [bool]: transpose matrix (display only)
  • large [bool]: view all float of the array
  • minmax [string]: “all” (default), “columns”, “rows”
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)[source]

Override DataItem method

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)[source]

Serialize this item

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.FloatItem(label, default=None, min=None, max=None, nonzero=None, unit=u'', step=0.1, slider=False, help=u'')[source]
Construct a float data item
  • label [string]: name
  • default [float]: default value (optional)
  • min [float]: minimum value (optional)
  • max [float]: maximum value (optional)
  • slider [bool]: if True, shows a slider widget right after the line edit widget (default is False)
  • step [float]: step between tick values with a slider widget (optional)
  • nonzero [bool]: if True, zero is not a valid value (optional)
  • unit [string]: physical unit (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Override DataItem method

from_string(value)

Override DataItem method

get_auto_help(instance)

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

type

alias of float

class guidata.dataset.dataitems.FontFamilyItem(label, default=None, notempty=None, wordwrap=False, help=u'')[source]
Construct a font family name item
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)

Override DataItem method

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.ImageChoiceItem(label, choices, default=<class 'guidata.dataset.dataitems.FirstChoice'>, help=u'')[source]
Construct a data item for a list of choices with images
  • label [string]: name
  • choices [list, tuple or function]: (label, image) list or (key, label, image) list function of two arguments (item, value) returning a list of tuples (key, label, image) where image is an icon path, a QIcon instance or a function of one argument (key) returning a QIcon instance
  • default [-]: default label or default key (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Override DataItem method

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.IntItem(label, default=None, min=None, max=None, nonzero=None, unit=u'', even=None, slider=False, help=u'')[source]
Construct an integer data item
  • label [string]: name
  • default [int]: default value (optional)
  • min [int]: minimum value (optional)
  • max [int]: maximum value (optional)
  • nonzero [bool]: if True, zero is not a valid value (optional)
  • unit [string]: physical unit (optional)
  • even [bool]: if True, even values are valid, if False, odd values are valid if None (default), ignored (optional)
  • slider [bool]: if True, shows a slider widget right after the line edit widget (default is False)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Override DataItem method

from_string(value)

Override DataItem method

get_auto_help(instance)[source]

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

type

alias of int

class guidata.dataset.dataitems.MultipleChoiceItem(label, choices, default=(), help=u'')[source]
Construct a data item for a list of choices – multiple choices can be selected
  • label [string]: name
  • choices [list or tuple]: string list or (key, label) list
  • default [-]: default label or default key (optional)
  • help [string]: text shown in tooltip (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)[source]

Deserialize this item

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Override DataItem method

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

horizontal(row_nb=1)[source]

Method to arange choice list horizontally on n rows

Example: nb = MultipleChoiceItem(“Number”, [‘1’, ‘2’, ‘3’] ).horizontal(2)

serialize(instance, writer)[source]

Serialize this item

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

vertical(col_nb=1)[source]

Method to arange choice list vertically on n columns

Example: nb = MultipleChoiceItem(“Number”, [‘1’, ‘2’, ‘3’] ).vertical(2)

class guidata.dataset.dataitems.NumericTypeItem(label, default=None, min=None, max=None, nonzero=None, unit=u'', help=u'')[source]

Numeric data item

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)[source]

Override DataItem method

from_string(value)[source]

Override DataItem method

get_auto_help(instance)[source]

Override DataItem method

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.StringItem(label, default=None, notempty=None, wordwrap=False, help=u'')[source]
Construct a string data item
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)
  • notempty [bool]: if True, empty string is not a valid value (opt.)
  • wordwrap [bool]: toggle word wrapping (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)[source]

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)[source]

Override DataItem method

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.dataitems.TextItem(label, default=None, notempty=None, wordwrap=True, help=u'')[source]
Construct a text data item (multiline string)
  • label [string]: name
  • default [string]: default value (optional)
  • help [string]: text shown in tooltip (optional)
  • notempty [bool]: if True, empty string is not a valid value (opt.)
  • wordwrap [bool]: toggle word wrapping (optional)
accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(value)

Override DataItem method

deserialize(instance, reader)

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(value)

Override DataItem method

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

dataset.datatypes

The guidata.dataset.datatypes module contains implementation for DataSets (DataSet, DataSetGroup, ...) and related objects (ItemProperty, ValueProp, ...).

class guidata.dataset.datatypes.ActivableDataSet(title=None, comment=None, icon=u'')[source]

An ActivableDataSet instance must have an “enable” class attribute which will set the active state of the dataset instance (see example in: tests/activable_dataset.py)

accept(vis)

helper function that passes the visitor to the accept methods of all the items in this dataset

classmethod active_setup(klass)[source]

This class method must be called after the child class definition in order to setup the dataset active state

check()

Check the dataset item values

edit(parent=None, apply=None, size=None)
Open a dialog box to edit data set
  • parent: parent widget (default is None, meaning no parent)
  • apply: apply callback (default is None)
  • size: dialog size (QSize object or integer tuple (width, height))
get_comment()

Return data set comment

get_icon()

Return data set icon

get_title()

Return data set title

set_defaults()

Set default values

set_readonly()[source]

The dataset is now in read-only mode, i.e. all data items are disabled

set_writeable()[source]

The dataset is now in read/write mode, i.e. all data items are enabled

text_edit()

Edit data set with text input only

to_string(debug=False, indent=None, align=False)

Return readable string representation of the data set If debug is True, add more details on data items

view(parent=None, size=None)
Open a dialog box to view data set
  • parent: parent widget (default is None, meaning no parent)
  • size: dialog size (QSize object or integer tuple (width, height))
class guidata.dataset.datatypes.BeginGroup(label, default=None, help=u'')[source]

Data item which does not represent anything but a begin flag to define a data set group

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.datatypes.DataItem(label, default=None, help=u'')[source]

DataSet data item

label : string default : any type, optional help : string Text displayed on data item’s tooltip

accept(visitor)[source]

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)[source]

Return a DataItemVariable instance bound to the data item

check_item(instance)[source]

Check data item’s current value (calling method check_value)

check_value(instance, value)[source]

Check if value is valid for this data item

deserialize(instance, reader)[source]

Deserialize this item using the reader object

Default base implementation supposes the reader can detect expected datatype from the stream

format_string(instance, value, fmt, func)[source]

Apply format to string representation of the item’s value

from_string(instance, string_value)[source]

Transform string into valid data item’s value

get_auto_help(instance)[source]

Return the automatically generated part of data item’s tooltip

get_help(instance)[source]

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)[source]

Get one property of this item

get_string_value(instance)[source]

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)[source]

Return data item’s value

get_value_from_reader(reader)[source]

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)[source]

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)[source]

Set data item’s value to default

set_from_string(instance, string_value)[source]

Set data item’s value from specified string

set_name(new_name)[source]

Set data item’s name

set_pos(col=0, colspan=None)[source]

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)[source]

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.datatypes.DataItemProxy(item)[source]

Proxy for DataItem objects

This class is needed to construct GroupItem class (see module guidata.qtwidgets)

accept(visitor)[source]

DataItem method proxy

bind(instance)[source]

DataItem method proxy

check_item(instance)[source]

DataItem method proxy

check_value(instance, value)[source]

DataItem method proxy

from_string(instance, string_value)[source]

DataItem method proxy

get_auto_help(instance)[source]

DataItem method proxy

get_help(instance)[source]

DataItem method proxy

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)[source]

DataItem method proxy

get_prop_value(realm, instance, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)[source]

DataItem method proxy

get_string_value(instance)[source]

DataItem method proxy

get_value(instance)[source]

DataItem method proxy

set_default(instance)[source]

DataItem method proxy

set_from_string(instance, string_value)[source]

DataItem method proxy

set_prop(realm, **kwargs)[source]

DataItem method proxy

class guidata.dataset.datatypes.DataItemVariable(item, instance)[source]

An instance of a DataItemVariable represent a binding between an item and a dataset.

could be called a bound property.

since DataItem instances are class attributes they need to have a DataSet instance to store their value. This class binds the two together.

check_item()[source]

Re-implement DataItem method

check_value(value)[source]

Re-implement DataItem method

from_string(string_value)[source]

Re-implement DataItem method

get()[source]

Re-implement DataItem method

get_auto_help()[source]

Re-implement DataItem method

get_help()[source]

Re-implement DataItem method

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)[source]

DataItem method proxy

get_prop_value(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)[source]

DataItem method proxy

get_string_value()[source]

Return a unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

label()[source]

Re-implement DataItem method

set(value)[source]

Re-implement DataItem method

set_default()[source]

Re-implement DataItem method

set_from_string(string_value)[source]

Re-implement DataItem method

class guidata.dataset.datatypes.DataSet(title=None, comment=None, icon=u'')[source]
Construct a DataSet object is a set of DataItem objects
  • title [string]
  • comment [string]: text shown on the top of the first data item
  • icon [QIcon or string]: icon show on the button (optional) (string: icon filename as in guidata/guiqwt image search paths)
accept(vis)[source]

helper function that passes the visitor to the accept methods of all the items in this dataset

check()[source]

Check the dataset item values

edit(parent=None, apply=None, size=None)[source]
Open a dialog box to edit data set
  • parent: parent widget (default is None, meaning no parent)
  • apply: apply callback (default is None)
  • size: dialog size (QSize object or integer tuple (width, height))
get_comment()[source]

Return data set comment

get_icon()[source]

Return data set icon

get_title()[source]

Return data set title

set_defaults()[source]

Set default values

text_edit()[source]

Edit data set with text input only

to_string(debug=False, indent=None, align=False)[source]

Return readable string representation of the data set If debug is True, add more details on data items

view(parent=None, size=None)[source]
Open a dialog box to view data set
  • parent: parent widget (default is None, meaning no parent)
  • size: dialog size (QSize object or integer tuple (width, height))
class guidata.dataset.datatypes.DataSetGroup(datasets, title=None, icon=u'')[source]
Construct a DataSetGroup object, used to group several datasets together
  • datasets [list of DataSet objects]
  • title [string]
  • icon [QIcon or string]: icon show on the button (optional) (string: icon filename as in guidata/guiqwt image search paths)

This class tries to mimics the DataSet interface.

The GUI should represent it as a notebook with one page for each contained dataset.

accept(vis)[source]

helper function that passes the visitor to the accept methods of all the items in this dataset

check()[source]

Check data set group items

edit(parent=None, apply=None)[source]

Open a dialog box to edit data set

get_comment()[source]

Return data set group comment –> not implemented (will return None)

get_title()[source]

Return data set group title

text_edit()[source]

Edit data set with text input only

class guidata.dataset.datatypes.DataSetMeta[source]

DataSet metaclass

Create class attribute _items: list of the DataSet class attributes, created in the same order as these attributes were written

mro() → list

return a type’s method resolution order

class guidata.dataset.datatypes.EndGroup(label, default=None, help=u'')[source]

Data item which does not represent anything but an end flag to define a data set group

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

set_default(instance)

Set data item’s value to default

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.datatypes.FormatProp(fmt, ignore_error=True)[source]

A Property that returns a string to help custom read-only representation of items

set(instance, item, value)

Sets the value of the property given an instance, item and value Depending on implementation the value will be stored either on the instance, item or self

class guidata.dataset.datatypes.FuncProp(prop, func, invfunc=None)[source]

An ‘operator property’ prop: ItemProperty instance func: function invfunc: inverse function (optional)

class guidata.dataset.datatypes.GetAttrProp(attr)[source]

A property that matches the value of an instance’s attribute

class guidata.dataset.datatypes.GroupItem(item)[source]

GroupItem proxy

accept(visitor)

DataItem method proxy

bind(instance)

DataItem method proxy

check_item(instance)

DataItem method proxy

check_value(instance, value)

DataItem method proxy

from_string(instance, string_value)

DataItem method proxy

get_auto_help(instance)

DataItem method proxy

get_help(instance)

DataItem method proxy

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

DataItem method proxy

get_prop_value(realm, instance, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

DataItem method proxy

get_string_value(instance)

DataItem method proxy

get_value(instance)

DataItem method proxy

set_default(instance)

DataItem method proxy

set_from_string(instance, string_value)

DataItem method proxy

set_prop(realm, **kwargs)

DataItem method proxy

class guidata.dataset.datatypes.NotProp(prop)[source]

Not property

class guidata.dataset.datatypes.Obj(**kwargs)[source]

An object that helps build default instances for ObjectItems

class guidata.dataset.datatypes.ObjectItem(label, default=None, help=u'')[source]

Simple helper class implementing default for composite objects

accept(visitor)

This is the visitor pattern’s accept function. It calls the corresponding visit_MYCLASS method of the visitor object.

Python’s allow a generic base class implementation of this method so there’s no need to write an accept function for each derived class unless you need to override the default behavior

bind(instance)

Return a DataItemVariable instance bound to the data item

check_item(instance)

Check data item’s current value (calling method check_value)

check_value(instance, value)

Check if value is valid for this data item

deserialize(instance, reader)[source]

Deserialize this item using the reader object

We build a new default object and deserialize it

format_string(instance, value, fmt, func)

Apply format to string representation of the item’s value

from_string(instance, string_value)

Transform string into valid data item’s value

get_auto_help(instance)

Return the automatically generated part of data item’s tooltip

get_help(instance)

Return data item’s tooltip

get_prop(realm, name, default=<class guidata.dataset.datatypes.NoDefault at 0x04F167A0>)

Get one property of this item

get_string_value(instance)

Return a formatted unicode representation of the item’s value obeying ‘display’ or ‘repr’ properties

get_value(instance)

Return data item’s value

get_value_from_reader(reader)

Reads value from the reader object, inside the try...except statement defined in the base item deserialize method

This method is reimplemented in some child classes

serialize(instance, writer)

Serialize this item using the writer object

this is a default implementation that should work for everything but new datatypes

set_default(instance)[source]

Make a copy of the default value

set_from_string(instance, string_value)

Set data item’s value from specified string

set_name(new_name)

Set data item’s name

set_pos(col=0, colspan=None)

Set data item’s position on a GUI layout

set_prop(realm, **kwargs)

Set one or several properties using the syntax set_prop(name1=value1, ..., nameX=valueX)

it returns self so that we can assign to the result like this:

item = Item().set_prop(x=y)

class guidata.dataset.datatypes.ValueProp(value)[source]

A property that retrieves a value stored elsewhere

qthelpers

The guidata.qthelpers module provides helper functions for developing easily Qt-based graphical user interfaces.

class guidata.qthelpers.ShowStdIcons(parent)[source]

Dialog showing standard icons

class RenderFlags

QWidget.RenderFlags(QWidget.RenderFlags) QWidget.RenderFlags(int) QWidget.RenderFlags()

ShowStdIcons.acceptDrops() → bool
ShowStdIcons.actionEvent(QActionEvent)
ShowStdIcons.actions() → list-of-QAction
ShowStdIcons.activateWindow()
ShowStdIcons.addAction(QAction)
ShowStdIcons.addActions(list-of-QAction)
ShowStdIcons.adjustSize()
ShowStdIcons.autoFillBackground() → bool
ShowStdIcons.backgroundRole() → QPalette.ColorRole
ShowStdIcons.baseSize() → QSize
ShowStdIcons.blockSignals(bool) → bool
ShowStdIcons.changeEvent(QEvent)
ShowStdIcons.childAt(QPoint) → QWidget

QWidget.childAt(int, int) -> QWidget

ShowStdIcons.children() → list-of-QObject
ShowStdIcons.childrenRect() → QRect
ShowStdIcons.childrenRegion() → QRegion
ShowStdIcons.clearFocus()
ShowStdIcons.clearMask()
ShowStdIcons.close() → bool
ShowStdIcons.closeEvent(QCloseEvent)
ShowStdIcons.colorCount() → int
ShowStdIcons.connect(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection) → bool

QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection) -> bool QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection) -> bool

ShowStdIcons.contentsMargins() → QMargins
ShowStdIcons.contentsRect() → QRect
ShowStdIcons.contextMenuEvent(QContextMenuEvent)
ShowStdIcons.contextMenuPolicy() → Qt.ContextMenuPolicy
ShowStdIcons.create(sip.voidptr window=None, bool initializeWindow=True, bool destroyOldWindow=True)
ShowStdIcons.cursor() → QCursor
ShowStdIcons.customContextMenuRequested

QWidget.customContextMenuRequested[QPoint] [signal]

ShowStdIcons.deleteLater()
ShowStdIcons.depth() → int
ShowStdIcons.destroy(bool destroyWindow=True, bool destroySubWindows=True)
ShowStdIcons.destroyed

QObject.destroyed[QObject] [signal] QObject.destroyed [signal]

ShowStdIcons.devType() → int
ShowStdIcons.disconnect(QObject, SIGNAL(), QObject, SLOT()) → bool

QObject.disconnect(QObject, SIGNAL(), callable) -> bool

ShowStdIcons.dragEnterEvent(QDragEnterEvent)
ShowStdIcons.dragLeaveEvent(QDragLeaveEvent)
ShowStdIcons.dragMoveEvent(QDragMoveEvent)
ShowStdIcons.dropEvent(QDropEvent)
ShowStdIcons.dumpObjectInfo()
ShowStdIcons.dumpObjectTree()
ShowStdIcons.dynamicPropertyNames() → list-of-QByteArray
ShowStdIcons.effectiveWinId() → sip.voidptr
ShowStdIcons.emit(SIGNAL(), ...)
ShowStdIcons.enabledChange(bool)
ShowStdIcons.ensurePolished()
ShowStdIcons.enterEvent(QEvent)
ShowStdIcons.event(QEvent) → bool
ShowStdIcons.eventFilter(QObject, QEvent) → bool
ShowStdIcons.find(sip.voidptr) → QWidget
ShowStdIcons.findChild(type, QString name=QString()) → QObject

QObject.findChild(tuple, QString name=QString()) -> QObject

ShowStdIcons.findChildren(type, QString name=QString()) → list-of-QObject

QObject.findChildren(tuple, QString name=QString()) -> list-of-QObject QObject.findChildren(type, QRegExp) -> list-of-QObject QObject.findChildren(tuple, QRegExp) -> list-of-QObject

ShowStdIcons.focusInEvent(QFocusEvent)
ShowStdIcons.focusNextChild() → bool
ShowStdIcons.focusNextPrevChild(bool) → bool
ShowStdIcons.focusOutEvent(QFocusEvent)
ShowStdIcons.focusPolicy() → Qt.FocusPolicy
ShowStdIcons.focusPreviousChild() → bool
ShowStdIcons.focusProxy() → QWidget
ShowStdIcons.focusWidget() → QWidget
ShowStdIcons.font() → QFont
ShowStdIcons.fontChange(QFont)
ShowStdIcons.fontInfo() → QFontInfo
ShowStdIcons.fontMetrics() → QFontMetrics
ShowStdIcons.foregroundRole() → QPalette.ColorRole
ShowStdIcons.frameGeometry() → QRect
ShowStdIcons.frameSize() → QSize
ShowStdIcons.geometry() → QRect
ShowStdIcons.getContentsMargins() -> (int, int, int, int)
ShowStdIcons.grabGesture(Qt.GestureType, Qt.GestureFlags flags=Qt.GestureFlags(0))
ShowStdIcons.grabKeyboard()
ShowStdIcons.grabMouse()

QWidget.grabMouse(QCursor)

ShowStdIcons.grabShortcut(QKeySequence, Qt.ShortcutContext context=Qt.WindowShortcut) → int
ShowStdIcons.graphicsEffect() → QGraphicsEffect
ShowStdIcons.graphicsProxyWidget() → QGraphicsProxyWidget
ShowStdIcons.hasFocus() → bool
ShowStdIcons.hasMouseTracking() → bool
ShowStdIcons.height() → int
ShowStdIcons.heightForWidth(int) → int
ShowStdIcons.heightMM() → int
ShowStdIcons.hide()
ShowStdIcons.hideEvent(QHideEvent)
ShowStdIcons.inherits(str) → bool
ShowStdIcons.inputContext() → QInputContext
ShowStdIcons.inputMethodEvent(QInputMethodEvent)
ShowStdIcons.inputMethodHints() → Qt.InputMethodHints
ShowStdIcons.inputMethodQuery(Qt.InputMethodQuery) → QVariant
ShowStdIcons.insertAction(QAction, QAction)
ShowStdIcons.insertActions(QAction, list-of-QAction)
ShowStdIcons.installEventFilter(QObject)
ShowStdIcons.isActiveWindow() → bool
ShowStdIcons.isAncestorOf(QWidget) → bool
ShowStdIcons.isEnabled() → bool
ShowStdIcons.isEnabledTo(QWidget) → bool
ShowStdIcons.isEnabledToTLW() → bool
ShowStdIcons.isFullScreen() → bool
ShowStdIcons.isHidden() → bool
ShowStdIcons.isLeftToRight() → bool
ShowStdIcons.isMaximized() → bool
ShowStdIcons.isMinimized() → bool
ShowStdIcons.isModal() → bool
ShowStdIcons.isRightToLeft() → bool
ShowStdIcons.isTopLevel() → bool
ShowStdIcons.isVisible() → bool
ShowStdIcons.isVisibleTo(QWidget) → bool
ShowStdIcons.isWidgetType() → bool
ShowStdIcons.isWindow() → bool
ShowStdIcons.isWindowModified() → bool
ShowStdIcons.keyPressEvent(QKeyEvent)
ShowStdIcons.keyReleaseEvent(QKeyEvent)
ShowStdIcons.keyboardGrabber() → QWidget
ShowStdIcons.killTimer(int)
ShowStdIcons.languageChange()
ShowStdIcons.layout() → QLayout
ShowStdIcons.layoutDirection() → Qt.LayoutDirection
ShowStdIcons.leaveEvent(QEvent)
ShowStdIcons.locale() → QLocale
ShowStdIcons.logicalDpiX() → int
ShowStdIcons.logicalDpiY() → int
ShowStdIcons.lower()
ShowStdIcons.mapFrom(QWidget, QPoint) → QPoint
ShowStdIcons.mapFromGlobal(QPoint) → QPoint
ShowStdIcons.mapFromParent(QPoint) → QPoint
ShowStdIcons.mapTo(QWidget, QPoint) → QPoint
ShowStdIcons.mapToGlobal(QPoint) → QPoint
ShowStdIcons.mapToParent(QPoint) → QPoint
ShowStdIcons.mask() → QRegion
ShowStdIcons.maximumHeight() → int
ShowStdIcons.maximumSize() → QSize
ShowStdIcons.maximumWidth() → int
ShowStdIcons.metaObject() → QMetaObject
ShowStdIcons.metric(QPaintDevice.PaintDeviceMetric) → int
ShowStdIcons.minimumHeight() → int
ShowStdIcons.minimumSize() → QSize
ShowStdIcons.minimumSizeHint() → QSize
ShowStdIcons.minimumWidth() → int
ShowStdIcons.mouseDoubleClickEvent(QMouseEvent)
ShowStdIcons.mouseGrabber() → QWidget
ShowStdIcons.mouseMoveEvent(QMouseEvent)
ShowStdIcons.mousePressEvent(QMouseEvent)
ShowStdIcons.mouseReleaseEvent(QMouseEvent)
ShowStdIcons.move(QPoint)

QWidget.move(int, int)

ShowStdIcons.moveEvent(QMoveEvent)
ShowStdIcons.moveToThread(QThread)
ShowStdIcons.nativeParentWidget() → QWidget
ShowStdIcons.nextInFocusChain() → QWidget
ShowStdIcons.normalGeometry() → QRect
ShowStdIcons.numColors() → int
ShowStdIcons.objectName() → QString
ShowStdIcons.overrideWindowFlags(Qt.WindowFlags)
ShowStdIcons.overrideWindowState(Qt.WindowStates)
ShowStdIcons.paintEngine() → QPaintEngine
ShowStdIcons.paintEvent(QPaintEvent)
ShowStdIcons.paintingActive() → bool
ShowStdIcons.palette() → QPalette
ShowStdIcons.paletteChange(QPalette)
ShowStdIcons.parent() → QObject
ShowStdIcons.parentWidget() → QWidget
ShowStdIcons.physicalDpiX() → int
ShowStdIcons.physicalDpiY() → int
ShowStdIcons.pos() → QPoint
ShowStdIcons.previousInFocusChain() → QWidget
ShowStdIcons.property(str) → QVariant
ShowStdIcons.pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

ShowStdIcons.raise_()
ShowStdIcons.rect() → QRect
ShowStdIcons.releaseKeyboard()
ShowStdIcons.releaseMouse()
ShowStdIcons.releaseShortcut(int)
ShowStdIcons.removeAction(QAction)
ShowStdIcons.removeEventFilter(QObject)
ShowStdIcons.render(QPaintDevice, QPoint targetOffset=QPoint(), QRegion sourceRegion=QRegion(), QWidget.RenderFlags flags=QWidget.DrawWindowBackground|QWidget.DrawChildren)

QWidget.render(QPainter, QPoint targetOffset=QPoint(), QRegion sourceRegion=QRegion(), QWidget.RenderFlags flags=QWidget.DrawWindowBackground|QWidget.DrawChildren)

ShowStdIcons.repaint()

QWidget.repaint(int, int, int, int) QWidget.repaint(QRect) QWidget.repaint(QRegion)

ShowStdIcons.resetInputContext()
ShowStdIcons.resize(QSize)

QWidget.resize(int, int)

ShowStdIcons.resizeEvent(QResizeEvent)
ShowStdIcons.restoreGeometry(QByteArray) → bool
ShowStdIcons.saveGeometry() → QByteArray
ShowStdIcons.scroll(int, int)

QWidget.scroll(int, int, QRect)

ShowStdIcons.setAcceptDrops(bool)
ShowStdIcons.setAttribute(Qt.WidgetAttribute, bool on=True)
ShowStdIcons.setAutoFillBackground(bool)
ShowStdIcons.setBackgroundRole(QPalette.ColorRole)
ShowStdIcons.setBaseSize(int, int)

QWidget.setBaseSize(QSize)

ShowStdIcons.setContentsMargins(int, int, int, int)

QWidget.setContentsMargins(QMargins)

ShowStdIcons.setContextMenuPolicy(Qt.ContextMenuPolicy)
ShowStdIcons.setCursor(QCursor)
ShowStdIcons.setDisabled(bool)
ShowStdIcons.setEnabled(bool)
ShowStdIcons.setFixedHeight(int)
ShowStdIcons.setFixedSize(QSize)

QWidget.setFixedSize(int, int)

ShowStdIcons.setFixedWidth(int)
ShowStdIcons.setFocus()

QWidget.setFocus(Qt.FocusReason)

ShowStdIcons.setFocusPolicy(Qt.FocusPolicy)
ShowStdIcons.setFocusProxy(QWidget)
ShowStdIcons.setFont(QFont)
ShowStdIcons.setForegroundRole(QPalette.ColorRole)
ShowStdIcons.setGeometry(QRect)

QWidget.setGeometry(int, int, int, int)

ShowStdIcons.setGraphicsEffect(QGraphicsEffect)
ShowStdIcons.setHidden(bool)
ShowStdIcons.setInputContext(QInputContext)
ShowStdIcons.setInputMethodHints(Qt.InputMethodHints)
ShowStdIcons.setLayout(QLayout)
ShowStdIcons.setLayoutDirection(Qt.LayoutDirection)
ShowStdIcons.setLocale(QLocale)
ShowStdIcons.setMask(QBitmap)

QWidget.setMask(QRegion)

ShowStdIcons.setMaximumHeight(int)
ShowStdIcons.setMaximumSize(int, int)

QWidget.setMaximumSize(QSize)

ShowStdIcons.setMaximumWidth(int)
ShowStdIcons.setMinimumHeight(int)
ShowStdIcons.setMinimumSize(int, int)

QWidget.setMinimumSize(QSize)

ShowStdIcons.setMinimumWidth(int)
ShowStdIcons.setMouseTracking(bool)
ShowStdIcons.setObjectName(QString)
ShowStdIcons.setPalette(QPalette)
ShowStdIcons.setParent(QWidget)

QWidget.setParent(QWidget, Qt.WindowFlags)

ShowStdIcons.setProperty(str, QVariant) → bool
ShowStdIcons.setShortcutAutoRepeat(int, bool enabled=True)
ShowStdIcons.setShortcutEnabled(int, bool enabled=True)
ShowStdIcons.setShown(bool)
ShowStdIcons.setSizeIncrement(int, int)

QWidget.setSizeIncrement(QSize)

ShowStdIcons.setSizePolicy(QSizePolicy)

QWidget.setSizePolicy(QSizePolicy.Policy, QSizePolicy.Policy)

ShowStdIcons.setStatusTip(QString)
ShowStdIcons.setStyle(QStyle)
ShowStdIcons.setStyleSheet(QString)
ShowStdIcons.setTabOrder(QWidget, QWidget)
ShowStdIcons.setToolTip(QString)
ShowStdIcons.setUpdatesEnabled(bool)
ShowStdIcons.setVisible(bool)
ShowStdIcons.setWhatsThis(QString)
ShowStdIcons.setWindowFilePath(QString)
ShowStdIcons.setWindowFlags(Qt.WindowFlags)
ShowStdIcons.setWindowIcon(QIcon)
ShowStdIcons.setWindowIconText(QString)
ShowStdIcons.setWindowModality(Qt.WindowModality)
ShowStdIcons.setWindowModified(bool)
ShowStdIcons.setWindowOpacity(float)
ShowStdIcons.setWindowRole(QString)
ShowStdIcons.setWindowState(Qt.WindowStates)
ShowStdIcons.setWindowTitle(QString)
ShowStdIcons.show()
ShowStdIcons.showEvent(QShowEvent)
ShowStdIcons.showFullScreen()
ShowStdIcons.showMaximized()
ShowStdIcons.showMinimized()
ShowStdIcons.showNormal()
ShowStdIcons.signalsBlocked() → bool
ShowStdIcons.size() → QSize
ShowStdIcons.sizeHint() → QSize
ShowStdIcons.sizeIncrement() → QSize
ShowStdIcons.sizePolicy() → QSizePolicy
ShowStdIcons.stackUnder(QWidget)
ShowStdIcons.startTimer(int) → int
ShowStdIcons.statusTip() → QString
ShowStdIcons.style() → QStyle
ShowStdIcons.styleSheet() → QString
ShowStdIcons.tabletEvent(QTabletEvent)
ShowStdIcons.testAttribute(Qt.WidgetAttribute) → bool
ShowStdIcons.thread() → QThread
ShowStdIcons.toolTip() → QString
ShowStdIcons.topLevelWidget() → QWidget
ShowStdIcons.tr(str, str disambiguation=None, int n=-1) → QString
ShowStdIcons.trUtf8(str, str disambiguation=None, int n=-1) → QString
ShowStdIcons.underMouse() → bool
ShowStdIcons.ungrabGesture(Qt.GestureType)
ShowStdIcons.unsetCursor()
ShowStdIcons.unsetLayoutDirection()
ShowStdIcons.unsetLocale()
ShowStdIcons.update()

QWidget.update(QRect) QWidget.update(QRegion) QWidget.update(int, int, int, int)

ShowStdIcons.updateGeometry()
ShowStdIcons.updateMicroFocus()
ShowStdIcons.updatesEnabled() → bool
ShowStdIcons.visibleRegion() → QRegion
ShowStdIcons.whatsThis() → QString
ShowStdIcons.wheelEvent(QWheelEvent)
ShowStdIcons.width() → int
ShowStdIcons.widthMM() → int
ShowStdIcons.winEvent(MSG) -> (bool, int)
ShowStdIcons.winId() → sip.voidptr
ShowStdIcons.window() → QWidget
ShowStdIcons.windowActivationChange(bool)
ShowStdIcons.windowFilePath() → QString
ShowStdIcons.windowFlags() → Qt.WindowFlags
ShowStdIcons.windowIcon() → QIcon
ShowStdIcons.windowIconText() → QString
ShowStdIcons.windowModality() → Qt.WindowModality
ShowStdIcons.windowOpacity() → float
ShowStdIcons.windowRole() → QString
ShowStdIcons.windowState() → Qt.WindowStates
ShowStdIcons.windowTitle() → QString
ShowStdIcons.windowType() → Qt.WindowType
ShowStdIcons.x() → int
ShowStdIcons.y() → int
guidata.qthelpers.add_actions(target, actions)[source]

Add actions (list of QAction instances) to target (menu, toolbar)

guidata.qthelpers.add_separator(target)[source]

Add separator to target only if last action is not a separator

guidata.qthelpers.create_action(parent, title, triggered=None, toggled=None, shortcut=None, icon=None, tip=None, checkable=None, context=1, enabled=None)[source]

Create a new QAction

guidata.qthelpers.create_groupbox(parent, title=None, toggled=None, checked=None, flat=False, layout=None)[source]

Create a QGroupBox

guidata.qthelpers.create_toolbutton(parent, icon=None, text=None, triggered=None, tip=None, toggled=None, shortcut=None, autoraise=True, enabled=None)[source]

Create a QToolButton

guidata.qthelpers.get_std_icon(name, size=None)[source]

Get standard platform icon Call ‘show_std_icons()’ for details

guidata.qthelpers.keybinding(attr)[source]

Return keybinding

guidata.qthelpers.show_std_icons()[source]

Show all standard Icons

guidata.qthelpers.text_to_qcolor(text)[source]

Create a QColor from specified string

disthelpers

The guidata.disthelpers module provides helper functions for Python package distribution on Microsoft Windows platforms with py2exe or on all platforms thanks to cx_Freeze.

class guidata.disthelpers.Distribution[source]

Distribution object

Help creating an executable using py2exe or cx_Freeze

add_executable(script, target_name, icon=None)[source]

Add executable to the cx_Freeze distribution Not supported for py2exe

add_matplotlib()[source]

Include module Matplotlib to the distribution

add_module_data_dir(module_name, data_dir_name, extensions, copy_to_root=True, verbose=False, exclude_dirs=[])[source]

Collect data files in data_dir_name for module module_name and add them to data_files extensions: list of file extensions, e.g. (‘.png’, ‘.svg’)

add_module_data_files(module_name, data_dir_names, extensions, copy_to_root=True, verbose=False, exclude_dirs=[])[source]

Collect data files for module module_name and add them to data_files data_dir_names: list of dirnames, e.g. (‘images’, ) extensions: list of file extensions, e.g. (‘.png’, ‘.svg’)

add_modules(*module_names)[source]

Include module module_name

add_pyqt4()[source]

Include module PyQt4 to the distribution

add_pyside()[source]

Include module PySide to the distribution

add_qt_bindings()[source]

Include Qt bindings, i.e. PyQt4 or PySide

add_text_data_file(filename, contents)[source]

Create temporary data file filename with contents and add it to data_files

build(library, cleanup=True, create_archive=None)[source]

Build executable with given library.

library:
  • ‘py2exe’: deploy using the py2exe library
  • ‘cx_Freeze’: deploy using the cx_Freeze library

cleanup: remove ‘build/dist’ directories before building distribution

create_archive (requires the executable zip):
  • None or False: do nothing
  • ‘add’: add target directory to a ZIP archive
  • ‘move’: move target directory to a ZIP archive
build_cx_freeze(cleanup=True, create_archive=None)[source]

Build executable with cx_Freeze

cleanup: remove ‘build/dist’ directories before building distribution

create_archive (requires the executable zip):
  • None or False: do nothing
  • ‘add’: add target directory to a ZIP archive
  • ‘move’: move target directory to a ZIP archive
build_py2exe(cleanup=True, compressed=2, optimize=2, company_name=None, copyright=None, create_archive=None)[source]

Build executable with py2exe

cleanup: remove ‘build/dist’ directories before building distribution

create_archive (requires the executable zip):
  • None or False: do nothing
  • ‘add’: add target directory to a ZIP archive
  • ‘move’: move target directory to a ZIP archive
setup(name, version, description, script, target_name=None, target_dir=None, icon=None, data_files=None, includes=None, excludes=None, bin_includes=None, bin_excludes=None, bin_path_includes=None, bin_path_excludes=None, msvc=None)[source]

Setup distribution object

Notes:
  • bin_path_excludes is specific to cx_Freeze (ignored if it’s None)
  • if msvc is None, it’s set to True by default on Windows platforms, False on non-Windows platforms
target_dir[source]

Return target directory (default: ‘dist’)

guidata.disthelpers.create_msvc_data_files(architecture=None, python_version=None, verbose=False)[source]

Including Microsoft Visual C++ DLLs

guidata.disthelpers.get_changeset(path, rev=None)[source]

Return Mercurial repository path revision number

guidata.disthelpers.get_msvc_dlls(msvc_version, architecture=None)[source]

Get the list of Microsoft Visual C++ DLLs associated to architecture and Python version, create the manifest file.

architecture: integer (32 or 64) – if None, take the Python build arch python_version: X.Y

guidata.disthelpers.get_msvc_version(python_version)[source]

Return Microsoft Visual C++ version used to build this Python version

guidata.disthelpers.prepend_module_to_path(module_path)[source]

Prepend to sys.path module located in module_path Return string with module infos: name, revision, changeset

Use this function: 1) In your application to import local frozen copies of internal libraries 2) In your py2exe distributed package to add a text file containing the returned string

guidata.disthelpers.prepend_modules_to_path(module_base_path)[source]

Prepend to sys.path all modules located in module_base_path

guidata.disthelpers.remove_dir(dirname)[source]

Remove directory dirname and all its contents Print details about the operation (progress, success/failure)

guidata.disthelpers.strip_version(version)[source]

Return version number with digits only (Windows does not support strings in version numbers)

guidata.disthelpers.to_include_files(data_files)[source]

Convert data_files list to include_files list

data_files:
  • this is the py2exe data files format
  • list of tuples (dest_dirname, (src_fname1, src_fname2, ...))
include_files:
  • this is the cx_Freeze data files format

  • list of tuples ((src_fname1, dst_fname1),

    (src_fname2, dst_fname2), ...))

configtools

The guidata.configtools module provides configuration related tools.

guidata.configtools.add_image_module_path(modname, relpath, subfolders=True)[source]

Appends image data path relative to a module name. Used to add module local data that resides in a module directory but will be shipped under sys.prefix / share/ ...

modname must be the name of an already imported module as found in sys.modules

guidata.configtools.add_image_path(path, subfolders=True)[source]

Append image path (opt. with its subfolders) to global list IMG_PATH

guidata.configtools.font_is_installed(font)[source]

Check if font is installed

guidata.configtools.get_brush(conf, section, option='', color='black', alpha=1.0)[source]

Construct a QBrush from the specified configuration file entry conf: UserConfig instance section [, option]: configuration entry [color]: default color [alpha]: default alpha-channel

guidata.configtools.get_family(families)[source]

Return the first installed font family in family list

guidata.configtools.get_font(conf, section, option='')[source]

Construct a QFont from the specified configuration file entry conf: UserConfig instance section [, option]: configuration entry

guidata.configtools.get_icon(name, default='not_found.png')[source]

Construct a QIcon from the file with specified name name, default: filenames with extensions

guidata.configtools.get_image_file_path(name, default='not_found.png')[source]

Return the absolute path to image with specified name name, default: filenames with extensions

guidata.configtools.get_image_label(name, default='not_found.png')[source]

Construct a QLabel from the file with specified name name, default: filenames with extensions

guidata.configtools.get_image_layout(imagename, text='', tooltip='', alignment=1)[source]

Construct a QHBoxLayout including image from the file with specified name, left-aligned text [with specified tooltip] Return (layout, label)

guidata.configtools.get_module_data_path(modname, relpath=None)[source]

Return module modname data path Handles py2exe/cx_Freeze distributions

guidata.configtools.get_module_locale_path(modname)[source]

Return module modname gettext translation path

guidata.configtools.get_pen(conf, section, option='', color='black', width=1, style='SolidLine')[source]

Construct a QPen from the specified configuration file entry conf: UserConfig instance section [, option]: configuration entry [color]: default color [width]: default width [style]: default style

guidata.configtools.get_translation(modname, dirname=None)[source]

Return translation callback for module modname

userconfig

The guidata.userconfig module provides user configuration file (.ini file) management features based on ConfigParser (standard Python library).

It is the exact copy of the open-source package userconfig (MIT license).

class guidata.userconfig.UserConfig(defaults)[source]

UserConfig class, based on ConfigParser name: name of the config options: dictionnary containing options or list of tuples (section_name, options)

Note that ‘get’ and ‘set’ arguments number and type differ from the overriden methods

add_section(section)

Create a new section in the configuration.

Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT or any of it’s case-insensitive variants.

check_default_values()[source]

Check the static options for forbidden data types

cleanup()[source]

Remove .ini file associated to config

filename()[source]

Create a .ini filename located in user home directory

get(section, option, default=<class guidata.userconfig.NoDefault at 0x031FD228>)[source]

Get an option section=None: attribute a default section name default: default value (if not specified, an exception will be raised if option doesn’t exist)

get_default(section, option)[source]

Get Default value for a given (section, option) -> useful for type checking in ‘get’ method

get_version(version='0.0.0')[source]

Return configuration (not application!) version

has_option(section, option)

Check for the existence of a given option in a given section.

has_section(section)

Indicate whether the named section is present in the configuration.

The DEFAULT section is not acknowledged.

items(section, raw=False, vars=None)

Return a list of tuples with (name, value) for each option in the section.

All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw’ is true. Additional substitutions may be provided using the `vars’ argument, which must be a dictionary whose contents overrides any pre-existing defaults.

The section DEFAULT is special.

options(section)

Return a list of option names for the given section name.

read(filenames)

Read and parse a filename or a list of filenames.

Files that cannot be opened are silently ignored; this is designed so that you can specify a list of potential configuration file locations (e.g. current directory, user’s home directory, systemwide directory), and all existing configuration files in the list will be read. A single filename may also be given.

Return list of successfully read files.

readfp(fp, filename=None)

Like read() but the argument must be a file-like object.

The `fp’ argument must have a `readline’ method. Optional second argument is the `filename’, which if not given, is taken from fp.name. If fp has no `name’ attribute, `<???>’ is used.

reset_to_defaults(save=True, verbose=False)[source]

Reset config to Default values

sections()

Return a list of section names, excluding [DEFAULT]

set(section, option, value, verbose=False, save=True)[source]

Set an option section=None: attribute a default section name

set_as_defaults()[source]

Set defaults from the current config

set_default(section, option, default_value)[source]

Set Default value for a given (section, option) -> called when a new (section, option) is set and no default exists

set_version(version='0.0.0', save=True)[source]

Set configuration (not application!) version

write(fp)

Write an .ini-format representation of the configuration state.

guidata.userconfig.encode_to_utf8(x)[source]

Encode unicode string in UTF-8 – but only with Python 2

guidata.userconfig.get_home_dir()[source]

Return user home directory

utils

The guidata.utils module provides various utility helper functions (pure python).

class guidata.utils.FormatTime(hours_fmt='%d H ', min_fmt='%d min ', sec_fmt='%d s')[source]

Helper object that substitute as a string to format seconds into (nn H mm min ss s)

class guidata.utils.Timer[source]

MATLAB-like timer: tic, toc

tic(cat)[source]

Starting timer

toc(cat, msg='delta:')[source]

Stopping timer

guidata.utils.add_extension(item, value)[source]

Add extension to filename item: data item representing a file path value: possible value for data item

guidata.utils.assert_interface_supported(klass, iface)[source]

Makes sure a class supports an interface

guidata.utils.assert_interfaces_valid(klass)[source]

Makes sure a class supports the interfaces it declares

guidata.utils.bind(fct, value)[source]

Returns a callable representing the function ‘fct’ with it’s first argument bound to the value

if g = bind(f,1) and f is a function of x,y,z then g(y,z) will return f(1,y,z)

guidata.utils.cythonize_all(relpath)[source]

Cythonize all Cython modules in relative path

guidata.utils.decode_fs_string(string)[source]

Convert string from file system charset to unicode

guidata.utils.get_module_path(modname)[source]

Return module modname base path

guidata.utils.get_package_data(name, extlist, exclude_dirs=[])[source]

Return data files for package name with extensions in extlist (search recursively in package directories)

guidata.utils.get_subpackages(name)[source]

Return subpackages of package name

guidata.utils.is_module_available(module_name)[source]

Return True if Python module is available

guidata.utils.is_program_installed(basename)[source]

Return program absolute path if installed in PATH Otherwise, return None

guidata.utils.isodate_to_localtime(datestr)[source]

Convert ISO date to local time

guidata.utils.localtime_to_isodate(time_struct)[source]

Convert local time to ISO date

guidata.utils.min_equals_max(min, max)[source]

Return True if minimium value equals maximum value Return False if not, or if maximum or minimum value is not defined

guidata.utils.pairs(iterable)[source]

A simple generator that takes a list and generates pairs [ (l[0],l[1]), ..., (l[n-2], l[n-1])]

guidata.utils.restore_dataset(source, dest)[source]

Restore dest dataset items from source dataset

This function is almost the same as update_dataset but requires the source to be a DataSet instead of the destination.

Symetrically from update_dataset, dest may also be a dictionary.

guidata.utils.run_program(name, args='', cwd=None, shell=True, wait=False)[source]

Run program in a separate process

guidata.utils.trace(fct)[source]

A decorator that traces function entry/exit used for debugging only

guidata.utils.unicode_to_stdout(ustr)[source]

convert a unicode string to a byte string encoded for stdout output

guidata.utils.update_dataset(dest, source, visible_only=False)[source]

Update dest dataset items from source dataset

dest should inherit from DataSet, whereas source can be:
  • any Python object containing matching attribute names
  • or a dictionary with matching key names

For each DataSet item, the function will try to get the attribute of the same name from the source.

visible_only: if True, update only visible items

guidata.utils.utf8_to_unicode(string)[source]

Convert UTF-8 string to Unicode