/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/common.py
ViewVC logotype

Contents of /branches/WIP-pyshapelib-bramz/Thuban/UI/common.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1541 - (show annotations)
Fri Aug 1 16:13:27 2003 UTC (21 years, 7 months ago) by bh
Original Path: trunk/thuban/Thuban/UI/common.py
File MIME type: text/x-python
File size: 1752 byte(s)
Insert cvs keywords and doc-strings.
(Color2wxColour, wxColour2Color, ThubanBeginBusyCursor)
(ThubanEndBusyCursor): Add doc-strings

1 # Copyright (c) 2001, 2003 by Intevation GmbH
2 # Authors:
3 # Jonathan Coles <[email protected]>
4 #
5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with Thuban for details.
7
8 """Miscellaneous UI related functions"""
9
10 __version__ = "$Revision$"
11 # $Source$
12 # $Id$
13
14
15 from Thuban.Model.color import Color
16 from wxPython.wx import wxColour, \
17 wxBeginBusyCursor, wxEndBusyCursor, wxSafeYield
18
19 def Color2wxColour(color):
20 """Return a wxColor object for the Thuban color object color"""
21 assert(color is not None)
22 assert(isinstance(color, Color))
23 return wxColour(color.red * 255,
24 color.green * 255,
25 color.blue * 255)
26
27 def wxColour2Color(colour):
28 """Return a Thuban color object for the wxColor object color"""
29 assert(colour is not None)
30 # this doesn't work because colour is really a wxColourPtr!
31 #assert(isinstance(colour, wxColour))
32 return Color(colour.Red() / 255.0,
33 colour.Green() / 255.0,
34 colour.Blue() / 255.0)
35
36 def ThubanBeginBusyCursor():
37 """Thuban wrapper for wxBeginBusyCursor
38
39 In addition to calling wxBeginBusyCursor this function also calls
40 wxSafeYield to make sure that the cursor change takes effect. wxGTK
41 2.4 at least doesn't do that automatically.
42
43 This function and the corresponding ThubanEndBusyCursor function are
44 the functions to use in Thuban to set a busy cursor.
45 """
46 wxBeginBusyCursor()
47 wxSafeYield()
48
49 def ThubanEndBusyCursor():
50 """Thuban wrapper for wxEndBusyCursor
51
52 This function doesn't do anything more than calling wxEndBusyCursor
53 yet, but please use this whereever you use ThubanBeginBusyCursor.
54 """
55 wxEndBusyCursor()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26