Commit a460a44320428af174784a3ee2370a819ae64306
1 parent
d8293fcf
Exists in
master
and in
68 other branches
ENH: The coloured button in volume viewer follows the volume viewer background
Showing
2 changed files
with
10 additions
and
0 deletions
Show diff stats
invesalius/data/volume.py
@@ -148,6 +148,7 @@ class Volume(): | @@ -148,6 +148,7 @@ class Volume(): | ||
148 | self.SetShading() | 148 | self.SetShading() |
149 | colour = self.GetBackgroundColour() | 149 | colour = self.GetBackgroundColour() |
150 | ps.Publisher.sendMessage('Change volume viewer background colour', colour) | 150 | ps.Publisher.sendMessage('Change volume viewer background colour', colour) |
151 | + ps.Publisher.sendMessage('Change volume viewer gui colour', colour) | ||
151 | 152 | ||
152 | 153 | ||
153 | def OnSetRelativeWindowLevel(self, pubsub_evt): | 154 | def OnSetRelativeWindowLevel(self, pubsub_evt): |
invesalius/gui/default_viewers.py
@@ -267,6 +267,7 @@ class VolumeToolPanel(wx.Panel): | @@ -267,6 +267,7 @@ class VolumeToolPanel(wx.Panel): | ||
267 | button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | 267 | button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) |
268 | self.button_colour = button_colour | 268 | self.button_colour = button_colour |
269 | 269 | ||
270 | + self.__bind_events() | ||
270 | # SIZER TO ORGANIZE ALL | 271 | # SIZER TO ORGANIZE ALL |
271 | sizer = wx.BoxSizer(wx.VERTICAL) | 272 | sizer = wx.BoxSizer(wx.VERTICAL) |
272 | sizer.Add(button_colour, 0, wx.ALL, 1) | 273 | sizer.Add(button_colour, 0, wx.ALL, 1) |
@@ -275,6 +276,14 @@ class VolumeToolPanel(wx.Panel): | @@ -275,6 +276,14 @@ class VolumeToolPanel(wx.Panel): | ||
275 | self.SetSizer(sizer) | 276 | self.SetSizer(sizer) |
276 | sizer.Fit(self) | 277 | sizer.Fit(self) |
277 | 278 | ||
279 | + def __bind_events(self): | ||
280 | + ps.Publisher().subscribe(self.ChangeButtonColour, | ||
281 | + 'Change volume viewer gui colour') | ||
282 | + | ||
283 | + def ChangeButtonColour(self, pubsub_evt): | ||
284 | + colour = [i*255 for i in pubsub_evt.data] | ||
285 | + self.button_colour.SetColour(colour) | ||
286 | + | ||
278 | def OnMenuRaycasting(self, evt): | 287 | def OnMenuRaycasting(self, evt): |
279 | """Events from raycasting menu.""" | 288 | """Events from raycasting menu.""" |
280 | id = evt.GetId() | 289 | id = evt.GetId() |