pep8 fixes
Vikram Ahuja
9 years ago
77 | 77 | |
78 | 78 | label = Gtk.Label(_('Open an example bundle')) |
79 | 79 | label.modify_fg(Gtk.StateType.NORMAL, |
80 | Gdk.color_parse('white')) | |
80 | Gdk.color_parse('white')) | |
81 | 81 | |
82 | 82 | item = Gtk.ToolItem() |
83 | 83 | item.add(label) |
100 | 100 | def build_scroll(self): |
101 | 101 | scroll = Gtk.ScrolledWindow() |
102 | 102 | scroll.set_policy(Gtk.PolicyType.AUTOMATIC, |
103 | Gtk.PolicyType.AUTOMATIC) | |
103 | Gtk.PolicyType.AUTOMATIC) | |
104 | 104 | |
105 | 105 | vbox = Gtk.VBox() |
106 | 106 | scroll.add_with_viewport(vbox) |
125 | 125 | expander = Gtk.Expander() |
126 | 126 | expander.set_label(name) |
127 | 127 | expander.modify_fg(Gtk.StateType.NORMAL, |
128 | Gdk.color_parse('black')) | |
128 | Gdk.color_parse('black')) | |
129 | 129 | |
130 | 130 | vbox = Gtk.VBox() |
131 | 131 | files = sorted(os.listdir(path)) |
28 | 28 | |
29 | 29 | DEFAULT_NAME = "default-pippy.svg" |
30 | 30 | DEFAULT_ICON = os.path.join(get_bundle_path(), 'activity', |
31 | 'activity-default.svg') | |
31 | 'activity-default.svg') | |
32 | 32 | |
33 | 33 | |
34 | 34 | def get_document_icons(): |
114 | 114 | |
115 | 115 | label = Gtk.Label("\t" + _('Select an icon')) |
116 | 116 | label.modify_fg(Gtk.StateType.NORMAL, |
117 | Gdk.color_parse('white')) | |
117 | Gdk.color_parse('white')) | |
118 | 118 | |
119 | 119 | item = Gtk.ToolItem() |
120 | 120 | item.add(label) |
156 | 156 | |
157 | 157 | for icon in get_user_icons(): |
158 | 158 | info = self.theme.lookup_icon(icon, 55, |
159 | Gtk.IconLookupFlags.FORCE_SVG) | |
159 | Gtk.IconLookupFlags.FORCE_SVG) | |
160 | 160 | if not info: |
161 | 161 | continue |
162 | 162 | icon_path = os.path.join(get_user_path(), icon + ".svg") |
39 | 39 | import dbus |
40 | 40 | from dbus.mainloop.glib import DBusGMainLoop |
41 | 41 | |
42 | DBusGMainLoop(set_as_default=True) | |
43 | bus = dbus.SessionBus() | |
44 | ||
45 | 42 | from gi.repository import Gtk |
46 | 43 | from gi.repository import Gdk |
47 | 44 | from gi.repository import GLib |
78 | 75 | from toolbars import DevelopViewToolbar |
79 | 76 | |
80 | 77 | import sound_check |
78 | import logging | |
79 | ||
80 | DBusGMainLoop(set_as_default=True) | |
81 | bus = dbus.SessionBus() | |
81 | 82 | |
82 | 83 | text_buffer = None |
83 | 84 | # magic prefix to use utf-8 source encoding |
88 | 89 | DEFAULT_CATEGORIES = [_('graphics'), _('math'), _('python'), _('sound'), |
89 | 90 | _('string'), _('tutorials')] |
90 | 91 | |
91 | import logging | |
92 | 92 | _logger = logging.getLogger('pippy-activity') |
93 | 93 | |
94 | 94 | groupthink_mimetype = 'pickle/groupthink-pippy' |
1098 | 1098 | elif self.metadata['mime_type'] == groupthink_mimetype: |
1099 | 1099 | return open(file_path).read() |
1100 | 1100 | |
1101 | ############# TEMPLATES AND INLINE FILES ############## | |
1101 | # TEMPLATES AND INLINE FILES | |
1102 | 1102 | ACTIVITY_INFO_TEMPLATE = ''' |
1103 | 1103 | [Activity] |
1104 | 1104 | name = %(title)s |
1111 | 1111 | %(extra_info)s |
1112 | 1112 | ''' |
1113 | 1113 | |
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 | |
1116 | 1115 | 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [ |
1117 | 1116 | <!ENTITY stroke_color "#010101"> |
1118 | 1117 | <!ENTITY fill_color "#FFFFFF"> |
1149 | 1148 | """ |
1150 | 1149 | |
1151 | 1150 | |
1152 | ############# ACTIVITY META-INFORMATION ############### | |
1151 | # ACTIVITY META-INFORMATION | |
1153 | 1152 | # this is used by Pippy to generate a bundle for itself. |
1154 | 1153 | |
1155 | 1154 | |
1203 | 1202 | license = GPLv2+ |
1204 | 1203 | update_url = http://activities.sugarlabs.org ''' |
1205 | 1204 | |
1206 | ################# ACTIVITY BUNDLER ################ | |
1205 | # ACTIVITY BUNDLER | |
1207 | 1206 | |
1208 | 1207 | |
1209 | 1208 | def main(): |
20 | 20 | |
21 | 21 | from sugar3 import env |
22 | 22 | |
23 | ||
23 | 24 | class SoundLibraryNotFoundError(Exception): |
24 | 25 | def __init__(self): |
25 | 26 | Exception.__init__(self, _('Cannot find TamTamEdit sound library.' |
26 | 27 | ' Did you install TamTamEdit?')) |
28 | ||
27 | 29 | |
28 | 30 | def finddir(): |
29 | 31 | paths = ['/usr/share/sugar/activities', env.get_user_activities_path()] |
42 | 44 | tamtam_subdir = str( |
43 | 45 | os.path.join(bundle_dir, 'common', 'Resources', 'Sounds')) |
44 | 46 | sound_candidate_dirs = [ |
45 | os.path.expandvars('$SUGAR_PATH/activities') + \ | |
47 | os.path.expandvars('$SUGAR_PATH/activities') + | |
46 | 48 | tamtam_subdir, |
47 | 49 | tamtam_subdir |
48 | 50 | ] |