widgets Package

widgets Package

accounttree Module

class stoqlib.gui.widgets.accounttree.StockTextColumn(*args, **kwargs)[source]

Bases: kiwi.ui.objectlist.Column

A column which you can add a stock item and a text

attach(objectlist)[source]
cell_data_func(tree_column, renderer, model, treeiter, (column, renderer_prop))[source]
stoqlib.gui.widgets.accounttree.sort_models(a, b)[source]
class stoqlib.gui.widgets.accounttree.AccountTree(with_code=True, create_mode=False)[source]

Bases: kiwi.ui.objectlist.ObjectTree

get_pixbuf(model)[source]
insert_initial(store, edited_account=None)[source]

Insert accounts and parent accounts in a ObjectTree.

Parameters:
  • store – a store
  • edited_account – If not None, this is the account being edited. In this case, this acount (and its decendents) will not be shown in the account tree.
add_account(parent_id, account)[source]
get_account_by_id(account_id)[source]
refresh_accounts(store, account=None)[source]

calculator Module

class stoqlib.gui.widgets.calculator.CalculatorPopup(entry, mode)[source]

Bases: kiwi.ui.popup.PopupWindow

A popup calculator for entries

Right now it supports both kiwi.ui.widgets.spinbutton.ProxySpinButton and kiwi.ui.widgets.entry.ProxyEntry, as long as their data types are numeric (e.g. int, currency, Decimal, etc)

MODE_ADD = 0

The add mode. Any value typed on the entry will be added to the original value. e.g. 10% means +10%

MODE_SUB = 1

The sub mode. Any value typed on the entry will be subtracted from the original value. e.g. 10% means -10%

get_main_widget()[source]
validate_popup()[source]
confirm()[source]

fieldgrid Module

Widget containing a Grid of fields

class stoqlib.gui.widgets.fieldgrid.Range(start, end)[source]

Bases: object

class stoqlib.gui.widgets.fieldgrid.FieldInfo(grid, name, widget, x, y, width=-1, height=1, model=None)[source]

Bases: object

update_label(text)[source]
allocate(width, height)[source]
find_at(x, y)[source]
show()[source]
get_cursor(x, y)[source]
class stoqlib.gui.widgets.fieldgrid.FieldGrid(font, width, height)[source]

Bases: gtk.Layout

FieldGrid is a Grid like widget which you can add fields to

  • field-added (object): Emitted when a field is added to the grid
  • field-removed (object): Emitted when a field is removed from the grid
  • ** selection-changed** (object): Emitted when a field is selected or deselected by the user.
do_realize()[source]
do_size_request(req)[source]
do_expose_event(event)[source]
do_button_press_event(event)[source]
do_button_release_event(event)[source]
do_motion_notify_event(event)[source]
do_key_press_event(event)[source]
do_drag_drop(context, x, y, time)[source]
do_drag_data_received(context, x, y, data, info, time)[source]
do_focus(direction)[source]
add_field(text, description, x, y, width=-1, height=1, model=None)[source]

Adds a new field to the grid

Parameters:
  • text – text of the field
  • description – description of the field
  • x – x position of the field
  • y – y position of the field
select_field(field)[source]

Selects a field :param field: the field to select, must be FieldInfo or None

get_selected_field()[source]

Returns the currently selected field :returns: the currently selected field :rtype: FieldInfo

get_fields()[source]

Returns a list of fields in the grid :returns: a list of fields in the grid

objectlist_dnd_handler(item, x, y)[source]

A subclass can implement this to support dnd from an ObjectList. :param item: the row dragged from the objectlist :param x: the x position it was dragged to :param y: the y position it was dragged to

resize(width, height)[source]

Resize the grid. :param width: the new width :param height: the new height

hintedentry Module

class stoqlib.gui.widgets.hintedentry.HintedEntry[source]

Bases: kiwi.ui.entry.KiwiEntry

set_hint(text)[source]
set_text(text)[source]
get_text()[source]
show_hint()[source]
show_text(text)[source]
do_grab_focus()[source]
do_focus_in_event(event)[source]
do_focus_out_event(event)[source]

