Skip to content

Commit

Permalink
Fix animitem settings loading twice
Browse files Browse the repository at this point in the history
Fix ValidateAnimationError
Fix namespaces default type
  • Loading branch information
krathjen committed Apr 6, 2017
1 parent f97b2a0 commit d4d19c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/studiolibrary/packages/studiolibraryitems/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def settings():
"""
settings = studiolibrary.Settings.instance("StudioLibrary", "ItemSettings")

# Shared options
settings.setdefault("namespaces", [])
settings.setdefault("namespaceOption", "file")

settings.setdefault("iconToggleBoxChecked", True)
settings.setdefault("infoToggleBoxChecked", True)
settings.setdefault("optionsToggleBoxChecked", True)
settings.setdefault("namespaceToggleBoxChecked", True)

# Anim options
settings.setdefault('byFrame', 1)
settings.setdefault('fileType', DEFAULT_FILE_TYPE)
Expand Down
4 changes: 1 addition & 3 deletions src/studiolibrary/packages/studiolibraryitems/animitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def validateFrameRange(self):
"""
if self.startFrame() is None or self.endFrame() is None:
msg = "Please choose a start frame and an end frame."
raise ValidateAnimationError(msg)
raise ValidateAnimError(msg)

def save(self, objects, path, iconPath, description):
"""
Expand Down Expand Up @@ -634,8 +634,6 @@ def __init__(self, *args, **kwargs):
self.connect(self.ui.connectCheckBox, QtCore.SIGNAL('stateChanged(int)'), self.connectChanged)
self.connect(self.ui.option, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.optionChanged)

self.loadSettings()

def setItem(self, item):
"""
:type item: AnimItem
Expand Down
12 changes: 6 additions & 6 deletions src/studiolibrary/packages/studiolibraryitems/transferitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ValidateError(TransferItemError):


class NamespaceOption:
FromFile = "pose"
FromFile = "file"
FromCustom = "custom"
FromSelection = "selection"

Expand Down Expand Up @@ -375,7 +375,7 @@ def namespaceFromCustom(self):
:rtype: list[str]
"""
return self.settings().get("namespaces", "")
return self.settings().get("namespaces", [])

def setCustomNamespaces(self, namespaces):
"""
Expand Down Expand Up @@ -971,12 +971,12 @@ def setState(self, state):
"""
:type state: dict
"""
namespaceOption = state.get("namespaceOption", "")
self.setNamespaceOption(namespaceOption)

namespaces = state.get("namespaces", "")
namespaces = state.get("namespaces", [])
self.setNamespaces(namespaces)

namespaceOption = state.get("namespaceOption", NamespaceOption.FromFile)
self.setNamespaceOption(namespaceOption)

toggleBoxChecked = state.get("iconToggleBoxChecked", True)
self.ui.iconToggleBoxFrame.setVisible(toggleBoxChecked)
self.ui.iconToggleBoxButton.setChecked(toggleBoxChecked)
Expand Down

0 comments on commit d4d19c9

Please sign in to comment.