Пример #1
0
def add_combo_text_column(combo, data_func=None, **kwargs):
    kwargs["xalign"] = kwargs.get("xalign", 0.0)
    kwargs, col_attrs = parse_kwargs(**kwargs)
    rend = get_default_renderer('text', **kwargs)
    add_renderer_with_attrs(combo, col_attrs, rend)
    if data_func != None:
        callback, args = parse_callback(data_func)
        combo.set_cell_data_func(rend, callback, args)
    return rend
Пример #2
0
def add_combo_text_column(combo,
        data_func=None,
        **kwargs):
    kwargs["xalign"] = kwargs.get("xalign", 0.0)
    kwargs, col_attrs = parse_kwargs(**kwargs)
    rend = get_default_renderer('text', **kwargs)
    add_renderer_with_attrs(combo, col_attrs, rend)
    if data_func!=None:
        callback, args = parse_callback(data_func)
        combo.set_cell_data_func(rend, callback, args)
    return rend
Пример #3
0
def _get_default_column(title,
                        rend,
                        data_func=None,
                        spacing=0,
                        visible=True,
                        resizable=True,
                        sizing=0,
                        fixed_width=-1,
                        min_width=-1,
                        max_width=-1,
                        expand=True,
                        clickable=False,
                        alignment=0.0,
                        reorderable=False,
                        sort_column_id=-1,
                        sort_indicator=False,
                        sort_order=gtk.SORT_ASCENDING,
                        col_attrs={}):
    """
        Creates a PyXRDTreeViewColumn using the arguments passed. Column 
        attribute mappings are to be passed as a single dict,
        not as key-word arguments.
    """
    col = PyXRDTreeViewColumn(title, rend, **col_attrs)
    if data_func is not None:
        callback, args = parse_callback(data_func)
        col.set_cell_data_func(rend, callback, args)
    col.set_spacing(spacing)
    col.set_visible(visible)
    col.set_resizable(resizable)
    col.set_sizing(sizing)
    if fixed_width >= 0:
        col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
        col.set_fixed_width(fixed_width)
    else:
        col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
    col.set_min_width(min_width)
    col.set_max_width(max_width)
    col.set_title(title)
    col.set_expand(expand)
    col.set_clickable(clickable)
    col.set_alignment(alignment)
    col.set_reorderable(reorderable)
    col.set_sort_column_id(sort_column_id)
    col.set_sort_indicator(sort_indicator)
    col.set_sort_order(sort_order)
    col.set_resizable(resizable)
    col.set_expand(expand)
    col.set_alignment(alignment)
    return col
Пример #4
0
def _get_default_column(title, rend,
        data_func=None,
        spacing=0,
        visible=True,
        resizable=True,
        sizing=0,
        fixed_width=-1,
        min_width=-1,
        max_width=-1,
        expand=True,
        clickable=False,
        alignment=0.0,
        reorderable=False,
        sort_column_id=-1,
        sort_indicator=False,
        sort_order=gtk.SORT_ASCENDING,
        col_attrs={}):
    """
        Creates a PyXRDTreeViewColumn using the arguments passed. Column 
        attribute mappings are to be passed as a single dict,
        not as key-word arguments.
    """
    col = PyXRDTreeViewColumn(title, rend, **col_attrs)
    if data_func is not None:
        callback, args = parse_callback(data_func)
        col.set_cell_data_func(rend, callback, args)
    col.set_spacing(spacing)
    col.set_visible(visible)
    col.set_resizable(resizable)
    col.set_sizing(sizing)
    if fixed_width >= 0:
        col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
        col.set_fixed_width(fixed_width)
    else:
        col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
    col.set_min_width(min_width)
    col.set_max_width(max_width)
    col.set_title(title)
    col.set_expand(expand)
    col.set_clickable(clickable)
    col.set_alignment(alignment)
    col.set_reorderable(reorderable)
    col.set_sort_column_id(sort_column_id)
    col.set_sort_indicator(sort_indicator)
    col.set_sort_order(sort_order)
    col.set_resizable(resizable)
    col.set_expand(expand)
    col.set_alignment(alignment)
    return col
Пример #5
0
def new_text_column(title,
                    edited_callback=None,
                    data_func=None,
                    spacing=0,
                    visible=True,
                    resizable=True,
                    sizing=0,
                    fixed_width=-1,
                    min_width=-1,
                    max_width=-1,
                    expand=True,
                    clickable=False,
                    alignment=None,
                    reorderable=False,
                    sort_column_id=-1,
                    sort_indicator=False,
                    sort_order=gtk.SORT_ASCENDING,
                    **kwargs):
    """
        Creates a TreeViewColumn packed with a CellRendererText .
    """
    kwargs, col_attrs = parse_kwargs(**kwargs)
    alignment = alignment if alignment is not None else kwargs["xalign"]

    rend = get_default_renderer(gtk.CellRendererText, **kwargs)
    if edited_callback is not None:
        callback, args = parse_callback(edited_callback, reduce=False)
        rend.connect('edited', callback, *args)

    col = _get_default_column(title,
                              rend,
                              data_func=data_func,
                              spacing=spacing,
                              visible=visible,
                              resizable=resizable,
                              sizing=sizing,
                              fixed_width=fixed_width,
                              min_width=min_width,
                              max_width=max_width,
                              expand=expand,
                              clickable=clickable,
                              alignment=alignment,
                              reorderable=reorderable,
                              sort_column_id=sort_column_id,
                              sort_indicator=sort_indicator,
                              sort_order=sort_order,
                              col_attrs=col_attrs)
    return col
Пример #6
0
def new_text_column(title,
        edited_callback=None,
        data_func=None,
        spacing=0,
        visible=True,
        resizable=True,
        sizing=0,
        fixed_width=-1,
        min_width=-1,
        max_width=-1,
        expand=True,
        clickable=False,
        alignment=None,
        reorderable=False,
        sort_column_id=-1,
        sort_indicator=False,
        sort_order=gtk.SORT_ASCENDING,
        **kwargs):
    """
        Creates a TreeViewColumn packed with a CellRendererText .
    """
    kwargs, col_attrs = parse_kwargs(**kwargs)
    alignment = alignment if alignment is not None else kwargs["xalign"]

    rend = get_default_renderer(gtk.CellRendererText, **kwargs)
    if edited_callback is not None:
        callback, args = parse_callback(edited_callback, reduce=False)
        rend.connect('edited', callback, *args)

    col = _get_default_column(
        title, rend,
        data_func=data_func,
        spacing=spacing,
        visible=visible,
        resizable=resizable,
        sizing=sizing,
        fixed_width=fixed_width,
        min_width=min_width,
        max_width=max_width,
        expand=expand,
        clickable=clickable,
        alignment=alignment,
        reorderable=reorderable,
        sort_column_id=sort_column_id,
        sort_indicator=sort_indicator,
        sort_order=sort_order,
        col_attrs=col_attrs)
    return col