kanbanview Module

class stoqlib.gui.widgets.kanbanview.KanbanObjectListColumn(attribute='', title=None, data_type=None, **kwargs)[source]

Bases: kiwi.ui.objectlist.Column

create_renderer(model)[source]
class stoqlib.gui.widgets.kanbanview.CellRendererTextBox[source]

Bases: gtk.CellRendererText

PADDING = 3
SIZE = 6
margin_color

the magin color of the renderer, this the part to the left of it, indicating a category color

do_render(drawable, widget, background_area, cell_area, expose_area, flags)[source]
on_get_size(widget, cell_area=None)[source]
do_get_property(pspec)
do_set_property(pspec, value)
class stoqlib.gui.widgets.kanbanview.KanbanViewColumn(title, value)[source]

Bases: object

A column in a KanbanView

It just has a title and can be cleared via clear and you can append an item via append_item

clear()[source]

Clear this view, eg remove all the items

append_item(item)[source]

Append an item to the view

class stoqlib.gui.widgets.kanbanview.KanbanView[source]

Bases: gtk.Frame

This is a kanban view which can be used to display a set of columns with boxes that can be rearranged.

TREEVIEW_DND_TARGETS = [('text/plain', 0, 1)]
clear()[source]

Clears the view and all it’s columns.

get_column_by_title(column_title)[source]

Get a column given a title

Returns:a column or None if none are found
add_column(column)[source]

Adds a new column to the view

Parameters:column (KanbanViewColumn) – column to add
enable_editing()[source]

Makes it possible to edit items within this treeview.

You also need to return True in the ::item-dragged callback for an item to be draggable.

select(item)[source]

Select an item in the view

Parameters:item – the item to select or None to unselect all
get_selected_item()[source]

Get the currently selected item from the view

Returns:the selected item or None if no items are selected
render_item(column, renderer, item)[source]

Renders an item, this is an optional hook that can be implemented by a subclass.

Parameters:
  • column – the treeview column
  • renderer – the cell renderer
Parma item:

the item

get_n_items()[source]
set_message(markup)[source]

Adds a message on top of the treeview rows :param markup: PangoMarkup with the text to add

clear_message()[source]
stoqlib.gui.widgets.kanbanview.main()[source]

lazyobjectlist Module

stoqlib.gui.widgets.lazyobjectlist.debug(func)[source]
class stoqlib.gui.widgets.lazyobjectlist.LazyObjectModelRow(item, path, iter)[source]

Bases: object

class stoqlib.gui.widgets.lazyobjectlist.LazyObjectModel(objectlist, result, executer, initial_count)[source]

Bases: gtk.GenericTreeModel, gtk.TreeSortable

on_get_flags()[source]
on_get_n_columns()[source]
on_get_column_type(index)[source]
on_get_value(row, column)[source]
on_get_iter(path)[source]
on_get_path(row)[source]
on_iter_parent(row)[source]
on_iter_next(row)[source]
on_iter_has_child(row)[source]
on_iter_children(row)[source]
on_iter_n_children(row)[source]
on_iter_nth_child(parent, n)[source]
do_get_sort_column_id_gtk2()[source]
do_get_sort_column_id()[source]
do_set_sort_column_id(sort_column_id, sort_order)[source]
do_set_sort_func(sort_column_id, sort_func, user_data=None)[source]
do_set_default_sort_func(sort_func, user_data=None)[source]
do_has_default_sort_func()[source]
clear()[source]
load_items_from_results(start, end)[source]

Fetchs rows from the database and displays in the model :param start: index of the first row to load :param end: index of the last row to load

get_post_data()[source]
class stoqlib.gui.widgets.lazyobjectlist.LazyObjectListUpdater(search, objectlist)[source]

Bases: object

This is a helper that updates the list automatically when you scroll down in it. Similar to what twisted / facebook does (as of 2012)

