Skip to content

Commit

Permalink
Adds Bluetooth menu info
Browse files Browse the repository at this point in the history
  • Loading branch information
riban committed Dec 23, 2024
1 parent d029c31 commit d1118cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Binary file added icons/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion zyngui/zynthian_gui_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def fill_list(self):
self.list_data.append((self.show_cv_config, 0, "CV Settings", ["Control Voltage configuration.", None]))
self.list_data.append((self.zyngui.calibrate_touchscreen, 0, "Calibrate Touchscreen", ["Show touchscreen calibration.\nTouch each crosshair until it changes color.\nScreen closes after 15s of inactivity.", None]))
self.list_data.append((self.zyngui.cuia_screen_clean, 0, "Clean Screen", ["10s countdown with no touch trigger. Allows screen to be cleaned without triggering any action.", None]))
self.list_data.append((self.bluetooth, 0, "Bluetooth", ["Scan, enable and configure Bluetooth devices.\n\nMust enable Bluetooth here to access BLE MIDI devices. Also supports HID devices.", None]))
self.list_data.append((self.bluetooth, 0, "Bluetooth", ["Scan, enable and configure Bluetooth devices.\n\nMust enable Bluetooth here to access BLE MIDI devices. Also supports HID devices.", "bluetooth.png"]))

self.list_data.append((None, 0, "> TEST"))
self.list_data.append((self.test_audio, 0, "Test Audio", ["Play an audio track to test audio output.\n\nPress BACK to cancel playback.", "headphones.png"]))
Expand Down
16 changes: 8 additions & 8 deletions zyngui/zynthian_gui_bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from subprocess import Popen, PIPE

# Zynthian specific modules
from zyngui.zynthian_gui_selector import zynthian_gui_selector
from zyngui.zynthian_gui_selector_info import zynthian_gui_selector_info
from zyngui import zynthian_gui_config
import zynconf

Expand All @@ -39,7 +39,7 @@
# ------------------------------------------------------------------------------


class zynthian_gui_bluetooth(zynthian_gui_selector):
class zynthian_gui_bluetooth(zynthian_gui_selector_info):

def __init__(self):
self.proc = None
Expand All @@ -49,7 +49,7 @@ def __init__(self):
self.ble_controllers = {}
self.ble_devices = {} # Map of BLE devices, indexed by device address
self.pending_actions = [] # List of BLE commands to queue
super().__init__('Bluetooth', True)
super().__init__('Bluetooth')
self.select_path.set("Bluetooth")

def build_view(self):
Expand All @@ -73,16 +73,16 @@ def fill_list(self):

if zynthian_gui_config.bluetooth_enabled:
self.list_data.append(
("stop_bluetooth", None, "\u2612 Enable Bluetooth"))
("stop_bluetooth", None, "\u2612 Enable Bluetooth", ["Bluetooth is enabled.\n\nSelect to disable Bluetooth.", "bluetooth.png"]))
if len(self.ble_controllers) == 0:
self.list_data.append(
(None, None, "No Bluetooth controllers detected!"))
(None, None, "No Bluetooth controllers detected!", ["There are not Bluetooth controllers attached to zynthian. You may connect a Bluetooth USB device.", "bluetooth.png"]))
super().fill_list()
return
for ctrl in sorted(self.ble_controllers.keys()):
chk = "\u2612" if self.ble_controllers[ctrl]["enabled"] else "\u2610"
self.list_data.append(
("enable_controller", ctrl, f" {chk} {self.ble_controllers[ctrl]['alias']}"))
("enable_controller", ctrl, f" {chk} {self.ble_controllers[ctrl]['alias']}", ["Enable/disable Bluetooth controller.\n\nOnly enable a single controller. It is advised to use a USB Bluetooth adapter because the Raspberry Pi onboard adapter has poor range.", "bluetooth.png"]))
self.list_data.append((None, None, "Devices"))
for addr, data in self.ble_devices.items():
# [name, paired, trusted, connected, is_midi]
Expand All @@ -93,10 +93,10 @@ def fill_list(self):
if data[3]:
title += "\uf293 "
title += data[0]
self.list_data.append((f"BLE:{addr}", addr, title))
self.list_data.append((f"BLE:{addr}", addr, title, ["Enable/disable this USB device.\n\nEnabling a device will pair it with zynthian. This state will be remembered.", "bluetooth.png"]))
else:
self.list_data.append(
("start_bluetooth", None, "\u2610 Enable Bluetooth"))
("start_bluetooth", None, "\u2610 Enable Bluetooth", ["Bluetooth is disabled.\n\nSelect to enable Bluetooth.", "bluetooth.png"]))

super().fill_list()

Expand Down

0 comments on commit d1118cc

Please sign in to comment.