Codebase list sugar-pippy-activity / f423bc6
pep8 fixes Vikram Ahuja 9 years ago
4 changed file(s) with 17 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
7777
7878 label = Gtk.Label(_('Open an example bundle'))
7979 label.modify_fg(Gtk.StateType.NORMAL,
80 Gdk.color_parse('white'))
80 Gdk.color_parse('white'))
8181
8282 item = Gtk.ToolItem()
8383 item.add(label)
100100 def build_scroll(self):
101101 scroll = Gtk.ScrolledWindow()
102102 scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
103 Gtk.PolicyType.AUTOMATIC)
103 Gtk.PolicyType.AUTOMATIC)
104104
105105 vbox = Gtk.VBox()
106106 scroll.add_with_viewport(vbox)
125125 expander = Gtk.Expander()
126126 expander.set_label(name)
127127 expander.modify_fg(Gtk.StateType.NORMAL,
128 Gdk.color_parse('black'))
128 Gdk.color_parse('black'))
129129
130130 vbox = Gtk.VBox()
131131 files = sorted(os.listdir(path))
2828
2929 DEFAULT_NAME = "default-pippy.svg"
3030 DEFAULT_ICON = os.path.join(get_bundle_path(), 'activity',
31 'activity-default.svg')
31 'activity-default.svg')
3232
3333
3434 def get_document_icons():
114114
115115 label = Gtk.Label("\t" + _('Select an icon'))
116116 label.modify_fg(Gtk.StateType.NORMAL,
117 Gdk.color_parse('white'))
117 Gdk.color_parse('white'))
118118
119119 item = Gtk.ToolItem()
120120 item.add(label)
156156
157157 for icon in get_user_icons():
158158 info = self.theme.lookup_icon(icon, 55,
159 Gtk.IconLookupFlags.FORCE_SVG)
159 Gtk.IconLookupFlags.FORCE_SVG)
160160 if not info:
161161 continue
162162 icon_path = os.path.join(get_user_path(), icon + ".svg")
3939 import dbus
4040 from dbus.mainloop.glib import DBusGMainLoop
4141
42 DBusGMainLoop(set_as_default=True)
43 bus = dbus.SessionBus()
44
4542 from gi.repository import Gtk
4643 from gi.repository import Gdk
4744 from gi.repository import GLib
7875 from toolbars import DevelopViewToolbar
7976
8077 import sound_check
78 import logging
79
80 DBusGMainLoop(set_as_default=True)
81 bus = dbus.SessionBus()
8182
8283 text_buffer = None
8384 # magic prefix to use utf-8 source encoding
8889 DEFAULT_CATEGORIES = [_('graphics'), _('math'), _('python'), _('sound'),
8990 _('string'), _('tutorials')]
9091
91 import logging
9292 _logger = logging.getLogger('pippy-activity')
9393
9494 groupthink_mimetype = 'pickle/groupthink-pippy'
10981098 elif self.metadata['mime_type'] == groupthink_mimetype:
10991099 return open(file_path).read()
11001100
1101 ############# TEMPLATES AND INLINE FILES ##############
1101 # TEMPLATES AND INLINE FILES
11021102 ACTIVITY_INFO_TEMPLATE = '''
11031103 [Activity]
11041104 name = %(title)s
11111111 %(extra_info)s
11121112 '''
11131113
1114 PIPPY_ICON = \
1115 """<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG
1114 PIPPY_ICON = """<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG
11161115 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
11171116 <!ENTITY stroke_color "#010101">
11181117 <!ENTITY fill_color "#FFFFFF">
11491148 """
11501149
11511150
1152 ############# ACTIVITY META-INFORMATION ###############
1151 # ACTIVITY META-INFORMATION
11531152 # this is used by Pippy to generate a bundle for itself.
11541153
11551154
12031202 license = GPLv2+
12041203 update_url = http://activities.sugarlabs.org '''
12051204
1206 ################# ACTIVITY BUNDLER ################
1205 # ACTIVITY BUNDLER
12071206
12081207
12091208 def main():
2020
2121 from sugar3 import env
2222
23
2324 class SoundLibraryNotFoundError(Exception):
2425 def __init__(self):
2526 Exception.__init__(self, _('Cannot find TamTamEdit sound library.'
2627 ' Did you install TamTamEdit?'))
28
2729
2830 def finddir():
2931 paths = ['/usr/share/sugar/activities', env.get_user_activities_path()]
4244 tamtam_subdir = str(
4345 os.path.join(bundle_dir, 'common', 'Resources', 'Sounds'))
4446 sound_candidate_dirs = [
45 os.path.expandvars('$SUGAR_PATH/activities') + \
47 os.path.expandvars('$SUGAR_PATH/activities') +
4648 tamtam_subdir,
4749 tamtam_subdir
4850 ]