[Sugar-devel] [PATCH] Replaced the use of Gtk.Tooltips in TamTamEdit by setting the tooltip in every widget using widget.set_tooltip_text()

Hansel Wave arastafiel at gmail.com
Fri May 24 16:27:07 EDT 2013


From: Hansel Paul Miranda Wave <arastafiel at gmail.com>

---
 Edit/EditToolbars.py |   22 ++++++++++++++--------
 Edit/MainWindow.py   |    6 +++++-
 Edit/Properties.py   |   12 +++++++-----
 3 files changed, 26 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 Edit/EditToolbars.py
 mode change 100644 => 100755 Edit/HitInterface.py
 mode change 100644 => 100755 Edit/MainWindow.py
 mode change 100644 => 100755 Edit/NoteInterface.py
 mode change 100644 => 100755 Edit/Properties.py
 mode change 100644 => 100755 Edit/TrackInterface.py
 mode change 100644 => 100755 Edit/TuneInterface.py
 mode change 100644 => 100755 Edit/__init__.py
 create mode 100644 tamtamEdit

diff --git a/Edit/EditToolbars.py b/Edit/EditToolbars.py
old mode 100644
new mode 100755
index d56acb2..c04ef8b
--- a/Edit/EditToolbars.py
+++ b/Edit/EditToolbars.py
@@ -35,15 +35,16 @@ def common_buttons(toolbar, edit):
         'toggled', edit.handlePlayPause_cb)
     toolbar.insert(toolbar.playButton, -1)
     toolbar.playButton.show()
-    toolbar.playButton.set_tooltip(_('Play / Pause'))
+    #toolbar.playButton.set_tooltip(_('Play / Pause')) #Deprecated
+    toolbar.playButton.set_tooltip_text(_('Play / Pause'))
 
     # Stop button
     toolbar.stopButton = ToolButton('media-playback-stop')
     toolbar.stopButton.connect('clicked', edit.handleStop_cb)
     toolbar.insert(toolbar.stopButton, -1)
     toolbar.stopButton.show()
-    toolbar.stopButton.set_tooltip(_('Stop'))
-
+    #toolbar.stopButton.set_tooltip(_('Stop'))  #deprecated
+    toolbar.stopButton.set_tooltip_text(_('Stop'))
     # Play button Image
     toolbar.playButtonImg = Gtk.Image()
     toolbar.playButtonImg.set_from_icon_name(
@@ -108,8 +109,8 @@ def common_buttons(toolbar, edit):
     toolbar.duplicateButton.connect('toggled', handleDuplicate)
     toolbar.insert(toolbar.duplicateButton, -1)
     toolbar.duplicateButton.show()
-    toolbar.duplicateButton.set_tooltip(_('Duplicate'))
-
+    #toolbar.duplicateButton.set_tooltip(_('Duplicate'))  #Deprecated
+    toolbar.duplicateButton.set_tooltip_text(_('Duplicate'))	
 
 class mainToolbar(Gtk.Toolbar):
     def __init__(self, edit):
@@ -135,7 +136,9 @@ class generateToolbar(Gtk.Toolbar):
         self.bigGenerationButton.connect('clicked', self.edit.createNewTune)
         self.insert(self.bigGenerationButton, -1)
         self.bigGenerationButton.show()
-        self.bigGenerationButton.set_tooltip(_('Generate Tune'))
+        #self.bigGenerationButton.set_tooltip(_('Generate Tune'))  #deprecated.
+	self.bigGenerationButton.set_tooltip_text(_('Generate Tune'))
+
 
         # Generation button
         self._generationPalette = generationPalette(_('Generation'), self.edit)
@@ -160,7 +163,9 @@ class recordToolbar(Gtk.Toolbar):
             'clicked', edit.handleKeyboardRecordButton)
         self.insert(self.recordButton, -1)
         self.recordButton.show()
-        self.recordButton.set_tooltip(_('Record keyboard'))
+        #self.recordButton.set_tooltip(_('Record keyboard'))  #Deprecated
+	self.recordButton.set_tooltip_text(_('Record keyboard'))
+	
 
         if Config.FEATURES_OGG:
             #RecordOgg button
@@ -168,7 +173,8 @@ class recordToolbar(Gtk.Toolbar):
             self.recordOggButton.connect('clicked', edit.handleRecord_cb)
             self.insert(self.recordOggButton, -1)
             self.recordOggButton.show()
-            self.recordOggButton.set_tooltip(_('Record to ogg'))
+            #self.recordOggButton.set_tooltip(_('Record to ogg'))  #Deprecated
+	    self.recordOggButton.set_tooltip_text(_('Record to ogg'))
 
 class toolsToolbar(Gtk.Toolbar):
     def __init__(self, edit):
