diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-03 22:55:20 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-03 22:55:20 (GMT) |
commit | 1f8ff1db1fddbf60fc776c484b980d8926c44538 (patch) | |
tree | f44ca2aa4df4c905d4861688f622b07fd8fd3299 /sugar/graphics | |
parent | 717bdd66f45e31074952bbf49c78e14153f92c57 (diff) |
Move all the canvas code that doesn't depend on goocanvas anymore in graphics.
Diffstat (limited to 'sugar/graphics')
-rw-r--r-- | sugar/graphics/__init__.py | 2 | ||||
-rw-r--r-- | sugar/graphics/canvasicon.py | 2 | ||||
-rw-r--r-- | sugar/graphics/colors.py | 562 | ||||
-rw-r--r-- | sugar/graphics/iconcolor.py | 34 | ||||
-rw-r--r-- | sugar/graphics/menushell.py | 26 | ||||
-rw-r--r-- | sugar/graphics/snowflakelayout.py | 71 | ||||
-rw-r--r-- | sugar/graphics/timeline.py | 98 |
7 files changed, 793 insertions, 2 deletions
diff --git a/sugar/graphics/__init__.py b/sugar/graphics/__init__.py index b494b9f..b3c54e1 100644 --- a/sugar/graphics/__init__.py +++ b/sugar/graphics/__init__.py @@ -1,7 +1,7 @@ import gtk from sugar.graphics import style -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor if gtk.gdk.screen_width() == 1200: _medium_icon_size = 75 diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 17a0193..4da0061 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -6,7 +6,7 @@ import hippo import rsvg import cairo -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor class _IconCache: def __init__(self): diff --git a/sugar/graphics/colors.py b/sugar/graphics/colors.py new file mode 100644 index 0000000..8a8f815 --- /dev/null +++ b/sugar/graphics/colors.py @@ -0,0 +1,562 @@ +colors = [ +['#75C228', '#0C3A0C'], \ +['#C2B00C', '#3A333A'], \ +['#F09C23', '#472E47'], \ +['#F8975E', '#680268'], \ +['#F391B3', '#610A61'], \ +['#C29CFD', '#4F0C4F'], \ +['#7DB0FA', '#331133'], \ +['#0CBDF0', '#113511'], \ +['#35C2C0', '#073807'], \ +['#2BC78C', '#193819'], \ +['#75C228', '#075707'], \ +['#C2B00C', '#5E455E'], \ +['#F09C23', '#6E3D6E'], \ +['#F8975E', '#941194'], \ +['#F391B3', '#8F0C8F'], \ +['#C29CFD', '#701770'], \ +['#7DB0FA', '#451945'], \ +['#0CBDF0', '#0C4C0C'], \ +['#35C2C0', '#1C511C'], \ +['#2BC78C', '#145414'], \ +['#75C228', '#3A6E3A'], \ +['#C2B00C', '#785C78'], \ +['#F09C23', '#AB3DAB'], \ +['#F8975E', '#C217C2'], \ +['#F391B3', '#B817B8'], \ +['#C29CFD', '#A114A1'], \ +['#7DB0FA', '#4A424A'], \ +['#0CBDF0', '#266826'], \ +['#35C2C0', '#356835'], \ +['#2BC78C', '#216E21'], \ +['#75C228', '#308C30'], \ +['#C29CFD', '#308C30'], \ +['#35C2C0', '#308C30'], \ +['#F09C23', '#308C30'], \ +['#C2B00C', '#997599'], \ +['#7DB0FA', '#997599'], \ +['#2BC78C', '#997599'], \ +['#F8975E', '#997599'], \ +['#F09C23', '#C25EC2'], \ +['#0CBDF0', '#C25EC2'], \ +['#75C228', '#C25EC2'], \ +['#F391B3', '#C25EC2'], \ +['#F8975E', '#F517F5'], \ +['#35C2C0', '#F517F5'], \ +['#C2B00C', '#F517F5'], \ +['#C29CFD', '#F517F5'], \ +['#F391B3', '#E32BE3'], \ +['#2BC78C', '#E32BE3'], \ +['#F09C23', '#E32BE3'], \ +['#7DB0FA', '#E32BE3'], \ +['#C29CFD', '#C71EC7'], \ +['#75C228', '#C71EC7'], \ +['#F8975E', '#C71EC7'], \ +['#0CBDF0', '#C71EC7'], \ +['#7DB0FA', '#576E57'], \ +['#C2B00C', '#576E57'], \ +['#F391B3', '#576E57'], \ +['#35C2C0', '#576E57'], \ +['#0CBDF0', '#118511'], \ +['#F09C23', '#118511'], \ +['#C29CFD', '#118511'], \ +['#2BC78C', '#118511'], \ +['#35C2C0', '#2E872E'], \ +['#F8975E', '#2E872E'], \ +['#7DB0FA', '#2E872E'], \ +['#75C228', '#2E872E'], \ +['#2BC78C', '#0F8A0F'], \ +['#F391B3', '#0F8A0F'], \ +['#0CBDF0', '#0F8A0F'], \ +['#C2B00C', '#0F8A0F'], \ +['#0C3A19', '#3A6E3A'], \ +['#4F0C73', '#3A6E3A'], \ +['#073838', '#3A6E3A'], \ +['#472E17', '#3A6E3A'], \ +['#0C3A19', '#308C30'], \ +['#0C3A19', '#66A366'], \ +['#0C3A19', '#75C275'], \ +['#0C3A19', '#38E838'], \ +['#0C3A19', '#97FA97'], \ +['#3A3307', '#785C78'], \ +['#331194', '#785C78'], \ +['#193828', '#785C78'], \ +['#680211', '#785C78'], \ +['#3A3307', '#997599'], \ +['#3A3307', '#AB91AB'], \ +['#3A3307', '#C2B0C2'], \ +['#3A3307', '#D1CFD1'], \ +['#3A3307', '#F0EBF0'], \ +['#472E17', '#AB3DAB'], \ +['#113547', '#AB3DAB'], \ +['#0C3A19', '#AB3DAB'], \ +['#610A45', '#AB3DAB'], \ +['#472E17', '#C25EC2'], \ +['#472E17', '#EB73EB'], \ +['#472E17', '#F09CF0'], \ +['#472E17', '#F8C2F8'], \ +['#472E17', '#F3E3F3'], \ +['#680211', '#C217C2'], \ +['#073838', '#C217C2'], \ +['#3A3307', '#C217C2'], \ +['#4F0C73', '#C217C2'], \ +['#680211', '#F517F5'], \ +['#680211', '#F863F8'], \ +['#680211', '#F897F8'], \ +['#680211', '#FDBAFD'], \ +['#680211', '#F3E1F3'], \ +['#610A45', '#B817B8'], \ +['#193828', '#B817B8'], \ +['#472E17', '#B817B8'], \ +['#331194', '#B817B8'], \ +['#610A45', '#E32BE3'], \ +['#610A45', '#F85CF8'], \ +['#610A45', '#F391F3'], \ +['#610A45', '#F8B8F8'], \ +['#610A45', '#FDD9FD'], \ +['#4F0C73', '#A114A1'], \ +['#0C3A19', '#A114A1'], \ +['#680211', '#A114A1'], \ +['#113547', '#A114A1'], \ +['#4F0C73', '#C71EC7'], \ +['#4F0C73', '#C76EC7'], \ +['#4F0C73', '#C29CC2'], \ +['#4F0C73', '#DEBADE'], \ +['#4F0C73', '#EBDEEB'], \ +['#331194', '#4A424A'], \ +['#3A3307', '#4A424A'], \ +['#610A45', '#4A424A'], \ +['#073838', '#4A424A'], \ +['#331194', '#576E57'], \ +['#331194', '#359735'], \ +['#331194', '#7DB07D'], \ +['#331194', '#AECCAE'], \ +['#331194', '#E1E3E1'], \ +['#113547', '#266826'], \ +['#472E17', '#266826'], \ +['#4F0C73', '#266826'], \ +['#193828', '#266826'], \ +['#113547', '#118511'], \ +['#113547', '#3A9E3A'], \ +['#113547', '#0CBD0C'], \ +['#113547', '#51DC51'], \ +['#113547', '#D4E6D4'], \ +['#073838', '#356835'], \ +['#680211', '#356835'], \ +['#331194', '#356835'], \ +['#0C3A19', '#356835'], \ +['#073838', '#2E872E'], \ +['#073838', '#47A147'], \ +['#073838', '#35C235'], \ +['#073838', '#17E317'], \ +['#073838', '#61FA61'], \ +['#193828', '#216E21'], \ +['#610A45', '#216E21'], \ +['#113547', '#216E21'], \ +['#3A3307', '#216E21'], \ +['#193828', '#0F8A0F'], \ +['#193828', '#23A823'], \ +['#193828', '#2BC72B'], \ +['#193828', '#40E340'], \ +['#193828', '#91FA91'], \ +['#07571E', '#308C30'], \ +['#7017A3', '#308C30'], \ +['#1C514F', '#308C30'], \ +['#6E3D1E', '#308C30'], \ +['#07571E', '#66A366'], \ +['#07571E', '#75C275'], \ +['#07571E', '#38E838'], \ +['#07571E', '#97FA97'], \ +['#5E4505', '#997599'], \ +['#4519D7', '#997599'], \ +['#145435', '#997599'], \ +['#94111C', '#997599'], \ +['#5E4505', '#AB91AB'], \ +['#5E4505', '#C2B0C2'], \ +['#5E4505', '#D1CFD1'], \ +['#5E4505', '#F0EBF0'], \ +['#6E3D1E', '#C25EC2'], \ +['#0C4C70', '#C25EC2'], \ +['#07571E', '#C25EC2'], \ +['#8F0C51', '#C25EC2'], \ +['#6E3D1E', '#EB73EB'], \ +['#6E3D1E', '#F09CF0'], \ +['#6E3D1E', '#F8C2F8'], \ +['#6E3D1E', '#F3E3F3'], \ +['#94111C', '#F517F5'], \ +['#1C514F', '#F517F5'], \ +['#5E4505', '#F517F5'], \ +['#7017A3', '#F517F5'], \ +['#94111C', '#F863F8'], \ +['#94111C', '#F897F8'], \ +['#94111C', '#FDBAFD'], \ +['#94111C', '#F3E1F3'], \ +['#8F0C51', '#E32BE3'], \ +['#145435', '#E32BE3'], \ +['#6E3D1E', '#E32BE3'], \ +['#4519D7', '#E32BE3'], \ +['#8F0C51', '#F85CF8'], \ +['#8F0C51', '#F391F3'], \ +['#8F0C51', '#F8B8F8'], \ +['#8F0C51', '#FDD9FD'], \ +['#7017A3', '#C71EC7'], \ +['#07571E', '#C71EC7'], \ +['#94111C', '#C71EC7'], \ +['#0C4C70', '#C71EC7'], \ +['#7017A3', '#C76EC7'], \ +['#7017A3', '#C29CC2'], \ +['#7017A3', '#DEBADE'], \ +['#7017A3', '#EBDEEB'], \ +['#4519D7', '#576E57'], \ +['#5E4505', '#576E57'], \ +['#8F0C51', '#576E57'], \ +['#1C514F', '#576E57'], \ +['#4519D7', '#359735'], \ +['#4519D7', '#7DB07D'], \ +['#4519D7', '#AECCAE'], \ +['#4519D7', '#E1E3E1'], \ +['#0C4C70', '#118511'], \ +['#6E3D1E', '#118511'], \ +['#7017A3', '#118511'], \ +['#145435', '#118511'], \ +['#0C4C70', '#3A9E3A'], \ +['#0C4C70', '#0CBD0C'], \ +['#0C4C70', '#51DC51'], \ +['#0C4C70', '#D4E6D4'], \ +['#1C514F', '#2E872E'], \ +['#94111C', '#2E872E'], \ +['#4519D7', '#2E872E'], \ +['#07571E', '#2E872E'], \ +['#1C514F', '#47A147'], \ +['#1C514F', '#35C235'], \ +['#1C514F', '#17E317'], \ +['#1C514F', '#61FA61'], \ +['#145435', '#0F8A0F'], \ +['#8F0C51', '#0F8A0F'], \ +['#0C4C70', '#0F8A0F'], \ +['#5E4505', '#0F8A0F'], \ +['#145435', '#23A823'], \ +['#145435', '#2BC72B'], \ +['#145435', '#40E340'], \ +['#145435', '#91FA91'], \ +['#75C228', '#97FA97'], \ +['#C29CFD', '#97FA97'], \ +['#35C2C0', '#97FA97'], \ +['#F09C23', '#97FA97'], \ +['#C2B00C', '#F0EBF0'], \ +['#7DB0FA', '#F0EBF0'], \ +['#2BC78C', '#F0EBF0'], \ +['#F8975E', '#F0EBF0'], \ +['#F09C23', '#F3E3F3'], \ +['#0CBDF0', '#F3E3F3'], \ +['#75C228', '#F3E3F3'], \ +['#F391B3', '#F3E3F3'], \ +['#F8975E', '#F3E1F3'], \ +['#35C2C0', '#F3E1F3'], \ +['#C2B00C', '#F3E1F3'], \ +['#C29CFD', '#F3E1F3'], \ +['#F391B3', '#FDD9FD'], \ +['#2BC78C', '#FDD9FD'], \ +['#F09C23', '#FDD9FD'], \ +['#7DB0FA', '#FDD9FD'], \ +['#C29CFD', '#EBDEEB'], \ +['#75C228', '#EBDEEB'], \ +['#F8975E', '#EBDEEB'], \ +['#0CBDF0', '#EBDEEB'], \ +['#7DB0FA', '#E1E3E1'], \ +['#C2B00C', '#E1E3E1'], \ +['#F391B3', '#E1E3E1'], \ +['#35C2C0', '#E1E3E1'], \ +['#0CBDF0', '#D4E6D4'], \ +['#F09C23', '#D4E6D4'], \ +['#C29CFD', '#D4E6D4'], \ +['#2BC78C', '#D4E6D4'], \ +['#35C2C0', '#61FA61'], \ +['#F8975E', '#61FA61'], \ +['#7DB0FA', '#61FA61'], \ +['#75C228', '#61FA61'], \ +['#2BC78C', '#91FA91'], \ +['#F391B3', '#91FA91'], \ +['#0CBDF0', '#91FA91'], \ +['#C2B00C', '#91FA91'], \ +['#75C228', '#0C3A0C'], \ +['#C2B00C', '#3A333A'], \ +['#F09C23', '#472E47'], \ +['#F8975E', '#680268'], \ +['#F391B3', '#610A61'], \ +['#C29CFD', '#4F0C4F'], \ +['#7DB0FA', '#331133'], \ +['#0CBDF0', '#113511'], \ +['#35C2C0', '#073807'], \ +['#2BC78C', '#193819'], \ +['#75C228', '#075707'], \ +['#C2B00C', '#5E455E'], \ +['#F09C23', '#6E3D6E'], \ +['#F8975E', '#941194'], \ +['#F391B3', '#8F0C8F'], \ +['#C29CFD', '#701770'], \ +['#7DB0FA', '#451945'], \ +['#0CBDF0', '#0C4C0C'], \ +['#35C2C0', '#1C511C'], \ +['#2BC78C', '#145414'], \ +['#75C228', '#3A6E3A'], \ +['#C2B00C', '#785C78'], \ +['#F09C23', '#AB3DAB'], \ +['#F8975E', '#C217C2'], \ +['#F391B3', '#B817B8'], \ +['#C29CFD', '#A114A1'], \ +['#7DB0FA', '#4A424A'], \ +['#0CBDF0', '#266826'], \ +['#35C2C0', '#356835'], \ +['#2BC78C', '#216E21'], \ +['#75C228', '#308C30'], \ +['#C29CFD', '#308C30'], \ +['#35C2C0', '#308C30'], \ +['#F09C23', '#308C30'], \ +['#C2B00C', '#997599'], \ +['#7DB0FA', '#997599'], \ +['#2BC78C', '#997599'], \ +['#F8975E', '#997599'], \ +['#F09C23', '#C25EC2'], \ +['#0CBDF0', '#C25EC2'], \ +['#75C228', '#C25EC2'], \ +['#F391B3', '#C25EC2'], \ +['#F8975E', '#F517F5'], \ +['#35C2C0', '#F517F5'], \ +['#C2B00C', '#F517F5'], \ +['#C29CFD', '#F517F5'], \ +['#F391B3', '#E32BE3'], \ +['#2BC78C', '#E32BE3'], \ +['#F09C23', '#E32BE3'], \ +['#7DB0FA', '#E32BE3'], \ +['#C29CFD', '#C71EC7'], \ +['#75C228', '#C71EC7'], \ +['#F8975E', '#C71EC7'], \ +['#0CBDF0', '#C71EC7'], \ +['#7DB0FA', '#576E57'], \ +['#C2B00C', '#576E57'], \ +['#F391B3', '#576E57'], \ +['#35C2C0', '#576E57'], \ +['#0CBDF0', '#118511'], \ +['#F09C23', '#118511'], \ +['#C29CFD', '#118511'], \ +['#2BC78C', '#118511'], \ +['#35C2C0', '#2E872E'], \ +['#F8975E', '#2E872E'], \ +['#7DB0FA', '#2E872E'], \ +['#75C228', '#2E872E'], \ +['#2BC78C', '#0F8A0F'], \ +['#F391B3', '#0F8A0F'], \ +['#0CBDF0', '#0F8A0F'], \ +['#C2B00C', '#0F8A0F'], \ +['#0C3A19', '#3A6E3A'], \ +['#4F0C73', '#3A6E3A'], \ +['#073838', '#3A6E3A'], \ +['#472E17', '#3A6E3A'], \ +['#0C3A19', '#308C30'], \ +['#0C3A19', '#66A366'], \ +['#0C3A19', '#75C275'], \ +['#0C3A19', '#38E838'], \ +['#0C3A19', '#97FA97'], \ +['#3A3307', '#785C78'], \ +['#331194', '#785C78'], \ +['#193828', '#785C78'], \ +['#680211', '#785C78'], \ +['#3A3307', '#997599'], \ +['#3A3307', '#AB91AB'], \ +['#3A3307', '#C2B0C2'], \ +['#3A3307', '#D1CFD1'], \ +['#3A3307', '#F0EBF0'], \ +['#472E17', '#AB3DAB'], \ +['#113547', '#AB3DAB'], \ +['#0C3A19', '#AB3DAB'], \ +['#610A45', '#AB3DAB'], \ +['#472E17', '#C25EC2'], \ +['#472E17', '#EB73EB'], \ +['#472E17', '#F09CF0'], \ +['#472E17', '#F8C2F8'], \ +['#472E17', '#F3E3F3'], \ +['#680211', '#C217C2'], \ +['#073838', '#C217C2'], \ +['#3A3307', '#C217C2'], \ +['#4F0C73', '#C217C2'], \ +['#680211', '#F517F5'], \ +['#680211', '#F863F8'], \ +['#680211', '#F897F8'], \ +['#680211', '#FDBAFD'], \ +['#680211', '#F3E1F3'], \ +['#610A45', '#B817B8'], \ +['#193828', '#B817B8'], \ +['#472E17', '#B817B8'], \ +['#331194', '#B817B8'], \ +['#610A45', '#E32BE3'], \ +['#610A45', '#F85CF8'], \ +['#610A45', '#F391F3'], \ +['#610A45', '#F8B8F8'], \ +['#610A45', '#FDD9FD'], \ +['#4F0C73', '#A114A1'], \ +['#0C3A19', '#A114A1'], \ +['#680211', '#A114A1'], \ +['#113547', '#A114A1'], \ +['#4F0C73', '#C71EC7'], \ +['#4F0C73', '#C76EC7'], \ +['#4F0C73', '#C29CC2'], \ +['#4F0C73', '#DEBADE'], \ +['#4F0C73', '#EBDEEB'], \ +['#331194', '#4A424A'], \ +['#3A3307', '#4A424A'], \ +['#610A45', '#4A424A'], \ +['#073838', '#4A424A'], \ +['#331194', '#576E57'], \ +['#331194', '#359735'], \ +['#331194', '#7DB07D'], \ +['#331194', '#AECCAE'], \ +['#331194', '#E1E3E1'], \ +['#113547', '#266826'], \ +['#472E17', '#266826'], \ +['#4F0C73', '#266826'], \ +['#193828', '#266826'], \ +['#113547', '#118511'], \ +['#113547', '#3A9E3A'], \ +['#113547', '#0CBD0C'], \ +['#113547', '#51DC51'], \ +['#113547', '#D4E6D4'], \ +['#073838', '#356835'], \ +['#680211', '#356835'], \ +['#331194', '#356835'], \ +['#0C3A19', '#356835'], \ +['#073838', '#2E872E'], \ +['#073838', '#47A147'], \ +['#073838', '#35C235'], \ +['#073838', '#17E317'], \ +['#073838', '#61FA61'], \ +['#193828', '#216E21'], \ +['#610A45', '#216E21'], \ +['#113547', '#216E21'], \ +['#3A3307', '#216E21'], \ +['#193828', '#0F8A0F'], \ +['#193828', '#23A823'], \ +['#193828', '#2BC72B'], \ +['#193828', '#40E340'], \ +['#193828', '#91FA91'], \ +['#07571E', '#308C30'], \ +['#7017A3', '#308C30'], \ +['#1C514F', '#308C30'], \ +['#6E3D1E', '#308C30'], \ +['#07571E', '#66A366'], \ +['#07571E', '#75C275'], \ +['#07571E', '#38E838'], \ +['#07571E', '#97FA97'], \ +['#5E4505', '#997599'], \ +['#4519D7', '#997599'], \ +['#145435', '#997599'], \ +['#94111C', '#997599'], \ +['#5E4505', '#AB91AB'], \ +['#5E4505', '#C2B0C2'], \ +['#5E4505', '#D1CFD1'], \ +['#5E4505', '#F0EBF0'], \ +['#6E3D1E', '#C25EC2'], \ +['#0C4C70', '#C25EC2'], \ +['#07571E', '#C25EC2'], \ +['#8F0C51', '#C25EC2'], \ +['#6E3D1E', '#EB73EB'], \ +['#6E3D1E', '#F09CF0'], \ +['#6E3D1E', '#F8C2F8'], \ +['#6E3D1E', '#F3E3F3'], \ +['#94111C', '#F517F5'], \ +['#1C514F', '#F517F5'], \ +['#5E4505', '#F517F5'], \ +['#7017A3', '#F517F5'], \ +['#94111C', '#F863F8'], \ +['#94111C', '#F897F8'], \ +['#94111C', '#FDBAFD'], \ +['#94111C', '#F3E1F3'], \ +['#8F0C51', '#E32BE3'], \ +['#145435', '#E32BE3'], \ +['#6E3D1E', '#E32BE3'], \ +['#4519D7', '#E32BE3'], \ +['#8F0C51', '#F85CF8'], \ +['#8F0C51', '#F391F3'], \ +['#8F0C51', '#F8B8F8'], \ +['#8F0C51', '#FDD9FD'], \ +['#7017A3', '#C71EC7'], \ +['#07571E', '#C71EC7'], \ +['#94111C', '#C71EC7'], \ +['#0C4C70', '#C71EC7'], \ +['#7017A3', '#C76EC7'], \ +['#7017A3', '#C29CC2'], \ +['#7017A3', '#DEBADE'], \ +['#7017A3', '#EBDEEB'], \ +['#4519D7', '#576E57'], \ +['#5E4505', '#576E57'], \ +['#8F0C51', '#576E57'], \ +['#1C514F', '#576E57'], \ +['#4519D7', '#359735'], \ +['#4519D7', '#7DB07D'], \ +['#4519D7', '#AECCAE'], \ +['#4519D7', '#E1E3E1'], \ +['#0C4C70', '#118511'], \ +['#6E3D1E', '#118511'], \ +['#7017A3', '#118511'], \ +['#145435', '#118511'], \ +['#0C4C70', '#3A9E3A'], \ +['#0C4C70', '#0CBD0C'], \ +['#0C4C70', '#51DC51'], \ +['#0C4C70', '#D4E6D4'], \ +['#1C514F', '#2E872E'], \ +['#94111C', '#2E872E'], \ +['#4519D7', '#2E872E'], \ +['#07571E', '#2E872E'], \ +['#1C514F', '#47A147'], \ +['#1C514F', '#35C235'], \ +['#1C514F', '#17E317'], \ +['#1C514F', '#61FA61'], \ +['#145435', '#0F8A0F'], \ +['#8F0C51', '#0F8A0F'], \ +['#0C4C70', '#0F8A0F'], \ +['#5E4505', '#0F8A0F'], \ +['#145435', '#23A823'], \ +['#145435', '#2BC72B'], \ +['#145435', '#40E340'], \ +['#145435', '#91FA91'], \ +['#75C228', '#97FA97'], \ +['#C29CFD', '#97FA97'], \ +['#35C2C0', '#97FA97'], \ +['#F09C23', '#97FA97'], \ +['#C2B00C', '#F0EBF0'], \ +['#7DB0FA', '#F0EBF0'], \ +['#2BC78C', '#F0EBF0'], \ +['#F8975E', '#F0EBF0'], \ +['#F09C23', '#F3E3F3'], \ +['#0CBDF0', '#F3E3F3'], \ +['#75C228', '#F3E3F3'], \ +['#F391B3', '#F3E3F3'], \ +['#F8975E', '#F3E1F3'], \ +['#35C2C0', '#F3E1F3'], \ +['#C2B00C', '#F3E1F3'], \ +['#C29CFD', '#F3E1F3'], \ +['#F391B3', '#FDD9FD'], \ +['#2BC78C', '#FDD9FD'], \ +['#F09C23', '#FDD9FD'], \ +['#7DB0FA', '#FDD9FD'], \ +['#C29CFD', '#EBDEEB'], \ +['#75C228', '#EBDEEB'], \ +['#F8975E', '#EBDEEB'], \ +['#0CBDF0', '#EBDEEB'], \ +['#7DB0FA', '#E1E3E1'], \ +['#C2B00C', '#E1E3E1'], \ +['#F391B3', '#E1E3E1'], \ +['#35C2C0', '#E1E3E1'], \ +['#0CBDF0', '#D4E6D4'], \ +['#F09C23', '#D4E6D4'], \ +['#C29CFD', '#D4E6D4'], \ +['#2BC78C', '#D4E6D4'], \ +['#35C2C0', '#61FA61'], \ +['#F8975E', '#61FA61'], \ +['#7DB0FA', '#61FA61'], \ +['#75C228', '#61FA61'], \ +['#2BC78C', '#91FA91'], \ +['#F391B3', '#91FA91'], \ +['#0CBDF0', '#91FA91'], \ +['#C2B00C', '#91FA91'], \ +] diff --git a/sugar/graphics/iconcolor.py b/sugar/graphics/iconcolor.py new file mode 100644 index 0000000..97c13c8 --- /dev/null +++ b/sugar/graphics/iconcolor.py @@ -0,0 +1,34 @@ +import random + +from sugar.graphics.colors import colors + +def _parse_string(color_string): + if color_string == 'white': + return ['#ffffff', '#4f4f4f'] + + splitted = color_string.split(',') + if len(splitted) == 2: + return [splitted[0], splitted[1]] + else: + return None + +def is_valid(color_string): + return (_parse_string(color_string) != None) + +class IconColor: + def __init__(self, color_string=None): + if color_string == None or not is_valid(color_string): + n = int(random.random() * (len(colors) - 1)) + [self._stroke, self._fill] = colors[n] + else: + [self._stroke, self._fill] = _parse_string(color_string) + + def get_stroke_color(self): + return self._stroke + + def get_fill_color(self): + return self._fill + + def to_string(self): + return '%s,%s' % (self._stroke, self._fill) + diff --git a/sugar/graphics/menushell.py b/sugar/graphics/menushell.py new file mode 100644 index 0000000..58358fb --- /dev/null +++ b/sugar/graphics/menushell.py @@ -0,0 +1,26 @@ +import gobject + +class MenuShell(gobject.GObject): + __gsignals__ = { + 'activated': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])), + 'deactivated': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])), + } + + def __init__(self): + gobject.GObject.__init__(self) + self._menu_controller = None + + def is_active(self): + return (self._menu_controller != None) + + def set_active(self, controller): + if controller == None: + self.emit('deactivated') + else: + self.emit('activated') + + if self._menu_controller: + self._menu_controller.popdown() + self._menu_controller = controller diff --git a/sugar/graphics/snowflakelayout.py b/sugar/graphics/snowflakelayout.py new file mode 100644 index 0000000..611ecaa --- /dev/null +++ b/sugar/graphics/snowflakelayout.py @@ -0,0 +1,71 @@ +import math + +import cairo + +class SnowflakeLayout: + _BASE_RADIUS = 65 + _CHILDREN_FACTOR = 1 + _FLAKE_DISTANCE = 6 + + def __init__(self): + self._root = None + self._children = [] + self._r = 0 + + def set_root(self, icon): + self._root = icon + + def add_child(self, icon): + self._children.append(icon) + self._layout() + + def remove_child(self, icon): + self._children.remove(icon) + self._layout() + + def _layout_root(self): + [width, height] = self._root.get_size_request() + + matrix = cairo.Matrix(1, 0, 0, 1, 0, 0) + matrix.translate(self._cx - (width / 2), self._cy - (height / 2)) + self._root.set_transform(matrix) + + def _layout_child(self, child, index): + r = self._r + if (len(self._children) > 10): + r += SnowflakeLayout._FLAKE_DISTANCE * (index % 3) + + angle = 2 * math.pi / len(self._children) * index + + [width, height] = child.get_size_request() + x = self._cx + math.cos(angle) * r - (width / 2) + y = self._cy + math.sin(angle) * r - (height / 2) + + matrix = cairo.Matrix(1, 0, 0, 1, 0, 0) + matrix.translate(x, y) + child.set_transform(matrix) + + def get_size(self): + max_child_size = 0 + for child in self._children: + [width, height] = child.get_size_request() + max_child_size = max (max_child_size, width) + max_child_size = max (max_child_size, height) + + return self._r * 2 + max_child_size + \ + SnowflakeLayout._FLAKE_DISTANCE * 2 + + def _layout(self): + self._r = SnowflakeLayout._BASE_RADIUS + \ + SnowflakeLayout._CHILDREN_FACTOR * len(self._children) + + size = self.get_size() + self._cx = size / 2 + self._cy = size / 2 + + self._layout_root() + + index = 0 + for child in self._children: + self._layout_child(child, index) + index += 1 diff --git a/sugar/graphics/timeline.py b/sugar/graphics/timeline.py new file mode 100644 index 0000000..a2736cf --- /dev/null +++ b/sugar/graphics/timeline.py @@ -0,0 +1,98 @@ +import gobject + +class _Tag: + def __init__(self, name, start_frame, end_frame): + self.name = name + self.start_frame = start_frame + self.end_frame = end_frame + +class TimelineObserver: + def __init__(self, observer): + self._observer = observer + + def next_frame(self, tag, current_frame, n_frames): + try: + method = getattr(self._observer, 'do_' + tag) + method(current_frame, n_frames) + except: + pass + +class Timeline: + def __init__(self, observer): + self._fps = 12 + self._tags = [] + self._name_to_tag = {} + self._current_frame = 0 + self._timeout_sid = 0 + self._observer = TimelineObserver(observer) + + def add_tag(self, name, start_frame, end_frame): + tag = _Tag(name, start_frame, end_frame) + self._tags.append(tag) + self._name_to_tag[name] = tag + + def remove_tag(self, name): + tag = self._tags[name] + self._tags.remove(tag) + del self._tags[name] + + def _next_frame(self, tag, frame): + n_frames = tag.start_frame - tag.end_frame + self._observer.next_frame(tag.name, frame, n_frames) + + def goto(self, tag_name, end_frame=False): + self.pause() + + tag = self._name_to_tag[tag_name] + if end_frame: + self._current_frame = tag.end_frame + else: + self._current_frame = tag.start_frame + + self._next_frame(tag, self._current_frame) + + def on_tag(self, name): + tag = self._name_to_tag[name] + return (tag.start_frame <= self._current_frame and \ + tag.end_frame >= self._current_frame) + + def _get_tags_for_frame(self, frame): + result = [] + for tag in self._tags: + if tag.start_frame <= frame and tag.end_frame >= frame: + result.append(tag) + return result + + def _timeout_cb(self, end_frame): + for tag in self._get_tags_for_frame(self._current_frame): + cur_frame = self._current_frame - tag.start_frame + self._next_frame(tag, cur_frame) + + if self._current_frame < end_frame: + self._current_frame += 1 + return True + else: + return False + + def play(self, start_tag=None, stop_tag=None): + self.pause() + + if start_tag == None: + start = 0 + else: + start = self._name_to_tag[start_tag].start_frame + + if stop_tag == None: + end = self._tags[len(self._tags) - 1].end_frame + else: + end = self._name_to_tag[stop_tag].end_frame + + self._current_frame = start + + interval = 1000 / self._fps + self._timeout_sid = gobject.timeout_add( + interval, self._timeout_cb, end) + + def pause(self): + if self._timeout_sid > 0: + gobject.source_remove(self._timeout_sid) |