Fix some MSW specific "special" behaviour.

This commit is contained in:
cncfanatics
2010-09-29 09:01:25 +02:00
parent b19798021d
commit 5a61ef1810
2 changed files with 20 additions and 8 deletions

View File

@@ -86,9 +86,13 @@ class FittingView(d.Display):
self.populate(self.mods)
def fitChanged(self, event):
if self.activeFitID is not None and self.activeFitID == event.fitID:
self.generateMods()
self.refresh(self.mods)
try:
if self.activeFitID is not None and self.activeFitID == event.fitID:
self.generateMods()
self.refresh(self.mods)
self.Show(self.activeFitID is not None and self.activeFitID == event.fitID)
event.Skip()
self.Show(self.activeFitID is not None and self.activeFitID == event.fitID)
except wx._core.PyDeadObjectError:
pass
finally:
event.Skip()

View File

@@ -44,12 +44,17 @@ class MultiSwitch(wx.Notebook):
self.imageList = wx.ImageList(16, 16)
self.SetImageList(self.imageList)
self.removal = False
def getActiveFit(self):
return self.GetCurrentPage().view.activeFitID
def AddTab(self, type="fit", frame=None, title=None):
#Hide current selection
if self.removal:
self.SetSelection(self.GetPageCount() - 2)
return False
#Hide current selection
pos = self.GetPageCount() - 1
if type == "fit":
@@ -67,8 +72,8 @@ class MultiSwitch(wx.Notebook):
self.InsertPage(pos, frame, title)
frame.type=type
self.ChangeSelection(pos)
wx.CallAfter(self.ChangeSelection, pos)
self.SetSelection(pos)
wx.CallAfter(self.SetSelection, pos)
return pos
def removeTab(self, i):
@@ -86,11 +91,14 @@ class MultiSwitch(wx.Notebook):
def checkRemove(self, event):
tab, _ = self.HitTest(event.Position)
if tab != -1 and tab != self.GetPageCount() - 1:
self.removal = True
self.removeTab(tab)
#Deleting a tab might have put us on the "+" tab, make sure we don't stay there
if self.GetSelection() == self.GetPageCount() - 1:
self.SetSelection(self.GetPageCount() - 2)
self.removal = False
def checkAdd(self, event):
if event.Selection == self.GetPageCount() - 1:
self.AddTab()