diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt index 200515b96aa0b9986eb890f68f03f957b6a1196e..d1cd7bd190916516ef1960303d7ac00b494a4575 100644 --- a/modules/gui/pymod/CMakeLists.txt +++ b/modules/gui/pymod/CMakeLists.txt @@ -45,6 +45,7 @@ render_mode_widget.py render_op.py render_options_widget.py scene_observer_impl.py +sequence_widget.py simple_widget.py sline_widget.py toolbar_options_widget.py @@ -96,6 +97,7 @@ set(INSPECTOR_ICONS scene/icons/color_icon.png scene/icons/preset_icon.png scene/icons/render_icon.png + scene/icons/seq_icon.png scene/icons/tool_icon.png ) copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene/icons" diff --git a/modules/gui/pymod/scene/icons/seq_icon.png b/modules/gui/pymod/scene/icons/seq_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a9cc5487aac7c1f6f8f37820190268ec7774f4b3 Binary files /dev/null and b/modules/gui/pymod/scene/icons/seq_icon.png differ diff --git a/modules/gui/pymod/scene/inspector_widget.py b/modules/gui/pymod/scene/inspector_widget.py index 4e7e7f76155f5c51219aaae95daa91967b3e6f03..20cf1d4961b7015e44f9d4df509dc5dab9edc488 100644 --- a/modules/gui/pymod/scene/inspector_widget.py +++ b/modules/gui/pymod/scene/inspector_widget.py @@ -29,6 +29,7 @@ from render_options_widget import RenderOptionsWidget from color_options_widget import ColorOptionsWidget from ost.gui.scene.scene_observer_impl import SceneObserverImpl from preset_widget import PresetWidget +from sequence_widget import SequenceWidget class InspectorWidget(ToolBarOptionsWidget): ICONS_PATH = os.path.join(ost.GetSharedDataPath(), "scene", "icons/") @@ -39,6 +40,7 @@ class InspectorWidget(ToolBarOptionsWidget): [InspectorWidget.ICONS_PATH+"render_icon.png",RenderOptionsWidget(self),None], [InspectorWidget.ICONS_PATH+"color_icon.png",ColorOptionsWidget(self),None], [InspectorWidget.ICONS_PATH+"preset_icon.png", PresetWidget(self),None], + [InspectorWidget.ICONS_PATH+"seq_icon.png", SequenceWidget(self),None], [InspectorWidget.ICONS_PATH+"tool_icon.png",app.tool_options_win.qobject,"Tool Options"] ] for o in options: diff --git a/modules/gui/pymod/scene/sequence_widget.py b/modules/gui/pymod/scene/sequence_widget.py new file mode 100644 index 0000000000000000000000000000000000000000..40a77a73d7dfdaa0fedbb5cbc94cfa4759e0fc48 --- /dev/null +++ b/modules/gui/pymod/scene/sequence_widget.py @@ -0,0 +1,65 @@ +#------------------------------------------------------------------------------ +# This file is part of the OpenStructure project <www.openstructure.org> +# +# Copyright (C) 2008-2010 by the OpenStructure authors +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 3.0 of the License, or (at your option) +# any later version. +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#------------------------------------------------------------------------------ + +import ost + +from ost import gui +from ost import gfx +from ost import seq + +from PyQt4 import QtCore, QtGui + + +class SequenceWidget(QtGui.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + + self.text_ = "Sequences" + + self.display_modes_ = QtGui.QComboBox(self); + self.display_modes_.addItem("Highlight properties") + self.display_modes_.addItem("Secondary structure") + self.display_modes_.addItem("Highlight conservation") + QtCore.QObject.connect(self.display_modes_, QtCore.SIGNAL("activated(int)"), self.__ChangeDisplayMode) + self.setMinimumSize(250,150) + + + def Update(self): + self.display_modes_.setEnabled(True) + scene_selection = gui.SceneSelection.Instance() + + if scene_selection.GetActiveNodeCount() == 0 and scene_selection.GetActiveViewCount() == 0: + self.display_modes_.setEnabled(False) + return + + for i in range(0,scene_selection.GetActiveNodeCount()): + node = scene_selection.GetActiveNode(i) + if not (isinstance(node, gfx.Entity) or (isinstance(node, seq.AlignmentHandle))) : + self.display_modes_.setEnabled(self,False) + return + + seq_viewer = gui.GostyApp.Instance().GetSequenceViewerV2() + + def __ChangeDisplayMode(self): + seq_viewer = gui.GostyApp.Instance().GetSequenceViewerV2() + scene_selection = gui.SceneSelection.Instance() + for i in range(0,scene_selection.GetActiveNodeCount()): + node = scene_selection.GetActiveNode(i) + seq_viewer.ChangeDisplayMode(node, str(self.display_modes_.currentText())) + \ No newline at end of file