Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/desktop/sweetener/basic_options.py
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/sweetener/basic_options.py')
-rw-r--r--desktop/sweetener/basic_options.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/desktop/sweetener/basic_options.py b/desktop/sweetener/basic_options.py
new file mode 100644
index 0000000..bdb5bfc
--- /dev/null
+++ b/desktop/sweetener/basic_options.py
@@ -0,0 +1,65 @@
+#!/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.
+
+from gettext import gettext as _
+import gtk
+
+import stock
+from item import Item
+from itemgroup import ItemGroup
+
+DOCUMENT = 0
+CONFIG = 1
+
+
+class BasicOptions(ItemGroup):
+ def __init__(self, activity, box, export_formats=None):
+ # TRANS: This string could be already translated at hello-integration, if not, please translate there, not only here.
+ ItemGroup.__init__(self, box, _('_File'), None)
+
+ if activity.save_type != CONFIG:
+ new = Item(gtk.STOCK_NEW, True)
+ new.connect('activate', lambda w: activity.new())
+ self.append_item(new)
+ _open = Item(gtk.STOCK_OPEN, True)
+ _open.connect('activate', lambda w: activity.open())
+ self.append_item(_open)
+ self.append_separator()
+ save_option = Item(gtk.STOCK_SAVE, True)
+ save_option.connect('activate', lambda w: activity.save())
+ self.append_item(save_option)
+ save_as_option = Item(gtk.STOCK_SAVE_AS)
+ save_as_option.connect('activate', lambda w: activity.save_as())
+ self.append_item(save_as_option)
+ if export_formats != None:
+ if len(export_formats) == 1:
+ stock.register('sweetener-%s' % export_formats[0][1],
+ # TRANS: This string could be already translated at hello-integration, if not, please translate there, not only here.
+ _('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.append_item(export)
+ self.append_separator()
+ _quit = Item(gtk.STOCK_QUIT)
+ _quit.connect('activate', lambda w: activity.stop())
+ self.append_item(_quit)