Package wx :: Class ArtProvider
[frames | no frames]

Type ArtProvider

object --+
         |
        ArtProvider

Known Subclasses:
Img2PyArtProvider

The wx.ArtProvider class is used to customize the look of wxWidgets application. When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file dialog), it does not use hard-coded resource but asks wx.ArtProvider for it instead. This way the users can plug in their own wx.ArtProvider class and easily replace standard art with his/her own version. It is easy thing to do: all that is needed is to derive a class from wx.ArtProvider, override it's CreateBitmap method and register the provider with wx.ArtProvider.Push:

class MyArtProvider(wx.ArtProvider):
    def __init__(self):
        wx.ArtProvider.__init__(self)

    def CreateBitmap(self, artid, client, size):
        ...
        return bmp

Identifying art resources

Every bitmap is known to wx.ArtProvider under an unique ID that is used when requesting a resource from it. The IDs can have one of the following predefined values. Additionally, any string recognized by custom art providers registered using Push may be used.

GTK+ Note

When running under GTK+ 2, GTK+ stock item IDs (e.g. 'gtk-cdrom') may be used as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then it is also possible to load icons from current icon theme by specifying their name without the extension and directory components. Icon themes recognized by GTK+ follow the freedesktop.org Icon Themes specification. Note that themes are not guaranteed to contain all icons, so wx.ArtProvider may return wx.NullBitmap or wx.NullIcon. The default theme is typically installed in /usr/share/icons/hicolor.

Clients

The Client is the entity that calls wx.ArtProvider's GetBitmap or GetIcon function. Client IDs serve as a hint to wx.ArtProvider that is supposed to help it to choose the best looking bitmap. For example it is often desirable to use slightly different icons in menus and toolbars even though they represent the same action (e.g. wx.ART_FILE_OPEN). Remember that this is really only a hint for wx.ArtProvider -- it is common that wx.ArtProvider.GetBitmap returns identical bitmap for different client values!


Method Summary
ArtProvider __init__(self)
The wx.ArtProvider class is used to customize the look of wxWidgets application.
  __del__(self)
bool Delete(provider)
Remove provider. (Static method)
  Destroy(self)
Bitmap GetBitmap(id, client, size)
Query the providers for bitmap with given ID and return it. (Static method)
Icon GetIcon(id, client, size)
Query the providers for icon with given ID and return it. (Static method)
Size GetSizeHint(client, platform_dependent)
Get the size hint of an icon from a specific Art Client, queries the topmost provider if platform_dependent = false (Static method)
  Insert(provider)
Add new provider to the bottom of providers stack. (Static method)
  InsertProvider(provider)
Add new provider to the bottom of providers stack. (Static method)
bool Pop()
Remove latest added provider and delete it. (Static method)
bool PopProvider()
Remove latest added provider and delete it. (Static method)
  Push(provider)
Add new provider to the top of providers stack. (Static method)
  PushProvider(provider)
Add new provider to the top of providers stack. (Static method)
bool RemoveProvider(provider)
Remove provider. (Static method)

Property Summary
  thisown: The membership flag

Instance Method Details

__init__(self)
(Constructor)

The wx.ArtProvider class is used to customize the look of wxWidgets application. When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file dialog), it does not use hard-coded resource but asks wx.ArtProvider for it instead. This way the users can plug in their own wx.ArtProvider class and easily replace standard art with his/her own version. It is easy thing to do: all that is needed is to derive a class from wx.ArtProvider, override it's CreateBitmap method and register the provider with wx.ArtProvider.Push:

class MyArtProvider(wx.ArtProvider):
    def __init__(self):
        wx.ArtProvider.__init__(self)

    def CreateBitmap(self, artid, client, size):
        ...
        return bmp

Identifying art resources

Every bitmap is known to wx.ArtProvider under an unique ID that is used when requesting a resource from it. The IDs can have one of the following predefined values. Additionally, any string recognized by custom art providers registered using Push may be used.

GTK+ Note

