Run pygi-convert.sh for automatic conversion from GTK2 to GTK3 + pygi.
This is only on a best-effort basis; the code will be in a broken state after this patch and need to be fixed manually. The purpose of committing the intermediate, non-working output is to make it reproducible. It's impractical to manually review the changes. The exact version used was 4f637212f13b197a95c824967a58496b9e3b877c from the main pygobject repository [1] plus a custom patch [2] that hasn't been sent upstream yet. [1] git://git.gnome.org/pygobject [2] https://sascha.silbe.org/patches/pygobject-convert-sugar-20111122.patch Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
This commit is contained in:
committed by
Simon Schampijer
parent
aed295ec4e
commit
820efa56b9
@@ -15,21 +15,21 @@
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
|
||||
|
||||
class Test(gtk.VBox):
|
||||
class Test(Gtk.VBox):
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self)
|
||||
GObject.GObject.__init__(self)
|
||||
|
||||
|
||||
class TestPalette(Test):
|
||||
def __init__(self):
|
||||
Test.__init__(self)
|
||||
|
||||
toolbar = gtk.Toolbar()
|
||||
toolbar = Gtk.Toolbar()
|
||||
|
||||
self._invoker = ToolButton('go-previous')
|
||||
toolbar.insert(self._invoker, -1)
|
||||
@@ -44,8 +44,8 @@ class TestPalette(Test):
|
||||
|
||||
class TestRunner(object):
|
||||
def run(self, test):
|
||||
window = gtk.Window()
|
||||
window.connect('destroy', lambda w: gtk.main_quit())
|
||||
window = Gtk.Window()
|
||||
window.connect('destroy', lambda w: Gtk.main_quit())
|
||||
window.add(test)
|
||||
test.show()
|
||||
|
||||
@@ -56,4 +56,4 @@ def main(test):
|
||||
runner = TestRunner()
|
||||
runner.run(test)
|
||||
|
||||
gtk.main()
|
||||
Gtk.main()
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Test the sugar3.graphics.icon.* cache.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
@@ -54,13 +54,13 @@ def _button_activated_cb(button):
|
||||
|
||||
for d in data:
|
||||
icon = Icon(icon_name=d[0],
|
||||
icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
xo_color=XoColor(d[1]))
|
||||
test.pack_start(icon)
|
||||
test.pack_start(icon, True, True, 0)
|
||||
icon.show()
|
||||
|
||||
button = gtk.Button('mec mac')
|
||||
test.pack_start(button)
|
||||
button = Gtk.Button('mec mac')
|
||||
test.pack_start(button, True, True, 0)
|
||||
button.connect('activate', _button_activated_cb)
|
||||
button.show()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Test the sugar3.graphics.icon.Icon widget.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
@@ -28,41 +28,41 @@ import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
hbox = gtk.HBox()
|
||||
test.pack_start(hbox)
|
||||
sensitive_box = gtk.VBox()
|
||||
insensitive_box = gtk.VBox()
|
||||
hbox = Gtk.HBox()
|
||||
test.pack_start(hbox, True, True, 0)
|
||||
sensitive_box = Gtk.VBox()
|
||||
insensitive_box = Gtk.VBox()
|
||||
|
||||
hbox.pack_start(sensitive_box)
|
||||
hbox.pack_start(insensitive_box)
|
||||
hbox.pack_start(sensitive_box, True, True, 0)
|
||||
hbox.pack_start(insensitive_box, True, True, 0)
|
||||
hbox.show_all()
|
||||
|
||||
|
||||
def create_icon_widgets(box, sensitive=True):
|
||||
icon = Icon(icon_name='go-previous')
|
||||
icon.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
|
||||
box.pack_start(icon)
|
||||
icon.props.icon_size = Gtk.IconSize.LARGE_TOOLBAR
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
icon = Icon(icon_name='computer-xo',
|
||||
icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
xo_color=XoColor())
|
||||
box.pack_start(icon)
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
icon = Icon(icon_name='battery-000',
|
||||
icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
badge_name='emblem-busy')
|
||||
box.pack_start(icon)
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
icon = Icon(icon_name='gtk-new',
|
||||
icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
badge_name='gtk-cancel')
|
||||
box.pack_start(icon)
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
@@ -80,8 +80,8 @@ test.show()
|
||||
# test.queue_draw()
|
||||
# return True
|
||||
#
|
||||
#import gobject
|
||||
#gobject.idle_add(idle_cb)
|
||||
#from gi.repository import GObject
|
||||
#GObject.idle_add(idle_cb)
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
|
||||
@@ -21,7 +21,7 @@ contains only an icon and should be rendered similarly to the toolbar
|
||||
controls. Ticket #2855.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.palette import Palette
|
||||
from sugar3.graphics.icon import Icon
|
||||
@@ -33,19 +33,19 @@ test = common.TestPalette()
|
||||
palette = Palette('Test radio and toggle')
|
||||
test.set_palette(palette)
|
||||
|
||||
box = gtk.HBox()
|
||||
box = Gtk.HBox()
|
||||
|
||||
toggle = gtk.ToggleButton()
|
||||
toggle = Gtk.ToggleButton()
|
||||
|
||||
icon = Icon(icon_name='go-previous', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
|
||||
icon = Icon(icon_name='go-previous', icon_size=Gtk.IconSize.LARGE_TOOLBAR)
|
||||
toggle.set_image(icon)
|
||||
|
||||
box.pack_start(toggle, False)
|
||||
toggle.show()
|
||||
|
||||
radio = gtk.RadioButton()
|
||||
radio = Gtk.RadioButton()
|
||||
|
||||
icon = Icon(icon_name='go-next', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
|
||||
icon = Icon(icon_name='go-next', icon_size=Gtk.IconSize.LARGE_TOOLBAR)
|
||||
radio.set_image(icon)
|
||||
|
||||
radio.set_mode(False)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Spec in ticket #2999.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.palette import Palette
|
||||
from sugar3.graphics.icon import Icon
|
||||
@@ -29,9 +29,9 @@ import common
|
||||
test = common.Test()
|
||||
test.set_border_width(60)
|
||||
|
||||
text_view = gtk.TextView()
|
||||
text_view = Gtk.TextView()
|
||||
text_view.props.buffer.props.text = 'Blah blah blah, blah blah blah.'
|
||||
test.pack_start(text_view)
|
||||
test.pack_start(text_view, True, True, 0)
|
||||
text_view.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Spec in ticket #3000.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
|
||||
@@ -27,7 +27,7 @@ import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
toolbar = gtk.Toolbar()
|
||||
toolbar = Gtk.Toolbar()
|
||||
test.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
||||
@@ -35,7 +35,7 @@ button = ToolButton('go-previous')
|
||||
toolbar.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
separator = gtk.SeparatorToolItem()
|
||||
separator = Gtk.SeparatorToolItem()
|
||||
toolbar.add(separator)
|
||||
separator.show()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Test palette positioning for toolbar and tray.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.tray import HTray, TrayButton
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
@@ -28,11 +28,11 @@ import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
vbox = gtk.VBox()
|
||||
vbox = Gtk.VBox()
|
||||
|
||||
theme_icons = gtk.icon_theme_get_default().list_icons()
|
||||
theme_icons = Gtk.IconTheme.get_default().list_icons()
|
||||
|
||||
toolbar = gtk.Toolbar()
|
||||
toolbar = Gtk.Toolbar()
|
||||
vbox.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
||||
@@ -42,8 +42,8 @@ for i in range(0, 5):
|
||||
toolbar.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
content = gtk.Label()
|
||||
vbox.pack_start(content)
|
||||
content = Gtk.Label()
|
||||
vbox.pack_start(content, True, True, 0)
|
||||
content.show()
|
||||
|
||||
tray = HTray()
|
||||
@@ -56,7 +56,7 @@ for i in range(0, 30):
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
test.pack_start(vbox)
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
test.show()
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Test the sugar3.graphics.icon.Icon widget.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.tray import HTray, VTray
|
||||
from sugar3.graphics.tray import TrayButton, TrayIcon
|
||||
@@ -28,13 +28,13 @@ import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
vbox = gtk.VBox()
|
||||
vbox = Gtk.VBox()
|
||||
|
||||
tray = HTray()
|
||||
vbox.pack_start(tray, False)
|
||||
tray.show()
|
||||
|
||||
theme_icons = gtk.icon_theme_get_default().list_icons()
|
||||
theme_icons = Gtk.IconTheme.get_default().list_icons()
|
||||
|
||||
for i in range(0, 100):
|
||||
button = TrayButton(icon_name=theme_icons[i])
|
||||
@@ -50,7 +50,7 @@ for i in range(0, 10):
|
||||
tray.add_item(icon)
|
||||
icon.show()
|
||||
|
||||
hbox = gtk.HBox()
|
||||
hbox = Gtk.HBox()
|
||||
|
||||
tray = VTray()
|
||||
hbox.pack_start(tray, False)
|
||||
@@ -70,10 +70,10 @@ for i in range(0, 4):
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
vbox.pack_start(hbox)
|
||||
vbox.pack_start(hbox, True, True, 0)
|
||||
hbox.show()
|
||||
|
||||
test.pack_start(vbox)
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
test.show()
|
||||
|
||||
Reference in New Issue
Block a user