fixed the flake8 errors for examples

doesn't affect that much the code, it just remove
unused modules and make it look better.
This commit is contained in:
Ignacio Rodríguez 2017-01-04 21:02:26 -03:00
parent 4f7ab56c3e
commit a735c7a6ce
14 changed files with 17 additions and 1 deletions

View File

@ -10,6 +10,7 @@ def _destroy_cb(widget, data=None):
def __start_response_cb(widget, data=None): def __start_response_cb(widget, data=None):
print 'Response: start download' print 'Response: start download'
w = Gtk.Window() w = Gtk.Window()
w.connect("destroy", _destroy_cb) w.connect("destroy", _destroy_cb)

View File

@ -25,6 +25,7 @@ def __animation_completed_cb(anim):
def _destroy_cb(widget, data=None): def _destroy_cb(widget, data=None):
Gtk.main_quit() Gtk.main_quit()
w = Gtk.Window() w = Gtk.Window()
w.connect("destroy", _destroy_cb) w.connect("destroy", _destroy_cb)

View File

@ -6,6 +6,7 @@ from sugar3.graphics.combobox import ComboBox
def __combo_changed_cb(combo): def __combo_changed_cb(combo):
print 'Combo changed to %r' % combo.get_value() print 'Combo changed to %r' % combo.get_value()
w = Gtk.Window() w = Gtk.Window()
w.connect("destroy", Gtk.main_quit) w.connect("destroy", Gtk.main_quit)

View File

@ -31,6 +31,8 @@ def set_theme():
sugar_theme = 'sugar-100' sugar_theme = 'sugar-100'
settings.set_property('gtk-theme-name', sugar_theme) settings.set_property('gtk-theme-name', sugar_theme)
settings.set_property('gtk-icon-theme-name', 'sugar') settings.set_property('gtk-icon-theme-name', 'sugar')
set_theme() set_theme()

View File

@ -22,6 +22,7 @@ def window_destroy_cb(*kwargs):
print "window destroy" print "window destroy"
Gtk.main_quit() Gtk.main_quit()
window = Gtk.Window(Gtk.WindowType.TOPLEVEL) window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
window.connect("destroy", window_destroy_cb) window.connect("destroy", window_destroy_cb)
window.show() window.show()
@ -30,6 +31,7 @@ window.show()
def treeview_destroy_cb(*kwargs): def treeview_destroy_cb(*kwargs):
print "treeview destroy" print "treeview destroy"
treeview = Gtk.TreeView() treeview = Gtk.TreeView()
treeview.connect("destroy", treeview_destroy_cb) treeview.connect("destroy", treeview_destroy_cb)
window.add(treeview) window.add(treeview)

View File

@ -40,6 +40,7 @@ class MyBox(Gtk.VBox):
self.show_all() self.show_all()
vbox = MyBox() vbox = MyBox()
test.pack_start(vbox, True, True, 0) test.pack_start(vbox, True, True, 0)
vbox.show() vbox.show()

View File

@ -52,6 +52,7 @@ def _button_activated_cb(button):
test.get_children()[i].props.icon_name = data[i][0] test.get_children()[i].props.icon_name = data[i][0]
test.get_children()[i].props.xo_color = XoColor(data[i][1]) test.get_children()[i].props.xo_color = XoColor(data[i][1])
for d in data: for d in data:
icon = Icon(icon_name=d[0], icon = Icon(icon_name=d[0],
icon_size=Gtk.IconSize.LARGE_TOOLBAR, icon_size=Gtk.IconSize.LARGE_TOOLBAR,

View File

@ -14,6 +14,7 @@ def __go_next_cb(entry, icon_pos, data=None):
def __entry_activate_cb(widget, data=None): def __entry_activate_cb(widget, data=None):
print 'Entry activate' print 'Entry activate'
w = Gtk.Window() w = Gtk.Window()
w.connect("destroy", _destroy_cb) w.connect("destroy", _destroy_cb)

View File

@ -6,6 +6,7 @@ from sugar3.graphics.notebook import Notebook
def _destroy_cb(widget, data=None): def _destroy_cb(widget, data=None):
Gtk.main_quit() Gtk.main_quit()
w = Gtk.Window() w = Gtk.Window()
w.connect("destroy", _destroy_cb) w.connect("destroy", _destroy_cb)

View File

@ -21,6 +21,7 @@ def echo(button, label):
return return
text_view.props.buffer.props.text += '\n' + label text_view.props.buffer.props.text += '\n' + label
# RadioMenuButton # RadioMenuButton
palette = RadioPalette() palette = RadioPalette()

View File

@ -3,7 +3,6 @@ from gi.repository import Gtk
from sugar3.graphics.radiotoolbutton import RadioToolButton from sugar3.graphics.radiotoolbutton import RadioToolButton
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton
from sugar3.graphics.xocolor import XoColor from sugar3.graphics.xocolor import XoColor
from sugar3.graphics import style
window = Gtk.Window() window = Gtk.Window()

View File

@ -15,10 +15,12 @@ def _scroll_start_cb(event, treeview, invoker):
print "Scroll starts" print "Scroll starts"
invoker.detach() invoker.detach()
def _scroll_end_cb(event, treeview, invoker): def _scroll_end_cb(event, treeview, invoker):
print "Scroll ends" print "Scroll ends"
invoker.attach_treeview(treeview) invoker.attach_treeview(treeview)
test = common.Test() test = common.Test()
test.show() test.show()

View File

@ -27,6 +27,8 @@ toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1)
def del_cb(widget): def del_cb(widget):
toolbar.toolbar.remove(tollbarbutton_3) toolbar.toolbar.remove(tollbarbutton_3)
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(

View File

@ -23,6 +23,7 @@ def __clicked_cb(button):
button.set_tooltip(str(n+1)) 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') tool_button = ToolButton(icon_name='view-radial', tooltip='0')
tool_button.connect('clicked', __clicked_cb) tool_button.connect('clicked', __clicked_cb)
tool_button.set_hide_tooltip_on_click(False) tool_button.set_hide_tooltip_on_click(False)