Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2012-08-31 00:08:29 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-08-31 00:08:29 (GMT)
commit8086f7a17162cb8f89c32cb11e6e73bba34c4365 (patch)
treefc5e9c7f8377595e200c44f8055cd623e294ebb3
parent710493713f6450de1b09058075ab9f8d9e5ef245 (diff)
Remove unused Sweetener modules
-rw-r--r--sugar/icons/toolbar-help.svg14
-rw-r--r--sugar/sweetener/.directory5
-rw-r--r--sugar/sweetener/__init__.py19
-rw-r--r--sugar/sweetener/basic_options.py45
-rw-r--r--sugar/sweetener/coloritem.py64
-rw-r--r--sugar/sweetener/colors.py32
-rw-r--r--sugar/sweetener/help.py91
-rw-r--r--sugar/sweetener/icon.py18
-rw-r--r--sugar/sweetener/item.py87
-rw-r--r--sugar/sweetener/itembox.py36
-rw-r--r--sugar/sweetener/itemgroup.py71
-rw-r--r--sugar/sweetener/profile.py27
-rw-r--r--sugar/sweetener/radioitem.py45
-rw-r--r--sugar/sweetener/settingsitem.py53
-rw-r--r--sugar/sweetener/settingsradioitem.py44
-rw-r--r--sugar/sweetener/shortcontentitem.py41
-rw-r--r--sugar/sweetener/stock.py78
-rw-r--r--sugar/sweetener/toggleitem.py56
-rw-r--r--sugar/sweetener/xocolor.py18
19 files changed, 19 insertions, 825 deletions
diff --git a/sugar/icons/toolbar-help.svg b/sugar/icons/toolbar-help.svg
new file mode 100644
index 0000000..f6c92bf
--- /dev/null
+++ b/sugar/icons/toolbar-help.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55px" height="55px">
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linejoin:round"
+ d="M 48,28 A 20,20 0 1 1 8,28 A 20,20 0 1 1 48,28 z"/>
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:round"
+ d="M 22,20 C 22,20 25,17 29,17 C 33,17 36,19 36,23 C 36,27 31,29 28,29 L 28,32" />
+ <path
+ style="fill:#ffffff"
+ d="M 25,40
+ a 3,3 0 1 1 6,0
+ a 3,3 0 1 1 -6,0 z" />
+</svg>
diff --git a/sugar/sweetener/.directory b/sugar/sweetener/.directory
new file mode 100644
index 0000000..35c843f
--- /dev/null
+++ b/sugar/sweetener/.directory
@@ -0,0 +1,5 @@
+[Dolphin]
+Timestamp=2012,8,30,21,7,18
+
+[Settings]
+HiddenFilesShown=true
diff --git a/sugar/sweetener/__init__.py b/sugar/sweetener/__init__.py
deleted file mode 100644
index 22ff499..0000000
--- a/sugar/sweetener/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
diff --git a/sugar/sweetener/basic_options.py b/sugar/sweetener/basic_options.py
deleted file mode 100644
index 52f4ebd..0000000
--- a/sugar/sweetener/basic_options.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-from gettext import gettext as _
-
-from sugar.activity.widgets import ActivityToolbarButton
-
-import stock
-from item import Item
-
-DOCUMENT = 0
-CONFIG = 1
-
-
-class BasicOptions(ActivityToolbarButton):
- def __init__(self, activity, box, export_formats=None):
- ActivityToolbarButton.__init__(self, activity)
- box.toolbar.insert(self, 0)
- self.show()
- if export_formats != None:
- if len(export_formats) == 1:
- stock.register('sweetener-%s' % export_formats[0][1],
- _('Export as %s') % export_formats[0][0],
- None, export_formats[0][1].replace('/',
- '-'))
- export = Item('sweetener-%s' % export_formats[0][1])
- export.connect('activate', activity.export,
- export_formats[0])
- self.page.insert(export.get_tool_item(), -1)
diff --git a/sugar/sweetener/coloritem.py b/sugar/sweetener/coloritem.py
deleted file mode 100644
index 30a3ad3..0000000
--- a/sugar/sweetener/coloritem.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('option')
-
-import gobject
-import gtk
-
-from sugar.graphics.colorbutton import ColorToolButton
-
-from colors import color2string
-from item import Item
-
-
-class ColorItem(Item):
- __gsignals__ = {'updated': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
- (gobject.TYPE_STRING,))}
-
- def __init__(self, parent=None, important=False):
- Item.__init__(self, gtk.STOCK_SELECT_COLOR)
- self.color = '#FFFFFF'
-
- def set_color(self, color):
- self.color = color
- if self.toolitem and self.color:
- self.toolitem.set_color(gtk.gdk.Color(self.color))
-
- def get_tool_item(self):
- self.toolitem = ColorToolButton()
- self.toolitem.connect('notify::color', self._color_changed_cb)
- self.setup_tooltip()
- self.set_color(self.color)
- return self.toolitem
-
- def setup_tooltip(self):
- if self.tooltip:
- self.toolitem.set_title(self.tooltip)
- else:
- text = gtk.stock_lookup(self.stock_id)[1]
- self.toolitem.set_title(text.replace('_', ''))
- self.setup_accelerator()
-
- def _color_changed_cb(self, widget, pspec):
- color_gdk = widget.get_color()
- self.color = color2string(color_gdk)
- self.emit('updated', self.color)
diff --git a/sugar/sweetener/colors.py b/sugar/sweetener/colors.py
deleted file mode 100644
index 3b5d938..0000000
--- a/sugar/sweetener/colors.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('colors')
-
-
-def color2string(color):
- color_string = ["#"]
- color_string.append("%02x" % (color.red / 256))
- color_string.append("%02x" % (color.green / 256))
- color_string.append("%02x" % (color.blue / 256))
- string = "".join(color_string)
- #logger.debug(str(color) + ' ' + string)
- return string
diff --git a/sugar/sweetener/help.py b/sugar/sweetener/help.py
deleted file mode 100644
index c2250ff..0000000
--- a/sugar/sweetener/help.py
+++ /dev/null
@@ -1,91 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-# Based on helpbutton by Gonzalo Odiard <gonzalo@laptop.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-from gettext import gettext as _
-import gtk
-
-from sugar.graphics import style
-from sugar.graphics.icon import Icon
-
-import stock
-from settingsitem import SettingsItem
-from itemgroup import ItemGroup
-import info
-import helpcontent
-
-
-class Help(SettingsItem):
- def __init__(self, box):
- title = gtk.stock_lookup(gtk.STOCK_HELP)[1]
- stock.register('sweetener-help-contents', title,
- '<Ctrl>H', 'toolbar-help')
- SettingsItem.__init__(self, None, 'sweetener-help-contents')
-
- sw = gtk.ScrolledWindow()
- sw.set_size_request(int(gtk.gdk.screen_width() / 2.8),
- gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 3)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- self._max_text_width = int(gtk.gdk.screen_width() / 3) - 20
- self._vbox = gtk.VBox()
- self._vbox.set_homogeneous(False)
- hbox = gtk.HBox()
- hbox.pack_start(self._vbox, False, True, 0)
- sw.add_with_viewport(hbox)
- sw.show()
- self.content = sw
- item = self.get_tool_item()
- item.show_all()
- separator = gtk.SeparatorToolItem()
- separator.show()
- box.toolbar.insert(separator,
- len(box.toolbar.get_children()[:-2]))
- box.toolbar.insert(item,
- len(box.toolbar.get_children()[:-2]))
- for i in helpcontent.help:
- self.add_section(i[0])
- for text, icon in i[1:]:
- self.add_paragraph(text, icon)
-
- def add_section(self, section_text):
- hbox = gtk.HBox()
- label = gtk.Label()
- label.set_use_markup(True)
- label.set_markup('<b>%s</b>' % section_text)
- label.set_line_wrap(True)
- label.set_size_request(self._max_text_width, -1)
- hbox.add(label)
- hbox.show_all()
- self._vbox.pack_start(hbox, False, False, padding=5)
-
- def add_paragraph(self, text, icon=None):
- hbox = gtk.HBox()
- label = gtk.Label(text)
- label.set_justify(gtk.JUSTIFY_LEFT)
- label.set_line_wrap(True)
- hbox.add(label)
- if icon is not None:
- _icon = Icon(icon_name=icon)
- hbox.add(_icon)
- label.set_size_request(self._max_text_width - 20, -1)
- else:
- label.set_size_request(self._max_text_width, -1)
-
- hbox.show_all()
- self._vbox.pack_start(hbox, False, False, padding=5)
diff --git a/sugar/sweetener/icon.py b/sugar/sweetener/icon.py
deleted file mode 100644
index 59be87a..0000000
--- a/sugar/sweetener/icon.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2006-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 sugar.graphics.icon import *
diff --git a/sugar/sweetener/item.py b/sugar/sweetener/item.py
deleted file mode 100644
index 291204a..0000000
--- a/sugar/sweetener/item.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('option')
-
-import gobject
-import gtk
-from sugar.graphics.toolbutton import ToolButton
-
-import stock
-
-
-class Item(gobject.GObject):
- __gsignals__ = {'activate': (gobject.SIGNAL_RUN_LAST,
- gobject.TYPE_NONE,
- tuple())}
- toolitem = None
-
- def __init__(self, stock_id=gtk.STOCK_CLEAR, important=False):
- gobject.GObject.__init__(self)
- self._stock_id = stock_id
- self.accel_group = None
- self.important = important
- self.connection = None
- self.connection_data = None
- self.tooltip = None
-
- def set_stock_id(self, stock_id):
- self._stock_id = stock_id
-
- def get_stock_id(self):
- return self._stock_id
-
- stock_id = property(get_stock_id, set_stock_id)
-
- def get_menu_item(self):
- return None
-
- def activate_cb(self, widget):
- self.emit('activate')
-
- def setup_accelerator(self):
- accelerator = stock.get_accelerator(self._stock_id)
- logger.debug(str(accelerator))
- try:
- if accelerator[1] > 0:
- self.toolitem.props.accelerator = gtk.accelerator_name(
- accelerator[1], accelerator[0])
- except:
- logger.error(
-'Could not set up accelerator; if toogletoolbutton, update your sugar version')
-
- def get_tool_item(self):
- if self._stock_id in stock.icons:
- icon_name = stock.icons[self._stock_id]
- else:
- icon_name = self._stock_id
- self.toolitem = ToolButton(icon_name)
- self.toolitem.connect('clicked', self.activate_cb)
- self.setup_tooltip()
- return self.toolitem
-
- def setup_tooltip(self):
- if self.tooltip:
- self.toolitem.set_tooltip(self.tooltip)
- else:
- text = gtk.stock_lookup(self._stock_id)[1]
- self.toolitem.set_tooltip(text.replace('_', ''))
- self.setup_accelerator()
diff --git a/sugar/sweetener/itembox.py b/sugar/sweetener/itembox.py
deleted file mode 100644
index d861c52..0000000
--- a/sugar/sweetener/itembox.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import gtk
-from sugar.graphics.toolbarbox import ToolbarBox
-from sugar.activity.widgets import StopButton
-
-
-class ItemBox(ToolbarBox):
- def __init__(self, activity):
- ToolbarBox.__init__(self)
- self._parent = activity
- separator = gtk.SeparatorToolItem()
- separator.set_draw(False)
- separator.set_expand(True)
- separator.show()
- self.toolbar.insert(separator, -1)
- self.stopbutton = StopButton(activity)
- self.toolbar.insert(self.stopbutton, -1)
- self.stopbutton.show()
diff --git a/sugar/sweetener/itemgroup.py b/sugar/sweetener/itemgroup.py
deleted file mode 100644
index 637eb4f..0000000
--- a/sugar/sweetener/itemgroup.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import gobject
-import gtk
-from sugar.activity.widgets import ToolbarButton
-
-
-class ItemGroup(gobject.GObject):
- def __init__(self, box, name=None, icon=None):
- gobject.GObject.__init__(self)
- self.items = []
- self.item = ToolbarButton(icon_name=icon)
- box.toolbar.insert(self.item, len(box.toolbar) - 2)
- self.toolbar = gtk.Toolbar()
- self.item.props.page = self.toolbar
- self.toolbar.show()
- self.item.show()
- self.activity = box._parent
- self.last_position = 0
-
- def append_item(self, item):
- tool_item = item.get_tool_item()
- self.toolbar.insert(tool_item, len(self.items) - self.last_position)
- tool_item.show_all()
- self.items.append(item)
-
- def append_separator(self, important=False):
- toolitem = gtk.SeparatorToolItem()
- toolitem.show()
- self.toolbar.insert(toolitem, len(self.items) - self.last_position)
- self.items.append(self.toolbar)
- return toolitem
-
-
-class GhostGroup(ItemGroup):
- def __init__(self, box, name):
- gobject.GObject.__init__(self)
- self.items = [i for i in box.toolbar.get_children()[:-2]]
- self.toolbar = box.toolbar
- self.activity = box._parent
- self.last_position = 0
-
-
-class SubGroup(ItemGroup):
- def __init__(self, group, name=None):
- gobject.GObject.__init__(self)
- self.items = group.items
- self.last_position = group.last_position
- if len(self.items) > 0:
- group.append_separator()
- group.append_separator()
- self.toolbar = group.toolbar
- self.last_position = 1
diff --git a/sugar/sweetener/profile.py b/sugar/sweetener/profile.py
deleted file mode 100644
index 39d1c97..0000000
--- a/sugar/sweetener/profile.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import gtk
-from sugar import profile
-profile_color = profile.get_color()
-fill_color = gtk.gdk.color_parse(profile_color.get_fill_color())
-stroke_color = gtk.gdk.color_parse(profile_color.get_stroke_color())
-
-get_fill_color = lambda widget: fill_color
-get_stroke_color = lambda widget: stroke_color
diff --git a/sugar/sweetener/radioitem.py b/sugar/sweetener/radioitem.py
deleted file mode 100644
index 93c640b..0000000
--- a/sugar/sweetener/radioitem.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('toggleoption')
-import gtk
-from sugar.graphics.radiotoolbutton import RadioToolButton
-import stock
-from toggleitem import ToggleItem
-
-
-class RadioItem(ToggleItem):
- def __init__(self, group, default_value=True,
- stock_id=None, important=False):
- ToggleItem.__init__(self, default_value, stock_id, important)
- self.group = group
-
- def get_tool_item(self):
- self.toolitem = RadioToolButton()
- if self.group:
- self.toolitem.set_group(self.group.toolitem)
- self.toolitem.set_named_icon(stock.icons[self._stock_id]
- if self._stock_id in stock.icons
- else self._stock_id)
- self.toolitem.set_active(self.default_value)
- self.toolitem.connect('toggled', self.toggled_cb)
- self.setup_tooltip()
- return self.toolitem
diff --git a/sugar/sweetener/settingsitem.py b/sugar/sweetener/settingsitem.py
deleted file mode 100644
index 4dcfdf5..0000000
--- a/sugar/sweetener/settingsitem.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('option')
-
-import gobject
-import gtk
-
-from item import Item
-
-
-class SettingsItem(Item):
- __gsignals__ = {'closed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
- tuple())}
-
- def __init__(self, parent=None, stock_id=None, important=False):
- Item.__init__(self, stock_id, important)
- self.content = gtk.EventBox()
- self.parent = parent
- self.created = False
- # For toggleoptions
- self.active = True
-
- def get_tool_item(self):
- self.tool_item = Item.get_tool_item(self)
- self.palette = self.toolitem.get_palette()
- self.palette.set_content(self.content)
- self.content.show_all()
- return self.tool_item
-
- def do_activate(self):
- if self.active:
- self.toolitem.props.palette.popup(immediate=True, state=1)
- #TODO: Send close event when de palette is closed.
- #self.emit('close')
diff --git a/sugar/sweetener/settingsradioitem.py b/sugar/sweetener/settingsradioitem.py
deleted file mode 100644
index cf1492d..0000000
--- a/sugar/sweetener/settingsradioitem.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('option')
-
-import gobject
-from radioitem import RadioItem
-from settingsitem import SettingsItem
-
-
-class SettingsRadioItem(SettingsItem, RadioItem):
- __gsignals__ = {'toggled': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
- (gobject.TYPE_BOOLEAN,))}
-
- def __init__(self, group, default_value=True, parent=None,
- stock_id=None, important=False):
- SettingsItem.__init__(self, parent, stock_id, important)
- RadioItem.__init__(self, group, default_value, stock_id, important)
-
- def get_tool_item(self):
- RadioItem.get_tool_item(self)
- self.toolitem.connect('clicked', self.activate_cb)
- self.palette = self.toolitem.get_palette()
- self.palette.set_content(self.content)
- self.content.show_all()
- return self.toolitem
diff --git a/sugar/sweetener/shortcontentitem.py b/sugar/sweetener/shortcontentitem.py
deleted file mode 100644
index 82fceba..0000000
--- a/sugar/sweetener/shortcontentitem.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('option')
-
-import gobject
-import gtk
-
-from item import Item
-
-
-class ShortContentItem(Item):
-
- def __init__(self, parent=None, stock_id=None, important=False):
- Item.__init__(self, stock_id, important)
- self.content = gtk.EventBox()
- self.parent = parent
- self.separator = None
-
- def get_tool_item(self):
- self.toolitem = gtk.ToolItem()
- self.toolitem.add(self.content)
- return self.toolitem
diff --git a/sugar/sweetener/stock.py b/sugar/sweetener/stock.py
deleted file mode 100644
index 8fbca2e..0000000
--- a/sugar/sweetener/stock.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('stock')
-import gtk
-
-icon_factory = gtk.IconFactory()
-
-# Set the icon name for the stock items, this is used only in Sugar.
-icons = {gtk.STOCK_ADD: 'list-add'}
-
-
-def register(name, label, accelerator, icon_name):
- if accelerator == None:
- keyval = 0
- mask = gtk.gdk.ModifierType(0)
- else:
- keyval, mask = gtk.accelerator_parse(accelerator)
- gtk.stock_add([(name, label, mask, keyval, '')])
- if icon_name:
- icon_source = gtk.IconSource()
- icon_source.set_icon_name(icon_name)
- icon = gtk.IconSet()
- icon.add_source(icon_source)
- icon_factory.add(name, icon)
- icon_factory.add_default()
- icons[name] = icon_name
-
-
-def overwrite_stock(stock_id, new_accelerator):
- info = list(gtk.stock_lookup(stock_id))
- keyval, mask = gtk.accelerator_parse(new_accelerator)
- info[2] = mask
- info[3] = keyval
- logger.debug(str(info))
- gtk.stock_add([(info[0], info[1], info[2], info[3], info[4])])
-
-# Here we overwrite the key accelerators for some stock ids.
-# Feel free to add here any other stock id if you need it at your activity,
-# and send us a patch.
-
-overwrite_stock(gtk.STOCK_ZOOM_IN, '<Ctrl>plus')
-overwrite_stock(gtk.STOCK_ZOOM_OUT, '<Ctrl>minus')
-overwrite_stock(gtk.STOCK_ZOOM_100, '<Ctrl>0')
-# Key accelerator will be F11 on desktops and <Alt>return on Sugar.
-overwrite_stock(gtk.STOCK_FULLSCREEN, '<Alt>Return')
-overwrite_stock(gtk.STOCK_ADD, '<Ctrl>A')
-# Key accelerator will be Delete on desktops and <Shift>backspace on Sugar
-overwrite_stock(gtk.STOCK_REMOVE, '<Shift>BackSpace')
-overwrite_stock(gtk.STOCK_SELECT_COLOR, '<Ctrl>L')
-
-
-def get_label(stock, underline):
- text = gtk.stock_lookup(stock)[1]
- if underline:
- text = text.replace('_', '')
- return text
-
-
-def get_accelerator(stock):
- return gtk.stock_lookup(stock)[2:-1]
diff --git a/sugar/sweetener/toggleitem.py b/sugar/sweetener/toggleitem.py
deleted file mode 100644
index d7b8c86..0000000
--- a/sugar/sweetener/toggleitem.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import logging
-logger = logging.getLogger('toggleoption')
-import gobject
-import gtk
-from sugar.graphics.toggletoolbutton import ToggleToolButton
-import stock
-from item import Item
-
-
-class ToggleItem(Item):
- __gsignals__ = {'toggled': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
- (gobject.TYPE_BOOLEAN,))}
-
- def __init__(self, default_value=True, stock_id=None, important=False):
- Item.__init__(self, stock_id, important)
- self.default_value = default_value
- self.active = default_value
-
- def get_menu_item(self):
- return None
-
- def toggled_cb(self, widget):
- active = widget.get_active()
- self.toolitem.set_active(active)
- self.active = active
- self.emit('toggled', active)
-
- def get_tool_item(self):
- self.toolitem = ToggleToolButton()
- self.toolitem.set_named_icon(stock.icons[self._stock_id]
- if self._stock_id in stock.icons
- else self._stock_id)
- self.toolitem.set_active(self.default_value)
- self.toolitem.connect('toggled', self.toggled_cb)
- self.setup_tooltip()
- return self.toolitem
diff --git a/sugar/sweetener/xocolor.py b/sugar/sweetener/xocolor.py
deleted file mode 100644
index a5344cc..0000000
--- a/sugar/sweetener/xocolor.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2012 Daniel Francis <francis@sugarlabs.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-from sugar.graphics.xocolor import *