Add a make target for tests
We are running the existing test_mime.py. All the other tests which are not unit tests but more examples of code one can run interactively are moved to the example directory.
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
import common
|
||||
|
||||
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
# test Gtk.SpinButton:
|
||||
|
||||
adj = Gtk.Adjustment(0, 0, 10, 1, 32, 0)
|
||||
spin = Gtk.SpinButton()
|
||||
spin.set_adjustment(adj)
|
||||
vbox.pack_start(spin, False, False, 1)
|
||||
spin.show()
|
||||
|
||||
# test Gtk.RadioButton:
|
||||
|
||||
radio_1 = Gtk.RadioButton.new_with_label_from_widget(None, 'Radio 1')
|
||||
vbox.pack_start(radio_1, False, False, 1)
|
||||
radio_1.show()
|
||||
radio_2 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 2')
|
||||
vbox.pack_start(radio_2, False, False, 1)
|
||||
radio_2.show()
|
||||
radio_3 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 3')
|
||||
vbox.pack_start(radio_3, False, False, 1)
|
||||
radio_3.show()
|
||||
|
||||
# test Gtk.CheckButton:
|
||||
|
||||
check_1 = Gtk.CheckButton('Check 1')
|
||||
vbox.pack_start(check_1, False, False, 1)
|
||||
check_1.show()
|
||||
|
||||
check_2 = Gtk.CheckButton('Check 2')
|
||||
vbox.pack_start(check_2, False, False, 1)
|
||||
check_2.show()
|
||||
|
||||
# test Gtk.Button:
|
||||
|
||||
button = Gtk.Button('Button')
|
||||
vbox.pack_start(button, False, False, 1)
|
||||
button.show()
|
||||
|
||||
# test Gtk.Button insensitive:
|
||||
|
||||
insensitive_button = Gtk.Button('Insensitive Button')
|
||||
vbox.pack_start(insensitive_button, False, False, 1)
|
||||
insensitive_button.props.sensitive = False
|
||||
insensitive_button.show()
|
||||
|
||||
# test Gtk.ToggleButton:
|
||||
|
||||
toggle_button = Gtk.ToggleButton('ToggleButton')
|
||||
vbox.pack_start(toggle_button, False, False, 1)
|
||||
toggle_button.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,37 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics import style
|
||||
from sugar3.graphics.icon import CellRendererIcon
|
||||
|
||||
import common
|
||||
|
||||
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
model = Gtk.ListStore(str)
|
||||
for icon in ['one', 'two', 'three']:
|
||||
model.append([icon])
|
||||
|
||||
treeview = Gtk.TreeView()
|
||||
treeview.set_model(model)
|
||||
test.pack_start(treeview, True, True, 0)
|
||||
treeview.show()
|
||||
|
||||
col = Gtk.TreeViewColumn()
|
||||
treeview.append_column(col)
|
||||
|
||||
cell_icon = CellRendererIcon(treeview)
|
||||
cell_icon.props.width = style.GRID_CELL_SIZE
|
||||
cell_icon.props.height = style.GRID_CELL_SIZE
|
||||
cell_icon.props.size = style.SMALL_ICON_SIZE
|
||||
cell_icon.props.icon_name = 'emblem-favorite'
|
||||
col.pack_start(cell_icon, expand=False)
|
||||
|
||||
cell_text = Gtk.CellRendererText()
|
||||
col.pack_start(cell_text, expand=True)
|
||||
col.add_attribute(cell_text, 'text', 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def set_theme():
|
||||
settings = Gtk.Settings.get_default()
|
||||
sugar_theme = 'sugar-72'
|
||||
if 'SUGAR_SCALING' in os.environ:
|
||||
if os.environ['SUGAR_SCALING'] == '100':
|
||||
sugar_theme = 'sugar-100'
|
||||
settings.set_property('gtk-theme-name', sugar_theme)
|
||||
settings.set_property('gtk-icon-theme-name', 'sugar')
|
||||
set_theme()
|
||||
|
||||
class Test(Gtk.VBox):
|
||||
def __init__(self):
|
||||
GObject.GObject.__init__(self)
|
||||
|
||||
|
||||
class TestPalette(Test):
|
||||
def __init__(self):
|
||||
Test.__init__(self)
|
||||
|
||||
toolbar = Gtk.Toolbar()
|
||||
|
||||
self._invoker = ToolButton('go-previous')
|
||||
toolbar.insert(self._invoker, -1)
|
||||
self._invoker.show()
|
||||
|
||||
self.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
||||
def set_palette(self, palette):
|
||||
self._invoker.set_palette(palette)
|
||||
|
||||
|
||||
class TestRunner(object):
|
||||
def run(self, test):
|
||||
window = Gtk.Window()
|
||||
window.connect('destroy', lambda w: Gtk.main_quit())
|
||||
window.add(test)
|
||||
test.show()
|
||||
|
||||
window.show()
|
||||
|
||||
|
||||
def main(test):
|
||||
runner = TestRunner()
|
||||
runner.run(test)
|
||||
|
||||
Gtk.main()
|
||||
@@ -1,44 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
"""
|
||||
Since GTK+3 Gtk.CellRenderer doesn't have a destroy signal anymore.
|
||||
We can do the cleanup in the python destructor method instead.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class MyCellRenderer(Gtk.CellRenderer):
|
||||
def __init__(self):
|
||||
Gtk.CellRenderer.__init__(self)
|
||||
|
||||
def __del__(self):
|
||||
print "cellrenderer destroy"
|
||||
|
||||
def do_render(self, cairo_t, widget, background_area, cell_area, flags):
|
||||
pass
|
||||
|
||||
|
||||
def window_destroy_cb(*kwargs):
|
||||
print "window destroy"
|
||||
Gtk.main_quit()
|
||||
|
||||
window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
|
||||
window.connect("destroy", window_destroy_cb)
|
||||
window.show()
|
||||
|
||||
|
||||
def treeview_destroy_cb(*kwargs):
|
||||
print "treeview destroy"
|
||||
|
||||
treeview = Gtk.TreeView()
|
||||
treeview.connect("destroy", treeview_destroy_cb)
|
||||
window.add(treeview)
|
||||
treeview.show()
|
||||
|
||||
col = Gtk.TreeViewColumn()
|
||||
treeview.append_column(col)
|
||||
|
||||
cel = MyCellRenderer()
|
||||
col.pack_start(cel, expand=True)
|
||||
|
||||
Gtk.main()
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
import common
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
|
||||
class MyBox(Gtk.VBox):
|
||||
|
||||
def __init__(self):
|
||||
Gtk.VBox.__init__(self)
|
||||
|
||||
self.scrolled = Gtk.ScrolledWindow()
|
||||
self.scrolled.set_policy(Gtk.PolicyType.AUTOMATIC,
|
||||
Gtk.PolicyType.AUTOMATIC)
|
||||
|
||||
self.store = Gtk.ListStore(str, str)
|
||||
for i in range(5):
|
||||
self.store.append([str(i), 'Item %s' % i])
|
||||
|
||||
self.treeview = Gtk.TreeView(self.store)
|
||||
renderer_no_sens = Gtk.CellRendererText()
|
||||
# set 'sensitive' property
|
||||
renderer_no_sens.set_property('sensitive', False)
|
||||
|
||||
renderer = Gtk.CellRendererText()
|
||||
|
||||
column = Gtk.TreeViewColumn('\'sensitive\' False',
|
||||
renderer_no_sens, text=0)
|
||||
self.treeview.append_column(column)
|
||||
|
||||
column = Gtk.TreeViewColumn('\'sensitive\' True',
|
||||
renderer, text=1)
|
||||
self.treeview.append_column(column)
|
||||
|
||||
self.scrolled.add(self.treeview)
|
||||
self.add(self.scrolled)
|
||||
|
||||
self.show_all()
|
||||
|
||||
vbox = MyBox()
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,28 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import EventIcon
|
||||
from sugar3.graphics.icon import Icon
|
||||
|
||||
import common
|
||||
|
||||
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
icon = Icon(icon_name="network-wireless-000")
|
||||
icon.props.badge_name = 'emblem-favorite'
|
||||
vbox.pack_start(icon, False, False, 0)
|
||||
icon.show()
|
||||
|
||||
icon = EventIcon(icon_name="network-wireless-000")
|
||||
icon.props.badge_name = 'emblem-favorite'
|
||||
vbox.pack_start(icon, False, False, 0)
|
||||
icon.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,70 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Test the sugar3.graphics.icon.* cache.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
data = [
|
||||
['battery-000', '#FF8F00,#FF2B34'],
|
||||
['battery-010', '#D1A3FF,#00A0FF'],
|
||||
['battery-020', '#FF8F00,#FF2B34'],
|
||||
['battery-030', '#00A0FF,#D1A3FF'],
|
||||
['battery-040', '#AC32FF,#FF2B34'],
|
||||
['battery-050', '#D1A3FF,#00A0FF'],
|
||||
['battery-060', '#AC32FF,#FF2B34'],
|
||||
['battery-070', '#00A0FF,#D1A3FF'],
|
||||
['battery-080', '#FF8F00,#FF2B34'],
|
||||
['battery-090', '#D1A3FF,#00A0FF'],
|
||||
['battery-100', '#AC32FF,#FF2B34']]
|
||||
|
||||
|
||||
def _button_activated_cb(button):
|
||||
import random
|
||||
|
||||
global data
|
||||
random.shuffle(data)
|
||||
|
||||
for i in range(0, len(test.get_children()) - 1):
|
||||
test.get_children()[i].props.icon_name = data[i][0]
|
||||
test.get_children()[i].props.xo_color = XoColor(data[i][1])
|
||||
|
||||
for d in data:
|
||||
icon = Icon(icon_name=d[0],
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
xo_color=XoColor(d[1]))
|
||||
test.pack_start(icon, True, True, 0)
|
||||
icon.show()
|
||||
|
||||
button = Gtk.Button('mec mac')
|
||||
test.pack_start(button, True, True, 0)
|
||||
button.connect('activate', _button_activated_cb)
|
||||
button.show()
|
||||
|
||||
test.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,87 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Test the sugar3.graphics.icon.Icon widget.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
hbox = Gtk.HBox()
|
||||
test.pack_start(hbox, True, True, 0)
|
||||
sensitive_box = Gtk.VBox()
|
||||
insensitive_box = Gtk.VBox()
|
||||
|
||||
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.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.IconSize.LARGE_TOOLBAR,
|
||||
xo_color=XoColor())
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
icon = Icon(icon_name='battery-000',
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
badge_name='emblem-busy')
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
icon = Icon(icon_name='gtk-new',
|
||||
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
|
||||
badge_name='gtk-cancel')
|
||||
box.pack_start(icon, True, True, 0)
|
||||
icon.set_sensitive(sensitive)
|
||||
icon.show()
|
||||
|
||||
|
||||
create_icon_widgets(sensitive_box, True)
|
||||
create_icon_widgets(insensitive_box, False)
|
||||
|
||||
test.show()
|
||||
|
||||
# This can be used to test for leaks by setting the LRU cache size
|
||||
# in icon.py to 1.
|
||||
#def idle_cb():
|
||||
# import gc
|
||||
# gc.collect()
|
||||
# test.queue_draw()
|
||||
# return True
|
||||
#
|
||||
#from gi.repository import GObject
|
||||
#GObject.idle_add(idle_cb)
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,8 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
from common import set_theme
|
||||
from jarabe.intro.window import IntroWindow
|
||||
|
||||
set_theme()
|
||||
win = IntroWindow()
|
||||
win.show_all()
|
||||
Gtk.main()
|
||||
@@ -1,20 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
import common
|
||||
|
||||
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
box = Gtk.HBox()
|
||||
test.pack_start(box, True, False, 10)
|
||||
box.show()
|
||||
|
||||
bar = Gtk.ProgressBar()
|
||||
bar.set_fraction(0.5)
|
||||
box.pack_start(bar, True, True, 10)
|
||||
bar.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import Icon
|
||||
|
||||
import common
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
box = Gtk.HBox()
|
||||
test.pack_start(box, True, True, 0)
|
||||
box.show()
|
||||
|
||||
# notebook without button
|
||||
|
||||
notebook = Gtk.Notebook()
|
||||
box.pack_start(notebook, True, True, 0)
|
||||
notebook.show()
|
||||
|
||||
for i in range(3):
|
||||
hbox = Gtk.HBox()
|
||||
notebook.append_page(hbox, Gtk.Label('Page %d' % (i + 1)))
|
||||
hbox.show()
|
||||
|
||||
# notebook with buttons
|
||||
|
||||
notebook = Gtk.Notebook()
|
||||
box.pack_start(notebook, True, True, 0)
|
||||
notebook.show()
|
||||
|
||||
add_icon = Icon(icon_name='add')
|
||||
button = Gtk.Button()
|
||||
button.props.focus_on_click = False
|
||||
button.add(add_icon)
|
||||
add_icon.show()
|
||||
|
||||
notebook.set_action_widget(button, Gtk.PackType.END)
|
||||
button.show()
|
||||
|
||||
for i in range(3):
|
||||
hbox = Gtk.HBox()
|
||||
notebook.append_page(hbox, Gtk.Label('Page %d' % (i + 1)))
|
||||
hbox.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,59 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Test the style of toggle and radio buttons inside a palette. The buttons
|
||||
contains only an icon and should be rendered similarly to the toolbar
|
||||
controls. Ticket #2855.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.palette import Palette
|
||||
from sugar3.graphics.icon import Icon
|
||||
|
||||
import common
|
||||
|
||||
test = common.TestPalette()
|
||||
|
||||
palette = Palette('Test radio and toggle')
|
||||
test.set_palette(palette)
|
||||
|
||||
box = Gtk.HBox()
|
||||
|
||||
toggle = Gtk.ToggleButton()
|
||||
|
||||
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()
|
||||
|
||||
icon = Icon(icon_name='go-next', icon_size=Gtk.IconSize.LARGE_TOOLBAR)
|
||||
radio.set_image(icon)
|
||||
|
||||
radio.set_mode(False)
|
||||
box.pack_start(radio, False)
|
||||
radio.show()
|
||||
|
||||
palette.set_content(box)
|
||||
box.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,35 +0,0 @@
|
||||
# Copyright (C) 2007, One Laptop Per Child
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Spec in ticket #2999.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
test.set_border_width(60)
|
||||
|
||||
text_view = Gtk.TextView()
|
||||
text_view.props.buffer.props.text = 'Blah blah blah, blah blah blah.'
|
||||
test.pack_start(text_view, True, True, 0)
|
||||
text_view.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,48 +0,0 @@
|
||||
# Copyright (C) 2007, One Laptop Per Child
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Spec in ticket #3000.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
toolbar = Gtk.Toolbar()
|
||||
test.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
||||
button = ToolButton('go-previous')
|
||||
toolbar.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
separator = Gtk.SeparatorToolItem()
|
||||
toolbar.add(separator)
|
||||
separator.show()
|
||||
|
||||
button = ToolButton('go-next')
|
||||
toolbar.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,65 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Test palette positioning for toolbar and tray.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.tray import HTray, TrayButton
|
||||
from sugar3.graphics.toolbutton import ToolButton
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
|
||||
theme_icons = Gtk.IconTheme.get_default().list_icons()
|
||||
|
||||
toolbar = Gtk.Toolbar()
|
||||
vbox.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
||||
for i in range(0, 5):
|
||||
button = ToolButton(icon_name=theme_icons[i])
|
||||
button.set_tooltip('Icon %d' % i)
|
||||
toolbar.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
content = Gtk.Label()
|
||||
vbox.pack_start(content, True, True, 0)
|
||||
content.show()
|
||||
|
||||
tray = HTray()
|
||||
vbox.pack_start(tray, False)
|
||||
tray.show()
|
||||
|
||||
for i in range(0, 30):
|
||||
button = TrayButton(icon_name=theme_icons[i])
|
||||
button.set_tooltip('Icon %d' % i)
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
test.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,46 +0,0 @@
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.toolbarbox import ToolbarBox
|
||||
from sugar3.graphics.colorbutton import ColorToolButton
|
||||
from sugar3.graphics.radiotoolbutton import RadioToolButton
|
||||
from sugar3.graphics.toggletoolbutton import ToggleToolButton
|
||||
|
||||
import common
|
||||
|
||||
|
||||
test = common.Test()
|
||||
test.show()
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
toolbar_box = ToolbarBox()
|
||||
vbox.pack_start(toolbar_box, False, False, 0)
|
||||
toolbar_box.show()
|
||||
|
||||
radial_button = RadioToolButton(icon_name='view-radial')
|
||||
toolbar_box.toolbar.insert(radial_button, -1)
|
||||
radial_button.show()
|
||||
|
||||
list_button = RadioToolButton(icon_name='view-list')
|
||||
list_button.props.group = radial_button
|
||||
toolbar_box.toolbar.insert(list_button, -1)
|
||||
list_button.show()
|
||||
|
||||
separator = Gtk.SeparatorToolItem()
|
||||
toolbar_box.toolbar.insert(separator, -1)
|
||||
separator.show()
|
||||
|
||||
color_button = ColorToolButton()
|
||||
toolbar_box.toolbar.insert(color_button, -1)
|
||||
color_button.show()
|
||||
|
||||
favorite_button = ToggleToolButton('emblem-favorite')
|
||||
favorite_button.set_tooltip('Favorite')
|
||||
toolbar_box.toolbar.insert(favorite_button, -1)
|
||||
favorite_button.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
@@ -1,82 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Test the sugar3.graphics.icon.Icon widget.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.tray import HTray, VTray
|
||||
from sugar3.graphics.tray import TrayButton, TrayIcon
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
|
||||
tray = HTray()
|
||||
vbox.pack_start(tray, False, False, 0)
|
||||
tray.show()
|
||||
|
||||
theme_icons = Gtk.IconTheme.get_default().list_icons(context=None)
|
||||
|
||||
for i in range(0, 100):
|
||||
button = TrayButton(icon_name=theme_icons[i])
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
tray = HTray()
|
||||
vbox.pack_start(tray, False, False, 0)
|
||||
tray.show()
|
||||
|
||||
for i in range(0, 10):
|
||||
icon = TrayIcon(icon_name=theme_icons[i])
|
||||
tray.add_item(icon)
|
||||
icon.show()
|
||||
|
||||
hbox = Gtk.HBox()
|
||||
|
||||
tray = VTray()
|
||||
hbox.pack_start(tray, False, False, 0)
|
||||
tray.show()
|
||||
|
||||
for i in range(0, 100):
|
||||
button = TrayButton(icon_name=theme_icons[i])
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
tray = VTray()
|
||||
hbox.pack_start(tray, False, False, 0)
|
||||
tray.show()
|
||||
|
||||
for i in range(0, 4):
|
||||
button = TrayButton(icon_name=theme_icons[i])
|
||||
tray.add_item(button)
|
||||
button.show()
|
||||
|
||||
vbox.pack_start(hbox, True, True, 0)
|
||||
hbox.show()
|
||||
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
test.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
||||
Reference in New Issue
Block a user