Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Edit/MainWindow.py106
-rw-r--r--Edit/TrackInterface.py18
-rw-r--r--SynthLab/SynthLabWindow.py2
-rwxr-xr-xTamTam.py6
-rw-r--r--Util/InstrumentPanel.py28
-rw-r--r--Util/ThemeWidgets.py38
6 files changed, 149 insertions, 49 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index 0137bd6..df523ae 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -123,8 +123,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument1volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument1volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 0 )
self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1volumeSlider"], False, False, 0 )
- self.GUI["2instrument1Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png')
- self.GUI["2instrument1Button"].connect("pressed", self.pickInstrument, 0 )
+ self.GUI["2instrument1Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png')
+ self.GUI["2instrument1Button"].connect("toggled", self.pickInstrument, 0 )
self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1Button"] )
#self.GUI["2instrument1Box"].pack_start( track_menu(0,'?') )
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument1Box"] )
@@ -138,8 +138,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument2volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument2volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 1 )
self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2volumeSlider"], False, False, 0 )
- self.GUI["2instrument2Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png')
- self.GUI["2instrument2Button"].connect("pressed", self.pickInstrument, 1 )
+ self.GUI["2instrument2Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png')
+ self.GUI["2instrument2Button"].connect("toggled", self.pickInstrument, 1 )
self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2Button"] )
#self.GUI["2instrument2Button"] = gtk.Button("Inst 2")
#self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2Button"] )
@@ -155,8 +155,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument3volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument3volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 2 )
self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3volumeSlider"], False, False, 0 )
- self.GUI["2instrument3Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png')
- self.GUI["2instrument3Button"].connect("pressed", self.pickInstrument, 2 )
+ self.GUI["2instrument3Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png')
+ self.GUI["2instrument3Button"].connect("toggled", self.pickInstrument, 2 )
self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3Button"] )
#self.GUI["2instrument3Button"] = gtk.Button("Inst 3")
#self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3Button"] )
@@ -172,8 +172,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument4volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument4volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 3 )
self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4volumeSlider"], False, False, 0 )
- self.GUI["2instrument4Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png')
- self.GUI["2instrument4Button"].connect("pressed", self.pickInstrument, 3 )
+ self.GUI["2instrument4Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png')
+ self.GUI["2instrument4Button"].connect("toggled", self.pickInstrument, 3 )
self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4Button"] )
#self.GUI["2instrument4Button"] = gtk.Button("Inst 4")
#self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4Button"] )
@@ -189,8 +189,8 @@ class MainWindow( SubActivity ):
self.GUI["2drumvolumeSlider"].set_size_request( 30, -1 )
self.GUI["2drumvolumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 4 )
self.GUI["2drumBox"].pack_start( self.GUI["2drumvolumeSlider"], False, False, 0 )
- self.GUI["2drumButton"] = ImageButton(Config.IMAGE_ROOT + 'drum1kit' + '.png')
- self.GUI["2drumButton"].connect("pressed", self.pickDrum)
+ self.GUI["2drumButton"] = ImageToggleButton(Config.IMAGE_ROOT + 'drum1kit' + '.png', Config.IMAGE_ROOT + 'drum1kit' + '.png')
+ self.GUI["2drumButton"].connect("toggled", self.pickDrum)
self.GUI["2drumBox"].pack_start( self.GUI["2drumButton"] )
#self.GUI["2instrument1Box"].pack_start( track_menu(4,'?') )
self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] )
@@ -234,7 +234,7 @@ class MainWindow( SubActivity ):
#self.GUI["2XYSlider"] = XYSlider( self.GUI["2XYSliderFixed"], self.GUI["2XYSliderButton"], self.GUI["2XYSliderXAdjustment"], self.GUI["2XYSliderYAdjustment"], True, True )
#self.GUI["2rightPanel"].pack_start( self.GUI["2XYSlider"], False, False, 0 )
self.trackInterface = TrackInterface( self.noteDB, self )
- self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite )
+ self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite, True )
self.trackInterface.set_size_request( -1, 713 )
self.GUI["2rightPanel"].pack_start( self.trackInterface, False, False, 0 )
# + tool panel
@@ -376,7 +376,7 @@ class MainWindow( SubActivity ):
self.GUI["2pauseBox"].pack_start( self.GUI["2pauseButton"] )
self.GUI["2pauseBox"].show_all()
self.GUI["2loopButton"] = ImageToggleButton( Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", backgroundFill = Config.BG_COLOR )
- self.GUI["2loopButton"].connect( "toggled", self.handleLoopButton )
+ #self.GUI["2loopButton"].connect( "toggled", self.handleLoopButton )
self.GUI["2transportBox"].pack_start( self.GUI["2loopButton"] )
self.GUI["2toolPanel"].pack_start( self.GUI["2transportBox"] )
# + tune box
@@ -411,13 +411,30 @@ class MainWindow( SubActivity ):
self.generationParametersWindow = GenerationParametersWindow( self.generate, self.variate, self.handleCloseGenerationParametersWindow )
- # playback scope
+ # Popups
+ # + instrument panel
+ self.GUI["9instrumentPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9instrumentPopup"].move( 400, 100 )
+ self.GUI["9instrumentPopup"].resize( 800, 452 )
+ self.GUI["9instrumentPopup"].set_modal(True)
+ self.GUI["9instrumentPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9instrumentPopup"].connect("button-release-event", lambda w,e:self.cancelInstrumentSelection() )
+ self.GUI["9instrumentPopup"].add( self.instrumentPanel )
+ # + drum panel
+ self.GUI["9drumPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9drumPopup"].move( 400, 100 )
+ self.GUI["9drumPopup"].resize( 400, 100 )
+ self.GUI["9drumPopup"].set_modal(True)
+ self.GUI["9drumPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9drumPopup"].connect("button-release-event", lambda w,e:self.cancelDrumSelection() )
+ self.GUI["9drumPopup"].add( self.drumPanel )
+ # + playback scope
self.GUI["9loopPopup"] = gtk.Window(gtk.WINDOW_POPUP)
self.GUI["9loopPopup"].move( 100, 100 )
self.GUI["9loopPopup"].resize( 300, 100 )
self.GUI["9loopPopup"].set_modal(True)
self.GUI["9loopPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
- self.GUI["9loopPopup"].connect("button-press-event", lambda w,e:self.GUI["2loopButton"].set_active(False) )
+ self.GUI["9loopPopup"].connect("button-release-event", lambda w,e:self.GUI["2loopButton"].set_active(False) )
self.GUI["9loopBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
self.GUI["9loopAllOnce"] = gtk.Button("AO")
self.GUI["9loopBox"].pack_start( self.GUI["9loopAllOnce"] )
@@ -479,6 +496,14 @@ class MainWindow( SubActivity ):
self.GUI["2trackBox"].hide()
self.GUI["2noteBox"].hide()
self.setContext( CONTEXT.PAGE )
+
+ def onActivate( self ):
+ SubActivity.onActivate( self )
+ # whatever needs to be done on initialization
+
+ def onDeactivate( self ):
+ SubActivity.onDeactivate( self )
+ # clean up things like popups etc
def updateFPS( self ):
t = time.time()
@@ -681,29 +706,49 @@ class MainWindow( SubActivity ):
self.kb_record = self.GUI["playButton"].get_active() and self.GUI["2recordButton"].get_active()
def pickInstrument( self, widget, num ):
- self.last_clicked_instTrackID = num
- self.instrumentPanel.selectFirstCat()
- self.instrumentPanel.set_activeInstrument( self._data['track_inst'][num], True )
- self.GUI["2main"].remove( self.GUI["2rightPanel"] )
- self.GUI["2main"].pack_start( self.instrumentPanel )
+ if widget.get_active(): # show the panel
+ self.last_clicked_instTrackID = num
+ self.instrumentPanel.selectFirstCat()
+ self.instrumentPanel.set_activeInstrument( self._data['track_inst'][num], True )
+ winLoc = self.parent.window.get_position()
+ alloc = widget.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.GUI["9instrumentPopup"].move( x, y )
+ self.GUI["9instrumentPopup"].show()
+ else: # hide the panel
+ self.GUI["9instrumentPopup"].hide()
+
+ def cancelInstrumentSelection( self ):
+ self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"].set_active(False)
def donePickInstrument( self, instrumentName ):
self.handleInstrumentChanged( (self.last_clicked_instTrackID, instrumentName) )
#self.instrumentPanel.set_activeInstrument( self._data['track_inst'][self.last_clicked_instTrackID], False )
- self.GUI["2main"].remove( self.instrumentPanel )
- self.GUI["2main"].pack_start( self.GUI["2rightPanel"] )
- self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"].load_pixmap( "main", self.GUI["2instrumentIcons"][instrumentName] )
- #self.instrumentPanel.destroy()
+ btn = self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"]
+ btn.load_pixmap( "main", self.GUI["2instrumentIcons"][instrumentName] )
+ btn.load_pixmap( "alt", self.GUI["2instrumentIcons"][instrumentName] )
+ btn.set_active( False )
def pickDrum( self, widget , data = None ):
- self.GUI["2main"].remove( self.GUI["2rightPanel"] )
- self.GUI["2main"].pack_start( self.drumPanel )
+ if widget.get_active(): # show the panel
+ winLoc = self.parent.window.get_position()
+ alloc = widget.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.GUI["9drumPopup"].move( x, y )
+ self.GUI["9drumPopup"].show()
+ else: # hide the panel
+ self.GUI["9drumPopup"].hide()
+ def cancelDrumSelection( self ):
+ self.GUI["2drumButton"].set_active( False )
+
def donePickDrum( self, drum ):
self._data['track_inst'][4] = drum
self.GUI["2drumButton"].load_pixmap( "main", self.GUI["2instrumentIcons"][drum] )
- self.GUI["2main"].remove( self.drumPanel )
- self.GUI["2main"].pack_start( self.GUI["2rightPanel"] )
+ self.GUI["2drumButton"].load_pixmap( "alt", self.GUI["2instrumentIcons"][drum] )
+ self.GUI["2drumButton"].set_active( False )
#-----------------------------------
# generation functions
@@ -1110,9 +1155,6 @@ class MainWindow( SubActivity ):
key = event.hardware_keycode
- if key == 53 and Config.ModKeys.ctrlDown: # q == 53
- self.destroy( self )
-
if not self.kb_active:
return
if self.kb_record:
@@ -1225,9 +1267,9 @@ class MainWindow( SubActivity ):
else:
self.updateContextNavButtons()
- def setContext( self, context ):
+ def setContext( self, context, force = False ):
- if self.context == context: return
+ if self.context == context and not force: return
if self.context == CONTEXT.PAGE: self.GUI["2pageBox"].hide()
elif self.context == CONTEXT.TRACK: self.GUI["2trackBox"].hide()
diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py
index 4acba12..cbe9673 100644
--- a/Edit/TrackInterface.py
+++ b/Edit/TrackInterface.py
@@ -185,6 +185,22 @@ class TrackInterface( gtk.EventBox ):
self.clipboardDrumTrack = self.clipboardArea["tracks"][self.drumIndex]
#=======================================================
+ # NoteDB notifications
+
+ def notifyPageAdd( self, id, at ):
+ return
+
+ def notifyPageDelete( self, which, safe ):
+ if self.screenBufPage[self.preScreen] in which:
+ self.screenBufPage[self.preScreen] = -1
+
+ def notifyPageDuplicate( self, new, at ):
+ return
+
+ def notifyPageMove( self, which, low, high ):
+ return
+
+ #=======================================================
# Module Interface
def getDrawingPackage( self, track ):
@@ -359,7 +375,7 @@ class TrackInterface( gtk.EventBox ):
id = self.noteDB.addNote( self.curPage, i, cs )
n = self.noteDB.getNote( self.curPage, i, id, self )
self.selectNotes( { i:[n] }, True )
- n.playSampleNote()
+ n.playSampleNote( False )
if i != self.drumIndex: # switch to drag duration
self.updateDragLimits()
self.clickLoc[0] += self.ticksToPixels( self.curBeats, 1 )
diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py
index d53116a..3f3fd26 100644
--- a/SynthLab/SynthLabWindow.py
+++ b/SynthLab/SynthLabWindow.py
@@ -185,6 +185,8 @@ class SynthLabWindow(SubActivity):
self.presetCallback(self.presets,0)
self.tooltips.set_tip(self.durationSlider, Tooltips.SOUNDDUR + ': ' + self.durString)
+
+ self.show_all()
def onDestroy(self):
pass
diff --git a/TamTam.py b/TamTam.py
index fdc9f61..d746af2 100755
--- a/TamTam.py
+++ b/TamTam.py
@@ -17,7 +17,6 @@ try :
except ImportError:
from FActivity import FakeActivity as Activity
-
if not os.path.isdir(Config.PREF_DIR):
os.mkdir(Config.PREF_DIR)
os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
@@ -71,7 +70,7 @@ class TamTam(Activity):
self.mode = mode
self.add( self.modeList[ self.mode ] )
self.modeList[ self.mode ].onActivate()
- self.show_all()
+ self.modeList[ self.mode ].show()
else:
print 'DEBUG: TamTam::set_mode invalid mode:', mode
@@ -99,6 +98,9 @@ class TamTam(Activity):
elif key == 25: #W
self.set_mode('welcome')
return
+ elif key == 53: #X
+ self.destroy()
+ return
self.modeList[ self.mode ].onKeyPress(widget, event)
def onKeyRelease(self, widget, event):
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py
index fc6185c..0e00dbc 100644
--- a/Util/InstrumentPanel.py
+++ b/Util/InstrumentPanel.py
@@ -24,8 +24,9 @@ class InstrumentPanel( gtk.EventBox ):
self.enterMode = enterMode
self.instrumentBox = None
self.recstate = False
+ self.lastInstrumentWidget = None
self.instDic = {}
-
+
self.mainVBox = gtk.VBox()
self.draw_toolbar()
if _instDic == None:
@@ -56,7 +57,7 @@ class InstrumentPanel( gtk.EventBox ):
self.firstTbBtn.set_active(True)
def handleToolbarBtnPress(self, widget, category):
- self.draw_instruments_panel(category)
+ self.draw_instruments_panel(category)
def draw_instruments_panel(self,category = 'all'):
@@ -100,13 +101,16 @@ class InstrumentPanel( gtk.EventBox ):
tableEventBox.modify_bg(gtk.STATE_NORMAL, color)
tableEventBox.add(self.instTable)
self.scrollWin.add_with_viewport(tableEventBox)
+ tableEventBox.get_parent().set_shadow_type( gtk.SHADOW_NONE )
self.instrumentBox.pack_start(self.scrollWin,True,True,0)
self.mainVBox.pack_start(self.instrumentBox)
self.show_all()
def handleInstrumentButtonClick(self,widget,instrument):
if widget.get_active() is True and self.recstate == False:
- if self.setInstrument: self.setInstrument(instrument)
+ if self.setInstrument:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setInstrument(instrument)
if self.playInstrument: self.playInstrument(instrument)
if self.enterMode:
pass #Close the window
@@ -127,7 +131,7 @@ class InstrumentPanel( gtk.EventBox ):
def handleRecButtonPress(self,widget,btn):
self.recstate = True
btn.set_active(True)
-
+
def getInstDic(self):
instDic = {}
self.firstInstButton = None
@@ -144,7 +148,7 @@ class InstrumentPanel( gtk.EventBox ):
if instrument[0:3] == 'lab':
self.tooltips.set_tip(RecBtn,Tooltips.RECLAB)
- Btn.connect('clicked', self.handleInstrumentButtonClick, instrument)
+ Btn.clickedHandler = Btn.connect('clicked', self.handleInstrumentButtonClick, instrument)
if instrument[0:3] == 'mic':
RecBtn.connect('clicked', self.handleMicRecButtonClick, instrument)
if instrument[0:3] == 'lab':
@@ -157,7 +161,7 @@ class InstrumentPanel( gtk.EventBox ):
instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
instBox.set_border_width(Config.PANEL_SPACING)
instButton = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png')
- instButton.connect('clicked',self.handleInstrumentButtonClick, instrument)
+ instButton.clickedHandler = instButton.connect('clicked',self.handleInstrumentButtonClick, instrument)
if self.enterMode:
instButton.connect('enter',self.handleInstrumentButtonEnter, instrument)
instBox.pack_start(instButton,False,False)
@@ -170,8 +174,10 @@ class InstrumentPanel( gtk.EventBox ):
if len(self.instDic) > 0:
for key in self.instDic:
if key == instrument:
- self.instDic[key].get_children()[0].set_active(state)
-
+ btn = self.instDic[key].get_children()[0]
+ btn.handler_block(btn.clickedHandler)
+ btn.set_active(state)
+ btn.handler_unblock(btn.clickedHandler)
def getInstrumentList(self,category = 'all'):
instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:4] != 'guid' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab'] + Config.DRUMKITS + ['mic1', 'mic2', 'mic3', 'mic4', 'lab1', 'lab2', 'lab3', 'lab4']
@@ -208,7 +214,7 @@ class DrumPanel( gtk.EventBox ):
instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
instBox.set_border_width(Config.PANEL_SPACING)
self.drums[drumkit] = ImageRadioButton(firstBtn, Config.IMAGE_ROOT + drumkit + '.png' , Config.IMAGE_ROOT + drumkit + 'sel.png', Config.IMAGE_ROOT + drumkit + 'sel.png')
- self.drums[drumkit].connect('clicked',self.setDrums,drumkit)
+ self.drums[drumkit].clickedHandler = self.drums[drumkit].connect('clicked',self.setDrums,drumkit)
if firstBtn == None:
firstBtn = self.drums[drumkit]
instBox.pack_start(self.drums[drumkit], False, False, 0)
@@ -218,7 +224,9 @@ class DrumPanel( gtk.EventBox ):
def setDrums(self,widget,data):
if widget.get_active():
- if self.setDrum: self.setDrum(data)
+ if self.setDrum:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setDrum(data)
if __name__ == "__main__":
win = gtk.Window()
diff --git a/Util/ThemeWidgets.py b/Util/ThemeWidgets.py
index 526d317..5c1bca2 100644
--- a/Util/ThemeWidgets.py
+++ b/Util/ThemeWidgets.py
@@ -795,6 +795,8 @@ class ImageButton(gtk.Button):
return True
def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
self.image[name] = pixmap
self.queue_draw()
@@ -864,8 +866,16 @@ class ImageToggleButton(gtk.ToggleButton):
if enterImg_path != None:
prepareImage( "enter", enterImg_path )
- self.connect('enter-notify-event',self.on_btn_enter)
- self.connect('leave-notify-event',self.on_btn_leave)
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
self.connect('toggled',self.toggleImage)
self.connect('pressed',self.pressed )
@@ -889,6 +899,12 @@ class ImageToggleButton(gtk.ToggleButton):
self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
return True
+ def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
+ self.image[name] = pixmap
+ self.queue_draw()
+
def toggleImage(self, widget):
if not self.get_active():
if self.within and self.image.has_key("enter"):
@@ -970,8 +986,16 @@ class ImageRadioButton(gtk.RadioButton):
if enterImg_path != None:
prepareImage( "enter", enterImg_path )
- self.connect('enter-notify-event',self.on_btn_enter)
- self.connect('leave-notify-event',self.on_btn_leave)
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
self.connect("toggled", self.toggleImage )
self.connect('pressed',self.pressed )
@@ -995,6 +1019,12 @@ class ImageRadioButton(gtk.RadioButton):
self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
return True
+ def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
+ self.image[name] = pixmap
+ self.queue_draw()
+
def toggleImage( self, widget ):
if not self.get_active():
if self.within and self.image.has_key("enter"):