When running under GTK+ 2, GTK+ stock item IDs (e.g. 'gtk-cdrom') may be used as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then it is also possible to load icons from current icon theme by specifying their name without the extension and directory components. Icon themes recognized by GTK+ follow the freedesktop.org Icon Themes specification. Note that themes are not guaranteed to contain all icons, so wx.ArtProvider may return wx.NullBitmap or wx.NullIcon. The default theme is typically installed in /usr/share/icons/hicolor.

  • wx.ART_ADD_BOOKMARK
  • wx.ART_DEL_BOOKMARK
  • wx.ART_HELP_SIDE_PANEL
  • wx.ART_HELP_SETTINGS
  • wx.ART_HELP_BOOK
  • wx.ART_HELP_FOLDER
  • wx.ART_HELP_PAGE
  • wx.ART_GO_BACK
  • wx.ART_GO_FORWARD
  • wx.ART_GO_UP
  • wx.ART_GO_DOWN
  • wx.ART_GO_TO_PARENT
  • wx.ART_GO_HOME
  • wx.ART_FILE_OPEN
  • wx.ART_FILE_SAVE
  • wx.ART_FILE_SAVE_AS
  • wx.ART_PRINT
  • wx.ART_HELP
  • wx.ART_TIP
  • wx.ART_REPORT_VIEW
  • wx.ART_LIST_VIEW
  • wx.ART_NEW_DIR
  • wx.ART_HARDDISK
  • wx.ART_FLOPPY
  • wx.ART_CDROM
  • wx.ART_REMOVABLE
  • wx.ART_FOLDER
  • wx.ART_FOLDER_OPEN
  • wx.ART_GO_DIR_UP
  • wx.ART_EXECUTABLE_FILE
  • wx.ART_NORMAL_FILE
  • wx.ART_TICK_MARK
  • wx.ART_CROSS_MARK
  • wx.ART_ERROR
  • wx.ART_QUESTION
  • wx.ART_WARNING
  • wx.ART_INFORMATION
  • wx.ART_MISSING_IMAGE
  • wx.ART_COPY
  • wx.ART_CUT
  • wx.ART_PASTE
  • wx.ART_DELETE
  • wx.ART_NEW
  • wx.ART_UNDO
  • wx.ART_REDO
  • wx.ART_QUIT
  • wx.ART_FIND
  • wx.ART_FIND_AND_REPLACE

Clients

The Client is the entity that calls wx.ArtProvider's GetBitmap or GetIcon function. Client IDs serve as a hint to wx.ArtProvider that is supposed to help it to choose the best looking bitmap. For example it is often desirable to use slightly different icons in menus and toolbars even though they represent the same action (e.g. wx.ART_FILE_OPEN). Remember that this is really only a hint for wx.ArtProvider -- it is common that wx.ArtProvider.GetBitmap returns identical bitmap for different client values!

  • wx.ART_TOOLBAR
  • wx.ART_MENU
  • wx.ART_FRAME_ICON
  • wx.ART_CMN_DIALOG
  • wx.ART_HELP_BROWSER
  • wx.ART_MESSAGE_BOX
  • wx.ART_BUTTON
  • wx.ART_OTHER (used for all requests that don't fit into any of the categories above)
Returns:
ArtProvider
Overrides:
__builtin__.object.__init__

Static Method Details

Delete(provider)

Remove provider. The provider must have been added previously! The provider is _not_ deleted.

Parameters:
provider
           (type=ArtProvider)

Returns:
bool

GetBitmap(id, client=ART_OTHER, size=DefaultSize)

Query the providers for bitmap with given ID and return it. Return wx.NullBitmap if no provider provides it.

Parameters:
id
           (type=String)

client
           (type=String)

size
           (type=Size)

Returns:
Bitmap

GetIcon(id, client=ART_OTHER, size=DefaultSize)

Query the providers for icon with given ID and return it. Return wx.NullIcon if no provider provides it.

Parameters:
id
           (type=String)

client
           (type=String)

size
           (type=Size)

Returns:
Icon

GetSizeHint(client, platform_dependent=False)

Get the size hint of an icon from a specific Art Client, queries the topmost provider if platform_dependent = false

Parameters:
client
           (type=String)

platform_dependent
           (type=bool)

Returns:
Size

Insert(provider)

Add new provider to the bottom of providers stack.

Parameters:
provider
           (type=ArtProvider)

InsertProvider(provider)

Add new provider to the bottom of providers stack.

Parameters:
provider
           (type=ArtProvider)

Pop()

Remove latest added provider and delete it.

Returns:
bool

PopProvider()

Remove latest added provider and delete it.

Returns:
bool

Push(provider)

Add new provider to the top of providers stack.

Parameters:
provider
           (type=ArtProvider)

PushProvider(provider)

Add new provider to the top of providers stack.

Parameters:
provider
           (type=ArtProvider)

RemoveProvider(provider)

Remove provider. The provider must have been added previously! The provider is _not_ deleted.

Parameters:
provider
           (type=ArtProvider)

Returns:
bool

Property Details

thisown

The membership flag


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:12 2007 http://epydoc.sf.net