pep8'd examples

This commit is contained in:
William Orr 2013-05-17 22:48:47 -04:00 committed by Daniel Narvaez
parent c736ffefcd
commit 30acc63d51
9 changed files with 33 additions and 23 deletions

View File

@ -2,9 +2,11 @@ from gi.repository import Gtk
from sugar3.graphics.alert import TimeoutAlert
def _destroy_cb(widget, data=None):
Gtk.main_quit()
def __start_response_cb(widget, data=None):
print 'Response: start download'

View File

@ -21,6 +21,7 @@ class _Animation(animator.Animation):
def __animation_completed_cb(anim):
print 'Animation completed'
def _destroy_cb(widget, data=None):
Gtk.main_quit()

View File

@ -2,9 +2,11 @@ from gi.repository import Gtk
from sugar3.graphics.combobox import ComboBox
def _destroy_cb(widget, data=None):
Gtk.main_quit()
def __combo_changed_cb(widget, data=None):
print 'combo-changed'

View File

@ -33,6 +33,7 @@ def set_theme():
settings.set_property('gtk-icon-theme-name', 'sugar')
set_theme()
class Test(Gtk.VBox):
def __init__(self):
GObject.GObject.__init__(self)

View File

@ -2,12 +2,15 @@ from gi.repository import Gtk
from sugar3.graphics import iconentry
def _destroy_cb(widget, data=None):
Gtk.main_quit()
def __go_next_cb(entry, icon_pos, data=None):
print 'Go next'
def __entry_activate_cb(widget, data=None):
print 'Entry activate'

View File

@ -2,6 +2,7 @@ from gi.repository import Gtk
from sugar3.graphics.notebook import Notebook
def _destroy_cb(widget, data=None):
Gtk.main_quit()

View File

@ -1,7 +1,7 @@
from gi.repository import Gtk
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton, \
RadioToolsButton
RadioToolsButton
from sugar3.graphics.radiotoolbutton import RadioToolButton
window = Gtk.Window()
@ -26,19 +26,19 @@ def echo(button, label):
palette = RadioPalette()
group = RadioToolButton(
icon_name='document-open')
icon_name='document-open')
group.connect('clicked', lambda button: echo(button, 'document-open'))
palette.append(group, 'menu.document-open')
button = RadioToolButton(
icon_name='document-save',
group=group)
icon_name='document-save',
group=group)
button.connect('clicked', lambda button: echo(button, 'document-save'))
palette.append(button, 'menu.document-save')
button = RadioToolButton(
icon_name='document-send',
group=group)
icon_name='document-send',
group=group)
button.connect('clicked', lambda button: echo(button, 'document-send'))
palette.append(button, 'menu.document-send')
@ -50,19 +50,19 @@ toolbar.insert(button, -1)
palette = RadioPalette()
group = RadioToolButton(
icon_name='document-open')
icon_name='document-open')
group.connect('clicked', lambda button: echo(button, 'document-open'))
palette.append(group, 'menu.document-open')
button = RadioToolButton(
icon_name='document-save',
group=group)
icon_name='document-save',
group=group)
button.connect('clicked', lambda button: echo(button, 'document-save'))
palette.append(button, 'menu.document-save')
button = RadioToolButton(
icon_name='document-send',
group=group)
icon_name='document-send',
group=group)
button.connect('clicked', lambda button: echo(button, 'document-send'))
palette.append(button, 'menu.document-send')

View File

@ -22,7 +22,7 @@ for i in range(3):
notebook.append_page(hbox, Gtk.Label('Page %d' % (i + 1)))
hbox.show()
# notebook with buttons
# notebook with buttons
notebook = Gtk.Notebook()
box.pack_start(notebook, True, True, 0)

View File

@ -12,14 +12,14 @@ toolbar = ToolbarBox()
box.pack_start(toolbar, False)
tollbarbutton_1 = ToolbarButton(
page=Gtk.Button('sub-widget #1'),
icon_name='computer-xo')
page=Gtk.Button('sub-widget #1'),
icon_name='computer-xo')
toolbar.toolbar.insert(tollbarbutton_1, -1)
tollbarbutton_2 = ToolbarButton(
page=Gtk.Button('sub-widget #2'),
icon_name='button_cancel',
tooltip='with custom palette instead of sub-widget')
page=Gtk.Button('sub-widget #2'),
icon_name='button_cancel',
tooltip='with custom palette instead of sub-widget')
toolbar.toolbar.insert(tollbarbutton_2, -1)
toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1)
@ -30,20 +30,20 @@ def del_cb(widget):
del_b = Gtk.Button('delete sub-widget #3')
del_b.connect('clicked', del_cb)
tollbarbutton_3 = ToolbarButton(
page=del_b,
icon_name='activity-journal')
page=del_b,
icon_name='activity-journal')
toolbar.toolbar.insert(tollbarbutton_3, -1)
subbar = Gtk.Toolbar()
subbutton = ToolButton(
icon_name='document-send',
tooltip='document-send')
icon_name='document-send',
tooltip='document-send')
subbar.insert(subbutton, -1)
subbar.show_all()
tollbarbutton_4 = ToolbarButton(
page=subbar,
icon_name='document-save')
page=subbar,
icon_name='document-save')
toolbar.toolbar.insert(tollbarbutton_4, -1)
window.show_all()