5 |
# This program is free software under the GPL (>=v2) |
# This program is free software under the GPL (>=v2) |
6 |
# Read the file COPYING coming with Thuban for details. |
# Read the file COPYING coming with Thuban for details. |
7 |
|
|
8 |
|
"""Acess to UI-related resources""" |
9 |
|
|
10 |
|
__version__ = "$Revision$" |
11 |
|
# $Source$ |
12 |
|
# $Id$ |
13 |
|
|
14 |
|
|
15 |
import os |
import os |
16 |
import Thuban |
import Thuban |
17 |
|
|
18 |
from wxPython.wx import wxBITMAP_TYPE_XPM, wxBitmap |
import wx |
19 |
|
|
20 |
|
|
21 |
bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps") |
bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps") |
22 |
EXT_XPM = ".xpm" |
bitmap_extensions = {wx.BITMAP_TYPE_XPM: ".xpm", |
23 |
EXT_NONE = "" |
wx.BITMAP_TYPE_ANY: ""} |
|
|
|
24 |
|
|
25 |
def GetBitmapResource(file, type): |
def GetBitmapResource(file, type): |
26 |
if type == wxBITMAP_TYPE_XPM: |
filename = os.path.join(bitmapdir, file) + bitmap_extensions[type] |
27 |
ext = EXT_XPM |
return wx.Bitmap(filename, type) |
|
else: |
|
|
ext = EXT_NONE |
|
28 |
|
|
29 |
filename = os.path.join(bitmapdir, file) + ext |
def GetImageResource(file, type): |
30 |
return wxBitmap(filename, type) |
filename = os.path.join(bitmapdir, file) + bitmap_extensions[type] |
31 |
|
return wx.Image(filename, type) |
32 |
|
|