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