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 SlineWidget(RenderModeWidget):
00028 def __init__(self, parent=None):
00029 RenderModeWidget.__init__(self, parent)
00030
00031
00032 self.text_ = "Fast Spline"
00033
00034
00035 self.mode_ = gfx.RenderMode.SLINE
00036
00037
00038 min_detail = 1
00039 max_detail = 20
00040
00041 min_line_width = 0.01
00042 max_line_width = 20
00043
00044
00045 self.detail_spinbox_ = QtGui.QSpinBox()
00046 self.detail_spinbox_.setRange(min_detail, max_detail)
00047 self.detail_spinbox_.setSingleStep(1)
00048
00049 self.aa_rendering_cb_ = QtGui.QCheckBox()
00050
00051 self.radius_spinbox_ = QtGui.QDoubleSpinBox()
00052 self.radius_spinbox_.setRange(min_line_width, max_line_width)
00053 self.radius_spinbox_.setDecimals(2)
00054 self.radius_spinbox_.setSingleStep(0.1)
00055
00056 sline_label = QtGui.QLabel("Spline Settings")
00057 font = sline_label.font()
00058 font.setBold(True)
00059
00060 detail_label = QtGui.QLabel("Spline Detail")
00061 aa_label = QtGui.QLabel("AA-Lines")
00062 radius_label = QtGui.QLabel("Line Width")
00063 grid = QtGui.QGridLayout()
00064 grid.addWidget(sline_label, 0, 0, 1, 1)
00065 grid.addWidget(detail_label, 1, 0, 1, 3)
00066 grid.addWidget(self.detail_spinbox_, 1, 2, 1, 1)
00067 grid.addWidget(aa_label, 2, 0, 1, 3)
00068 grid.addWidget(self.aa_rendering_cb_, 2, 2, 1, 1)
00069 grid.addWidget(radius_label, 3, 0, 1, 3)
00070 grid.addWidget(self.radius_spinbox_, 3, 2, 1, 1)
00071 grid.setRowStretch(4,1)
00072 self.setLayout(grid)
00073
00074 QtCore.QObject.connect(self.detail_spinbox_, QtCore.SIGNAL("valueChanged(int)"), self.UpdateDetail)
00075 QtCore.QObject.connect(self.aa_rendering_cb_, QtCore.SIGNAL("stateChanged(int)"), self.UpdateAA)
00076 QtCore.QObject.connect(self.radius_spinbox_, QtCore.SIGNAL("valueChanged(double)"), self.UpdateLineWidth)
00077
00078 self.setMinimumSize(250,120)
00079
00080 def UpdateDetail(self, value):
00081 self.GetOptions().SetSplineDetail(value)
00082 self.ApplyOptions()
00083
00084 def UpdateAA(self, value):
00085 self.GetOptions().SetAALines(value)
00086 self.ApplyOptions()
00087
00088 def UpdateLineWidth(self, value):
00089 self.GetOptions().SetLineWidth(value)
00090 self.ApplyOptions()
00091
00092 def UpdateGui(self,options):
00093 self.detail_spinbox_.setValue(options.GetSplineDetail())
00094 self.aa_rendering_cb_.setChecked(options.GetAALines())
00095 self.radius_spinbox_.setValue(options.GetLineWidth())
00096
00097 def GetText(self):
00098 return self.text_
00099
00100 def GetRenderMode(self):
00101 return self.mode_