Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 309 #314

Merged
merged 4 commits into from
Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,25 +502,30 @@ 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)])
# Get all items' current toggle state
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:
# Use items' states instead of section state if all optional items
# are the same state.
checkState = not states.pop()

for item in model.items:
if item.itemType == "instance" and sectionLabel == item.category:
if item.isToggled != checkState:
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.isToggled != checkState and item.optional:
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
2 changes: 1 addition & 1 deletion pyblish_qml/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

VERSION_MAJOR = 1
VERSION_MINOR = 9
VERSION_PATCH = 0
VERSION_PATCH = 1

version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
Expand Down