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

PianoKeyboard

Widget containing a row of piano keys styled like JD-Xi

Functions

drum_label_style(color) → str

The style of the drum labels above the keys, in color.

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.QWidget

Widget containing a row of piano keys styled like JD-Xi

noteOn[source]
noteOff[source]
current_channel = 0[source]
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]
drum_labels = [][source]
LABEL_HEIGHT = 30[source]
_apply_key_sizes(instrument_width: int) → None[source]

Size the keys for an instrument instrument_width px 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

_rebuild_keys() → None[source]

Build the keys again at the current size.

Returns:

None

set_instrument_width(instrument_width: int, depth: int = 0) → None[source]

Re-size the keys for an instrument instrument_width px 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

apply_skin() → None[source]

Letter the drum labels in the active skin’s silkscreen.

Returns:

None

_create_keys(keyboard_widget: jdxi_editor.ui.common.QWidget) → None[source]

Create piano keys with individual shadows

Parameters:

keyboard_widget – QWidget

MIDDLE_C = 60[source]
show_middle_c(octave: int = 0) → None[source]

Mark the key that sounds middle C (C4) on the JD-Xi at octave.

With Octave +1 it is the lower C, with -1 the top one; beyond the 37 keys (+2, -2…) no key is marked.

Parameters:

octave – int the octave shift

Returns:

None

set_midi_channel(channel: int) → None[source]

Set MIDI channel for note messages

Parameters:

channel – int