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