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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 438 by jonathan, Thu Feb 27 15:53:48 2003 UTC revision 2700 by dpinte, Mon Sep 18 14:27:02 2006 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001 by Intevation GmbH  # Copyright (c) 2001, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Jonathan Coles <[email protected]>  # Jonathan Coles <[email protected]>
4  #  #
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    """Miscellaneous UI related functions"""
9    
10    __version__ = "$Revision$"
11    # $Source$
12    # $Id$
13    
14    
15  from Thuban.Model.color import Color  from Thuban.Model.color import Color
16  from wxPython.wx import wxColour  import wx
17    
18  def Color2wxColour(color):  def Color2wxColour(color):
19      assert(color is not None)      """Return a wxColor object for the Thuban color object color"""
20      assert(isinstance(color, Color))      return wx.Colour(int(round(color.red * 255)),
21      return wxColour(color.red   * 255,                      int(round(color.green * 255)),
22                      color.green * 255,                      int(round(color.blue * 255)))
                     color.blue  * 255)  
23    
24  def wxColour2Color(colour):  def wxColour2Color(colour):
25        """Return a Thuban color object for the wxColor object color"""
26      assert(colour is not None)      assert(colour is not None)
27      # this doesn't work because colour is really a wxColourPtr!      # this doesn't work because colour is really a wxColourPtr!
28      #assert(isinstance(colour, wxColour))      #assert(isinstance(colour, wxColour))
# Line 23  def wxColour2Color(colour): Line 30  def wxColour2Color(colour):
30                   colour.Green() / 255.0,                   colour.Green() / 255.0,
31                   colour.Blue()  / 255.0)                   colour.Blue()  / 255.0)
32    
33    def ThubanBeginBusyCursor():
34        """Thuban wrapper for wxBeginBusyCursor
35    
36        In addition to calling wxBeginBusyCursor this function also calls
37        wxSafeYield to make sure that the cursor change takes effect. wxGTK
38        2.4 at least doesn't do that automatically.
39    
40        This function and the corresponding ThubanEndBusyCursor function are
41        the functions to use in Thuban to set a busy cursor.
42        """
43        wx.BeginBusyCursor()
44        wx.SafeYield()
45    
46    def ThubanEndBusyCursor():
47        """Thuban wrapper for wxEndBusyCursor
48    
49        This function doesn't do anything more than calling wxEndBusyCursor
50        yet, but please use this whereever you use ThubanBeginBusyCursor.
51        """
52        wx.EndBusyCursor()

Legend:
Removed from v.438  
changed lines
  Added in v.2700

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26