mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 12:41:10 +02:00
tests: replace deprecated calls in XRC
This commit is contained in:
@@ -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()
|
||||
|
@@ -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))
|
||||
|
||||
|
Reference in New Issue
Block a user