Commit dcf9635c3651f75f652ec1c3517517b0e5ea18d8

Authored by Thiago Franco de Moraes
1 parent c70780c8
Exists in wxgtk3_bkp

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
... ... @@ -85,6 +85,7 @@ class Frame(wx.Frame):
85 85 if sys.platform != 'darwin':
86 86 self.Maximize()
87 87  
  88 + self.sizeChanged = True
88 89 #Necessary update AUI (statusBar in special)
89 90 #when maximized in the Win 7 and XP
90 91 self.SetSize(self.GetSize())
... ... @@ -132,6 +133,7 @@ class Frame(wx.Frame):
132 133 Bind normal events from wx (except pubsub related).
133 134 """
134 135 self.Bind(wx.EVT_SIZE, self.OnSize)
  136 + self.Bind(wx.EVT_IDLE, self.OnIdle)
135 137 self.Bind(wx.EVT_MENU, self.OnMenuClick)
136 138 self.Bind(wx.EVT_CLOSE, self.OnClose)
137 139 #self.Bind(wx.EVT_MOVE, self.OnMove)
... ... @@ -404,8 +406,17 @@ class Frame(wx.Frame):
404 406 """
405 407 Refresh GUI when frame is resized.
406 408 """
407   - Publisher.sendMessage(('ProgressBar Reposition'))
408 409 evt.Skip()
  410 + self.Reposition()
  411 + self.sizeChanged = True
  412 +
  413 + def OnIdle(self, evt):
  414 + if self.sizeChanged:
  415 + self.Reposition()
  416 +
  417 + def Reposition(self):
  418 + Publisher.sendMessage(('ProgressBar Reposition'))
  419 + self.sizeChanged = False
409 420  
410 421  
411 422 def OnMove(self, evt):
... ... @@ -732,9 +743,10 @@ class ProgressBar(wx.Gauge):
732 743 """
733 744 Compute new size and position, according to parent resize
734 745 """
735   - rect = self.parent.GetFieldRect(2)
  746 + rect = self.Parent.GetFieldRect(2)
736 747 self.SetPosition((rect.x + 2, rect.y + 2))
737 748 self.SetSize((rect.width - 4, rect.height - 4))
  749 + self.Show()
738 750  
739 751 def SetPercentage(self, value):
740 752 """
... ...