Commit dd952eab11149887f548d4436d7c323e082bc699

Authored by Thiago Franco de Moraes
1 parent 4d20057e
Exists in wxgtk3_b5

solved the problem with position of statusbar using idle event

Showing 1 changed file with 14 additions and 2 deletions   Show diff stats
invesalius/gui/frame.py
... ... @@ -68,6 +68,7 @@ class Frame(wx.Frame):
68 68 if sys.platform != 'darwin':
69 69 self.Maximize()
70 70  
  71 + self.sizeChanged = True
71 72 #Necessary update AUI (statusBar in special)
72 73 #when maximized in the Win 7 and XP
73 74 self.SetSize(self.GetSize())
... ... @@ -114,6 +115,7 @@ class Frame(wx.Frame):
114 115 Bind normal events from wx (except pubsub related).
115 116 """
116 117 self.Bind(wx.EVT_SIZE, self.OnSize)
  118 + self.Bind(wx.EVT_IDLE, self.OnIdle)
117 119 self.Bind(wx.EVT_MENU, self.OnMenuClick)
118 120 self.Bind(wx.EVT_CLOSE, self.OnClose)
119 121  
... ... @@ -375,8 +377,17 @@ class Frame(wx.Frame):
375 377 """
376 378 Refresh GUI when frame is resized.
377 379 """
378   - Publisher.sendMessage(('ProgressBar Reposition'))
379 380 evt.Skip()
  381 + self.Reposition()
  382 + self.sizeChanged = True
  383 +
  384 + def OnIdle(self, evt):
  385 + if self.sizeChanged:
  386 + self.Reposition()
  387 +
  388 + def Reposition(self):
  389 + Publisher.sendMessage(('ProgressBar Reposition'))
  390 + self.sizeChanged = False
380 391  
381 392 def ShowPreferences(self):
382 393  
... ... @@ -691,9 +702,10 @@ class ProgressBar(wx.Gauge):
691 702 """
692 703 Compute new size and position, according to parent resize
693 704 """
694   - rect = self.parent.GetFieldRect(2)
  705 + rect = self.Parent.GetFieldRect(2)
695 706 self.SetPosition((rect.x + 2, rect.y + 2))
696 707 self.SetSize((rect.width - 4, rect.height - 4))
  708 + self.Show()
697 709  
698 710 def SetPercentage(self, value):
699 711 """
... ...