29 from PyQt4
import QtCore, QtGui
31 from preset_widget
import PresetWidget
35 QtGui.QStackedWidget.__init__(self, parent)
40 self.setContentsMargins(0,0,0,0)
41 self.setMinimumSize(self.preset_widget_.minimumSize())
45 scene_selection = gui.SceneSelection.Instance()
48 for i
in range(0,scene_selection.GetActiveNodeCount()):
49 node = scene_selection.GetActiveNode(i)
52 if (
not _img_present)
or (
not isinstance(node,
gfx.MapIso)):
55 self.map_widget_.Update()
56 self.setMinimumSize(self.map_widget_.minimumSize())
57 self.resize(self.map_widget_.minimumSize())
58 self.setMinimumSize(self.map_widget_.minimumSize())
61 self.preset_widget_.Update()
62 self.setMinimumSize(self.preset_widget_.minimumSize())
63 self.resize(self.preset_widget_.minimumSize())
64 self.setMinimumSize(self.preset_widget_.minimumSize())
67 self.setEnabled(
False)
72 QtGui.QWidget.__init__(self, parent)
76 self.
font = self.map_level_label_.font()
77 self.font.setBold(
True)
82 self.level_spinbox_.setDecimals(3)
83 self.level_spinbox_.setSingleStep(0.05)
85 grid = QtGui.QGridLayout()
86 grid.setContentsMargins(0,5,0,0)
90 grid.setRowStretch(3, 1)
97 self.setMinimumSize(250,200)
100 scene_selection = gui.SceneSelection.Instance()
101 if(scene_selection.GetActiveNodeCount()==1):
102 node = scene_selection.GetActiveNode(0)
103 if _img_present
and isinstance(node,
gfx.MapIso):
105 self.level_preview_.SetBins(node.GetHistogram())
106 self.level_preview_.SetMinimum(node.GetMinLevel())
107 self.level_spinbox_.setMinimum(node.GetMinLevel())
108 self.level_preview_.SetMaximum(node.GetMaxLevel())
109 self.level_spinbox_.setMaximum(node.GetMaxLevel())
110 self.level_preview_.SetLevel(node.GetLevel())
111 self.level_spinbox_.show()
112 self.font.setBold(
True)
113 self.map_level_label_.setText(
"Map Contour Level")
114 self.setEnabled(
True)
116 self.font.setBold(
False)
117 self.map_level_label_.setText(
"Map uniformly filled with level %s"%node.GetLevel())
118 self.level_spinbox_.hide()
119 self.setEnabled(
False)
121 self.setEnabled(
False)
123 self.setEnabled(
False)
126 scene_selection = gui.SceneSelection.Instance()
127 if(scene_selection.GetActiveNodeCount()==1):
128 node = scene_selection.GetActiveNode(0)
133 self.level_spinbox_.setValue(level)
139 QtGui.QWidget.__init__(self, parent)
144 QtGui.QWidget.__init__(self, parent)
173 if self.isEnabled()
and self.
bins_ is not None:
174 painter = QtGui.QPainter()
175 if painter.begin(self):
185 painter.setBrush(QtCore.Qt.white)
186 painter.setPen(QtCore.Qt.white)
194 bin_cnt = len(self.
bins_)
195 bin_width = (size.width()-2* self.
border_offset_) / float(bin_cnt)
202 painter.setBrush(QtCore.Qt.black)
203 painter.setPen(QtCore.Qt.black)
204 for i
in range(0,bin_cnt):
205 bin_height = self.
bins_[i]
219 painter.setBrush(QtCore.Qt.red)
220 painter.setPen(QtCore.Qt.red)
221 painter.drawRect((width / tot_len) * cur_len,
229 painter.setBrush(QtCore.Qt.gray)
230 painter.setPen(QtCore.Qt.gray)
231 pos=self.mapFromGlobal(QtGui.QCursor.pos())
232 painter.drawRect(pos.x(),
244 self.emit(QtCore.SIGNAL(
"levelUpdated"),(self.
level_))
253 level = self.
minimum_ + float(event.x())/width * tot_len
254 self.emit(QtCore.SIGNAL(
"levelModified"),(level))
graphical rendering of mol::EntityHandle entites
isocontour rendering for 3D image data