File: resource.py

package info (click to toggle)
thuban 1.2.2-14
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,176 kB
  • sloc: python: 30,410; ansic: 6,181; xml: 4,234; cpp: 1,595; makefile: 145
file content (36 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) 2003 by Intevation GmbH
# Authors:
# Jonathan Coles <jonathan@intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with Thuban for details.

"""Acess to UI-related resources"""

__version__ = "$Revision: 2880 $"
# $Source$
# $Id: resource.py 2880 2009-06-29 14:06:24Z dpinte $


import os
import Thuban
from Thuban.Lib.fileutil import get_thuban_dir

import wx


# The directory where the toolbar icons are stored has to be changed for
# the debian package to be conformant with the FHS
#bitmapdir = os.path.join(get_thuban_dir(), "Resources", "Bitmaps")
bitmapdir = "/usr/share/thuban/Resources/Bitmaps"
bitmap_extensions = {wx.BITMAP_TYPE_XPM: ".xpm",
                     wx.BITMAP_TYPE_ANY: ""}

def GetBitmapResource(file, type):
    filename = os.path.join(bitmapdir, file) + bitmap_extensions[type]
    return wx.Bitmap(filename, type)

def GetImageResource(file, type):
    filename = os.path.join(bitmapdir, file) + bitmap_extensions[type]
    return wx.Image(filename, type)