EXTRA_ROWS = 30
SCROLL_TIMEOUT = 10
INITIAL_ROWS = 50
THRESHOLD = 250
add_results(results)[source]
class stoqlib.gui.widgets.lazyobjectlist.LazySummaryLabel(klist, column, label='Total:', value_format='%s', font_desc=None)[source]

Bases: kiwi.ui.objectlist.ListLabel

update_total(value=None)[source]

Recalculate the total value of all columns

notebookbutton Module

class stoqlib.gui.widgets.notebookbutton.NotebookCloseButton[source]

Bases: gtk.Button

A simple button that doesn’t have much border or padding, to be used specially with notebooks.

processview Module

Process View a simple view of a process’ stdout or stderr

class stoqlib.gui.widgets.processview.ProcessView[source]

Bases: gtk.ScrolledWindow

execute_command(args)[source]
feed(line)[source]
terminal

queryentry Module

class stoqlib.gui.widgets.queryentry.QueryEntryGadget(entry, store, initial_value=None, parent=None, run_editor=None, edit_button=None, info_button=None, search_clause=None)[source]

Bases: object

This gadget modifies a ProxyEntry to behave like a ProxyComboEntry.

When instanciated, the gadget will remove the entry from the editor, add a gtk.HBox on its place, and re-attach the entry to the newly created hbox. This hbox will also have a button to add/edit a new object.

There are a few advantages in using this instead of a combo:

  • There is no need to prefill the combo with all the options, which can be very slow depending on the number of objects.
  • This allows the user to use a better search mechanism, allowing him to filter using multiple keywords and even candidade keys (like a client document)
MIN_KEY_LENGTH = 1
LOADING_ITEMS_TEXT = 'Loading items...'
NEW_ITEM_TEXT = 'Create a new item with that name'
NEW_ITEM_TOOLTIP = 'Create a new item'
EDIT_ITEM_TOOLTIP = 'Edit the selected item'
INFO_ITEM_TOOLTIP = 'See info about the selected item'
NO_ITEMS_FOUND_TEXT = 'No items found'
selection_only = False
item_editor = None
item_info_dialog

alias of ClientEditor

search_class = None
search_spec = None
search_columns = None
set_value(obj, force=False)[source]
set_editable(can_edit)[source]
update_edit_button(stock, tooltip=None)[source]
get_object_from_item(item)[source]
describe_item(item)[source]
class stoqlib.gui.widgets.queryentry.PersonEntryGadget(entry, store, initial_value=None, parent=None, run_editor=None, edit_button=None, info_button=None)[source]

Bases: stoqlib.gui.widgets.queryentry.QueryEntryGadget

person_type = None
get_object_from_item(item)[source]
describe_item(person_view)[source]
class stoqlib.gui.widgets.queryentry.ClientEntryGadget(entry, store, initial_value=None, parent=None, run_editor=None, edit_button=None, info_button=None)[source]

Bases: stoqlib.gui.widgets.queryentry.PersonEntryGadget

LOADING_ITEMS_TEXT = 'Loading clients...'
NEW_ITEM_TEXT = 'Create a new client with this name...'
NEW_ITEM_TOOLTIP = 'Create a new client'
EDIT_ITEM_TOOLTIP = 'Edit the selected client'
INFO_ITEM_TOOLTIP = 'See info about the selected client'
item_editor

alias of ClientEditor

item_info_dialog

alias of ClientDetailsDialog

person_type

alias of Client

search_class

alias of ClientSearch

search_spec

alias of ClientView

search_columns = [<storm.properties.PropertyColumn object at 0x7f2cb4e9d3d0>, <storm.properties.PropertyColumn object at 0x7f2cb4e9dd70>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d4b0>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d360>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d670>, <storm.properties.PropertyColumn object at 0x7f2cb4e9db40>]
class stoqlib.gui.widgets.queryentry.SupplierEntryGadget(entry, store, initial_value=None, parent=None, run_editor=None, edit_button=None, info_button=None)[source]

Bases: stoqlib.gui.widgets.queryentry.PersonEntryGadget

