Skip to content

Fix allows slots with default values to be set to None#2

Open
xotmatrix wants to merge 1 commit intoanomixer:masterfrom
xotmatrix:patch-slot-defaults
Open

Fix allows slots with default values to be set to None#2
xotmatrix wants to merge 1 commit intoanomixer:masterfrom
xotmatrix:patch-slot-defaults

Conversation

@xotmatrix
Copy link
Copy Markdown

This patch addresses a problem with setting certain slots to be empty.

Background:
Attempting to select "—None—" for a slot with a default device will immediately select the default device. I do not have a Mac to compare to, but according to my discussion with Kelvin Sherlock, the correct behavior is to explicitly set the slot to empty in the command line. For example, slot 6 defaults to diskiing when no command line argument is given. To disable it, the empty string -sl6 '' is required. Ample does this, but AmpleWin does not.

Cause:
This problem is caused by initialize_default_slots() being called each time the UI selections change. That function will automatically set a slot to its default value because an empty slot is indistinguishable from an unset slot.

Fix:
According to Kelvin, Ample does not initialize the system when the UI is changed. It simply updates the command line. The first part of this patch removes the reinitialization when the UI is refreshed. The second part sets the slot to a quoted, empty string whenever it has a default=False value in its XML, which I believe means the slot must be explicitly disabled in the command line.

Linux:
It looks like the same fix could be applied to the Linux port. I cannot build for Linux, so I left this alone. I think these are the equivalent lines.

# 0. Re-initialize defaults for any newly appeared slots/devices

item.setData(opt['value'], Qt.UserRole)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant