Revision: 3833
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3833&view=rev
Author:   jrevans
Date:     2007-09-11 12:40:27 -0700 (Tue, 11 Sep 2007)

Log Message:
-----------
Added the ability for the following in the various GUI backends:
>>> import pylab
>>> fig = pylab.figure()
>>> fig.canvas.set_window_title("My Plot Window")

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backend_bases.py
    trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
    trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
    trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
    trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
    trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
    trunk/matplotlib/lib/matplotlib/backends/backend_wx.py

Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py    2007-09-11 18:46:47 UTC 
(rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py    2007-09-11 19:40:27 UTC 
(rev 3833)
@@ -1205,6 +1205,14 @@
     def get_default_filetype(self):
         raise NotImplementedError
     
+    def set_window_title(self, title):
+        """
+        Set the title text of the window containing the figure.  Note that
+        this has no effect if there is no window (eg, a PS backend).
+        """
+        if hasattr(self, "manager"):
+            self.manager.set_window_title(title)
+
     def switch_backends(self, FigureCanvasClass):
         """
         instantiate an instance of FigureCanvasClass
@@ -1317,6 +1325,13 @@
         """
         pass
 
+    def set_window_title(self, title):
+        """
+        Set the title text of the window containing the figure.  Note that
+        this has no effect if there is no window (eg, a PS backend).
+        """
+        pass
+
 # cursors
 class Cursors:  #namespace
     HAND, POINTER, SELECT_REGION, MOVE = range(4)

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py 2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py 2007-09-11 
19:40:27 UTC (rev 3833)
@@ -299,6 +299,9 @@
         self.canvas.draw()
         self.window.redraw()
 
+    def set_window_title(self, title):
+        self.window_title=title
+        self.window.label(title)
 
 class AxisMenu:
     def __init__(self, toolbar):

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2007-09-11 
19:40:27 UTC (rev 3833)
@@ -460,6 +460,8 @@
             toolbar = None
         return toolbar
 
+    def set_window_title(self, title):
+        self.window.set_title(title)
 
     def resize(self, width, height):
         'set the canvas size in pixels'

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py      2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py      2007-09-11 
19:40:27 UTC (rev 3833)
@@ -247,6 +247,9 @@
         if DEBUG: print "destroy figure manager"
         self.window.close(True)
 
+    def set_window_title(self, title):
+        self.window.setCaption(title)
+
 class NavigationToolbar2QT( NavigationToolbar2, qt.QWidget ):
     # list of toolitems to add to the toolbar, format is:
     # text, tooltip_text, image_file, callback(str)

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2007-09-11 
19:40:27 UTC (rev 3833)
@@ -249,6 +249,9 @@
         if DEBUG: print "destroy figure manager"
         self.window.close()
 
+    def set_window_title(self, title):
+        self.window.setWindowTitle(title)
+
 class NavigationToolbar2QT( NavigationToolbar2, QtGui.QWidget ):
     # list of toolitems to add to the toolbar, format is:
     # text, tooltip_text, image_file, callback(str)

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2007-09-11 
19:40:27 UTC (rev 3833)
@@ -349,6 +349,9 @@
             pass
         self.window = None
 
+    def set_window_title(self, title):
+        self.window.wm_title(title)
+
 class AxisMenu:
     def __init__(self, master, naxes):
         self._master = master

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py      2007-09-11 
18:46:47 UTC (rev 3832)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py      2007-09-11 
19:40:27 UTC (rev 3833)
@@ -1399,6 +1399,9 @@
         #wx.GetApp().ProcessIdle()
         wx.WakeUpIdle()
 
+    def set_window_title(self, title):
+        self.window.SetTitle(title)
+
 # Identifiers for toolbar controls - images_wx contains bitmaps for the images
 # used in the controls. wxWindows does not provide any stock images, so I've
 # 'stolen' those from GTK2, and transformed them into the appropriate format.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to