diff --git a/Edit/HitInterface.py b/Edit/HitInterface.py
old mode 100644
new mode 100755
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
old mode 100644
new mode 100755
index 237aae0..dfbd451
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -311,6 +311,7 @@ class MainWindow(Gtk.EventBox):
                 if Tooltips.Edit.has_key(key):
                     pass
                     #self.tooltips.set_tip(self.GUI[key],Tooltips.Edit[key])
+			self.GUI[key].set_tooltip_text(Tooltips.Edit[key])
 
             self.add( self.GUI["2main"] )
 
@@ -2217,12 +2218,13 @@ class instrumentPalette(Popup):
         self.muteButton.connect("toggled",self.handlemuteButton)
         self.muteButton.set_active(True)
         #self.tooltips.set_tip(self.muteButton, _('Mute track'))
-
+	self.muteButton.set_tooltip_text(_('Mute track'))#This is a new line adding the tooltip text functionality
         self.soloButtonLabel = Gtk.Label(_('S'))
         self.soloButton = Gtk.CheckButton()
         self.soloButton.connect("toggled",self.handlesoloButton)
         self.soloButton.set_active(True)
         #self.tooltips.set_tip(self.soloButton, _('Solo track'))
+	self.soloButton.set_tooltip_text(_('Solo track'))#This is a new line adding the tooltip text functionality
 
         self.volumeSliderAdj = Gtk.Adjustment( self.edit._data["track_volume"][0], 0, 100, 1, 1, 0 )
         self.volumeSliderAdj.connect( "value-changed", self.handleTrackVolume)
@@ -2345,6 +2347,8 @@ class drumPalette(Popup):
         self.muteButton.connect("button-press-event",self.edit.handlemuteButtonRightClick, self.trackID)
         self.muteButton.set_active(True)
         #self.tooltips.set_tip(self.muteButton, _('Left click to mute, right click to solo'))
+	self.muteButton.set_tooltip_text( _('Left click to mute, right click to solo'))#This is a new line adding the tooltip textfunctionality	
+	
 
         if self.trackID < 4:
             exec "self.volumeSliderAdj = self.edit.GUI['2instrument%svolumeAdjustment']" % str(self.trackID+1)
diff --git a/Edit/NoteInterface.py b/Edit/NoteInterface.py
old mode 100644
new mode 100755
diff --git a/Edit/Properties.py b/Edit/Properties.py
old mode 100644
new mode 100755
index b6baf9d..08c339e
--- a/Edit/Properties.py
+++ b/Edit/Properties.py
@@ -14,7 +14,7 @@ Tooltips = Config.Tooltips()
 class Properties( gtk.VBox ):
     def __init__( self, noteDB, doneHandler, popup ):
         gtk.VBox.__init__( self )
-        self.tooltips = gtk.Tooltips()
+        #self.tooltips = gtk.Tooltips()
         self.noteDB = noteDB
         #self.doneHandler = doneHandler
         self.popup = popup
@@ -380,9 +380,10 @@ class Properties( gtk.VBox ):
         # set tooltips
         for key in self.GUI:
             if Tooltips.PROP.has_key(key):
-                self.tooltips.set_tip(self.GUI[key],Tooltips.PROP[key])
-        self.tooltips.set_tip(self.GUI['paraSlider'], 'Random')
-                
+                #self.tooltips.set_tip(self.GUI[key],Tooltips.PROP[key])
+		self.GUI[key].set_tooltip_text(Tooltips.PROP[key])	
+        #self.tooltips.set_tip(self.GUI['paraSlider'], 'Random')
+        self.GUI['paraSlider'].set_tooltip_text('Random')        
 
         self.show_all()
 
@@ -819,7 +820,8 @@ class Properties( gtk.VBox ):
     def handleAlgo( self, widget, data ):
         self.algorithm = self.algoTypes[data]
         paraTooltips = ['Random', 'Maximum step', 'Maximum step', 'Maximum step', 'Maximum step']
-        self.tooltips.set_tip(self.GUI['paraSlider'], paraTooltips[data])
+        #self.tooltips.set_tip(self.GUI['paraSlider'], paraTooltips[data])
+	self.GUI['paraSlider'].set_tooltip_text(paraTooltips[data]) 
         
     def handleMin( self, adjust ):
         self.minValue = adjust.value
diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py
old mode 100644
new mode 100755
diff --git a/Edit/TuneInterface.py b/Edit/TuneInterface.py
old mode 100644
new mode 100755
diff --git a/Edit/__init__.py b/Edit/__init__.py
old mode 100644
new mode 100755
diff --git a/tamtamEdit b/tamtamEdit
new file mode 100644
index 0000000..e69de29
-- 
1.7.10.4



More information about the Sugar-devel mailing list