From 2a5b85211d360319dbf46eb51a8a35ebee3a6343 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 15 May 2019 14:22:37 +0200 Subject: [PATCH] "Add Secondary Structure" in scene menu --- modules/gui/pymod/init_context_menu.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/gui/pymod/init_context_menu.py b/modules/gui/pymod/init_context_menu.py index 0041ef817..568241a3a 100644 --- a/modules/gui/pymod/init_context_menu.py +++ b/modules/gui/pymod/init_context_menu.py @@ -232,6 +232,23 @@ class SurfaceContextMenu(QtCore.QObject): except UserWarning: LogError("WARNING: Entry with the same name already present in scene") return + + +class SecStructContextMenu(QtCore.QObject): + def __init__(self, context_menu): + QtCore.QObject.__init__(self, context_menu.qobject) + self.action = QtWidgets.QAction("Assign Secondary Structure", self) + self.action.triggered.connect(self.AssignSecondaryStructure) + context_menu.AddAction(self.action, gui.ContextActionType.ENTITY) + + def AssignSecondaryStructure(self): + scene_selection = gui.SceneSelection.Instance() + ent_list = list() + for i in range(0,scene_selection.GetActiveNodeCount()): + node = scene_selection.GetActiveNode(i) + mol.alg.AssignSecStruct(node.view) + node.UpdateView() + class AlignmentContextMenu(QtCore.QObject): @@ -365,5 +382,6 @@ class SelectMenuPoints(QtCore.QObject): def _InitContextMenu(app): _InitContextMenu.cm=app.scene_win.GetContextMenu() _InitContextMenu.am=AlignmentContextMenu(_InitContextMenu.cm) + _InitContextMenu.sec=SecStructContextMenu(_InitContextMenu.cm) _InitContextMenu.sc=SurfaceContextMenu(_InitContextMenu.cm) _InitContextMenu.sm=SelectMenuPoints(_InitContextMenu.cm) -- GitLab