pep8'd examples
This commit is contained in:
parent
c736ffefcd
commit
30acc63d51
@ -2,9 +2,11 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from sugar3.graphics.alert import TimeoutAlert
|
from sugar3.graphics.alert import TimeoutAlert
|
||||||
|
|
||||||
|
|
||||||
def _destroy_cb(widget, data=None):
|
def _destroy_cb(widget, data=None):
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
def __start_response_cb(widget, data=None):
|
def __start_response_cb(widget, data=None):
|
||||||
print 'Response: start download'
|
print 'Response: start download'
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class _Animation(animator.Animation):
|
|||||||
def __animation_completed_cb(anim):
|
def __animation_completed_cb(anim):
|
||||||
print 'Animation completed'
|
print 'Animation completed'
|
||||||
|
|
||||||
|
|
||||||
def _destroy_cb(widget, data=None):
|
def _destroy_cb(widget, data=None):
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
@ -2,9 +2,11 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from sugar3.graphics.combobox import ComboBox
|
from sugar3.graphics.combobox import ComboBox
|
||||||
|
|
||||||
|
|
||||||
def _destroy_cb(widget, data=None):
|
def _destroy_cb(widget, data=None):
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
def __combo_changed_cb(widget, data=None):
|
def __combo_changed_cb(widget, data=None):
|
||||||
print 'combo-changed'
|
print 'combo-changed'
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ def set_theme():
|
|||||||
settings.set_property('gtk-icon-theme-name', 'sugar')
|
settings.set_property('gtk-icon-theme-name', 'sugar')
|
||||||
set_theme()
|
set_theme()
|
||||||
|
|
||||||
|
|
||||||
class Test(Gtk.VBox):
|
class Test(Gtk.VBox):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GObject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
|
@ -2,12 +2,15 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from sugar3.graphics import iconentry
|
from sugar3.graphics import iconentry
|
||||||
|
|
||||||
|
|
||||||
def _destroy_cb(widget, data=None):
|
def _destroy_cb(widget, data=None):
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
def __go_next_cb(entry, icon_pos, data=None):
|
def __go_next_cb(entry, icon_pos, data=None):
|
||||||
print 'Go next'
|
print 'Go next'
|
||||||
|
|
||||||
|
|
||||||
def __entry_activate_cb(widget, data=None):
|
def __entry_activate_cb(widget, data=None):
|
||||||
print 'Entry activate'
|
print 'Entry activate'
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from sugar3.graphics.notebook import Notebook
|
from sugar3.graphics.notebook import Notebook
|
||||||
|
|
||||||
|
|
||||||
def _destroy_cb(widget, data=None):
|
def _destroy_cb(widget, data=None):
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton, \
|
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton, \
|
||||||
RadioToolsButton
|
RadioToolsButton
|
||||||
from sugar3.graphics.radiotoolbutton import RadioToolButton
|
from sugar3.graphics.radiotoolbutton import RadioToolButton
|
||||||
|
|
||||||
window = Gtk.Window()
|
window = Gtk.Window()
|
||||||
@ -26,19 +26,19 @@ def echo(button, label):
|
|||||||
palette = RadioPalette()
|
palette = RadioPalette()
|
||||||
|
|
||||||
group = RadioToolButton(
|
group = RadioToolButton(
|
||||||
icon_name='document-open')
|
icon_name='document-open')
|
||||||
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
||||||
palette.append(group, 'menu.document-open')
|
palette.append(group, 'menu.document-open')
|
||||||
|
|
||||||
button = RadioToolButton(
|
button = RadioToolButton(
|
||||||
icon_name='document-save',
|
icon_name='document-save',
|
||||||
group=group)
|
group=group)
|
||||||
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
||||||
palette.append(button, 'menu.document-save')
|
palette.append(button, 'menu.document-save')
|
||||||
|
|
||||||
button = RadioToolButton(
|
button = RadioToolButton(
|
||||||
icon_name='document-send',
|
icon_name='document-send',
|
||||||
group=group)
|
group=group)
|
||||||
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
||||||
palette.append(button, 'menu.document-send')
|
palette.append(button, 'menu.document-send')
|
||||||
|
|
||||||
@ -50,19 +50,19 @@ toolbar.insert(button, -1)
|
|||||||
palette = RadioPalette()
|
palette = RadioPalette()
|
||||||
|
|
||||||
group = RadioToolButton(
|
group = RadioToolButton(
|
||||||
icon_name='document-open')
|
icon_name='document-open')
|
||||||
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
||||||
palette.append(group, 'menu.document-open')
|
palette.append(group, 'menu.document-open')
|
||||||
|
|
||||||
button = RadioToolButton(
|
button = RadioToolButton(
|
||||||
icon_name='document-save',
|
icon_name='document-save',
|
||||||
group=group)
|
group=group)
|
||||||
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
||||||
palette.append(button, 'menu.document-save')
|
palette.append(button, 'menu.document-save')
|
||||||
|
|
||||||
button = RadioToolButton(
|
button = RadioToolButton(
|
||||||
icon_name='document-send',
|
icon_name='document-send',
|
||||||
group=group)
|
group=group)
|
||||||
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
||||||
palette.append(button, 'menu.document-send')
|
palette.append(button, 'menu.document-send')
|
||||||
|
|
||||||
|
@ -12,14 +12,14 @@ toolbar = ToolbarBox()
|
|||||||
box.pack_start(toolbar, False)
|
box.pack_start(toolbar, False)
|
||||||
|
|
||||||
tollbarbutton_1 = ToolbarButton(
|
tollbarbutton_1 = ToolbarButton(
|
||||||
page=Gtk.Button('sub-widget #1'),
|
page=Gtk.Button('sub-widget #1'),
|
||||||
icon_name='computer-xo')
|
icon_name='computer-xo')
|
||||||
toolbar.toolbar.insert(tollbarbutton_1, -1)
|
toolbar.toolbar.insert(tollbarbutton_1, -1)
|
||||||
|
|
||||||
tollbarbutton_2 = ToolbarButton(
|
tollbarbutton_2 = ToolbarButton(
|
||||||
page=Gtk.Button('sub-widget #2'),
|
page=Gtk.Button('sub-widget #2'),
|
||||||
icon_name='button_cancel',
|
icon_name='button_cancel',
|
||||||
tooltip='with custom palette instead of sub-widget')
|
tooltip='with custom palette instead of sub-widget')
|
||||||
toolbar.toolbar.insert(tollbarbutton_2, -1)
|
toolbar.toolbar.insert(tollbarbutton_2, -1)
|
||||||
|
|
||||||
toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -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 = Gtk.Button('delete sub-widget #3')
|
||||||
del_b.connect('clicked', del_cb)
|
del_b.connect('clicked', del_cb)
|
||||||
tollbarbutton_3 = ToolbarButton(
|
tollbarbutton_3 = ToolbarButton(
|
||||||
page=del_b,
|
page=del_b,
|
||||||
icon_name='activity-journal')
|
icon_name='activity-journal')
|
||||||
toolbar.toolbar.insert(tollbarbutton_3, -1)
|
toolbar.toolbar.insert(tollbarbutton_3, -1)
|
||||||
|
|
||||||
subbar = Gtk.Toolbar()
|
subbar = Gtk.Toolbar()
|
||||||
subbutton = ToolButton(
|
subbutton = ToolButton(
|
||||||
icon_name='document-send',
|
icon_name='document-send',
|
||||||
tooltip='document-send')
|
tooltip='document-send')
|
||||||
subbar.insert(subbutton, -1)
|
subbar.insert(subbutton, -1)
|
||||||
subbar.show_all()
|
subbar.show_all()
|
||||||
|
|
||||||
tollbarbutton_4 = ToolbarButton(
|
tollbarbutton_4 = ToolbarButton(
|
||||||
page=subbar,
|
page=subbar,
|
||||||
icon_name='document-save')
|
icon_name='document-save')
|
||||||
toolbar.toolbar.insert(tollbarbutton_4, -1)
|
toolbar.toolbar.insert(tollbarbutton_4, -1)
|
||||||
|
|
||||||
window.show_all()
|
window.show_all()
|
||||||
|
Loading…
Reference in New Issue
Block a user