mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
remove usage of six.print_()
This commit is contained in:
committed by
Scott Talbert
parent
5abeba2f5d
commit
beb9932241
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from six import print_
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
FONTSIZE = 10
|
FONTSIZE = 10
|
||||||
@@ -180,7 +181,7 @@ class PrintFrameworkSample(wx.Frame):
|
|||||||
data = dlg.GetPageSetupData()
|
data = dlg.GetPageSetupData()
|
||||||
self.pdata = wx.PrintData(data.GetPrintData()) # force a copy
|
self.pdata = wx.PrintData(data.GetPrintData()) # force a copy
|
||||||
self.pdata.SetPaperId(data.GetPaperId())
|
self.pdata.SetPaperId(data.GetPaperId())
|
||||||
#print_("paperID %r, paperSize %r" % (self.pdata.GetPaperId(), self.pdata.GetPaperSize()))
|
#print("paperID %r, paperSize %r" % (self.pdata.GetPaperId(), self.pdata.GetPaperSize()))
|
||||||
self.margins = (data.GetMarginTopLeft(),
|
self.margins = (data.GetMarginTopLeft(),
|
||||||
data.GetMarginBottomRight())
|
data.GetMarginBottomRight())
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
@@ -226,20 +227,20 @@ class PrintFrameworkSample(wx.Frame):
|
|||||||
dlg = wx.PrintDialog(self, data)
|
dlg = wx.PrintDialog(self, data)
|
||||||
if dlg.ShowModal() == wx.ID_OK:
|
if dlg.ShowModal() == wx.ID_OK:
|
||||||
data = dlg.GetPrintDialogData()
|
data = dlg.GetPrintDialogData()
|
||||||
print_()
|
print()
|
||||||
print_("GetFromPage:", data.GetFromPage())
|
print("GetFromPage:", data.GetFromPage())
|
||||||
print_("GetToPage:", data.GetToPage())
|
print("GetToPage:", data.GetToPage())
|
||||||
print_("GetMinPage:", data.GetMinPage())
|
print("GetMinPage:", data.GetMinPage())
|
||||||
print_("GetMaxPage:", data.GetMaxPage())
|
print("GetMaxPage:", data.GetMaxPage())
|
||||||
print_("GetNoCopies:", data.GetNoCopies())
|
print("GetNoCopies:", data.GetNoCopies())
|
||||||
print_("GetAllPages:", data.GetAllPages())
|
print("GetAllPages:", data.GetAllPages())
|
||||||
print_("GetSelection:", data.GetSelection())
|
print("GetSelection:", data.GetSelection())
|
||||||
print_("GetCollate:", data.GetCollate())
|
print("GetCollate:", data.GetCollate())
|
||||||
print_("GetPrintToFile:", data.GetPrintToFile())
|
print("GetPrintToFile:", data.GetPrintToFile())
|
||||||
|
|
||||||
self.pdata = wx.PrintData(data.GetPrintData())
|
self.pdata = wx.PrintData(data.GetPrintData())
|
||||||
print_()
|
print()
|
||||||
print_("GetPrinterName:", self.pdata.GetPrinterName())
|
print("GetPrinterName:", self.pdata.GetPrinterName())
|
||||||
|
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,9 @@
|
|||||||
# ideal Roses program should be, however, callers are welcome to assert their
|
# ideal Roses program should be, however, callers are welcome to assert their
|
||||||
# independence, override defaults, ignore features, etc.
|
# independence, override defaults, ignore features, etc.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
from math import sin, cos, pi
|
from math import sin, cos, pi
|
||||||
from six import print_
|
|
||||||
|
|
||||||
# Rose class knows about:
|
# Rose class knows about:
|
||||||
# > Generating points and vectors (returning data as a list of points)
|
# > Generating points and vectors (returning data as a list of points)
|
||||||
@@ -151,7 +152,7 @@ class rose:
|
|||||||
# update parameters or stop.
|
# update parameters or stop.
|
||||||
def restart(self):
|
def restart(self):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print_('restart: int_state', self.int_state, 'cmd_state', self.cmd_state)
|
print('restart: int_state', self.int_state, 'cmd_state', self.cmd_state)
|
||||||
try:
|
try:
|
||||||
tmp = self.sin_table[0]
|
tmp = self.sin_table[0]
|
||||||
except:
|
except:
|
||||||
@@ -192,7 +193,7 @@ class rose:
|
|||||||
# before initialization is done.
|
# before initialization is done.
|
||||||
def repaint(self, delay):
|
def repaint(self, delay):
|
||||||
if self.int_state != self.INT_RESIZE:
|
if self.int_state != self.INT_RESIZE:
|
||||||
# print_('repaint after', delay)
|
# print('repaint after', delay)
|
||||||
self.int_state = self.INT_RESIZE
|
self.int_state = self.INT_RESIZE
|
||||||
self.AppCancelTimer()
|
self.AppCancelTimer()
|
||||||
self.AppAfter(delay, self.clock)
|
self.AppAfter(delay, self.clock)
|
||||||
@@ -264,7 +265,7 @@ class rose:
|
|||||||
# roses is 0.)
|
# roses is 0.)
|
||||||
def clock(self):
|
def clock(self):
|
||||||
if self.int_state == self.INT_IDLE:
|
if self.int_state == self.INT_IDLE:
|
||||||
# print_('clock called in idle state')
|
# print('clock called in idle state')
|
||||||
delay = 0
|
delay = 0
|
||||||
elif self.int_state == self.INT_DRAW:
|
elif self.int_state == self.INT_DRAW:
|
||||||
line, run = self.roselet()
|
line, run = self.roselet()
|
||||||
@@ -295,7 +296,7 @@ class rose:
|
|||||||
|
|
||||||
if delay == 0:
|
if delay == 0:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print_('clock: going idle from state', self.int_state)
|
print('clock: going idle from state', self.int_state)
|
||||||
else:
|
else:
|
||||||
self.AppAfter(delay, self.clock)
|
self.AppAfter(delay, self.clock)
|
||||||
|
|
||||||
|
|||||||
@@ -68,10 +68,11 @@
|
|||||||
# control the display (without blocking the user's control) would be pretty
|
# control the display (without blocking the user's control) would be pretty
|
||||||
# straightforward.
|
# straightforward.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import clroses
|
import clroses
|
||||||
import wx.lib.colourselect as cs
|
import wx.lib.colourselect as cs
|
||||||
from six import print_
|
|
||||||
|
|
||||||
# Class SpinPanel creates a control that includes both a StaticText widget
|
# Class SpinPanel creates a control that includes both a StaticText widget
|
||||||
# which holds the the name of a parameter and a SpinCtrl widget which
|
# which holds the the name of a parameter and a SpinCtrl widget which
|
||||||
@@ -109,7 +110,7 @@ class SpinPanel(wx.Panel):
|
|||||||
name = self.st.GetLabel()
|
name = self.st.GetLabel()
|
||||||
value = self.sc.GetValue()
|
value = self.sc.GetValue()
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnSpin', name, '=', value)
|
print('OnSpin', name, '=', value)
|
||||||
self.callback(name, value) # Call MyFrame.OnSpinback to call clroses
|
self.callback(name, value) # Call MyFrame.OnSpinback to call clroses
|
||||||
|
|
||||||
|
|
||||||
@@ -372,10 +373,10 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
h = max(600, fh) # Change 600 to desired minimum size
|
h = max(600, fh) # Change 600 to desired minimum size
|
||||||
w = h + fw - rw
|
w = h + fw - rw
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('rose panel size', (rw, rh))
|
print('rose panel size', (rw, rh))
|
||||||
print_('side panel size', (sw, sh))
|
print('side panel size', (sw, sh))
|
||||||
print_(' frame size', (fw, fh))
|
print(' frame size', (fw, fh))
|
||||||
print_('Want size', (w,h))
|
print('Want size', (w,h))
|
||||||
self.SetSize((w, h))
|
self.SetSize((w, h))
|
||||||
self.SupplyControlValues() # Ask clroses to tell us all the defaults
|
self.SupplyControlValues() # Ask clroses to tell us all the defaults
|
||||||
self.Show()
|
self.Show()
|
||||||
@@ -386,25 +387,25 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
# Go/Stop button
|
# Go/Stop button
|
||||||
def OnGoStop(self, event):
|
def OnGoStop(self, event):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnGoStop')
|
print('OnGoStop')
|
||||||
self.cmd_go_stop()
|
self.cmd_go_stop()
|
||||||
|
|
||||||
# Redraw/Redraw
|
# Redraw/Redraw
|
||||||
def OnRedraw(self, event):
|
def OnRedraw(self, event):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnRedraw')
|
print('OnRedraw')
|
||||||
self.cmd_redraw()
|
self.cmd_redraw()
|
||||||
|
|
||||||
# Backward/Reverse
|
# Backward/Reverse
|
||||||
def OnBackward(self, event):
|
def OnBackward(self, event):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnBackward')
|
print('OnBackward')
|
||||||
self.cmd_backward()
|
self.cmd_backward()
|
||||||
|
|
||||||
# Forward/Skip
|
# Forward/Skip
|
||||||
def OnForward(self, event):
|
def OnForward(self, event):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnForward')
|
print('OnForward')
|
||||||
self.cmd_step()
|
self.cmd_step()
|
||||||
|
|
||||||
|
|
||||||
@@ -415,7 +416,7 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
|
|
||||||
def AppClear(self):
|
def AppClear(self):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('AppClear: clear screen')
|
print('AppClear: clear screen')
|
||||||
self.rose_panel.Clear()
|
self.rose_panel.Clear()
|
||||||
|
|
||||||
def AppCreateLine(self, line):
|
def AppCreateLine(self, line):
|
||||||
@@ -467,8 +468,8 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
# Method to provide a single callback after some amount of time.
|
# Method to provide a single callback after some amount of time.
|
||||||
def AppAfter(self, msec, callback):
|
def AppAfter(self, msec, callback):
|
||||||
if self.timer_callback:
|
if self.timer_callback:
|
||||||
print_('AppAfter: timer_callback already set!')
|
print('AppAfter: timer_callback already set!')
|
||||||
# print_('AppAfter:', callback)
|
# print('AppAfter:', callback)
|
||||||
self.timer_callback = callback
|
self.timer_callback = callback
|
||||||
self.timer.Start(msec, True)
|
self.timer.Start(msec, True)
|
||||||
|
|
||||||
@@ -476,14 +477,14 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
# interest in.
|
# interest in.
|
||||||
def AppCancelTimer(self):
|
def AppCancelTimer(self):
|
||||||
self.timer.Stop()
|
self.timer.Stop()
|
||||||
# print_('AppCancelTimer')
|
# print('AppCancelTimer')
|
||||||
self.timer_callback = None
|
self.timer_callback = None
|
||||||
|
|
||||||
# When the timer happens, we come here and jump off to clroses internal code.
|
# When the timer happens, we come here and jump off to clroses internal code.
|
||||||
def OnTimer(self, evt):
|
def OnTimer(self, evt):
|
||||||
callback = self.timer_callback
|
callback = self.timer_callback
|
||||||
self.timer_callback = None
|
self.timer_callback = None
|
||||||
# print_('OnTimer,', callback)
|
# print('OnTimer,', callback)
|
||||||
if callback:
|
if callback:
|
||||||
callback() # Often calls AppAfter() and sets the callback
|
callback() # Often calls AppAfter() and sets the callback
|
||||||
else:
|
else:
|
||||||
@@ -502,7 +503,7 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
# Called when data in spin boxes changes.
|
# Called when data in spin boxes changes.
|
||||||
def OnSpinback(self, name, value):
|
def OnSpinback(self, name, value):
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('OnSpinback', name, value)
|
print('OnSpinback', name, value)
|
||||||
if name == 'Style':
|
if name == 'Style':
|
||||||
self.SetStyle(value)
|
self.SetStyle(value)
|
||||||
elif name == 'Sincr':
|
elif name == 'Sincr':
|
||||||
@@ -530,7 +531,7 @@ class MyFrame(wx.Frame, clroses.rose):
|
|||||||
elif name == 'Delay':
|
elif name == 'Delay':
|
||||||
self.SetWaitDelay(value)
|
self.SetWaitDelay(value)
|
||||||
else:
|
else:
|
||||||
print_('OnSpinback: Don\'t recognize', name)
|
print('OnSpinback: Don\'t recognize', name)
|
||||||
|
|
||||||
verbose = 0 # Need some command line options...
|
verbose = 0 # Need some command line options...
|
||||||
spin_panels = {} # Hooks to get from rose to panel labels
|
spin_panels = {} # Hooks to get from rose to panel labels
|
||||||
@@ -539,6 +540,6 @@ ctrl_buttons = {} # Button widgets for command (NE) panel
|
|||||||
app = wx.App(False)
|
app = wx.App(False)
|
||||||
MyFrame()
|
MyFrame()
|
||||||
if verbose:
|
if verbose:
|
||||||
print_('spin_panels', list(spin_panels))
|
print('spin_panels', list(spin_panels))
|
||||||
print_('ctrl_buttons', list(ctrl_buttons))
|
print('ctrl_buttons', list(ctrl_buttons))
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from six import print_
|
|
||||||
|
|
||||||
print_(wx.version())
|
print(wx.version())
|
||||||
#import os; print_('PID:', os.getpid()); raw_input('Ready to start, press enter...')
|
#import os; print('PID:', os.getpid()); raw_input('Ready to start, press enter...')
|
||||||
|
|
||||||
|
|
||||||
class MyFrame(wx.Frame):
|
class MyFrame(wx.Frame):
|
||||||
@@ -13,21 +13,21 @@ class MyFrame(wx.Frame):
|
|||||||
wx.CallAfter(self.after, 1, 2, 3)
|
wx.CallAfter(self.after, 1, 2, 3)
|
||||||
|
|
||||||
def after(self, a, b, c):
|
def after(self, a, b, c):
|
||||||
print_('Called via wx.CallAfter:', a, b, c)
|
print('Called via wx.CallAfter:', a, b, c)
|
||||||
|
|
||||||
def onSize(self, evt):
|
def onSize(self, evt):
|
||||||
print_(repr(evt.Size))
|
print(repr(evt.Size))
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|
||||||
class MyApp(wx.App):
|
class MyApp(wx.App):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
print_('OnInit')
|
print('OnInit')
|
||||||
frm = MyFrame(None, title="Hello with Events", size=(480,360))
|
frm = MyFrame(None, title="Hello with Events", size=(480,360))
|
||||||
frm.Show()
|
frm.Show()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def OnExit(self):
|
def OnExit(self):
|
||||||
print_('OnExit')
|
print('OnExit')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
app = MyApp()
|
app = MyApp()
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ printTreeDocs and printTreeSpec.
|
|||||||
:license: BSD, see LICENSE_BSD_Simple.txt for details.
|
:license: BSD, see LICENSE_BSD_Simple.txt for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from .. import py2and3
|
|
||||||
|
|
||||||
__all__ = ('printImported', 'StructMsg', 'Callback', 'Enum' )
|
__all__ = ('printImported', 'StructMsg', 'Callback', 'Enum' )
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ def printImported():
|
|||||||
"""Output a list of pubsub modules imported so far"""
|
"""Output a list of pubsub modules imported so far"""
|
||||||
ll = sorted([mod for mod in sys.modules if mod.find('pubsub') >= 0])
|
ll = sorted([mod for mod in sys.modules if mod.find('pubsub') >= 0])
|
||||||
|
|
||||||
py2and3.print_('\n'.join(ll))
|
print('\n'.join(ll))
|
||||||
|
|
||||||
|
|
||||||
class StructMsg:
|
class StructMsg:
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ of the XML tree.
|
|||||||
:license: BSD, see LICENSE_BSD_Simple.txt for details.
|
:license: BSD, see LICENSE_BSD_Simple.txt for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
__author__ = 'Joshua R English'
|
__author__ = 'Joshua R English'
|
||||||
__revision__ = 6
|
__revision__ = 6
|
||||||
__date__ = '2013-07-27'
|
__date__ = '2013-07-27'
|
||||||
@@ -80,7 +82,7 @@ def _get_elem(elem):
|
|||||||
try:
|
try:
|
||||||
elem = ET.fromstring(elem)
|
elem = ET.fromstring(elem)
|
||||||
except:
|
except:
|
||||||
py2and3.print_("Value Error", elem)
|
print("Value Error", elem)
|
||||||
raise ValueError("Cannot convert to element")
|
raise ValueError("Cannot convert to element")
|
||||||
return elem
|
return elem
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ Usage: python pywxrc.py -h
|
|||||||
-o, --output output filename, or - for stdout
|
-o, --output output filename, or - for stdout
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys, os, getopt, glob, re
|
import sys, os, getopt, glob, re
|
||||||
import xml.dom.minidom as minidom
|
import xml.dom.minidom as minidom
|
||||||
from six import print_, byte2int
|
from six import byte2int
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -286,7 +288,7 @@ class XmlResourceCompiler:
|
|||||||
gettextStrings += self.FindStringsInNode(resourceDocument.firstChild)
|
gettextStrings += self.FindStringsInNode(resourceDocument.firstChild)
|
||||||
|
|
||||||
# now write it all out
|
# now write it all out
|
||||||
print_(self.templates.FILE_HEADER, file=outputFile)
|
print(self.templates.FILE_HEADER, file=outputFile)
|
||||||
|
|
||||||
# Note: Technically it is not legal to have anything other
|
# Note: Technically it is not legal to have anything other
|
||||||
# than ascii for class and variable names, but since the user
|
# than ascii for class and variable names, but since the user
|
||||||
@@ -295,23 +297,23 @@ class XmlResourceCompiler:
|
|||||||
# later when they try to run the program.
|
# later when they try to run the program.
|
||||||
if subclasses:
|
if subclasses:
|
||||||
subclasses = self.ReplaceBlocks(u"\n".join(subclasses))
|
subclasses = self.ReplaceBlocks(u"\n".join(subclasses))
|
||||||
print_(subclasses, file=outputFile)
|
print(subclasses, file=outputFile)
|
||||||
if classes:
|
if classes:
|
||||||
classes = self.ReplaceBlocks(u"\n".join(classes))
|
classes = self.ReplaceBlocks(u"\n".join(classes))
|
||||||
print_(classes, file=outputFile)
|
print(classes, file=outputFile)
|
||||||
|
|
||||||
print_(self.templates.INIT_RESOURE_HEADER, file=outputFile)
|
print(self.templates.INIT_RESOURE_HEADER, file=outputFile)
|
||||||
if embedResources:
|
if embedResources:
|
||||||
print_(self.templates.PREPARE_MEMFS, file=outputFile)
|
print(self.templates.PREPARE_MEMFS, file=outputFile)
|
||||||
resources = u"\n".join(resources)
|
resources = u"\n".join(resources)
|
||||||
print_(resources, file=outputFile)
|
print(resources, file=outputFile)
|
||||||
|
|
||||||
if generateGetText:
|
if generateGetText:
|
||||||
# gettextStrings is a list of unicode strings as returned by ConvertText
|
# gettextStrings is a list of unicode strings as returned by ConvertText
|
||||||
conversions = [u' _("%s")' % s for s in gettextStrings]
|
conversions = [u' _("%s")' % s for s in gettextStrings]
|
||||||
conversion_block = u"\n".join(conversions)
|
conversion_block = u"\n".join(conversions)
|
||||||
conversion_func = self.templates.GETTEXT_DUMMY_FUNC % conversion_block
|
conversion_func = self.templates.GETTEXT_DUMMY_FUNC % conversion_block
|
||||||
print_(conversion_func, file=outputFile)
|
print(conversion_func, file=outputFile)
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -327,7 +329,7 @@ class XmlResourceCompiler:
|
|||||||
strings = self.FindStringsInNode(resource)
|
strings = self.FindStringsInNode(resource)
|
||||||
# strings is a list of unicode strings as returned by ConvertText
|
# strings is a list of unicode strings as returned by ConvertText
|
||||||
strings = ['_("%s");' % s for s in strings]
|
strings = ['_("%s");' % s for s in strings]
|
||||||
print_("\n".join(strings), file=outputFile)
|
print("\n".join(strings), file=outputFile)
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -940,10 +942,10 @@ def main(args=None):
|
|||||||
|
|
||||||
|
|
||||||
except IOError as exc:
|
except IOError as exc:
|
||||||
print_("%s." % str(exc), file=sys.stderr)
|
print("%s." % str(exc), file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
if outputFilename != "-":
|
if outputFilename != "-":
|
||||||
print_("Resources written to %s." % outputFilename, file=sys.stderr)
|
print("Resources written to %s." % outputFilename, file=sys.stderr)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
||||||
|
|||||||
Reference in New Issue
Block a user