Commit 6a82b017555d61ff791daf1d410f48c7160dc142

Authored by tfmoraes
1 parent 85caf5c6

ENH: A dicom selected is kept selected when the user scrolled in dicom preview panel

Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
invesalius/gui/dicom_preview_panel.py
... ... @@ -57,6 +57,7 @@ class DicomInfo(object):
57 57 self.title = title
58 58 self.subtitle = subtitle
59 59 self._preview = None
  60 + self.selected = False
60 61  
61 62 @property
62 63 def preview(self):
... ... @@ -144,12 +145,15 @@ class Preview(wx.Panel):
144 145 """
145 146 Set a dicom to preview.
146 147 """
  148 + self.dicom_info = dicom_info
147 149 self.SetTitle(dicom_info.title)
148 150 self.SetSubtitle(dicom_info.subtitle)
149 151 self.ID = dicom_info.id
150 152 image = dicom_info.preview
151 153 self.image_viewer.SetBitmap(image)
152 154 self.data = dicom_info.id
  155 + self.select_on = dicom_info.selected
  156 + self.Select()
153 157 self.Update()
154 158  
155 159 def SetTitle(self, title):
... ... @@ -166,12 +170,13 @@ class Preview(wx.Panel):
166 170  
167 171 def OnLeave(self, evt):
168 172 if not self.select_on:
169   - c = (255,255,255)
  173 + c = (PREVIEW_BACKGROUND)
170 174 self.SetBackgroundColour(c)
171 175  
172 176 def OnSelect(self, evt):
173 177 print "OnSelect"
174 178 self.select_on = True
  179 + self.dicom_info.selected = True
175 180 ##c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)
176 181 ##c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HOTLIGHT)
177 182 #c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT)
... ... @@ -190,7 +195,7 @@ class Preview(wx.Panel):
190 195 if self.select_on:
191 196 c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT)
192 197 else:
193   - c = (255,255,255)
  198 + c = (PREVIEW_BACKGROUND)
194 199 self.SetBackgroundColour(c)
195 200 self.Refresh()
196 201  
... ...