LOADING_ITEMS_TEXT = 'Loading suppliers...'
NEW_ITEM_TEXT = 'Create a new supplier with this name...'
NEW_ITEM_TOOLTIP = 'Create a new supplier'
EDIT_ITEM_TOOLTIP = 'Edit the selected supplier'
INFO_ITEM_TOOLTIP = 'See info about the selected supplier'
item_editor

alias of SupplierEditor

item_info_dialog

alias of SupplierDetailsDialog

person_type

alias of Supplier

search_class

alias of SupplierSearch

search_spec

alias of SupplierView

search_columns = [<storm.properties.PropertyColumn object at 0x7f2cb4e9d3d0>, <storm.properties.PropertyColumn object at 0x7f2cb4e9dd70>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d4b0>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d360>, <storm.properties.PropertyColumn object at 0x7f2cb4e9d670>, <storm.properties.PropertyColumn object at 0x7f2cb4e9db40>]
class stoqlib.gui.widgets.queryentry.SaleTokenEntryGadget(entry, store, initial_value=None, parent=None, run_editor=None, edit_button=None, info_button=None, search_clause=None)[source]

Bases: stoqlib.gui.widgets.queryentry.QueryEntryGadget

LOADING_ITEMS_TEXT = 'Loading tokens...'
NO_ITEMS_FOUND_TEXT = 'No tokens found... Register some in the admin app'
selection_only = True
search_spec

alias of SaleTokenView

search_columns = [<storm.properties.PropertyColumn object at 0x7f2cb411b1a0>, <storm.properties.PropertyColumn object at 0x7f2cb411b280>, <storm.expr.Coalesce object at 0x7f2cb41cf590>]
get_object_from_item(item)[source]
describe_item(sale_token_view)[source]

searchfilterbutton Module

class stoqlib.gui.widgets.searchfilterbutton.SearchFilterButton(label=None, stock=None, use_underline=True)[source]

Bases: gtk.Button

set_label_visible(visible)[source]
set_icon_size(icon_size)[source]

searchentry Module

A gadget that will transform a regular entry in an advanced entry, that allows the user to select the object using a regular search.

class stoqlib.gui.widgets.searchentry.SearchEntryGadget(entry, store, model, model_property, search_columns, search_class, parent, run_editor=None)[source]

Bases: object

find_tooltip = 'Search'
edit_tooltip = 'Edit'
new_tooltip = 'Create'
set_value(obj)[source]
get_model_obj(obj)[source]
update_edit_button(stock, tooltip)[source]
class stoqlib.gui.widgets.searchentry.ClientSearchEntryGadget(entry, store, model, parent, model_property='client', search_class=<class 'stoqlib.gui.search.personsearch.ClientSearch'>, run_editor=None)[source]

Bases: stoqlib.gui.widgets.searchentry.SearchEntryGadget

find_tooltip = 'Search for clients'
edit_tooltip = 'Edit the selected client'
new_tooltip = 'Create a new client'
get_model_obj(obj)[source]
set_editable(can_edit)[source]

splash Module

Splash screen helper

class stoqlib.gui.widgets.splash.SplashScreen[source]

Bases: gtk.Window

draw(widget, cr)[source]
expose(widget, event)[source]
show()[source]
stoqlib.gui.widgets.splash.show_splash()[source]

toolmenuaction Module

class stoqlib.gui.widgets.toolmenuaction.ToolMenuAction[source]

Bases: gtk.Action

add_actions(uimanager, actions, add_separator=True, position=None)[source]

webview Module

stoqlib.gui.widgets.webview.register_scheme(scheme)[source]
class stoqlib.gui.widgets.webview.WebView[source]

Bases: gtk.ScrolledWindow

refresh()[source]
get_view()[source]
print_()[source]
load_uri(uri)[source]
load_string(html, mime_type='text/html', encoding='utf-8')[source]
js_function_call(function, *args)[source]
web_open_uri(kwargs)[source]
stoqlib.gui.widgets.webview.show_html(html)[source]