From 4c09c63d8100ed8187a89ea07c530f5b02d6c083 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Wed, 27 Mar 2024 16:47:59 -0700 Subject: [PATCH 01/11] wip --- src/main/scala/edg_ide/swing/dse/JDsePlot.scala | 12 ++++++------ .../scala/edg_ide/ui/BlockVisualizerPanel.scala | 15 +++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala index 101984b6..d0a0faaf 100644 --- a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala +++ b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala @@ -13,12 +13,12 @@ object JDsePlot { val kBackgroundBlend: Float = 0.25f val kBackgroundAlpha: Int = 127 - val kPointSizePx: Int = 4 // diameter in px - val kSnapDistancePx: Int = 6 // distance (radius) to snap for a click - val kPointSelectedSizePx: Int = 6 // diameter in px - val kPointHoverOutlinePx: Int = 12 // diameter in px - val kLineHoverBackgroundPx: Int = 19 // width in px - val kLineHoverOutlinePx: Int = 9 // width in px + val kPointSizePx: Int = 8 // diameter in px + val kSnapDistancePx: Int = 12 // distance (radius) to snap for a click + val kPointSelectedSizePx: Int = 12 // diameter in px + val kPointHoverOutlinePx: Int = 18 // diameter in px + val kLineHoverBackgroundPx: Int = 30 // width in px + val kLineHoverOutlinePx: Int = 16 // width in px val kHoverOutlineColor: Color = JBColor.BLUE val kHoverOutlineBlend: Float = 0.5f diff --git a/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala b/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala index 0cabcbc9..8e6d6ef3 100644 --- a/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala +++ b/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala @@ -285,13 +285,16 @@ class BlockVisualizerPanel(val project: Project, toolWindow: ToolWindow) extends dsePanelShown = dseConfigSelected // set it now, so we don't get multiple invocations of the update ApplicationManager.getApplication.invokeLater(() => { if (dseConfigSelected) { - remove(mainSplitter) - dseSplitter.setFirstComponent(mainSplitter) - add(dseSplitter) + mainSplitter.setSecondComponent(dsePanel) +// remove(mainSplitter) +// dseSplitter.setFirstComponent(mainSplitter) +// add(dseSplitter) } else { - remove(dseSplitter) - dseSplitter.setFirstComponent(null) - add(mainSplitter) + mainSplitter.setSecondComponent(bottomSplitter) + +// remove(dseSplitter) +// dseSplitter.setFirstComponent(null) +// add(mainSplitter) } }) revalidate() From 3bfd33e5d47d92e314b075dbdc7c01de93a9f877 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Wed, 27 Mar 2024 16:54:55 -0700 Subject: [PATCH 02/11] Update DseFeature.scala --- src/main/scala/edg_ide/dse/DseFeature.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/edg_ide/dse/DseFeature.scala b/src/main/scala/edg_ide/dse/DseFeature.scala index d15d0390..710330bb 100644 --- a/src/main/scala/edg_ide/dse/DseFeature.scala +++ b/src/main/scala/edg_ide/dse/DseFeature.scala @@ -2,5 +2,5 @@ package edg_ide.dse object DseFeature { // feature flag to hide the feature while it's still in development - val kEnabled = false + val kEnabled = true } From 53f864a19ce969d26f8a78afa3f0a0a1a910f8c2 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Wed, 27 Mar 2024 23:38:18 -0700 Subject: [PATCH 03/11] params addable from ports --- src/main/scala/edg_ide/ui/DsePanel.scala | 6 ++-- .../scala/edg_ide/ui/tools/DefaultTool.scala | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/scala/edg_ide/ui/DsePanel.scala b/src/main/scala/edg_ide/ui/DsePanel.scala index 5443c74d..33ea3b14 100644 --- a/src/main/scala/edg_ide/ui/DsePanel.scala +++ b/src/main/scala/edg_ide/ui/DsePanel.scala @@ -403,8 +403,10 @@ class DsePanel(project: Project) extends JPanel { val nodePath = new TreePath(treeRoot).pathByAddingChild(treeRoot.objectivesNode) configTree.getTree.expandPath(nodePath) if (scrollToLast) { - val lastNodePath = nodePath.pathByAddingChild(treeRoot.objectivesNode.children.last) - configTree.scrollRectToVisible(configTree.getTree.getPathBounds(lastNodePath)) + treeRoot.objectivesNode.children.lastOption.foreach { last => + val lastNodePath = nodePath.pathByAddingChild(last) + configTree.scrollRectToVisible(configTree.getTree.getPathBounds(lastNodePath)) + } } tabbedPane.setSelectedIndex(kTabConfig) }) diff --git a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala index 8f0bc2b5..573d5754 100644 --- a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala +++ b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala @@ -5,6 +5,7 @@ import com.intellij.openapi.project.Project import com.intellij.util.concurrency.AppExecutorUtil import com.jetbrains.python.psi.search.PyClassInheritorsSearch import edg.EdgirUtils.SimpleLibraryPath +import edg.compiler.FloatValue import edg.util.Errorable import edg.wir.DesignPath import edg.wir.ProtoUtil.ParamProtoToSeqMap @@ -289,6 +290,38 @@ class DesignPortPopupMenu(path: DesignPath, interface: ToolInterface) addGotoDefinitionItem(portClass, project) addGotoConnectItems(path, interface.getDesign, project) + if (DseFeature.kEnabled) { + addSeparator() + + val params = port match { + case port: elem.Port => port.params + case bundle: elem.Bundle => bundle.params + case other => Seq() // including arrays, not supported + } + params.toSeqMap.foreach { case (paramName, paramValue) => + add(ContextMenuUtils.MenuItemFromErrorable( + exceptable { + val paramType = paramValue.`val` match { + case edgir.init.init.ValInit.Val.Floating(_) => classOf[edg.compiler.FloatValue] + case edgir.init.init.ValInit.Val.Integer(_) => classOf[edg.compiler.IntValue] + case edgir.init.init.ValInit.Val.Boolean(_) => classOf[edg.compiler.BooleanValue] + case edgir.init.init.ValInit.Val.Text(_) => classOf[edg.compiler.TextValue] + case edgir.init.init.ValInit.Val.Range(_) => classOf[edg.compiler.RangeValue] + case _ => exceptable.fail(f"unknown parameter type") + } + val objective = DseObjectiveParameter(path.asIndirect + paramName, paramType) + + () => { + val config = + DseService(project).getOrCreateRunConfiguration(interface.getDesign.getContents.getSelfClass, this) + config.options.objectives = config.options.objectives :+ objective + DseService(project).onObjectiveConfigChanged(config, true) + } + }, + f"Add objective $paramName" + )) + } + } } class DefaultTool(val interface: ToolInterface) extends BaseTool { From b269161389bcd4f9aaa74560cf8754a870568d5b Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Wed, 27 Mar 2024 23:52:37 -0700 Subject: [PATCH 04/11] fix type bug --- src/main/scala/edg_ide/ui/tools/DefaultTool.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala index 573d5754..3ca9de9e 100644 --- a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala +++ b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala @@ -306,7 +306,7 @@ class DesignPortPopupMenu(path: DesignPath, interface: ToolInterface) case edgir.init.init.ValInit.Val.Integer(_) => classOf[edg.compiler.IntValue] case edgir.init.init.ValInit.Val.Boolean(_) => classOf[edg.compiler.BooleanValue] case edgir.init.init.ValInit.Val.Text(_) => classOf[edg.compiler.TextValue] - case edgir.init.init.ValInit.Val.Range(_) => classOf[edg.compiler.RangeValue] + case edgir.init.init.ValInit.Val.Range(_) => classOf[edg.compiler.RangeType] case _ => exceptable.fail(f"unknown parameter type") } val objective = DseObjectiveParameter(path.asIndirect + paramName, paramType) From b4cb127a8952094ef65236ded7020d5e07d0aa04 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 00:14:36 -0700 Subject: [PATCH 05/11] clean up axes --- src/main/scala/edg_ide/swing/dse/JDsePlot.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala index d0a0faaf..2ebefc1a 100644 --- a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala +++ b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala @@ -1,6 +1,7 @@ package edg_ide.swing.dse import com.intellij.ui.JBColor +import edg_ide.util.SiPrefixUtil import java.awt.Color import scala.collection.mutable @@ -86,7 +87,7 @@ object JDsePlot { var tickPos = (math.floor(range._1 / tickSpacing) * tickSpacing).toFloat val ticksBuilder = mutable.ArrayBuffer[(Float, String)]() while (tickPos <= range._2) { - ticksBuilder.append((tickPos, f"$tickPos%.02g")) + ticksBuilder.append((tickPos, SiPrefixUtil.unitsToString(tickPos, ""))) tickPos = (tickPos + tickSpacing).toFloat } ticksBuilder.toSeq From 3af76d08df1c256ea387badcb4ff227d6e3a732b Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 00:50:14 -0700 Subject: [PATCH 06/11] less errors --- src/main/scala/edg_ide/ui/DsePanel.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/edg_ide/ui/DsePanel.scala b/src/main/scala/edg_ide/ui/DsePanel.scala index 33ea3b14..9e6a36c6 100644 --- a/src/main/scala/edg_ide/ui/DsePanel.scala +++ b/src/main/scala/edg_ide/ui/DsePanel.scala @@ -387,8 +387,10 @@ class DsePanel(project: Project) extends JPanel { val nodePath = new TreePath(treeRoot).pathByAddingChild(treeRoot.searchConfigNode) configTree.getTree.expandPath(nodePath) if (scrollToLast) { - val lastNodePath = nodePath.pathByAddingChild(treeRoot.searchConfigNode.children.last) - configTree.scrollRectToVisible(configTree.getTree.getPathBounds(lastNodePath)) + treeRoot.searchConfigNode.children.lastOption.foreach { last => + val lastNodePath = nodePath.pathByAddingChild(last) + configTree.scrollRectToVisible(configTree.getTree.getPathBounds(lastNodePath)) + } } tabbedPane.setSelectedIndex(kTabConfig) }) From 02be6cf7045693734289e56e75ddc50e8ddf5dca Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 00:50:18 -0700 Subject: [PATCH 07/11] Update JDsePlot.scala --- src/main/scala/edg_ide/swing/dse/JDsePlot.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala index 2ebefc1a..316c6096 100644 --- a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala +++ b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala @@ -14,12 +14,12 @@ object JDsePlot { val kBackgroundBlend: Float = 0.25f val kBackgroundAlpha: Int = 127 - val kPointSizePx: Int = 8 // diameter in px - val kSnapDistancePx: Int = 12 // distance (radius) to snap for a click - val kPointSelectedSizePx: Int = 12 // diameter in px - val kPointHoverOutlinePx: Int = 18 // diameter in px - val kLineHoverBackgroundPx: Int = 30 // width in px - val kLineHoverOutlinePx: Int = 16 // width in px + val kPointSizePx: Int = 6 // diameter in px + val kSnapDistancePx: Int = 9 // distance (radius) to snap for a click + val kPointSelectedSizePx: Int = 9 // diameter in px + val kPointHoverOutlinePx: Int = 14 // diameter in px + val kLineHoverBackgroundPx: Int = 24 // width in px + val kLineHoverOutlinePx: Int = 14 // width in px val kHoverOutlineColor: Color = JBColor.BLUE val kHoverOutlineBlend: Float = 0.5f From 58a550abf517b7c6f646ee5ed674198f1dd74524 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 18:21:44 -0700 Subject: [PATCH 08/11] enable the feature but cleaned up --- src/main/scala/edg_ide/dse/DseFeature.scala | 1 - src/main/scala/edg_ide/ui/DetailPanel.scala | 28 +++++++++-------- .../scala/edg_ide/ui/tools/DefaultTool.scala | 30 +++++++++++-------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/main/scala/edg_ide/dse/DseFeature.scala b/src/main/scala/edg_ide/dse/DseFeature.scala index 710330bb..81a21c31 100644 --- a/src/main/scala/edg_ide/dse/DseFeature.scala +++ b/src/main/scala/edg_ide/dse/DseFeature.scala @@ -1,6 +1,5 @@ package edg_ide.dse object DseFeature { - // feature flag to hide the feature while it's still in development val kEnabled = true } diff --git a/src/main/scala/edg_ide/ui/DetailPanel.scala b/src/main/scala/edg_ide/ui/DetailPanel.scala index 517dc0e0..37fb2a1f 100644 --- a/src/main/scala/edg_ide/ui/DetailPanel.scala +++ b/src/main/scala/edg_ide/ui/DetailPanel.scala @@ -20,7 +20,7 @@ import edgrpc.hdl.{hdl => edgrpc} import java.awt.datatransfer.StringSelection import java.awt.event.{KeyAdapter, KeyEvent, MouseAdapter, MouseEvent} import java.awt.{BorderLayout, Toolkit} -import javax.swing.{JPanel, JPopupMenu, KeyStroke, SwingUtilities} +import javax.swing.{JMenu, JPanel, JPopupMenu, KeyStroke, SwingUtilities} class DetailParamPopupMenu( path: IndirectDesignPath, @@ -92,9 +92,16 @@ class DetailParamPopupMenu( ) ) + addSeparator() + val hotkeyModifier = Toolkit.getDefaultToolkit.getMenuShortcutKeyMaskEx + val copyValueItem = add(ContextMenuUtils.MenuItemFromErrorable(copyAction, s"Copy value")) + copyValueItem.setMnemonic(KeyEvent.VK_C) + copyValueItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, hotkeyModifier)) + if (DseFeature.kEnabled) { - addSeparator() - add( + val dseMenu = new JMenu("Design Space Exploration") + + dseMenu.add( ContextMenuUtils.MenuItemFromErrorable( exceptable { val directPath = DesignPath.fromIndirectOption(path).exceptNone("not a direct param") @@ -114,7 +121,7 @@ class DetailParamPopupMenu( ) ) - add( + dseMenu.add( ContextMenuUtils.MenuItemNamedFromErrorable( exceptable { val (paramDefiningClass, postfix) = paramDefiningClassPostfix.exceptError @@ -137,8 +144,8 @@ class DetailParamPopupMenu( ) ) - addSeparator() - add( + dseMenu.addSeparator() + dseMenu.add( ContextMenuUtils.MenuItemFromErrorable( exceptable { val objective = compiler.getParamType(path) match { @@ -155,13 +162,10 @@ class DetailParamPopupMenu( "Add objective" ) ) - } - addSeparator() - val hotkeyModifier = Toolkit.getDefaultToolkit.getMenuShortcutKeyMaskEx - val copyValueItem = add(ContextMenuUtils.MenuItemFromErrorable(copyAction, s"Copy value")) - copyValueItem.setMnemonic(KeyEvent.VK_C) - copyValueItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, hotkeyModifier)) + addSeparator() + add(dseMenu) + } } // TODO: remove initCompiler, it's counterintuitive diff --git a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala index 3ca9de9e..e9cc1016 100644 --- a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala +++ b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala @@ -20,7 +20,7 @@ import edgir.schema.schema import java.awt.event.MouseEvent import java.util.concurrent.Callable -import javax.swing.{JLabel, JPopupMenu, SwingUtilities} +import javax.swing.{JLabel, JMenu, JPopupMenu, SwingUtilities} import scala.jdk.CollectionConverters.CollectionHasAsScala trait NavigationPopupMenu extends JPopupMenu { @@ -120,14 +120,14 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) addGotoDefinitionItem(blockClass, project) if (DseFeature.kEnabled) { - addSeparator() + val dseMenu = new JMenu("Design Space Exploration") val rootClass = interface.getDesign.getContents.getSelfClass val refinementClass = block.prerefineClass.getOrElse(block.getSelfClass) - add( + dseMenu.add( ContextMenuUtils.MenuItemFromErrorable( exceptable { - val blockPyClass = DesignAnalysisUtils.pyClassOf(refinementClass, project).get + val blockPyClass = DesignAnalysisUtils.pyClassOf(refinementClass, project).exceptError () => { ReadAction .nonBlocking((() => { @@ -163,7 +163,7 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) f"Search subclasses of ${refinementClass.toSimpleString}" ) ) - add( + dseMenu.add( ContextMenuUtils.MenuItemFromErrorable( exceptable { requireExcept(block.params.toSeqMap.contains("matching_parts"), "block must have matching_parts") @@ -177,7 +177,7 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) ) ) - add( + dseMenu.add( ContextMenuUtils.MenuItem( () => { val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) @@ -187,7 +187,7 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) s"Add objective area" ) ) - add( + dseMenu.add( ContextMenuUtils.MenuItem( () => { val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) @@ -198,7 +198,7 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) ) ) if (path == DesignPath()) { // price only supported at top level for now - add( + dseMenu.add( ContextMenuUtils.MenuItem( () => { val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) @@ -209,7 +209,7 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) ) ) } - add( + dseMenu.add( ContextMenuUtils.MenuItem( () => { val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) @@ -219,6 +219,9 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) "Add unproven count" ) ) + + addSeparator() + add(dseMenu) } } @@ -291,15 +294,15 @@ class DesignPortPopupMenu(path: DesignPath, interface: ToolInterface) addGotoConnectItems(path, interface.getDesign, project) if (DseFeature.kEnabled) { - addSeparator() + val dseMenu = new JMenu("Design Space Exploration") val params = port match { case port: elem.Port => port.params case bundle: elem.Bundle => bundle.params - case other => Seq() // including arrays, not supported + case _ => Seq() // including arrays, not supported } params.toSeqMap.foreach { case (paramName, paramValue) => - add(ContextMenuUtils.MenuItemFromErrorable( + dseMenu.add(ContextMenuUtils.MenuItemFromErrorable( exceptable { val paramType = paramValue.`val` match { case edgir.init.init.ValInit.Val.Floating(_) => classOf[edg.compiler.FloatValue] @@ -321,6 +324,9 @@ class DesignPortPopupMenu(path: DesignPath, interface: ToolInterface) f"Add objective $paramName" )) } + + addSeparator() + add(dseMenu) } } From abfeb11fd46fb821610642ab318e06489a91e611 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 18:21:52 -0700 Subject: [PATCH 09/11] reverse ui hax --- src/main/scala/edg_ide/swing/dse/JDsePlot.scala | 12 ++++++------ .../scala/edg_ide/ui/BlockVisualizerPanel.scala | 15 ++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala index 316c6096..261a3a0c 100644 --- a/src/main/scala/edg_ide/swing/dse/JDsePlot.scala +++ b/src/main/scala/edg_ide/swing/dse/JDsePlot.scala @@ -14,12 +14,12 @@ object JDsePlot { val kBackgroundBlend: Float = 0.25f val kBackgroundAlpha: Int = 127 - val kPointSizePx: Int = 6 // diameter in px - val kSnapDistancePx: Int = 9 // distance (radius) to snap for a click - val kPointSelectedSizePx: Int = 9 // diameter in px - val kPointHoverOutlinePx: Int = 14 // diameter in px - val kLineHoverBackgroundPx: Int = 24 // width in px - val kLineHoverOutlinePx: Int = 14 // width in px + val kPointSizePx: Int = 4 // diameter in px + val kSnapDistancePx: Int = 6 // distance (radius) to snap for a click + val kPointSelectedSizePx: Int = 6 // diameter in px + val kPointHoverOutlinePx: Int = 12 // diameter in px + val kLineHoverBackgroundPx: Int = 19 // width in px + val kLineHoverOutlinePx: Int = 9 // width in px val kHoverOutlineColor: Color = JBColor.BLUE val kHoverOutlineBlend: Float = 0.5f diff --git a/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala b/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala index 8e6d6ef3..0cabcbc9 100644 --- a/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala +++ b/src/main/scala/edg_ide/ui/BlockVisualizerPanel.scala @@ -285,16 +285,13 @@ class BlockVisualizerPanel(val project: Project, toolWindow: ToolWindow) extends dsePanelShown = dseConfigSelected // set it now, so we don't get multiple invocations of the update ApplicationManager.getApplication.invokeLater(() => { if (dseConfigSelected) { - mainSplitter.setSecondComponent(dsePanel) -// remove(mainSplitter) -// dseSplitter.setFirstComponent(mainSplitter) -// add(dseSplitter) + remove(mainSplitter) + dseSplitter.setFirstComponent(mainSplitter) + add(dseSplitter) } else { - mainSplitter.setSecondComponent(bottomSplitter) - -// remove(dseSplitter) -// dseSplitter.setFirstComponent(null) -// add(mainSplitter) + remove(dseSplitter) + dseSplitter.setFirstComponent(null) + add(mainSplitter) } }) revalidate() From e7491d60f042bae2083f7aa07a3452087afd2b15 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 19:13:03 -0700 Subject: [PATCH 10/11] Update DefaultTool.scala --- .../scala/edg_ide/ui/tools/DefaultTool.scala | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala index e9cc1016..599d58c5 100644 --- a/src/main/scala/edg_ide/ui/tools/DefaultTool.scala +++ b/src/main/scala/edg_ide/ui/tools/DefaultTool.scala @@ -209,16 +209,18 @@ class DesignBlockPopupMenu(path: DesignPath, interface: ToolInterface) ) ) } - dseMenu.add( - ContextMenuUtils.MenuItem( - () => { - val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) - config.options.objectives = config.options.objectives ++ Seq(DseObjectiveUnprovenCount(path)) - DseService(project).onObjectiveConfigChanged(config, true) - }, - "Add unproven count" + if (EdgSettingsState.getInstance().showProvenStatus) { + dseMenu.add( + ContextMenuUtils.MenuItem( + () => { + val config = DseService(project).getOrCreateRunConfiguration(rootClass, this) + config.options.objectives = config.options.objectives ++ Seq(DseObjectiveUnprovenCount(path)) + DseService(project).onObjectiveConfigChanged(config, true) + }, + "Add unproven count" + ) ) - ) + } addSeparator() add(dseMenu) @@ -304,16 +306,8 @@ class DesignPortPopupMenu(path: DesignPath, interface: ToolInterface) params.toSeqMap.foreach { case (paramName, paramValue) => dseMenu.add(ContextMenuUtils.MenuItemFromErrorable( exceptable { - val paramType = paramValue.`val` match { - case edgir.init.init.ValInit.Val.Floating(_) => classOf[edg.compiler.FloatValue] - case edgir.init.init.ValInit.Val.Integer(_) => classOf[edg.compiler.IntValue] - case edgir.init.init.ValInit.Val.Boolean(_) => classOf[edg.compiler.BooleanValue] - case edgir.init.init.ValInit.Val.Text(_) => classOf[edg.compiler.TextValue] - case edgir.init.init.ValInit.Val.Range(_) => classOf[edg.compiler.RangeType] - case _ => exceptable.fail(f"unknown parameter type") - } - val objective = DseObjectiveParameter(path.asIndirect + paramName, paramType) - + val objective = + DseObjectiveParameter(path.asIndirect + paramName, edg.compiler.ExprValue.classFromValInit(paramValue)) () => { val config = DseService(project).getOrCreateRunConfiguration(interface.getDesign.getContents.getSelfClass, this) From 1b6ec78c61e56170b412f5a4850d544c7c86aa54 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 28 Mar 2024 19:18:20 -0700 Subject: [PATCH 11/11] Update PolymorphicBlocks --- PolymorphicBlocks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PolymorphicBlocks b/PolymorphicBlocks index 6c87b602..17405f03 160000 --- a/PolymorphicBlocks +++ b/PolymorphicBlocks @@ -1 +1 @@ -Subproject commit 6c87b602a6c88222727c8c745832d28903229e22 +Subproject commit 17405f03d65db06e812b981a9d7cfa34e2f6d6d5