diff options
62 files changed, 153 insertions, 111 deletions
@@ -379,6 +379,9 @@ LANGUAGE = 'En' IMAGE_ROOT = TAM_TAM_ROOT + '/Resources/Images/' MAIN_WINDOW_PADDING = 5 + +BG_COLOR = "#8CAF97" + NOTE_HEIGHT = 9 # pixels NOTE_IMAGE_PADDING = 6 NOTE_IMAGE_PADDING_MUL2 = NOTE_IMAGE_PADDING*2 diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py index 778eaf3..859a500 100644 --- a/Edit/MainWindow.py +++ b/Edit/MainWindow.py @@ -97,7 +97,7 @@ class MainWindow( gtk.EventBox ): if 1: # + instrument panel self.GUI["2instrumentPanel"] = gtk.VBox() # + + instrument 1 box - self.GUI["2instrument1Box"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2instrument1Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2instrument1Box"].set_size_request( -1, 137 ) self.GUI["2instrument1volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 ) self.GUI["2instrument1volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 0 ) @@ -111,7 +111,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2instrument1Box"].pack_start( track_menu(0,'?') ) self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument1Box"] ) # + + instrument 2 box - self.GUI["2instrument2Box"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2instrument2Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2instrument2Box"].set_size_request( -1, 137 ) self.GUI["2instrument2volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 ) self.GUI["2instrument2volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 1 ) @@ -125,7 +125,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2instrument2Box"].pack_start( track_menu(1,'?') ) self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument2Box"] ) # + + instrument 3 box - self.GUI["2instrument3Box"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2instrument3Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2instrument3Box"].set_size_request( -1, 137 ) self.GUI["2instrument3volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][2], 0, 100, 1, 1, 0 ) self.GUI["2instrument3volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 2 ) @@ -139,7 +139,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2instrument3Box"].pack_start( track_menu(2,'?') ) self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument3Box"] ) # + + instrument 4 box - self.GUI["2instrument4Box"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2instrument4Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2instrument4Box"].set_size_request( -1, 137 ) self.GUI["2instrument4volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][3], 0, 100, 1, 1, 0 ) self.GUI["2instrument4volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 3 ) @@ -153,7 +153,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2instrument4Box"].pack_start( track_menu(3,'?') ) self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument4Box"] ) # + + drum box - self.GUI["2drumBox"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2drumBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2drumBox"].set_size_request( -1, 165 ) self.GUI["2drumvolumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][4], 0, 100, 1, 1, 0 ) self.GUI["2drumvolumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 4 ) @@ -168,7 +168,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] ) self.GUI["2leftPanel"].pack_start( self.GUI["2instrumentPanel"], False ) # + volume panel - self.GUI["2volumePanel"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2volumePanel"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) # + + volume box self.GUI["2volumeBox"] = gtk.VBox() self.GUI["2volumeImage"] = gtk.Image() @@ -198,7 +198,7 @@ class MainWindow( gtk.EventBox ): # right panel self.GUI["2rightPanel"] = gtk.VBox() if 1: # + track interface - #self.GUI["2XYSliderFixed"] = formatRoundBox( RoundFixed(), "#6C9790" ) + #self.GUI["2XYSliderFixed"] = formatRoundBox( RoundFixed(), Config.BG_COLOR ) #self.GUI["2XYSliderFixed"].set_size_request( -1, 713 ) #self.GUI["2XYSliderButton"] = ImageToggleButton( Config.IMAGE_ROOT+"pointer.png", Config.IMAGE_ROOT+"pointerDown.png" ) #self.GUI["2XYSliderXAdjustment"] = gtk.Adjustment( 650, 500, 1000, 1, 1, 1 ) @@ -210,115 +210,122 @@ class MainWindow( gtk.EventBox ): self.trackInterface.set_size_request( -1, 713 ) self.GUI["2rightPanel"].pack_start( self.trackInterface, False, False, 0 ) # + tool panel + toolPanelHeight = 75 self.GUI["2toolPanel"] = gtk.HBox() - self.GUI["2toolPanel"].set_size_request( -1, 75 ) + self.GUI["2toolPanel"].set_size_request( -1, toolPanelHeight ) # + + tool box - self.GUI["2toolBox"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2toolBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2toolBox"].set_size_request( 154, -1 ) - self.GUI["2toolPointerButton"] = ImageRadioButton( None, Config.IMAGE_ROOT+"pointer.png", Config.IMAGE_ROOT+"pointerDown.png", backgroundFill = "#6C9790" ) + self.GUI["2toolPointerButton"] = ImageRadioButton( None, Config.IMAGE_ROOT+"pointer.png", Config.IMAGE_ROOT+"pointerDown.png", backgroundFill = Config.BG_COLOR ) self.GUI["2toolPointerButton"].connect( "clicked", self.handleToolClick , "default" ) self.GUI["2toolBox"].pack_start( self.GUI["2toolPointerButton"] ) - self.GUI["2toolPencilButton"] = ImageRadioButton( self.GUI["2toolPointerButton"], Config.IMAGE_ROOT+"pencil.png", Config.IMAGE_ROOT+"pencilDown.png", backgroundFill = "#6C9790" ) + self.GUI["2toolPencilButton"] = ImageRadioButton( self.GUI["2toolPointerButton"], Config.IMAGE_ROOT+"pencil.png", Config.IMAGE_ROOT+"pencilDown.png", backgroundFill = Config.BG_COLOR ) self.GUI["2toolPencilButton"].connect( "clicked", self.handleToolClick , "draw" ) self.GUI["2toolBox"].pack_start( self.GUI["2toolPencilButton"] ) self.GUI["2toolPanel"].pack_start( self.GUI["2toolBox"], False, False ) self.GUI["2rightPanel"].pack_start( self.GUI["2toolPanel"], False ) # + + context box (for context sensitive buttons, nothing to do with CAIRO) contextWidth = 674 - self.GUI["2contextBox"] = formatRoundBox( RoundFixed(), "#6C9790" ) + self.GUI["2contextBox"] = formatRoundBox( RoundFixed(), Config.BG_COLOR ) self.GUI["2contextBox"].set_size_request( contextWidth, -1 ) - self.GUI["2contextPrevButton"] = gtk.Button("<") + self.GUI["2contextPrevButton"] = ImageButton( Config.IMAGE_ROOT+"arrowEditLeft.png", backgroundFill = Config.BG_COLOR ) + self.GUI["2contextPrevButton"].set_size_request( 25, toolPanelHeight ) self.GUI["2contextPrevButton"].connect( "clicked", lambda a1:self.prevContext() ) self.GUI["2contextBox"].put( self.GUI["2contextPrevButton"], 0, 0 ) - self.GUI["2contextNextButton"] = gtk.Button(">") + self.GUI["2contextNextButton"] = ImageButton( Config.IMAGE_ROOT+"arrowEditRight.png", backgroundFill = Config.BG_COLOR ) + self.GUI["2contextNextButton"].set_size_request( 25, toolPanelHeight ) self.GUI["2contextNextButton"].connect( "clicked", lambda a1:self.nextContext() ) self.GUI["2contextBox"].put( self.GUI["2contextNextButton"], contextWidth-25, 0 ) # + + + page box self.GUI["2pageBox"] = gtk.HBox() self.GUI["2pageBox"].set_size_request( contextWidth-50, 73 ) - self.GUI["2pageGenerateButton"] = ImageButton( Config.IMAGE_ROOT+"genPage.png", Config.IMAGE_ROOT+"genPageOver.png", Config.IMAGE_ROOT+"genPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pageGenerateButton"] = ImageButton( Config.IMAGE_ROOT+"genPage.png", Config.IMAGE_ROOT+"genPageDown.png", Config.IMAGE_ROOT+"genPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pageGenerateButton"].connect( "clicked", lambda a1:self.pageGenerate() ) self.GUI["2pageBox"].pack_start( self.GUI["2pageGenerateButton"] ) - self.GUI["2pagePropertiesButton"] = ImageButton( Config.IMAGE_ROOT+"propPage.png", Config.IMAGE_ROOT+"propPageOver.png", Config.IMAGE_ROOT+"propPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pagePropertiesButton"] = ImageButton( Config.IMAGE_ROOT+"propPage.png", Config.IMAGE_ROOT+"propPageDown.png", Config.IMAGE_ROOT+"propPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pagePropertiesButton"].connect( "clicked", lambda a1:self.pageProperties() ) self.GUI["2pageBox"].pack_start( self.GUI["2pagePropertiesButton"] ) - self.GUI["2pageDeleteButton"] = ImageButton( Config.IMAGE_ROOT+"delPage.png", Config.IMAGE_ROOT+"delPageOver.png", Config.IMAGE_ROOT+"delPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pageDeleteButton"] = ImageButton( Config.IMAGE_ROOT+"delPage.png", Config.IMAGE_ROOT+"delPageDown.png", Config.IMAGE_ROOT+"delPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pageDeleteButton"].connect( "clicked", lambda a1:self.pageDelete() ) self.GUI["2pageBox"].pack_start( self.GUI["2pageDeleteButton"] ) - self.GUI["2pageDuplicateButton"] = ImageButton( Config.IMAGE_ROOT+"dupPage.png", Config.IMAGE_ROOT+"dupPageOver.png", Config.IMAGE_ROOT+"dupPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pageDuplicateButton"] = ImageButton( Config.IMAGE_ROOT+"dupPage.png", Config.IMAGE_ROOT+"dupPageDown.png", Config.IMAGE_ROOT+"dupPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pageDuplicateButton"].connect( "clicked", lambda a1:self.pageDuplicate() ) self.GUI["2pageBox"].pack_start( self.GUI["2pageDuplicateButton"] ) - self.GUI["2pageNewButton"] = ImageButton( Config.IMAGE_ROOT+"addPage.png", Config.IMAGE_ROOT+"addPageOver.png", Config.IMAGE_ROOT+"addPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pageNewButton"] = ImageButton( Config.IMAGE_ROOT+"addPage.png", Config.IMAGE_ROOT+"addPageDown.png", Config.IMAGE_ROOT+"addPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pageNewButton"].connect( "clicked", lambda a1:self.pageAdd() ) self.GUI["2pageBox"].pack_start( self.GUI["2pageNewButton"] ) - self.GUI["2pageBeatsButton"] = ImageButton( Config.IMAGE_ROOT+"beatPage.png", Config.IMAGE_ROOT+"beatPageOver.png", Config.IMAGE_ROOT+"beatPageDown.png", backgroundFill = "#6C9790" ) + self.GUI["2pageBeatsButton"] = ImageButton( Config.IMAGE_ROOT+"beatPage.png", Config.IMAGE_ROOT+"beatPageDown.png", Config.IMAGE_ROOT+"beatPageOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2pageBeatsButton"].connect( "clicked", lambda a1:self.pageBeats() ) self.GUI["2pageBox"].pack_start( self.GUI["2pageBeatsButton"] ) self.GUI["2contextBox"].put( self.GUI["2pageBox"], 25, 0 ) # + + + track box self.GUI["2trackBox"] = gtk.HBox() self.GUI["2trackBox"].set_size_request( contextWidth-50, 73 ) - self.GUI["2trackGenerateButton"] = ImageButton( Config.IMAGE_ROOT+"genPage.png", None, None, backgroundFill = "#6C9790" ) + self.GUI["2trackGenerateButton"] = ImageButton( Config.IMAGE_ROOT+"genTrack.png", Config.IMAGE_ROOT+"genTrackDown.png", Config.IMAGE_ROOT+"genTrackOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2trackGenerateButton"].connect( "clicked", lambda a1:self.trackGenerate() ) self.GUI["2trackBox"].pack_start( self.GUI["2trackGenerateButton"] ) - self.GUI["2trackPropertiesButton"] = gtk.Button("tProp") + self.GUI["2trackPropertiesButton"] = ImageButton( Config.IMAGE_ROOT+"propTrack.png", Config.IMAGE_ROOT+"propTrackDown.png", Config.IMAGE_ROOT+"propTrackOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2trackPropertiesButton"].connect( "clicked", lambda a1:self.trackProperties() ) self.GUI["2trackBox"].pack_start( self.GUI["2trackPropertiesButton"] ) - self.GUI["2trackDeleteButton"] = gtk.Button("tDelete") + self.GUI["2trackDeleteButton"] = ImageButton( Config.IMAGE_ROOT+"delTrack.png", Config.IMAGE_ROOT+"delTrackDown.png", Config.IMAGE_ROOT+"delTrackOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2trackDeleteButton"].connect( "clicked", lambda a1:self.trackDelete() ) self.GUI["2trackBox"].pack_start( self.GUI["2trackDeleteButton"] ) - self.GUI["2trackDuplicateButton"] = gtk.ToggleButton("tDuplicate") - self.GUI["2trackDuplicateButton"].connect( "toggled", lambda a1:self.trackDuplicate() ) + self.GUI["2trackDuplicateButton"] = ImageToggleButton( Config.IMAGE_ROOT+"dupTrack.png", Config.IMAGE_ROOT+"dupTrackDown.png", Config.IMAGE_ROOT+"dupTrackOver.png", backgroundFill = Config.BG_COLOR ) + self.GUI["2trackDuplicateButton"].connect( "toggled", self.trackDuplicateWidget ) self.GUI["2trackBox"].pack_start( self.GUI["2trackDuplicateButton"] ) self.GUI["2contextBox"].put( self.GUI["2trackBox"], 25, 0 ) # + + + note box self.GUI["2noteBox"] = gtk.HBox() self.GUI["2noteBox"].set_size_request( contextWidth-50, 73 ) - self.GUI["2notePropertiesButton"] = gtk.Button("nProp") + self.GUI["2notePropertiesButton"] = ImageButton( Config.IMAGE_ROOT+"propNote.png", Config.IMAGE_ROOT+"propNoteDown.png", Config.IMAGE_ROOT+"propNoteOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2notePropertiesButton"].connect( "clicked", lambda a1:self.noteProperties() ) self.GUI["2noteBox"].pack_start( self.GUI["2notePropertiesButton"] ) - self.GUI["2noteDeleteButton"] = gtk.Button("nDelete") + self.GUI["2noteDeleteButton"] = ImageButton( Config.IMAGE_ROOT+"delNote.png", Config.IMAGE_ROOT+"delNoteDown.png", Config.IMAGE_ROOT+"delNoteOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteDeleteButton"].connect( "clicked", lambda a1:self.noteDelete() ) self.GUI["2noteBox"].pack_start( self.GUI["2noteDeleteButton"] ) - self.GUI["2noteDuplicateButton"] = gtk.ToggleButton("nDuplicate") + self.GUI["2noteDuplicateButton"] = ImageToggleButton( Config.IMAGE_ROOT+"dupNote.png", Config.IMAGE_ROOT+"dupNoteDown.png", Config.IMAGE_ROOT+"dupNoteOver.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteDuplicateButton"].connect( "toggled", self.noteDuplicateWidget ) self.GUI["2noteBox"].pack_start( self.GUI["2noteDuplicateButton"] ) - self.GUI["2noteOnsetBox"] = gtk.HBox() - self.GUI["2noteOnsetMinusButton"] = gtk.Button("<") + self.GUI["2noteOnsetBox"] = gtk.HBox( False ) + self.GUI["2noteOnsetBox"].set_size_request( 72, -1 ) + self.GUI["2noteOnsetMinusButton"] = ImageButton( Config.IMAGE_ROOT+"editOnsetLeft.png", Config.IMAGE_ROOT+"editOnsetDownLeft.png", Config.IMAGE_ROOT+"editOnsetOverLeft.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteOnsetMinusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepOnset(-1) ) - self.GUI["2noteOnsetBox"].pack_start( self.GUI["2noteOnsetMinusButton"] ) - self.GUI["2noteOnsetPlusButton"] = gtk.Button(">") + self.GUI["2noteOnsetBox"].pack_start( self.GUI["2noteOnsetMinusButton"], False, False ) + self.GUI["2noteOnsetPlusButton"] = ImageButton( Config.IMAGE_ROOT+"editOnsetRight.png", Config.IMAGE_ROOT+"editOnsetDownRight.png", Config.IMAGE_ROOT+"editOnsetOverRight.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteOnsetPlusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepOnset(1) ) - self.GUI["2noteOnsetBox"].pack_start( self.GUI["2noteOnsetPlusButton"] ) + self.GUI["2noteOnsetBox"].pack_start( self.GUI["2noteOnsetPlusButton"], False, False ) self.GUI["2noteBox"].pack_start( self.GUI["2noteOnsetBox"] ) self.GUI["2notePitchBox"] = gtk.VBox() - self.GUI["2notePitchPlusButton"] = gtk.Button("^") + self.GUI["2notePitchBox"].set_size_request( 72, -1 ) + self.GUI["2notePitchPlusButton"] = ImageButton( Config.IMAGE_ROOT+"editPitchTop.png", Config.IMAGE_ROOT+"editPitchDownTop.png", Config.IMAGE_ROOT+"editPitchOverTop.png", backgroundFill = Config.BG_COLOR ) self.GUI["2notePitchPlusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepPitch(1) ) self.GUI["2notePitchBox"].pack_start( self.GUI["2notePitchPlusButton"] ) - self.GUI["2notePitchMinusButton"] = gtk.Button("v") + self.GUI["2notePitchMinusButton"] = ImageButton( Config.IMAGE_ROOT+"editPitchBot.png", Config.IMAGE_ROOT+"editPitchDownBot.png", Config.IMAGE_ROOT+"editPitchOverBot.png", backgroundFill = Config.BG_COLOR ) self.GUI["2notePitchMinusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepPitch(-1) ) self.GUI["2notePitchBox"].pack_start( self.GUI["2notePitchMinusButton"] ) self.GUI["2noteBox"].pack_start( self.GUI["2notePitchBox"] ) - self.GUI["2noteDurationBox"] = gtk.HBox() - self.GUI["2noteDurationMinusButton"] = gtk.Button("<") + self.GUI["2noteDurationBox"] = gtk.HBox( False ) + self.GUI["2noteDurationBox"].set_size_request( 72, -1 ) + self.GUI["2noteDurationMinusButton"] = ImageButton( Config.IMAGE_ROOT+"editDurLeft.png", Config.IMAGE_ROOT+"editDurDownLeft.png", Config.IMAGE_ROOT+"editDurOverLeft.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteDurationMinusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepDuration(-1) ) - self.GUI["2noteDurationBox"].pack_start( self.GUI["2noteDurationMinusButton"] ) - self.GUI["2noteDurationPlusButton"] = gtk.Button(">") + self.GUI["2noteDurationBox"].pack_start( self.GUI["2noteDurationMinusButton"], False, False ) + self.GUI["2noteDurationPlusButton"] = ImageButton( Config.IMAGE_ROOT+"editDurRight.png", Config.IMAGE_ROOT+"editDurDownRight.png", Config.IMAGE_ROOT+"editDurOverRight.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteDurationPlusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepDuration(1) ) - self.GUI["2noteDurationBox"].pack_start( self.GUI["2noteDurationPlusButton"] ) + self.GUI["2noteDurationBox"].pack_start( self.GUI["2noteDurationPlusButton"], False, False ) self.GUI["2noteBox"].pack_start( self.GUI["2noteDurationBox"] ) self.GUI["2noteVolumeBox"] = gtk.VBox() - self.GUI["2noteVolumePlusButton"] = gtk.Button("^") + self.GUI["2noteVolumeBox"].set_size_request( 72, -1 ) + self.GUI["2noteVolumePlusButton"] = ImageButton( Config.IMAGE_ROOT+"editAmpTop.png", Config.IMAGE_ROOT+"editAmpDownTop.png", Config.IMAGE_ROOT+"editAmpOverTop.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteVolumePlusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepVolume(0.05) ) self.GUI["2noteVolumeBox"].pack_start( self.GUI["2noteVolumePlusButton"] ) - self.GUI["2noteVolumeMinusButton"] = gtk.Button("v") + self.GUI["2noteVolumeMinusButton"] = ImageButton( Config.IMAGE_ROOT+"editAmpBot.png", Config.IMAGE_ROOT+"editAmpDownBot.png", Config.IMAGE_ROOT+"editAmpOverBot.png", backgroundFill = Config.BG_COLOR ) self.GUI["2noteVolumeMinusButton"].connect( "clicked", lambda a1:self.trackInterface.noteStepVolume(-0.05) ) self.GUI["2noteVolumeBox"].pack_start( self.GUI["2noteVolumeMinusButton"] ) self.GUI["2noteBox"].pack_start( self.GUI["2noteVolumeBox"] ) self.GUI["2contextBox"].put( self.GUI["2noteBox"], 25, 0 ) self.GUI["2toolPanel"].pack_start( self.GUI["2contextBox"], False ) # + + transport box - self.GUI["2transportBox"] = formatRoundBox( RoundHBox(), "#6C9790" ) + self.GUI["2transportBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR ) self.GUI["2recordButton"] = gtk.ToggleButton("R") self.GUI["2transportBox"].pack_start( self.GUI["2recordButton"] ) self.GUI["2playButton"] = gtk.ToggleButton("P") @@ -328,7 +335,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2transportBox"].pack_start( self.GUI["2loopButton"] ) self.GUI["2toolPanel"].pack_start( self.GUI["2transportBox"] ) # + tune box - self.GUI["2tuneBox"] = formatRoundBox( RoundVBox(), "#6C9790" ) + self.GUI["2tuneBox"] = formatRoundBox( RoundVBox(), Config.BG_COLOR ) self.GUI["2tuneScrolledWindow"] = gtk.ScrolledWindow() self.GUI["2tuneScrolledWindow"].set_policy( gtk.POLICY_ALWAYS, gtk.POLICY_NEVER ) self.GUI["2tuneScrolledWindow"].set_shadow_type(gtk.SHADOW_NONE) @@ -341,6 +348,8 @@ class MainWindow( gtk.EventBox ): self.add( self.GUI["2main"] ) + self.skipCleanup = "" # used when jumping between duplicate note/track + self.generationParametersWindow = GenerationParametersWindow( self.generate, self.variate, self.handleCloseGenerationParametersWindow ) #=================================================== @@ -392,34 +401,19 @@ class MainWindow( gtk.EventBox ): self.setContext( CONTEXT.PAGE ) self.tempPopup = gtk.Window(gtk.WINDOW_POPUP) - self.tempPopup.set_decorated(False) + self.tempPopup.set_modal(True) + self.tempPopup.add_events( gtk.gdk.BUTTON_PRESS_MASK ) + self.tempPopup.connect("button-press-event", self.tempPopPress ) + #self.tempPopup.set_decorated(False) b = gtk.Button("hello") self.tempPopup.add(b) - self.tempPopup.connect("set-focus", self.tempPrint) - #b.connect("focus-in-event", self.tempFocus) - b.connect("focus-out-event", self.tempFocus) self.tempPopup.move( 100, 100 ) self.tempPopup.resize( 300, 100 ) #self.tempPopup.show_all() - self.menu = gtk.Menu() - m1 = gtk.MenuItem("hello") - m2 = gtk.MenuItem("people") - m3 = gtk.MenuItem("s") - self.menu.append(m1) - self.menu.append(m2) - self.menu.append(m3) - m1.show() - m2.show() - m3.show() - - def tempFocus( self, widget, event ): - print "tempFocus", widget, event.type - self.tempPopup.hide_all() - - def tempPrint( self, window, widget ): - print "tempPrint", window, widget, self.tempPopup - print "helloeuaue", self.tempPopup.has_toplevel_focus() + def tempPopPress( self, w, event ): + print "pressed", event.x, event.y + self.tempPopup.hide() def updateFPS( self ): t = time.time() @@ -677,9 +671,9 @@ class MainWindow( gtk.EventBox ): return self.noteDB.pasteClipboard( pages, offset, trackMap ) def cleanupClipboard( self ): - if self.GUI["2noteDuplicateButton"].get_active(): + if self.skipCleanup != "note" and self.GUI["2noteDuplicateButton"].get_active(): self.GUI["2noteDuplicateButton"].set_active(False) - if self.GUI["2trackDuplicateButton"].get_active(): + if self.skipCleanup != "track" and self.GUI["2trackDuplicateButton"].get_active(): self.GUI["2trackDuplicateButton"].set_active(False) self.trackInterface.donePaste() @@ -709,8 +703,10 @@ class MainWindow( gtk.EventBox ): if not N: continue stream += [ self.displayedPage, t, N ] + ids[t] if len(stream): + self.skipCleanup = "note" if self.GUI["2trackDuplicateButton"].get_active(): self.GUI["2trackDuplicateButton"].set_active( False ) + self.skipCleanup = "" self.noteDB.notesToClipboard( stream + [-1] ) self.trackInterface.setInterfaceMode("paste_notes") return True @@ -720,9 +716,11 @@ class MainWindow( gtk.EventBox ): if widget.get_active(): if self.noteDuplicate(): # duplicate succeeded return - # cancel duplicate - self.trackInterface.setInterfaceMode("tool") - widget.set_active(False) + # cancel duplicate + widget.set_active(False) + self.trackInterface.setInterfaceMode("tool") + else: + self.trackInterface.setInterfaceMode("tool") def noteOnset( self, step ): self.trackInterface.noteStepOnset( step ) @@ -799,8 +797,10 @@ class MainWindow( gtk.EventBox ): if trackIds == -1: trackIds = [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackSelected[i] ] if len(trackIds): + self.skipCleanup = "track" if self.GUI["2noteDuplicateButton"].get_active(): self.GUI["2noteDuplicateButton"].set_active( False ) + self.skipCleanup = "" self.noteDB.tracksToClipboard( pageIds, trackIds ) self.trackInterface.setInterfaceMode("paste_tracks") return True @@ -810,9 +810,11 @@ class MainWindow( gtk.EventBox ): if widget.get_active(): if self.trackDuplicate(): # duplicate succeeded return - # cancel duplicate - self.trackInterface.setInterfaceMode("tool") - widget.set_active(False) + # cancel duplicate + widget.set_active(False) + self.trackInterface.setInterfaceMode("tool") + else: + self.trackInterface.setInterfaceMode("tool") #----------------------------------- # tune/page functions @@ -844,7 +846,7 @@ class MainWindow( gtk.EventBox ): def pageProperties( self, pageIds = -1 ): #print "hello", self.tempPopup.has_toplevel_focus() - #self.tempPopup.show_all() + self.tempPopup.show_all() #self.tempPopup.unfullscreen() #self.menu.popup( None, None, None, self.GUI["2pagePropertiesButton"], 0 ) diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py index 5d9da92..364a68f 100644 --- a/Edit/TrackInterface.py +++ b/Edit/TrackInterface.py @@ -66,6 +66,7 @@ class TrackInterface( gtk.EventBox ): self.curAction = False # stores the current mouse action self.curActionObject = False # stores the object that in handling the action + self.clickButton = 0 # used in release and motion events to make sure we where actually the widget originally clicked. (hack for popup windows) self.buttonPressCount = 1 # used on release events to indicate double/triple releases self.clickLoc = [0,0] # location of the last click self.marqueeLoc = False # current drag location of the marquee @@ -289,6 +290,8 @@ class TrackInterface( gtk.EventBox ): TP.ProfileBegin( "TI::handleButtonPress" ) + self.clickButton = event.button + if event.button != 1: print "Should bring up some note parameters or something!" #self.noteParameters = NoteParametersWindow( self.trackDictionary, self.getNoteParameters ) @@ -368,6 +371,9 @@ class TrackInterface( gtk.EventBox ): def handleButtonRelease( self, widget, event ): + if not self.clickButton: return # we recieved this event but were never clicked! (probably a popup window was open) + self.clickButton = 0 + TP.ProfileBegin( "TI::handleButtonRelease" ) if event.button != 1: @@ -416,6 +422,12 @@ class TrackInterface( gtk.EventBox ): TP.ProfileEnd( "TI::handleMotion::Common" ) + if not self.clickButton and self.curAction != "paste": # we recieved this event but were never clicked! (probably a popup window was open) + TP.ProfileBegin( "TI::handleMotion::Hover" ) + self.updateTooltip( event ) + TP.ProfileEnd( "TI::handleMotion::Hover" ) + return + if self.curAction == "paste": TP.ProfileBegin( "TI::handleMotion::Paste" ) top = Config.NUMBER_OF_TRACKS diff --git a/Resources/Images/arrowEditLeft.png b/Resources/Images/arrowEditLeft.png Binary files differnew file mode 100755 index 0000000..dfdc5b4 --- /dev/null +++ b/Resources/Images/arrowEditLeft.png diff --git a/Resources/Images/arrowEditRight.png b/Resources/Images/arrowEditRight.png Binary files differnew file mode 100755 index 0000000..8330d2c --- /dev/null +++ b/Resources/Images/arrowEditRight.png diff --git a/Resources/Images/delNote.png b/Resources/Images/delNote.png Binary files differnew file mode 100755 index 0000000..af04020 --- /dev/null +++ b/Resources/Images/delNote.png diff --git a/Resources/Images/delNoteDown.png b/Resources/Images/delNoteDown.png Binary files differnew file mode 100755 index 0000000..70d136b --- /dev/null +++ b/Resources/Images/delNoteDown.png diff --git a/Resources/Images/delNoteOver.png b/Resources/Images/delNoteOver.png Binary files differnew file mode 100755 index 0000000..5625b4f --- /dev/null +++ b/Resources/Images/delNoteOver.png diff --git a/Resources/Images/delTrack.png b/Resources/Images/delTrack.png Binary files differnew file mode 100755 index 0000000..78117d4 --- /dev/null +++ b/Resources/Images/delTrack.png diff --git a/Resources/Images/delTrackDown.png b/Resources/Images/delTrackDown.png Binary files differnew file mode 100755 index 0000000..862e5a8 --- /dev/null +++ b/Resources/Images/delTrackDown.png diff --git a/Resources/Images/delTrackOver.png b/Resources/Images/delTrackOver.png Binary files differnew file mode 100755 index 0000000..5da2949 --- /dev/null +++ b/Resources/Images/delTrackOver.png diff --git a/Resources/Images/dupNote.png b/Resources/Images/dupNote.png Binary files differnew file mode 100755 index 0000000..2fcd0e9 --- /dev/null +++ b/Resources/Images/dupNote.png diff --git a/Resources/Images/dupNoteDown.png b/Resources/Images/dupNoteDown.png Binary files differnew file mode 100755 index 0000000..97d5766 --- /dev/null +++ b/Resources/Images/dupNoteDown.png diff --git a/Resources/Images/dupNoteOver.png b/Resources/Images/dupNoteOver.png Binary files differnew file mode 100755 index 0000000..516c1f5 --- /dev/null +++ b/Resources/Images/dupNoteOver.png diff --git a/Resources/Images/dupPage.png b/Resources/Images/dupPage.png Binary files differindex 3aeaa44..1cd5b84 100755 --- a/Resources/Images/dupPage.png +++ b/Resources/Images/dupPage.png diff --git a/Resources/Images/dupPageDown.png b/Resources/Images/dupPageDown.png Binary files differindex cc72a45..7582b19 100755 --- a/Resources/Images/dupPageDown.png +++ b/Resources/Images/dupPageDown.png diff --git a/Resources/Images/dupPageOver.png b/Resources/Images/dupPageOver.png Binary files differindex e6db0b5..b3514ab 100755 --- a/Resources/Images/dupPageOver.png +++ b/Resources/Images/dupPageOver.png diff --git a/Resources/Images/dupTrack.png b/Resources/Images/dupTrack.png Binary files differnew file mode 100755 index 0000000..3eae1b1 --- /dev/null +++ b/Resources/Images/dupTrack.png diff --git a/Resources/Images/dupTrackDown.png b/Resources/Images/dupTrackDown.png Binary files differnew file mode 100755 index 0000000..014d713 --- /dev/null +++ b/Resources/Images/dupTrackDown.png diff --git a/Resources/Images/dupTrackOver.png b/Resources/Images/dupTrackOver.png Binary files differnew file mode 100755 index 0000000..b3db0a7 --- /dev/null +++ b/Resources/Images/dupTrackOver.png diff --git a/Resources/Images/editAmpBot.png b/Resources/Images/editAmpBot.png Binary files differnew file mode 100755 index 0000000..4469401 --- /dev/null +++ b/Resources/Images/editAmpBot.png diff --git a/Resources/Images/editAmpDownBot.png b/Resources/Images/editAmpDownBot.png Binary files differnew file mode 100755 index 0000000..d72385b --- /dev/null +++ b/Resources/Images/editAmpDownBot.png diff --git a/Resources/Images/editAmpDownTop.png b/Resources/Images/editAmpDownTop.png Binary files differnew file mode 100755 index 0000000..d8b351a --- /dev/null +++ b/Resources/Images/editAmpDownTop.png diff --git a/Resources/Images/editAmpOverBot.png b/Resources/Images/editAmpOverBot.png Binary files differnew file mode 100755 index 0000000..deb2309 --- /dev/null +++ b/Resources/Images/editAmpOverBot.png diff --git a/Resources/Images/editAmpOverTop.png b/Resources/Images/editAmpOverTop.png Binary files differnew file mode 100755 index 0000000..03a0b55 --- /dev/null +++ b/Resources/Images/editAmpOverTop.png diff --git a/Resources/Images/editAmpTop.png b/Resources/Images/editAmpTop.png Binary files differnew file mode 100755 index 0000000..bf46783 --- /dev/null +++ b/Resources/Images/editAmpTop.png diff --git a/Resources/Images/editDurDownLeft.png b/Resources/Images/editDurDownLeft.png Binary files differnew file mode 100755 index 0000000..1fad77e --- /dev/null +++ b/Resources/Images/editDurDownLeft.png diff --git a/Resources/Images/editDurDownRight.png b/Resources/Images/editDurDownRight.png Binary files differnew file mode 100755 index 0000000..8dc9102 --- /dev/null +++ b/Resources/Images/editDurDownRight.png diff --git a/Resources/Images/editDurLeft.png b/Resources/Images/editDurLeft.png Binary files differnew file mode 100755 index 0000000..79ff5ea --- /dev/null +++ b/Resources/Images/editDurLeft.png diff --git a/Resources/Images/editDurOverLeft.png b/Resources/Images/editDurOverLeft.png Binary files differnew file mode 100755 index 0000000..7dcaf71 --- /dev/null +++ b/Resources/Images/editDurOverLeft.png diff --git a/Resources/Images/editDurOverRight.png b/Resources/Images/editDurOverRight.png Binary files differnew file mode 100755 index 0000000..3156991 --- /dev/null +++ b/Resources/Images/editDurOverRight.png diff --git a/Resources/Images/editDurRight.png b/Resources/Images/editDurRight.png Binary files differnew file mode 100755 index 0000000..c3eba1e --- /dev/null +++ b/Resources/Images/editDurRight.png diff --git a/Resources/Images/editOnsetDownLeft.png b/Resources/Images/editOnsetDownLeft.png Binary files differnew file mode 100755 index 0000000..a514a23 --- /dev/null +++ b/Resources/Images/editOnsetDownLeft.png diff --git a/Resources/Images/editOnsetDownRight.png b/Resources/Images/editOnsetDownRight.png Binary files differnew file mode 100755 index 0000000..4737ad8 --- /dev/null +++ b/Resources/Images/editOnsetDownRight.png diff --git a/Resources/Images/editOnsetLeft.png b/Resources/Images/editOnsetLeft.png Binary files differnew file mode 100755 index 0000000..6eed2ee --- /dev/null +++ b/Resources/Images/editOnsetLeft.png diff --git a/Resources/Images/editOnsetOverLeft.png b/Resources/Images/editOnsetOverLeft.png Binary files differnew file mode 100755 index 0000000..d9bc04b --- /dev/null +++ b/Resources/Images/editOnsetOverLeft.png diff --git a/Resources/Images/editOnsetOverRight.png b/Resources/Images/editOnsetOverRight.png Binary files differnew file mode 100755 index 0000000..adb0eb0 --- /dev/null +++ b/Resources/Images/editOnsetOverRight.png diff --git a/Resources/Images/editOnsetRight.png b/Resources/Images/editOnsetRight.png Binary files differnew file mode 100755 index 0000000..77e42eb --- /dev/null +++ b/Resources/Images/editOnsetRight.png diff --git a/Resources/Images/editPitchBot.png b/Resources/Images/editPitchBot.png Binary files differnew file mode 100755 index 0000000..efd84e2 --- /dev/null +++ b/Resources/Images/editPitchBot.png diff --git a/Resources/Images/editPitchDown.png b/Resources/Images/editPitchDown.png Binary files differnew file mode 100755 index 0000000..83407de --- /dev/null +++ b/Resources/Images/editPitchDown.png diff --git a/Resources/Images/editPitchDownBot.png b/Resources/Images/editPitchDownBot.png Binary files differnew file mode 100755 index 0000000..c4b4a0b --- /dev/null +++ b/Resources/Images/editPitchDownBot.png diff --git a/Resources/Images/editPitchDownDown.png b/Resources/Images/editPitchDownDown.png Binary files differnew file mode 100755 index 0000000..d330505 --- /dev/null +++ b/Resources/Images/editPitchDownDown.png diff --git a/Resources/Images/editPitchDownOver.png b/Resources/Images/editPitchDownOver.png Binary files differnew file mode 100755 index 0000000..8800f62 --- /dev/null +++ b/Resources/Images/editPitchDownOver.png diff --git a/Resources/Images/editPitchDownTop.png b/Resources/Images/editPitchDownTop.png Binary files differnew file mode 100755 index 0000000..0a8825c --- /dev/null +++ b/Resources/Images/editPitchDownTop.png diff --git a/Resources/Images/editPitchOverBot.png b/Resources/Images/editPitchOverBot.png Binary files differnew file mode 100755 index 0000000..7d9e602 --- /dev/null +++ b/Resources/Images/editPitchOverBot.png diff --git a/Resources/Images/editPitchOverTop.png b/Resources/Images/editPitchOverTop.png Binary files differnew file mode 100755 index 0000000..2f2aa34 --- /dev/null +++ b/Resources/Images/editPitchOverTop.png diff --git a/Resources/Images/editPitchTop.png b/Resources/Images/editPitchTop.png Binary files differnew file mode 100755 index 0000000..2084acd --- /dev/null +++ b/Resources/Images/editPitchTop.png diff --git a/Resources/Images/editPitchUp.png b/Resources/Images/editPitchUp.png Binary files differnew file mode 100755 index 0000000..6c49101 --- /dev/null +++ b/Resources/Images/editPitchUp.png diff --git a/Resources/Images/editPitchUpDown.png b/Resources/Images/editPitchUpDown.png Binary files differnew file mode 100755 index 0000000..29c99fb --- /dev/null +++ b/Resources/Images/editPitchUpDown.png diff --git a/Resources/Images/editPitchUpOver.png b/Resources/Images/editPitchUpOver.png Binary files differnew file mode 100755 index 0000000..cf9acaa --- /dev/null +++ b/Resources/Images/editPitchUpOver.png diff --git a/Resources/Images/genTrack.png b/Resources/Images/genTrack.png Binary files differnew file mode 100755 index 0000000..04fa722 --- /dev/null +++ b/Resources/Images/genTrack.png diff --git a/Resources/Images/genTrackDown.png b/Resources/Images/genTrackDown.png Binary files differnew file mode 100755 index 0000000..a4e9a1d --- /dev/null +++ b/Resources/Images/genTrackDown.png diff --git a/Resources/Images/genTrackOver.png b/Resources/Images/genTrackOver.png Binary files differnew file mode 100755 index 0000000..fa11a9a --- /dev/null +++ b/Resources/Images/genTrackOver.png diff --git a/Resources/Images/propNote.png b/Resources/Images/propNote.png Binary files differnew file mode 100755 index 0000000..ef79c88 --- /dev/null +++ b/Resources/Images/propNote.png diff --git a/Resources/Images/propNoteDown.png b/Resources/Images/propNoteDown.png Binary files differnew file mode 100755 index 0000000..7601a72 --- /dev/null +++ b/Resources/Images/propNoteDown.png diff --git a/Resources/Images/propNoteOver.png b/Resources/Images/propNoteOver.png Binary files differnew file mode 100755 index 0000000..7268a66 --- /dev/null +++ b/Resources/Images/propNoteOver.png diff --git a/Resources/Images/propTrack.png b/Resources/Images/propTrack.png Binary files differnew file mode 100755 index 0000000..0cecb41 --- /dev/null +++ b/Resources/Images/propTrack.png diff --git a/Resources/Images/propTrackDown.png b/Resources/Images/propTrackDown.png Binary files differnew file mode 100755 index 0000000..91280f1 --- /dev/null +++ b/Resources/Images/propTrackDown.png diff --git a/Resources/Images/propTrackOver.png b/Resources/Images/propTrackOver.png Binary files differnew file mode 100755 index 0000000..130c094 --- /dev/null +++ b/Resources/Images/propTrackOver.png diff --git a/SynthLab/SynthLabParametersWindow.py b/SynthLab/SynthLabParametersWindow.py index 499ffcb..45aff9f 100644 --- a/SynthLab/SynthLabParametersWindow.py +++ b/SynthLab/SynthLabParametersWindow.py @@ -129,7 +129,7 @@ class SynthLabParametersWindow( gtk.Window ): self.mainBox.pack_start(self.sliderBox) - closeButton = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/close.png' ) + closeButton = ImageButton(Config.IMAGE_ROOT + 'close.png' ) closeButton.connect('clicked', self.destroy ) self.mainBox.pack_start(closeButton) diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py index 979aba7..6248418 100644 --- a/SynthLab/SynthLabWindow.py +++ b/SynthLab/SynthLabWindow.py @@ -149,11 +149,11 @@ class SynthLabWindow( gtk.Window ): self.sliderBox.pack_start(self.durationSlider, True, True, 5) self.sliderBox.pack_start(self.durLabel, False, padding=10) - saveButton = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/save.png') + saveButton = ImageButton(Config.IMAGE_ROOT + 'save.png') saveButton.connect("clicked", self.handleSave, None) self.buttonBox.pack_start(saveButton, False, False, 2) - loadButton = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/load.png') + loadButton = ImageButton(Config.IMAGE_ROOT + 'load.png') loadButton.connect("clicked", self.handleLoad, None) self.buttonBox.pack_start(loadButton, False, False, 2) @@ -161,11 +161,11 @@ class SynthLabWindow( gtk.Window ): self.recordButton.connect("clicked", self.recordSound) self.buttonBox.pack_start(self.recordButton, False, False, 2) - resetButton = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/reset.png') + resetButton = ImageButton(Config.IMAGE_ROOT + 'reset.png') resetButton.connect("clicked", self.handleReset, None) self.buttonBox.pack_start(resetButton, False, False, 2) - closeButton = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/close.png') + closeButton = ImageButton(Config.IMAGE_ROOT + 'close.png') closeButton.connect("clicked", self.handleClose, None) self.buttonBox.pack_start(closeButton, False, False, 2) diff --git a/Util/ThemeWidgets.py b/Util/ThemeWidgets.py index 026ced5..cfc1130 100644 --- a/Util/ThemeWidgets.py +++ b/Util/ThemeWidgets.py @@ -719,7 +719,7 @@ class RoundFixed( gtk.Fixed ): return False class ImageButton(gtk.Button): - def __init__(self , mainImg_path, enterImg_path = None, clickImg_path = None, backgroundFill = None ): + def __init__( self, mainImg_path, clickImg_path = None, enterImg_path = None, backgroundFill = None ): gtk.Button.__init__(self) self.alloc = None win = gtk.gdk.get_default_root_window() @@ -757,8 +757,8 @@ class ImageButton(gtk.Button): if enterImg_path != None: prepareImage( "enter", enterImg_path ) - self.connect('enter',self.on_btn_enter, None) - self.connect('leave',self.on_btn_leave, None) + self.connect('enter-notify-event',self.on_btn_enter) + self.connect('leave-notify-event',self.on_btn_leave) if clickImg_path != None: prepareImage( "click", clickImg_path ) self.connect('pressed',self.on_btn_press, None) @@ -770,8 +770,8 @@ class ImageButton(gtk.Button): self.iwidthDIV2["enter"] = self.iwidthDIV2["main"] self.iheight["enter"] = self.iheight["main"] self.iheightDIV2["enter"] = self.iheightDIV2["main"] - self.connect('enter',self.on_btn_enter, None) - self.connect('leave',self.on_btn_leave, None) + self.connect('enter-notify-event',self.on_btn_enter) + self.connect('leave-notify-event',self.on_btn_leave) self.curImage = self.upImage = "main" self.down = False @@ -799,14 +799,16 @@ class ImageButton(gtk.Button): self.queue_draw() def on_btn_enter(self, widget, event): - self.upImage = "enter" - if self.down: self.curImage = "click" - else: self.curImage = "enter" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.upImage = "enter" + if self.down: self.curImage = "click" + else: self.curImage = "enter" + self.queue_draw() def on_btn_leave(self, widget, event): - self.curImage = self.upImage = "main" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.curImage = self.upImage = "main" + self.queue_draw() def on_btn_release(self, widget, event): self.curImage = self.upImage @@ -818,6 +820,7 @@ class ImageToggleButton(gtk.ToggleButton): def __init__(self , mainImg_path, altImg_path, enterImg_path = None, backgroundFill = None ): gtk.ToggleButton.__init__(self) self.alloc = None + self.within = False win = gtk.gdk.get_default_root_window() self.gc = gtk.gdk.GC( win ) @@ -855,8 +858,8 @@ class ImageToggleButton(gtk.ToggleButton): if enterImg_path != None: prepareImage( "enter", enterImg_path ) - self.connect('enter',self.on_btn_enter, None) - self.connect('leave',self.on_btn_leave, None) + self.connect('enter-notify-event',self.on_btn_enter) + self.connect('leave-notify-event',self.on_btn_leave) self.connect('toggled',self.toggleImage, None) self.connect('expose-event', self.expose) @@ -880,26 +883,38 @@ class ImageToggleButton(gtk.ToggleButton): def toggleImage(self, widget, event): if not self.get_active(): - self.curImage = "main" + if self.within and self.image.has_key("enter"): + self.curImage = "enter" + else: + self.curImage = "main" else: self.curImage = "alt" self.queue_draw() def on_btn_enter(self, widget, event): - self.curImage = "enter" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.within = True + if not self.get_active(): + self.curImage = "enter" + else: + self.curImage = "alt" + self.queue_draw() def on_btn_leave(self, widget, event): - if not self.get_active(): - self.curImage = "main" - else: - self.curImage = "alt" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.within = False + if not self.get_active(): + self.curImage = "main" + else: + self.curImage = "alt" + self.queue_draw() class ImageRadioButton(gtk.RadioButton): + def __init__( self, group, mainImg_path, altImg_path, enterImg_path = None, backgroundFill = None ): gtk.RadioButton.__init__(self, group) self.alloc = None + self.within = False win = gtk.gdk.get_default_root_window() self.gc = gtk.gdk.GC( win ) @@ -937,8 +952,8 @@ class ImageRadioButton(gtk.RadioButton): if enterImg_path != None: prepareImage( "enter", enterImg_path ) - self.connect('enter',self.on_btn_enter, None) - self.connect('leave',self.on_btn_leave, None) + self.connect('enter-notify-event',self.on_btn_enter) + self.connect('leave-notify-event',self.on_btn_leave) self.connect("toggled", self.toggleImage, None ) self.connect('expose-event', self.expose) @@ -962,18 +977,28 @@ class ImageRadioButton(gtk.RadioButton): def toggleImage(self, widget, event): if not self.get_active(): - self.curImage = "main" + if self.within and self.image.has_key("enter"): + self.curImage = "enter" + else: + self.curImage = "main" else: self.curImage = "alt" self.queue_draw() def on_btn_enter(self, widget, event): - self.curImage = "enter" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.within = True + if not self.get_active(): + self.curImage = "enter" + else: + self.curImage = "alt" + self.queue_draw() def on_btn_leave(self, widget, event): - if not self.get_active(): - self.curImage = "main" - else: - self.curImage = "alt" - self.queue_draw() + if event.mode == gtk.gdk.CROSSING_NORMAL: + self.within = False + if not self.get_active(): + self.curImage = "main" + else: + self.curImage = "alt" + self.queue_draw() |