Commit af3889aa663337ad1e3cdb2e5dbb169f3ab878f7

Authored by Paulo Henrique Junqueira Amorim
1 parent 2a604b01

ENH: Resized icons to Window size

Showing 1 changed file with 22 additions and 18 deletions   Show diff stats
invesalius/gui/frame.py
@@ -105,7 +105,7 @@ class Frame(wx.Frame): @@ -105,7 +105,7 @@ class Frame(wx.Frame):
105 t3 = LayoutToolBar(self) 105 t3 = LayoutToolBar(self)
106 t2 = ObjectToolBar(self) 106 t2 = ObjectToolBar(self)
107 t1 = SliceToolBar(self) 107 t1 = SliceToolBar(self)
108 - 108 +
109 aui_manager.AddPane(t1, wx.aui.AuiPaneInfo(). 109 aui_manager.AddPane(t1, wx.aui.AuiPaneInfo().
110 Name("General Features Toolbar"). 110 Name("General Features Toolbar").
111 ToolbarPane().Top().Floatable(False). 111 ToolbarPane().Top().Floatable(False).
@@ -296,7 +296,7 @@ class ProjectToolBar(wx.ToolBar): @@ -296,7 +296,7 @@ class ProjectToolBar(wx.ToolBar):
296 def __init__(self, parent): 296 def __init__(self, parent):
297 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, 297 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition,
298 wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) 298 wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER)
299 - 299 +
300 self.SetToolBitmapSize(wx.Size(32,32)) 300 self.SetToolBitmapSize(wx.Size(32,32))
301 301
302 self.parent = parent 302 self.parent = parent
@@ -349,7 +349,7 @@ class ObjectToolBar(wx.ToolBar): @@ -349,7 +349,7 @@ class ObjectToolBar(wx.ToolBar):
349 def __init__(self, parent): 349 def __init__(self, parent):
350 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, 350 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize,
351 wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE) 351 wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE)
352 - 352 +
353 self.SetToolBitmapSize(wx.Size(32,32)) 353 self.SetToolBitmapSize(wx.Size(32,32))
354 354
355 self.parent = parent 355 self.parent = parent
@@ -385,7 +385,7 @@ class ObjectToolBar(wx.ToolBar): @@ -385,7 +385,7 @@ class ObjectToolBar(wx.ToolBar):
385 self.AddLabelTool(4, "Bright and contrast adjustment", BMP_CONTRAST, kind = wx.ITEM_CHECK) 385 self.AddLabelTool(4, "Bright and contrast adjustment", BMP_CONTRAST, kind = wx.ITEM_CHECK)
386 386
387 self.Realize() 387 self.Realize()
388 - 388 +
389 self.states = {0:"Set Zoom Mode", 1:"Set Zoom Select Mode", 389 self.states = {0:"Set Zoom Mode", 1:"Set Zoom Select Mode",
390 2:"Set Spin Mode", 3:"Set Pan Mode", 390 2:"Set Spin Mode", 3:"Set Pan Mode",
391 4: "Bright and contrast adjustment"} 391 4: "Bright and contrast adjustment"}
@@ -412,11 +412,11 @@ class ObjectToolBar(wx.ToolBar): @@ -412,11 +412,11 @@ class ObjectToolBar(wx.ToolBar):
412 #Not exist's tool enbled, change to default state 412 #Not exist's tool enbled, change to default state
413 if not (exist_enable_state): 413 if not (exist_enable_state):
414 ps.Publisher().sendMessage('Set Editor Mode') 414 ps.Publisher().sendMessage('Set Editor Mode')
415 - 415 +
416 ps.Publisher().sendMessage('UnToogle All Slice Item') 416 ps.Publisher().sendMessage('UnToogle All Slice Item')
417 evt.Skip() 417 evt.Skip()
418 -  
419 - 418 +
  419 +
