jdxi_editor.ui.widgets.piano.keyboard
Piano keyboard widget for JD-Xi Manager.
This module defines address PianoKeyboard widget, address custom QWidget that arranges and displays address set of piano keys styled like those on address JD-Xi synthesizer. The widget combines both white and black keys to form address complete piano keyboard, along with labels representing drum pad names.
Key Features: - Custom Key Dimensions: White and black keys are sized and positioned appropriately,
with configurable widths and heights.
- Dynamic Key Creation: White keys are created first in address horizontal layout,
while black keys are overlaid at specific positions.
- Drum Pad Labels: A row of labels is displayed above the keyboard to denote
corresponding drum pad names.
- Signal Integration: Each key emits custom signals (noteOn and noteOff) to notify
parent widgets of key events.
- MIDI Channel Configuration: The widget supports setting address MIDI channel for outgoing
note messages.
- Styling and Layout: Uses QHBoxLayout and QVBoxLayout to manage key and label placement,
ensuring address neat appearance.
- Usage Example:
from jdxi_editor.ui.widgets.piano.keyboard import PianoKeyboard keyboard = PianoKeyboard(parent=main_window) keyboard.set_midi_channel(1) main_window.setCentralWidget(keyboard)
This module requires PySide6 and proper integration with the JD-Xi Manager’s signal handling for note events.
Classes
Widget containing a row of piano keys styled like JD-Xi |
Functions
|
The style of the drum labels above the keys, in |
Module Contents
- jdxi_editor.ui.widgets.piano.keyboard.drum_label_style(color: str) str[source]
The style of the drum labels above the keys, in
color.They sit on the instrument’s body, so they are silkscreen and have to follow the skin: a fixed grey disappears on a pale chassis.
- Parameters:
color – str the lettering colour
- Returns:
str stylesheet for one label
- class jdxi_editor.ui.widgets.piano.keyboard.PianoKeyboard(parent: jdxi_editor.ui.common.QWidget = None)[source]
Bases:
jdxi_editor.ui.common.QWidgetWidget containing a row of piano keys styled like JD-Xi
- white_notes = [36, 38, 40, 41, 43, 45, 47, 48, 50, 52, 53, 55, 57, 59, 60, 62, 64, 65, 67, 69, 71, 72][source]
- black_notes = [37, 39, None, 42, 44, 46, 49, 51, None, 54, 56, 58, 61, 63, None, 66, 68, 70][source]
- _apply_key_sizes(instrument_width: int) None[source]
Size the keys for an instrument
instrument_widthpx wide.The JD-Xi’s keys run from the wheels to the right edge and are as long as the machine is deep below the panel, so both follow the width rather than being pinned to a number that is only right at one size.
- Parameters:
instrument_width – int the instrument’s width in px
- Returns:
None
- set_instrument_width(instrument_width: int, depth: int = 0) None[source]
Re-size the keys for an instrument
instrument_widthpx wide.Rebuilds the keys, so it returns at once when nothing would change.
- Parameters:
instrument_width – int the instrument’s width in px
depth – int the depth the keyboard must fill, labels included; 0 to take it from the instrument’s own proportions
- Returns:
None
- _create_keys(keyboard_widget: jdxi_editor.ui.common.QWidget) None[source]
Create piano keys with individual shadows
- Parameters:
keyboard_widget – QWidget