tests: replace deprecated calls in XRC

This commit is contained in:
Scott Talbert
2021-12-30 15:57:34 -05:00
parent f5a55e6bf3
commit 6b386d85a7
2 changed files with 7 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ class xrc_Tests(wtc.WidgetTestCase):
xmlres = xrc.XmlResource()
with open(xrcFile, 'rb') as f:
data = f.read()
xmlres.LoadFromString(data)
xmlres.LoadFromBuffer(data)
self.checkXmlRes(xmlres)
def test_xrc4(self):
@@ -91,7 +91,7 @@ class xrc_Tests(wtc.WidgetTestCase):
def OnSize(self, evt):
sz = self.GetSize()
w, h = self.t.GetTextExtent(self.t.GetLabel())
self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
self.t.SetPosition(((sz.width-w)//2, (sz.height-h)//2))
# this is the handler class that will create the resource item
@@ -127,7 +127,7 @@ class xrc_Tests(wtc.WidgetTestCase):
# now load it
xmlres = xrc.XmlResource()
xmlres.InsertHandler( MyCustomPanelXmlHandler() )
success = xmlres.LoadFromString(resource)
success = xmlres.LoadFromBuffer(resource)
f = xmlres.LoadFrame(self.frame, 'MainFrame')
self.assertNotEqual(f, None)
@@ -178,7 +178,7 @@ class xrc_Tests(wtc.WidgetTestCase):
def OnSize(self, evt):
sz = self.GetSize()
w, h = self.t.GetTextExtent(self.t.GetLabel())
self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
self.t.SetPosition(((sz.width-w)//2, (sz.height-h)//2))
# this is the handler class that will create the resource item
@@ -215,7 +215,7 @@ class xrc_Tests(wtc.WidgetTestCase):
# now load it
xmlres = xrc.XmlResource()
xmlres.InsertHandler( MyCustomPanelXmlHandler() )
success = xmlres.LoadFromString(resource)
success = xmlres.LoadFromBuffer(resource)
f = xmlres.LoadFrame(self.frame, 'MainFrame')
self.assertNotEqual(f, None)
@@ -246,7 +246,7 @@ class xrc_Tests(wtc.WidgetTestCase):
# now load it
xmlres = xrc.XmlResource()
success = xmlres.LoadFromString(resource)
success = xmlres.LoadFromBuffer(resource)
panel = xmlres.LoadPanel(self.frame, "MyPanel")
self.frame.SendSizeEvent()

View File

@@ -31,5 +31,5 @@ class MyCustomPanel(wx.Panel):
if hasattr(self, 't'):
sz = self.GetSize()
w, h = self.t.GetTextExtent(self.t.GetLabel())
self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
self.t.SetPosition(((sz.width-w)//2, (sz.height-h)//2))