Browse Source

Repair viewing only loaded instruments

master
Nils 3 years ago
parent
commit
63f99d4902
  1. 2
      engine/instrument.py
  2. 10
      qtgui/instrument.py

2
engine/instrument.py

@ -165,7 +165,7 @@ class Instrument(object):
result["defaultVariantWithoutSfzExtension"] = self.metadata["defaultVariant"].rstrip(".sfz") #str
result["tags"] = self.metadata["tags"].split(",") # list of str
result["instrumentsInLibraryCount"] = self.instrumentsInLibraryCount # int
result["status"] = self.exportStatus() #a dict
result["status"] = self.exportStatus() #a dict #TODO: This is a problem because metadata is only exported on program start. This could lead functions to try to check for state/enabled in here, which would be always false. This is only valid on program start/load from file
#Optional Tags.
result["group"] = self.metadata["group"] if "group" in self.metadata else "" #str

10
qtgui/instrument.py

@ -132,12 +132,17 @@ class InstrumentTreeController(object):
The currentTreeItem we receive is not a global instance but from a widget different to ours.
We need to find our local version of the same instrument/library/idKey first.
"""
if not self.guiLibraries or not self.guiInstruments:
#"Show Only Loaded" but no instruments are.
#Or Non-Nested view without libraries
return
self.treeWidget.blockSignals(True)
isLibrary = type(currentTreeItem) is GuiLibrary
idKey = currentTreeItem.idKey
if isLibrary:
if isLibrary and idKey in self.guiLibraries:
assert idKey in self.guiLibraries, (idKey, self.guiLibraries)
item = self.guiLibraries[idKey]
else:
@ -253,7 +258,8 @@ class InstrumentTreeController(object):
if showOnlyLoadedInstruments and instrumentDict["idKey"] in self._cachedLastInstrumentStatus and not self._cachedLastInstrumentStatus[instrumentDict["idKey"]]["state"]: #don't create if we only want to see enabled instrument
instrumentVisible = False
elif showOnlyLoadedInstruments and not instrumentDict["status"]["state"]:
elif showOnlyLoadedInstruments and not instrumentDict["idKey"] in self._cachedLastInstrumentStatus and not instrumentDict["status"]["state"]:
#Not cached yet. This is only good for "load from file". The instruments are not in _cachedLastInstrumentStatus yet
instrumentVisible = False
else:
instrumentVisible = True

Loading…
Cancel
Save