420 def UnToggleAllItem(self, pubsub_evt): 420 def UnToggleAllItem(self, pubsub_evt):
421 for x in xrange(0,len(self.states)): 421 for x in xrange(0,len(self.states)):
422 #necessary if the usurio enable another state 422 #necessary if the usurio enable another state
@@ -426,12 +426,12 @@ class ObjectToolBar(wx.ToolBar): @@ -426,12 +426,12 @@ class ObjectToolBar(wx.ToolBar):
426 self.ToggleTool(x, False) 426 self.ToggleTool(x, False)
427 427
428 # ------------------------------------------------------------------------------ 428 # ------------------------------------------------------------------------------
429 - 429 +
430 class SliceToolBar(wx.ToolBar): 430 class SliceToolBar(wx.ToolBar):
431 # TODO: what will appear in menubar? 431 # TODO: what will appear in menubar?
432 def __init__(self, parent): 432 def __init__(self, parent):
433 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) 433 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER)
434 - 434 +
435 self.SetToolBitmapSize(wx.Size(32,32)) 435 self.SetToolBitmapSize(wx.Size(32,32))
436 436
437 self.parent = parent 437 self.parent = parent
@@ -455,9 +455,9 @@ class SliceToolBar(wx.ToolBar): @@ -455,9 +455,9 @@ class SliceToolBar(wx.ToolBar):
455 def __bind_events(self): 455 def __bind_events(self):
456 self.Bind(wx.EVT_TOOL, self.OnClick) 456 self.Bind(wx.EVT_TOOL, self.OnClick)
457 ps.Publisher().subscribe(self.UnToggleAllItem, "UnToogle All Slice Item") 457 ps.Publisher().subscribe(self.UnToggleAllItem, "UnToogle All Slice Item")
458 - 458 +
459 def OnClick(self, evt): 459 def OnClick(self, evt):
460 - 460 +
461 id = evt.GetId() 461 id = evt.GetId()
462 exist_enable_state = 0 462 exist_enable_state = 0
463 463
@@ -474,9 +474,9 @@ class SliceToolBar(wx.ToolBar): @@ -474,9 +474,9 @@ class SliceToolBar(wx.ToolBar):
474 #Not exist's tool enbled, change to default state 474 #Not exist's tool enbled, change to default state
475 if not (exist_enable_state): 475 if not (exist_enable_state):
476 ps.Publisher().sendMessage('Set Editor Mode') 476 ps.Publisher().sendMessage('Set Editor Mode')
477 - 477 +
478 ps.Publisher().sendMessage('UnToogle All Object Item') 478 ps.Publisher().sendMessage('UnToogle All Object Item')
479 - 479 +
480 evt.Skip() 480 evt.Skip()
481 481
482 def UnToggleAllItem(self, pubsub_evt): 482 def UnToggleAllItem(self, pubsub_evt):
@@ -486,23 +486,27 @@ class SliceToolBar(wx.ToolBar): @@ -486,23 +486,27 @@ class SliceToolBar(wx.ToolBar):
486 state = self.GetToolState(x) 486 state = self.GetToolState(x)
487 if not (x == id) and (state == True): 487 if not (x == id) and (state == True):
488 self.ToggleTool(x, False) 488 self.ToggleTool(x, False)
489 - 489 +
490 # ------------------------------------------------------------------------------ 490 # ------------------------------------------------------------------------------
491 491
492 class LayoutToolBar(wx.ToolBar): 492 class LayoutToolBar(wx.ToolBar):
493 # TODO: what will appear in menubar? 493 # TODO: what will appear in menubar?
494 def __init__(self, parent): 494 def __init__(self, parent):
495 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) 495 wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER)
496 - if sys.platform == 'darwin':  
497 - self.SetToolBitmapSize(wx.Size(32,32)) 496 +
  497 + self.SetToolBitmapSize(wx.Size(32,32))
498 498
499 self.parent = parent 499 self.parent = parent
500 self.__init_items() 500 self.__init_items()
501 self.__bind_events() 501 self.__bind_events()
502 502
503 def __init_items(self): 503 def __init_items(self):
504 - BMP_ROTATE = wx.Bitmap("../icons/layout_data_only_original.gif", wx.BITMAP_TYPE_GIF)  
505 - BMP_TRANSLATE = wx.Bitmap("../icons/layout_full_original.gif", wx.BITMAP_TYPE_GIF) 504 + if sys.platform == 'darwin':
  505 + BMP_ROTATE = wx.Bitmap("../icons/layout_data_only_original.gif", wx.BITMAP_TYPE_GIF)
  506 + BMP_TRANSLATE = wx.Bitmap("../icons/layout_full_original.gif", wx.BITMAP_TYPE_GIF)
  507 + else:
  508 + BMP_ROTATE = wx.Bitmap("../icons/layout_data_only.gif", wx.BITMAP_TYPE_GIF)
  509 + BMP_TRANSLATE = wx.Bitmap("../icons/layout_full.gif", wx.BITMAP_TYPE_GIF)
506 510
507 self.AddLabelTool(101, "Rotate image", BMP_ROTATE) 511 self.AddLabelTool(101, "Rotate image", BMP_ROTATE)
508 self.AddLabelTool(101, "Translate image", BMP_TRANSLATE) 512 self.AddLabelTool(101, "Translate image", BMP_TRANSLATE)