Author: bugman
Date: Tue Dec 28 20:51:10 2010
New Revision: 12000
URL: http://svn.gna.org/viewcvs/relax?rev=12000&view=rev
Log:
Shifted the about relax cursor_style() method to the base class so that
moving over URLs changes the cursor.
Modified:
branches/bieri_gui/gui_bieri/about.py
Modified: branches/bieri_gui/gui_bieri/about.py
URL:
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/about.py?rev=12000&r1=11999&r2=12000&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/about.py (original)
+++ branches/bieri_gui/gui_bieri/about.py Tue Dec 28 20:51:10 2010
@@ -78,6 +78,9 @@
self.total_y = self.dim_y + 2*self.border
self.SetSize((self.total_x, self.total_y))
+ # The starting cursor type.
+ self.cursor_type = 'normal'
+
# Initialise URL data structures.
self.url_text = []
self.url_pos = []
@@ -152,10 +155,41 @@
def cursor_style(self, event):
- """Dummy method for not changing the mouse cursor!"""
-
- # Terminate the event.
- event.Skip()
+ """Change the mouse cursor when over the url."""
+
+ # Determine the mouse position.
+ x = event.GetX()
+ y = event.GetY()
+
+ # Selection cursor.
+ over_url = False
+ for i in range(len(self.url_pos)):
+ if x > self.url_pos[i][0, 0] and x < self.url_pos[i][0, 1] and y
self.url_pos[i][1, 0] and y < self.url_pos[i][1, 1]:
+ over_url = True
+
+ # Only change if needed.
+ if over_url and self.cursor_type == 'normal':
+ # Build the cursor.
+ select_cursor = wx.StockCursor(wx.CURSOR_HAND)
+
+ # Set the cursor.
+ self.window.SetCursor(select_cursor)
+
+ # Reset the cursor type.
+ self.cursor_type = 'select'
+
+ # The flag.
+
+ # Normal cursor.
+ if not over_url and self.cursor_type == 'select':
+ # Build the cursor.
+ select_cursor = wx.StockCursor(wx.CURSOR_ARROW)
+
+ # Set the cursor.
+ self.window.SetCursor(select_cursor)
+
+ # Reset the cursor type.
+ self.cursor_type = 'normal'
def draw_url(self, url_text=None, point_size=11,
family=wx.FONTFAMILY_ROMAN):
@@ -437,9 +471,6 @@
# Initialise the program information container.
self.info = Info_box()
- # The starting cursor type.
- self.cursor_type = 'normal'
-
# Execute the base class __init__() method.
super(About_relax, self).__init__(parent=parent, id=id, title=title)
@@ -461,44 +492,6 @@
self.draw_licence()
- def cursor_style(self, event):
- """Change the mouse cursor when over the url."""
-
- # Determine the mouse position.
- x = event.GetX()
- y = event.GetY()
-
- # Selection cursor.
- over_url = False
- for i in range(len(self.url_pos)):
- if x > self.url_pos[i][0, 0] and x < self.url_pos[i][0, 1] and y
self.url_pos[i][1, 0] and y < self.url_pos[i][1, 1]:
- over_url = True
-
- # Only change if needed.
- if over_url and self.cursor_type == 'normal':
- # Build the cursor.
- select_cursor = wx.StockCursor(wx.CURSOR_HAND)
-
- # Set the cursor.
- self.window.SetCursor(select_cursor)
-
- # Reset the cursor type.
- self.cursor_type = 'select'
-
- # The flag.
-
- # Normal cursor.
- if not over_url and self.cursor_type == 'select':
- # Build the cursor.
- select_cursor = wx.StockCursor(wx.CURSOR_ARROW)
-
- # Set the cursor.
- self.window.SetCursor(select_cursor)
-
- # Reset the cursor type.
- self.cursor_type = 'normal'
-
-
def draw_copyright(self):
"""Draw the copyright statements."""