plugin: add a tap bpm plugin #2264
Conversation
self.pack_start(box, False, True, 0) | ||
|
||
self.tap_btn = Gtk.Button(label=_("Tap")) | ||
self.tap_btn.connect('button-press-event', self.tap) |
lazka
Feb 24, 2017
Member
'clicked' event, otherwise pressing space/enter wont do anything if the button is focused.
'clicked' event, otherwise pressing space/enter wont do anything if the button is focused.
ptitjes
Feb 24, 2017
•
Author
Collaborator
I used press
event because when you tap with a mouse or a pad, whereas the clicked
comes at the release of the mouse/pad button. The user (well me) expects to tap at press. It is really not nice when tap is triggered by release, because not only you have to tap in rhythm but also kinda press the button for the same duration every time (not simple, I tried :p).
Maybe I should document it so that not one wonders in the future.
I could add an additional trigger for key-presses when the button is focused...
I used press
event because when you tap with a mouse or a pad, whereas the clicked
comes at the release of the mouse/pad button. The user (well me) expects to tap at press. It is really not nice when tap is triggered by release, because not only you have to tap in rhythm but also kinda press the button for the same duration every time (not simple, I tried :p).
Maybe I should document it so that not one wonders in the future.
I could add an additional trigger for key-presses when the button is focused...
lazka
Feb 24, 2017
Member
I see, let's leave it that way then for now..
I see, let's leave it that way then for now..
|
||
box = Gtk.HBox() | ||
box.set_spacing(6) | ||
box.pack_start(Gtk.Label(_("BPM:")), False, True, 0) |
lazka
Feb 24, 2017
Member
add a translators comment above:
# TRANSLATORS: BPM measn "beats per minute"
add a translators comment above:
# TRANSLATORS: BPM measn "beats per minute"
ptitjes
Feb 24, 2017
Author
Collaborator
Sure !
Sure !
self.show_all() | ||
|
||
def update(self): | ||
GObject.idle_add(self.do_update) |
lazka
Feb 24, 2017
Member
Why the idle_add?
Why the idle_add?
ptitjes
Feb 24, 2017
Author
Collaborator
It won't work without it, I think because we are in modal dialog.
It won't work without it, I think because we are in modal dialog.
lazka
Feb 24, 2017
Member
What doesn't work? It seems to work the same here as far as I can see.
What doesn't work? It seems to work the same here as far as I can see.
ptitjes
Feb 24, 2017
Author
Collaborator
If call do_update
directly in update
, the label is never updated.
If call do_update
directly in update
, the label is never updated.
ptitjes
Feb 24, 2017
Author
Collaborator
OK, forget it you're right ! :)
I'll change that.
OK, forget it you're right ! :)
I'll change that.
return | ||
|
||
# Save metadata | ||
self._panel.save() |
lazka
Feb 24, 2017
Member
Not a bug, but try to save before destroying the window. After destroy() widgets shouldn't be used anymore and while it currently doesn't use it in save(), it might in the future.
Not a bug, but try to save before destroying the window. After destroy() widgets shouldn't be used anymore and while it currently doesn't use it in save(), it might in the future.
ptitjes
Feb 24, 2017
Author
Collaborator
Indeed, I'll modify that !
Indeed, I'll modify that !
* clean code * add key-press-event support * save metadata before destroying widgets
@lazka Changes made as requested. I kept using "button-press-event" but added code to handle space/return key presses. |
Thanks |
Thank you ! |
This is a very little plugin that allows the user to tap the BPM for the selected song and save it in its tags.