Designer - expanding/collapsing Perspective property lists

Some of our perspective views have a lot of properties, and navigating and viewing them is an irritation. They always default to expanding the 1 top level and keeping the rest closed. For some of our views that are holding multiple large lists/objects, this default is already very cluttered. I can click to collapse them all, but if I move to another component or view and back, then they expand again.

And if I do want to dig down to a single value that is nested multiple levels deep and expand one tree of properties, that also gets lost if I jump between components.

Is there a shortcut to "expand all" or "collapse all" on the property views? (keyboard, mouse, anything?)

Would it be feasible to have Designer remember in the short-term while a view is open what nesting levels are expanded/collapsed on each component?

In my particular case I would be even be happy if I could just change the default that it uses to be "expand 0 levels" and not "expand 1 level", so it would be a less cluttered starting point which is currently my bigger irritation.

Tragically, expand all and collapse all methods are available, just not exposed in the UI of the component...

For instance, this works from the script console:

from com.inductiveautomation.ignition.designer import IgnitionDesigner
from com.inductiveautomation.perspective.common.api import PropertyType

designerGui = IgnitionDesigner.getFrame()
context = designerGui.context

dockingManager = context.dockingManager
propertyEditor = dockingManager.getFrame("PerspectivePropEditor")
propertyEditor.getEditorFor(PropertyType.props).collapseAll()
3 Likes

That snippet doesn't seem to be doing anything when I run it. No errors on the console or log and no obvious effect. I can poke around at the variables like dockingManager and they are there and seem sensible.

Just to confirm, this should collapse the bit I circled in red:

Don't forget that the property filter is there. It is most useful.

Property filter

Well, don't you dare contact support if this ever ends up breaking or doing anything weird, but...
If you run this in the script console once, it'll add two buttons to the designer toolbar that expand/collapse all the nodes in the current property tree:

from java.lang import Runnable
from com.inductiveautomation.ignition.designer import IgnitionDesigner
from com.inductiveautomation.perspective.common.api import PropertyType
from com.inductiveautomation.ignition.client.util.action import BaseAction
from com.inductiveautomation.ignition.client.icons import VectorIcons

context = IgnitionDesigner.getFrame().context

propertyEditor = context.dockingManager.getFrame("PerspectivePropEditor")

class PropTreeManipulator(Runnable):
	def __init__(self, callback):
		self.callback = callback
		
	def run(self):
		for propType in PropertyType.values():
			self.callback(propertyEditor.getEditorFor(propType))

expandAll = BaseAction.create(
	"Actions.ExpandAll",
	VectorIcons.get("expand-all"),
	PropTreeManipulator(lambda e: e.expandAll())
)
collapseAll = BaseAction.create(
	"Actions.CollapseAll",
	VectorIcons.get("collapse-all"),
	PropTreeManipulator(lambda e: e.collapseAll())
)

toolbar = context.toolbarManager.getDockableBar("com.inductiveautomation.perspective")
toolbar.addButton(expandAll)
toolbar.addButton(collapseAll)
5 Likes

I was going to ask how to get rid of the buttons, but they disappear as soon as you open a new project. It's a hacky workaround, but it works and it makes editing views less irritating. Thank you.

1 Like