Port from Python 2 to six
Signed-off-by: James Cameron <quozl@laptop.org>
This commit is contained in:
+3
-3
@@ -21,11 +21,11 @@ box.pack_start(alert, False, False, 0)
|
||||
# Called when an alert object throws a response event.
|
||||
def __alert_response_cb(alert, response_id):
|
||||
if response_id is Gtk.ResponseType.OK:
|
||||
print 'Continue Button was clicked.'
|
||||
print('Continue Button was clicked.')
|
||||
elif response_id is Gtk.ResponseType.CANCEL:
|
||||
print 'Cancel Button was clicked.'
|
||||
print('Cancel Button was clicked.')
|
||||
elif response_id == -1:
|
||||
print 'Timeout occurred'
|
||||
print('Timeout occurred')
|
||||
|
||||
|
||||
alert.connect('response', __alert_response_cb)
|
||||
|
||||
@@ -23,7 +23,7 @@ class _Animation(animator.Animation):
|
||||
|
||||
|
||||
def __animation_completed_cb(anim):
|
||||
print 'Animation completed'
|
||||
print('Animation completed')
|
||||
|
||||
|
||||
w = Gtk.Window()
|
||||
|
||||
@@ -24,7 +24,7 @@ separator.show()
|
||||
|
||||
|
||||
def color_changed_cb(button, pspec):
|
||||
print button.get_color()
|
||||
print(button.get_color())
|
||||
|
||||
|
||||
color_button = ColorToolButton()
|
||||
|
||||
@@ -6,7 +6,7 @@ set_theme()
|
||||
|
||||
|
||||
def __combo_changed_cb(combo):
|
||||
print 'Combo changed to %r' % combo.get_value()
|
||||
print('Combo changed to %r' % combo.get_value())
|
||||
|
||||
|
||||
w = Gtk.Window()
|
||||
|
||||
@@ -13,14 +13,14 @@ class MyCellRenderer(Gtk.CellRenderer):
|
||||
Gtk.CellRenderer.__init__(self)
|
||||
|
||||
def __del__(self):
|
||||
print "cellrenderer destroy"
|
||||
print("cellrenderer destroy")
|
||||
|
||||
def do_render(self, cairo_t, widget, background_area, cell_area, flags):
|
||||
pass
|
||||
|
||||
|
||||
def window_destroy_cb(*kwargs):
|
||||
print "window destroy"
|
||||
print("window destroy")
|
||||
Gtk.main_quit()
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ window.show()
|
||||
|
||||
|
||||
def treeview_destroy_cb(*kwargs):
|
||||
print "treeview destroy"
|
||||
print("treeview destroy")
|
||||
|
||||
|
||||
treeview = Gtk.TreeView()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
from gi.repository import Gtk
|
||||
|
||||
import common
|
||||
|
||||
@@ -6,11 +6,11 @@ set_theme()
|
||||
|
||||
|
||||
def __go_next_cb(entry, icon_pos, data=None):
|
||||
print 'Go next'
|
||||
print('Go next')
|
||||
|
||||
|
||||
def __entry_activate_cb(widget, data=None):
|
||||
print 'Entry activate'
|
||||
print('Entry activate')
|
||||
|
||||
|
||||
w = Gtk.Window()
|
||||
|
||||
@@ -19,7 +19,7 @@ box.show()
|
||||
def echo(button, label):
|
||||
if not button.props.active:
|
||||
return
|
||||
print label
|
||||
print(label)
|
||||
|
||||
|
||||
palette = RadioPalette()
|
||||
|
||||
@@ -12,12 +12,12 @@ import common
|
||||
|
||||
|
||||
def _scroll_start_cb(event, treeview, invoker):
|
||||
print "Scroll starts"
|
||||
print("Scroll starts")
|
||||
invoker.detach()
|
||||
|
||||
|
||||
def _scroll_end_cb(event, treeview, invoker):
|
||||
print "Scroll ends"
|
||||
print("Scroll ends")
|
||||
invoker.attach_treeview(treeview)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ data_dir = os.getenv('GTK_DATA_PREFIX', '/usr/')
|
||||
|
||||
iconlist = os.listdir(os.path.join(data_dir,
|
||||
'share/icons/sugar/scalable/actions/'))
|
||||
print "Displaying %s icons" % len(iconlist)
|
||||
print("Displaying %s icons" % len(iconlist))
|
||||
for icon in iconlist:
|
||||
icon = os.path.basename(icon)
|
||||
icon = icon[:icon.find('.')]
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
|
||||
@@ -21,7 +21,7 @@ toolbar_box.toolbar.insert(separator, -1)
|
||||
def __clicked_cb(button):
|
||||
n = int(button.get_tooltip())
|
||||
button.set_tooltip(str(n + 1))
|
||||
print "tool button click count %d" % n
|
||||
print("tool button click count %d" % n)
|
||||
|
||||
|
||||
tool_button = ToolButton(icon_name='view-radial', tooltip='0')
|
||||
|
||||
Reference in New Issue
Block a user