Skip to content

Commit

Permalink
Enable multi-selection in Loader
Browse files Browse the repository at this point in the history
  • Loading branch information
mottosso committed Jan 17, 2017
1 parent fbf6bd7 commit a60d24e
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions mindbender/tools/loader/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def __init__(self, parent=None):
assets = QtWidgets.QListWidget()
subsets = QtWidgets.QListWidget()

# Enable loading many subsets at once
subsets.setSelectionMode(subsets.ExtendedSelection)

layout = QtWidgets.QHBoxLayout(container)
layout.addWidget(assets)
layout.addWidget(subsets)
Expand Down Expand Up @@ -255,31 +258,32 @@ def on_load_pressed(self):
autoclose_checkbox = self.data["button"]["autoclose"]

asset_item = assets_model.currentItem()
subset_item = subsets_model.currentItem()

if subset_item is None:
return
for subset_item in subsets_model.selectedItems():

asset = asset_item.data(AssetRole)
subset = subset_item.data(SubsetRole)
assert asset
assert subset
if subset_item is None:
return

try:
api.registered_host().load(asset, subset)
asset = asset_item.data(AssetRole)
subset = subset_item.data(SubsetRole)
assert asset
assert subset

try:
api.registered_host().load(asset, subset)

except ValueError as e:
self.echo(e)
raise
except ValueError as e:
self.echo(e)
raise

except NameError as e:
self.echo(e)
raise
except NameError as e:
self.echo(e)
raise

# Catch-all
except Exception as e:
self.echo("Program error: %s" % str(e))
raise
# Catch-all
except Exception as e:
self.echo("Program error: %s" % str(e))
raise

if autoclose_checkbox.checkState():
self.close()
Expand Down

0 comments on commit a60d24e

Please sign in to comment.