00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 from ost import gui
00022 from ost import gfx
00023 from PyQt4 import QtCore, QtGui
00024 from render_mode_widget import RenderModeWidget
00025
00026
00027 class SimpleWidget(RenderModeWidget):
00028 def __init__(self, parent=None):
00029 RenderModeWidget.__init__(self, parent)
00030
00031
00032 self.text_ = "Fast Bonds"
00033
00034
00035 min_line_width = 0.01
00036 max_line_width = 20
00037 min_bo_dist = 0.01
00038 max_bo_dist = 0.20
00039
00040
00041 self.mode_ = gfx.RenderMode.SIMPLE
00042
00043
00044 self.aa_rendering_cb_ = QtGui.QCheckBox()
00045
00046 self.radius_spinbox_ = QtGui.QDoubleSpinBox()
00047 self.radius_spinbox_.setRange(min_line_width, max_line_width)
00048 self.radius_spinbox_.setDecimals(2)
00049 self.radius_spinbox_.setSingleStep(0.1)
00050
00051 self.bo_rendering_cb_ = QtGui.QCheckBox()
00052
00053 self.bo_distance_spinbox_ = QtGui.QDoubleSpinBox()
00054 self.bo_distance_spinbox_.setRange(min_bo_dist, max_bo_dist)
00055 self.bo_distance_spinbox_.setDecimals(2)
00056 self.bo_distance_spinbox_.setSingleStep(0.01)
00057
00058 simple_label = QtGui.QLabel("Fast Bonds Simple Settings")
00059 font = simple_label.font()
00060 font.setBold(True)
00061
00062 radius_label = QtGui.QLabel("Line Width")
00063 aa_label = QtGui.QLabel("AA-Lines")
00064 bo_label = QtGui.QLabel("Show Bond Order")
00065 bo_distance = QtGui.QLabel("Bond Order Distance")
00066
00067 grid = QtGui.QGridLayout()
00068 grid.addWidget(simple_label,0,0,1,3)
00069 grid.addWidget(aa_label, 1, 0, 1, 3)
00070 grid.addWidget(self.aa_rendering_cb_, 1, 2, 1, 1)
00071 grid.addWidget(radius_label,2,0,1,3)
00072 grid.addWidget(self.radius_spinbox_,2,2,1,1)
00073 grid.addWidget(bo_label, 3, 0, 1, 3)
00074 grid.addWidget(self.bo_rendering_cb_, 3,2,1,1)
00075 grid.addWidget(bo_distance, 4, 0, 1, 3)
00076 grid.addWidget(self.bo_distance_spinbox_, 4,2,1,1)
00077 grid.setRowStretch(5,1)
00078 self.setLayout(grid)
00079
00080 QtCore.QObject.connect(self.radius_spinbox_, QtCore.SIGNAL("valueChanged(double)"), self.UpdateLineWidth)
00081 QtCore.QObject.connect(self.aa_rendering_cb_, QtCore.SIGNAL("stateChanged(int)"), self.UpdateAA)
00082 QtCore.QObject.connect(self.bo_distance_spinbox_, QtCore.SIGNAL("valueChanged(double)"), self.UpdateBODistance)
00083 QtCore.QObject.connect(self.bo_rendering_cb_, QtCore.SIGNAL("stateChanged(int)"), self.UpdateBO)
00084 self.setMinimumSize(250,140)
00085
00086 self.setMinimumSize(250,140)
00087
00088 def UpdateAA(self, value):
00089 self.GetOptions().SetAALines(value)
00090 self.ApplyOptions()
00091
00092 def UpdateLineWidth(self, value):
00093 self.GetOptions().SetLineWidth(value)
00094 self.ApplyOptions()
00095
00096 def UpdateBO(self, value):
00097 self.GetOptions().SetBondOrderFlag(value)
00098 self.ApplyOptions()
00099
00100 def UpdateBODistance(self, value):
00101 self.GetOptions().SetBondOrderDistance(value)
00102 self.ApplyOptions()
00103
00104 def UpdateGui(self,options):
00105 self.aa_rendering_cb_.setChecked(options.GetAALines())
00106 self.radius_spinbox_.setValue(options.GetLineWidth())
00107 self.bo_rendering_cb_.setChecked(options.GetBondOrderFlag())
00108 self.bo_distance_spinbox_.setValue(options.GetBondOrderDistance())
00109
00110 def GetText(self):
00111 return self.text_
00112
00113 def GetRenderMode(self):
00114 return self.mode_