Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlatwe committed Jan 9, 2019
1 parent 4449e5c commit c5c2d19
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,25 +517,28 @@ def toggleInstance(self, index):
def toggleSection(self, checkState, sectionLabel):
model = self.data["models"]["item"]

states = set([item.isToggled for item in model.items
if (item.itemType == "instance" and
sectionLabel == item.category)])
states = set()
for item in model.items:
if item.itemType == "instance" and sectionLabel == item.category:
if item.optional:
states.add(item.isToggled)
if item.itemType == "plugin" and sectionLabel == item.verb:
if item.optional:
states.add(item.isToggled)

if len(states) == 1:
checkState = not states.pop()

for item in model.items:
if item.itemType == "instance" and sectionLabel == item.category:
if item.isToggled != checkState:
if item.isToggled != checkState and item.optional:
self.__toggle_item(model,
model.items.index(item))

if item.itemType == "plugin" and item.optional:
if item.verb == sectionLabel:
if item.isToggled != checkState:
self.__toggle_item(
model,
model.items.index(item))
if item.itemType == "plugin" and sectionLabel == item.verb:
if item.isToggled != checkState and item.optional:
self.__toggle_item(model,
model.items.index(item))

@QtCore.pyqtSlot(bool, str)
def hideSection(self, hideState, sectionLabel):
Expand Down

0 comments on commit c5c2d19

Please sign in to comment.