[Sugar-devel] [PATCH sugar v2 03/21] pep8 cleanup: fix number of blank lines
Sascha Silbe
sascha-pgp at silbe.org
Fri Nov 19 16:13:11 EST 2010
Reviewed-by: James Cameron <quozl at laptop.org>
CC: Aleksey Lim <alsroot at member.fsf.org>
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
diff --git a/extensions/cpsection/aboutcomputer/__init__.py b/extensions/cpsection/aboutcomputer/__init__.py
index ceb515a..faf814d 100644
--- a/extensions/cpsection/aboutcomputer/__init__.py
+++ b/extensions/cpsection/aboutcomputer/__init__.py
@@ -19,4 +19,3 @@ from gettext import gettext as _
CLASS = 'AboutComputer'
ICON = 'module-about_my_computer'
TITLE = _('About my Computer')
-
diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py
index 77d3b86..b700a6b 100644
--- a/extensions/cpsection/aboutcomputer/model.py
+++ b/extensions/cpsection/aboutcomputer/model.py
@@ -24,29 +24,35 @@ import errno
from jarabe import config
+
_logger = logging.getLogger('ControlPanel - AboutComputer')
_not_available = _('Not available')
+
def get_aboutcomputer():
msg = 'Serial Number: %s \nBuild Number: %s \nFirmware Number: %s \n' \
% (get_serial_number(), get_build_number(), get_firmware_number())
return msg
+
def print_aboutcomputer():
print get_aboutcomputer()
+
def get_serial_number():
serial_no = _read_file('/ofw/serial-number')
if serial_no is None:
serial_no = _not_available
return serial_no
+
def print_serial_number():
serial_no = get_serial_number()
if serial_no is None:
serial_no = _not_available
print serial_no
+
def get_build_number():
build_no = _read_file('/boot/olpc_build')
@@ -68,9 +74,11 @@ def get_build_number():
return build_no
+
def print_build_number():
print get_build_number()
+
def get_firmware_number():
firmware_no = _read_file('/ofw/openprom/model')
if firmware_no is None:
@@ -81,9 +89,11 @@ def get_firmware_number():
firmware_no = firmware_no[1]
return firmware_no
+
def print_firmware_number():
print get_firmware_number()
+
def get_wireless_firmware():
try:
info = subprocess.Popen(["/usr/sbin/ethtool", "-i", "eth0"],
@@ -97,9 +107,11 @@ def get_wireless_firmware():
wireless_firmware = _not_available
return wireless_firmware
+
def print_wireless_firmware():
print get_wireless_firmware()
+
def _read_file(path):
if os.access(path, os.R_OK) == 0:
return None
@@ -114,6 +126,7 @@ def _read_file(path):
_logger.debug('No information in file or directory: %s', path)
return None
+
def get_license():
license_file = os.path.join(config.data_path, 'GPLv2')
lang = os.environ['LANG']
diff --git a/extensions/cpsection/aboutcomputer/view.py b/extensions/cpsection/aboutcomputer/view.py
index 39bacfb..68545fd 100644
--- a/extensions/cpsection/aboutcomputer/view.py
+++ b/extensions/cpsection/aboutcomputer/view.py
@@ -26,6 +26,7 @@ from sugar.graphics import style
from jarabe import config
from jarabe.controlpanel.sectionview import SectionView
+
class AboutComputer(SectionView):
def __init__(self, model, alerts=None):
SectionView.__init__(self)
diff --git a/extensions/cpsection/aboutme/__init__.py b/extensions/cpsection/aboutme/__init__.py
index 98843e1..7ded428 100644
--- a/extensions/cpsection/aboutme/__init__.py
+++ b/extensions/cpsection/aboutme/__init__.py
@@ -24,5 +24,3 @@ ICON = 'module-about_me'
TITLE = _('About Me')
client = gconf.client_get_default()
COLOR = XoColor(client.get_string('/desktop/sugar/user/color'))
-
-
diff --git a/extensions/cpsection/aboutme/model.py b/extensions/cpsection/aboutme/model.py
index 078fff4..fd7261c 100644
--- a/extensions/cpsection/aboutme/model.py
+++ b/extensions/cpsection/aboutme/model.py
@@ -18,6 +18,7 @@
from gettext import gettext as _
import gconf
+
_COLORS = {'red': {'dark':'#b20008', 'medium':'#e6000a', 'light':'#ffadce'},
'orange': {'dark':'#9a5200', 'medium':'#c97e00', 'light':'#ffc169'},
'yellow': {'dark':'#807500', 'medium':'#be9e00', 'light':'#fffa00'},
@@ -28,13 +29,16 @@ _COLORS = {'red': {'dark':'#b20008', 'medium':'#e6000a', 'light':'#ffadce'},
_MODIFIERS = ('dark', 'medium', 'light')
+
def get_nick():
client = gconf.client_get_default()
return client.get_string("/desktop/sugar/user/nick")
+
def print_nick():
print get_nick()
+
def set_nick(nick):
"""Set the nickname.
nick : e.g. 'walter'
@@ -47,10 +51,12 @@ def set_nick(nick):
client.set_string("/desktop/sugar/user/nick", nick)
return 1
+
def get_color():
client = gconf.client_get_default()
return client.get_string("/desktop/sugar/user/color")
+
def print_color():
color_string = get_color()
tmp = color_string.split(',')
@@ -74,6 +80,7 @@ def print_color():
else:
print _('fill: %s') % (tmp[1])
+
def set_color(stroke, fill, stroke_modifier='medium', fill_modifier='medium'):
"""Set the system color by setting a fill and stroke color.
fill : [red, orange, yellow, blue, green, purple]
@@ -102,10 +109,12 @@ def set_color(stroke, fill, stroke_modifier='medium', fill_modifier='medium'):
client.set_string("/desktop/sugar/user/color", color)
return 1
+
def get_color_xo():
client = gconf.client_get_default()
return client.get_string("/desktop/sugar/user/color")
+
def set_color_xo(color):
"""Set a color with an XoColor
This method is used by the graphical user interface
diff --git a/extensions/cpsection/datetime/model.py b/extensions/cpsection/datetime/model.py
index a928b41..39d5e5e 100644
--- a/extensions/cpsection/datetime/model.py
+++ b/extensions/cpsection/datetime/model.py
@@ -26,6 +26,7 @@ import gconf
_zone_tab = '/usr/share/zoneinfo/zone.tab'
+
def _initialize():
'''Initialize the docstring of the set function'''
if set_timezone.__doc__ is None:
@@ -36,6 +37,7 @@ def _initialize():
for timezone in timezones:
set_timezone.__doc__ += timezone + '\n'
+
def read_all_timezones(fn=_zone_tab):
fd = open (fn, 'r')
lines = fd.readlines()
@@ -67,13 +69,16 @@ def read_all_timezones(fn=_zone_tab):
timezones.append(tz)
return timezones
+
def get_timezone():
client = gconf.client_get_default()
return client.get_string('/desktop/sugar/date/timezone')
+
def print_timezone():
print get_timezone()
+
def set_timezone(timezone):
"""Set the system timezone
timezone : e.g. 'America/Los_Angeles'
@@ -89,4 +94,3 @@ def set_timezone(timezone):
# inilialize the docstrings for the timezone
_initialize()
-
diff --git a/extensions/cpsection/datetime/view.py b/extensions/cpsection/datetime/view.py
index a2c4c78..72fdad1 100644
--- a/extensions/cpsection/datetime/view.py
+++ b/extensions/cpsection/datetime/view.py
@@ -24,6 +24,7 @@ from sugar.graphics import iconentry
from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert
+
class TimeZone(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
diff --git a/extensions/cpsection/frame/model.py b/extensions/cpsection/frame/model.py
index 765d183..de2da5e 100644
--- a/extensions/cpsection/frame/model.py
+++ b/extensions/cpsection/frame/model.py
@@ -18,14 +18,17 @@
from gettext import gettext as _
import gconf
+
def get_corner_delay():
client = gconf.client_get_default()
corner_delay = client.get_int('/desktop/sugar/frame/corner_delay')
return corner_delay
+
def print_corner_delay():
print get_corner_delay()
+
def set_corner_delay(delay):
"""Set a delay for the activation of the frame using hot corners.
instantaneous: 0 (0 milliseconds)
@@ -40,14 +43,17 @@ def set_corner_delay(delay):
client.set_int('/desktop/sugar/frame/corner_delay', int(delay))
return 0
+
def get_edge_delay():
client = gconf.client_get_default()
edge_delay = client.get_int('/desktop/sugar/frame/edge_delay')
return edge_delay
+
def print_edge_delay():
print get_edge_delay()
+
def set_edge_delay(delay):
"""Set a delay for the activation of the frame using warm edges.
instantaneous: 0 (0 milliseconds)
diff --git a/extensions/cpsection/frame/view.py b/extensions/cpsection/frame/view.py
index d9e1a6a..fb2b6b7 100644
--- a/extensions/cpsection/frame/view.py
+++ b/extensions/cpsection/frame/view.py
@@ -23,11 +23,13 @@ from sugar.graphics import style
from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert
+
_never = _('never')
_instantaneous = _('instantaneous')
_seconds_label = _('%s seconds')
_MAX_DELAY = 1000
+
class Frame(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
diff --git a/extensions/cpsection/keyboard/__init__.py b/extensions/cpsection/keyboard/__init__.py
index 568e7a5..065086c 100644
--- a/extensions/cpsection/keyboard/__init__.py
+++ b/extensions/cpsection/keyboard/__init__.py
@@ -19,4 +19,3 @@ from gettext import gettext as _
CLASS = 'Keyboard'
ICON = 'module-keyboard'
TITLE = _('Keyboard')
-
diff --git a/extensions/cpsection/keyboard/model.py b/extensions/cpsection/keyboard/model.py
index 4c44740..b7186e2 100644
--- a/extensions/cpsection/keyboard/model.py
+++ b/extensions/cpsection/keyboard/model.py
@@ -26,6 +26,7 @@ _LAYOUTS_KEY = '/desktop/sugar/peripherals/keyboard/layouts'
_OPTIONS_KEY = '/desktop/sugar/peripherals/keyboard/options'
_MODEL_KEY = '/desktop/sugar/peripherals/keyboard/model'
+
class KeyboardManager(object):
def __init__(self, display):
self._engine = xklavier.Engine(display)
@@ -166,4 +167,3 @@ class KeyboardManager(object):
self._configrec.set_layouts(layouts_list)
self._configrec.set_variants(variants_list)
self._configrec.activate(self._engine)
-
diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py
index bcc98d8..51062fd 100644
--- a/extensions/cpsection/keyboard/view.py
+++ b/extensions/cpsection/keyboard/view.py
@@ -26,6 +26,7 @@ from sugar.graphics.icon import Icon
from jarabe.controlpanel.sectionview import SectionView
+
CLASS = 'Language'
ICON = 'module-keyboard'
TITLE = _('Keyboard')
@@ -37,6 +38,7 @@ _APPLY_TIMEOUT = 500
# once python-xklavier has been packaged for all major distributions
# For more information, see: http://dev.sugarlabs.org/ticket/407
+
class LayoutCombo(gtk.HBox):
"""
@@ -306,7 +308,6 @@ class Keyboard(SectionView):
except Exception:
logging.exception('Could not set new keyboard group switch option')
-
return False
def _setup_layouts(self):
@@ -417,10 +418,8 @@ class Keyboard(SectionView):
return False
-
def undo(self):
"""Reverts back to the original keyboard configuration"""
self._keyboard_manager.set_model(self._kmodel)
self._keyboard_manager.set_layouts(self._klayouts)
self._keyboard_manager.set_option_group(self._group_switch_option)
-
diff --git a/extensions/cpsection/language/__init__.py b/extensions/cpsection/language/__init__.py
index a8f9f08..c93b7d1 100644
--- a/extensions/cpsection/language/__init__.py
+++ b/extensions/cpsection/language/__init__.py
@@ -19,4 +19,3 @@ from gettext import gettext as _
CLASS = 'Language'
ICON = 'module-language'
TITLE = _('Language')
-
diff --git a/extensions/cpsection/language/model.py b/extensions/cpsection/language/model.py
index bd61ed1..c6f4847 100644
--- a/extensions/cpsection/language/model.py
+++ b/extensions/cpsection/language/model.py
@@ -25,9 +25,11 @@ import locale
from gettext import gettext as _
import subprocess
+
_default_lang = '%s.%s' % locale.getdefaultlocale()
_standard_msg = _("Could not access ~/.i18n. Create standard settings.")
+
def read_all_languages():
fdp = subprocess.Popen(['locale', '-av'], stdout=subprocess.PIPE)
lines = fdp.stdout.read().split('\n')
@@ -52,6 +54,7 @@ def read_all_languages():
locales.sort()
return locales
+
def _initialize():
if set_languages.__doc__ is None:
# when running under 'python -OO', all __doc__ fields are None,
@@ -63,6 +66,7 @@ def _initialize():
set_languages.__doc__ += '%s \n' % (lang[0].replace(' ', '_') + '/' +
lang[1].replace(' ', '_'))
+
def _write_i18n(langs):
colon = ':'
langstr = colon.join(langs)
@@ -79,6 +83,7 @@ def _write_i18n(langs):
fd.write('LANGUAGE="%s"\n' % langstr)
fd.close()
+
def get_languages():
path = os.path.join(os.environ.get("HOME"), '.i18n')
if not os.access(path, os.R_OK):
@@ -109,6 +114,7 @@ def get_languages():
else:
return langlist
+
def print_languages():
codes = get_languages()
@@ -124,6 +130,7 @@ def print_languages():
if not found_lang:
print (_("Language for code=%s could not be determined.") % code)
+
def set_languages(languages):
"""Set the system language.
languages :
@@ -146,6 +153,6 @@ def set_languages(languages):
else:
_write_i18n(languages)
+
# inilialize the docstrings for the language
_initialize()
-
diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py
index 4ce7196..3a1f1a5 100644
--- a/extensions/cpsection/language/view.py
+++ b/extensions/cpsection/language/view.py
@@ -32,6 +32,7 @@ CLASS = 'Language'
ICON = 'module-language'
TITLE = gettext.gettext('Language')
+
class Language(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
@@ -99,7 +100,6 @@ class Language(SectionView):
self._attach_to_table(label, 0, 1, padding=1)
label.show()
-
store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
for language, country, code in self._available_locales:
description = '%s (%s)' % (_translate_language(language), \
@@ -271,7 +271,6 @@ class Language(SectionView):
else:
remove_button.props.visible = True
-
def __lang_timeout_cb(self, codes):
self._lang_sid = 0
self._model.set_languages(codes)
diff --git a/extensions/cpsection/modemconfiguration/__init__.py b/extensions/cpsection/modemconfiguration/__init__.py
index 8a219dc..61f5904 100644
--- a/extensions/cpsection/modemconfiguration/__init__.py
+++ b/extensions/cpsection/modemconfiguration/__init__.py
@@ -19,4 +19,3 @@ from gettext import gettext as _
CLASS = 'ModemConfiguration'
ICON = 'module-modemconfiguration'
TITLE = _('Modem Configuration')
-
diff --git a/extensions/cpsection/modemconfiguration/model.py b/extensions/cpsection/modemconfiguration/model.py
index 2545ce1..1e83c44 100755
--- a/extensions/cpsection/modemconfiguration/model.py
+++ b/extensions/cpsection/modemconfiguration/model.py
@@ -20,51 +20,62 @@ from jarabe.model.network import GSM_USERNAME_PATH, GSM_PASSWORD_PATH, \
GSM_NUMBER_PATH, GSM_APN_PATH, GSM_PIN_PATH, \
GSM_PUK_PATH
+
def get_username():
client = gconf.client_get_default()
return client.get_string(GSM_USERNAME_PATH) or ''
+
def get_password():
client = gconf.client_get_default()
return client.get_string(GSM_PASSWORD_PATH) or ''
+
def get_number():
client = gconf.client_get_default()
return client.get_string(GSM_NUMBER_PATH) or ''
+
def get_apn():
client = gconf.client_get_default()
return client.get_string(GSM_APN_PATH) or ''
+
def get_pin():
client = gconf.client_get_default()
return client.get_string(GSM_PIN_PATH) or ''
+
def get_puk():
client = gconf.client_get_default()
return client.get_string(GSM_PUK_PATH) or ''
+
def set_username(username):
client = gconf.client_get_default()
client.set_string(GSM_USERNAME_PATH, username)
+
def set_password(password):
client = gconf.client_get_default()
client.set_string(GSM_PASSWORD_PATH, password)
+
def set_number(number):
client = gconf.client_get_default()
client.set_string(GSM_NUMBER_PATH, number)
+
def set_apn(apn):
client = gconf.client_get_default()
client.set_string(GSM_APN_PATH, apn)
+
def set_pin(pin):
client = gconf.client_get_default()
client.set_string(GSM_PIN_PATH, pin)
+
def set_puk(puk):
client = gconf.client_get_default()
client.set_string(GSM_PUK_PATH, puk)
-
diff --git a/extensions/cpsection/modemconfiguration/view.py b/extensions/cpsection/modemconfiguration/view.py
index af8f332..11396d7 100644
--- a/extensions/cpsection/modemconfiguration/view.py
+++ b/extensions/cpsection/modemconfiguration/view.py
@@ -25,8 +25,10 @@ from sugar.graphics import style
from jarabe.controlpanel.sectionview import SectionView
+
APPLY_TIMEOUT = 1000
+
class EntryWithLabel(gtk.HBox):
__gtype_name__ = "SugarEntryWithLabel"
@@ -86,6 +88,7 @@ class EntryWithLabel(gtk.HBox):
return self._is_valid
is_valid = gobject.property(type=bool, getter=_get_is_valid, default=True)
+
class UsernameEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Username:'))
@@ -97,6 +100,7 @@ class UsernameEntry(EntryWithLabel):
def set_value(self, username):
self._model.set_username(username)
+
class PasswordEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Password:'))
@@ -108,6 +112,7 @@ class PasswordEntry(EntryWithLabel):
def set_value(self, password):
self._model.set_password(password)
+
class NumberEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Number:'))
@@ -119,6 +124,7 @@ class NumberEntry(EntryWithLabel):
def set_value(self, number):
self._model.set_number(number)
+
class ApnEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Access Point Name (APN):'))
@@ -130,6 +136,7 @@ class ApnEntry(EntryWithLabel):
def set_value(self, apn):
self._model.set_apn(apn)
+
class PinEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Personal Identity Number (PIN):'))
@@ -141,6 +148,7 @@ class PinEntry(EntryWithLabel):
def set_value(self, pin):
self._model.set_pin(pin)
+
class PukEntry(EntryWithLabel):
def __init__(self, model):
EntryWithLabel.__init__(self, _('Personal Unblocking Key (PUK):'))
@@ -247,4 +255,3 @@ class ModemConfiguration(SectionView):
if entry.is_valid:
self.needs_restart = True
self._validate()
-
diff --git a/extensions/cpsection/network/__init__.py b/extensions/cpsection/network/__init__.py
index 8fea274..86546f7 100644
--- a/extensions/cpsection/network/__init__.py
+++ b/extensions/cpsection/network/__init__.py
@@ -20,6 +20,3 @@ CLASS = 'Network'
ICON = 'module-network'
TITLE = _('Network')
KEYWORDS = ['network', 'jabber', 'radio', 'server']
-
-
-
diff --git a/extensions/cpsection/network/model.py b/extensions/cpsection/network/model.py
index aad0607..c1e7229 100644
--- a/extensions/cpsection/network/model.py
+++ b/extensions/cpsection/network/model.py
@@ -25,19 +25,24 @@ _NM_IFACE = 'org.freedesktop.NetworkManager'
KEYWORDS = ['network', 'jabber', 'radio', 'server']
+
class ReadError(Exception):
def __init__(self, value):
self.value = value
+
def __str__(self):
return repr(self.value)
+
def get_jabber():
client = gconf.client_get_default()
return client.get_string('/desktop/sugar/collaboration/jabber_server')
+
def print_jabber():
print get_jabber()
+
def set_jabber(server):
"""Set the jabber server
server : e.g. 'olpc.collabora.co.uk'
@@ -47,6 +52,7 @@ def set_jabber(server):
return 0
+
def get_radio():
try:
bus = dbus.SystemBus()
@@ -61,9 +67,11 @@ def get_radio():
else:
raise ReadError(_('State is unknown.'))
+
def print_radio():
print ('off', 'on')[get_radio()]
+
def set_radio(state):
"""Turn Radio 'on' or 'off'
state : 'on/off'
@@ -89,6 +97,7 @@ def set_radio(state):
return 0
+
def clear_registration():
"""Clear the registration with the schoolserver
"""
@@ -96,19 +105,23 @@ def clear_registration():
client.set_string('/desktop/sugar/backup_url', '')
return 1
+
def clear_networks():
"""Clear saved passwords and network configurations.
"""
pass
+
def get_publish_information():
client = gconf.client_get_default()
publish = client.get_bool('/desktop/sugar/collaboration/publish_gadget')
return publish
+
def print_publish_information():
print get_publish_information()
+
def set_publish_information(value):
""" If set to true, Sugar will make you searchable for
the other users of the Jabber server.
diff --git a/extensions/cpsection/network/view.py b/extensions/cpsection/network/view.py
index a331bbd..447a51d 100644
--- a/extensions/cpsection/network/view.py
+++ b/extensions/cpsection/network/view.py
@@ -23,12 +23,14 @@ from sugar.graphics import style
from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert
+
CLASS = 'Network'
ICON = 'module-network'
TITLE = _('Network')
_APPLY_TIMEOUT = 3000
+
class Network(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
diff --git a/extensions/cpsection/power/__init__.py b/extensions/cpsection/power/__init__.py
index 8b2e85f..35f7efd 100644
--- a/extensions/cpsection/power/__init__.py
+++ b/extensions/cpsection/power/__init__.py
@@ -20,4 +20,3 @@ CLASS = 'Power'
ICON = 'module-power'
TITLE = _('Power')
KEYWORDS = ['automatic', 'extreme', 'power', 'suspend', 'battery']
-
diff --git a/extensions/cpsection/power/model.py b/extensions/cpsection/power/model.py
index 6c03ca8..ffbb5a2 100644
--- a/extensions/cpsection/power/model.py
+++ b/extensions/cpsection/power/model.py
@@ -35,14 +35,17 @@ _logger = logging.getLogger('ControlPanel - Power')
class ReadError(Exception):
def __init__(self, value):
self.value = value
+
def __str__(self):
return repr(self.value)
+
def using_powerd():
# directory exists if powerd running, and it's recent
# enough to be controllable.
return os.access(POWERD_FLAG_DIR, os.W_OK)
+
def get_automatic_pm():
if using_powerd():
return not os.access(POWERD_INHIBIT_FLAG, os.R_OK)
@@ -51,9 +54,11 @@ def get_automatic_pm():
client = gconf.client_get_default()
return client.get_bool('/desktop/sugar/power/automatic')
+
def print_automatic_pm():
print ('off', 'on')[get_automatic_pm()]
+
def set_automatic_pm(enabled):
"""Automatic suspends on/off."""
@@ -88,13 +93,16 @@ def set_automatic_pm(enabled):
client.set_bool('/desktop/sugar/power/automatic', enabled)
return
+
def get_extreme_pm():
client = gconf.client_get_default()
return client.get_bool('/desktop/sugar/power/extreme')
+
def print_extreme_pm():
print ('off', 'on')[get_extreme_pm()]
+
def set_extreme_pm(enabled):
"""Extreme power management on/off."""
diff --git a/extensions/cpsection/power/view.py b/extensions/cpsection/power/view.py
index 8f1ed56..fd89efa 100644
--- a/extensions/cpsection/power/view.py
+++ b/extensions/cpsection/power/view.py
@@ -22,6 +22,7 @@ from sugar.graphics import style
from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert
+
class Power(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
index 4cb90ed..7db49fe 100755
--- a/extensions/cpsection/updater/model.py
+++ b/extensions/cpsection/updater/model.py
@@ -216,6 +216,7 @@ class UpdateModel(gobject.GObject):
self._bundles_to_update = None
self._cancelling = False
+
class BundleUpdate(object):
def __init__(self, bundle, version, link, size):
diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
index 31a5737..2bec3f0 100644
--- a/extensions/cpsection/updater/view.py
+++ b/extensions/cpsection/updater/view.py
@@ -179,6 +179,7 @@ class ActivityUpdater(SectionView):
def undo(self):
self._model.cancel()
+
class ProgressPane(gtk.VBox):
'''Container which replaces the `ActivityPane` during refresh or
install.'''
diff --git a/extensions/deviceicon/battery.py b/extensions/deviceicon/battery.py
index 8b1bac8..c1c920b 100644
--- a/extensions/deviceicon/battery.py
+++ b/extensions/deviceicon/battery.py
@@ -30,6 +30,7 @@ from sugar.graphics.xocolor import XoColor
from jarabe.frame.frameinvoker import FrameWidgetInvoker
+
_ICON_NAME = 'battery'
_STATUS_CHARGING = 0
@@ -42,6 +43,7 @@ _CHARGING_PROP = 'battery.rechargeable.is_charging'
_DISCHARGING_PROP = 'battery.rechargeable.is_discharging'
_PRESENT_PROP = 'battery.present'
+
class DeviceView(TrayIcon):
FRAME_POSITION_RELATIVE = 102
@@ -101,6 +103,7 @@ class DeviceView(TrayIcon):
def _battery_status_changed_cb(self, pspec, param):
self._update_info()
+
class BatteryPalette(Palette):
def __init__(self, primary_text):
@@ -155,6 +158,7 @@ class BatteryPalette(Palette):
self.props.secondary_text = secondary_text
self._status_label.set_text(status_text)
+
class DeviceModel(gobject.GObject):
__gproperties__ = {
'level' : (int, None, None, 0, 100, 0,
@@ -241,6 +245,7 @@ class DeviceModel(gobject.GObject):
self._present = self._get_present()
self.notify('present')
+
def setup(tray):
bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
proxy = bus.get_object('org.freedesktop.Hal',
diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py
index 447cad5..55e334f 100644
--- a/extensions/deviceicon/network.py
+++ b/extensions/deviceicon/network.py
@@ -49,6 +49,7 @@ from jarabe.model.network import IP4Config
from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.view.pulsingicon import PulsingIcon
+
IP_ADDRESS_TEXT_TEMPLATE = _("IP address: %s")
_NM_SERVICE = 'org.freedesktop.NetworkManager'
@@ -199,6 +200,7 @@ class WiredPalette(Palette):
ip_address_text = ""
self._ip_address_label.set_text(ip_address_text)
+
class GsmPalette(Palette):
__gtype_name__ = 'SugarGsmPalette'
@@ -749,6 +751,7 @@ class GsmDeviceView(TrayIcon):
signal_name='PppStats',
path=self._device.object_path,
dbus_interface=_NM_SERIAL_IFACE)
+
def create_palette(self):
palette = GsmPalette()
@@ -1001,6 +1004,7 @@ class WiredDeviceObserver(object):
del self._device_view
self._device_view = None
+
class GsmDeviceObserver(object):
def __init__(self, device, tray):
self._device = device
@@ -1015,6 +1019,7 @@ class GsmDeviceObserver(object):
self._tray.remove_device(self._device_view)
self._device_view = None
+
class NetworkManagerObserver(object):
def __init__(self, tray):
self._bus = dbus.SystemBus()
@@ -1073,5 +1078,6 @@ class NetworkManagerObserver(object):
device.disconnect()
del self._devices[device_op]
+
def setup(tray):
device_observer = NetworkManagerObserver(tray)
diff --git a/extensions/deviceicon/speaker.py b/extensions/deviceicon/speaker.py
index cf06e01..ae84036 100644
--- a/extensions/deviceicon/speaker.py
+++ b/extensions/deviceicon/speaker.py
@@ -32,6 +32,7 @@ from jarabe.model import sound
_ICON_NAME = 'speaker'
+
class DeviceView(TrayIcon):
FRAME_POSITION_RELATIVE = 103
@@ -86,6 +87,7 @@ class DeviceView(TrayIcon):
def __speaker_status_changed_cb(self, pspec_, param_):
self._update_info()
+
class SpeakerPalette(Palette):
def __init__(self, primary_text, model):
@@ -167,6 +169,7 @@ class SpeakerPalette(Palette):
self._update_level()
self._update_muted()
+
class DeviceModel(gobject.GObject):
__gproperties__ = {
'level' : (int, None, None, 0, 100, 0, gobject.PARAM_READWRITE),
@@ -212,5 +215,6 @@ class DeviceModel(gobject.GObject):
elif pspec.name == "muted":
self._set_muted(value)
+
def setup(tray):
tray.add_device(DeviceView())
diff --git a/extensions/deviceicon/volume.py b/extensions/deviceicon/volume.py
index e7f62a2..ea2377d 100644
--- a/extensions/deviceicon/volume.py
+++ b/extensions/deviceicon/volume.py
@@ -28,8 +28,10 @@ from jarabe.journal import journalactivity
from jarabe.view.palettes import VolumePalette
from jarabe.frame.frameinvoker import FrameWidgetInvoker
+
_icons = {}
+
class DeviceView(TrayIcon):
FRAME_POSITION_RELATIVE = 500
@@ -70,9 +72,11 @@ class DeviceView(TrayIcon):
journal.reveal()
return True
+
def setup(tray):
gobject.idle_add(_setup_volumes, tray)
+
def _setup_volumes(tray):
volume_monitor = gio.volume_monitor_get()
@@ -86,9 +90,11 @@ def _setup_volumes(tray):
volume_monitor.connect('mount-added', _mount_added_cb, tray)
volume_monitor.connect('mount-removed', _mount_removed_cb, tray)
+
def _volume_added_cb(volume_monitor, volume, tray):
_mount(volume, tray)
+
def _mount(volume, tray):
# Follow Nautilus behaviour here
# since it has the same issue with removable device
@@ -102,20 +108,23 @@ def _mount(volume, tray):
#TODO: pass None as mount_operation, or better, SugarMountOperation
volume.mount(gtk.MountOperation(tray.get_toplevel()), _mount_cb)
+
def _mount_cb(volume, result):
logging.debug('_mount_cb %r %r', volume, result)
volume.mount_finish(result)
+
def _mount_added_cb(volume_monitor, mount, tray):
_add_device(mount, tray)
+
def _mount_removed_cb(volume_monitor, mount, tray):
icon = _icons[mount]
tray.remove_device(icon)
del _icons[mount]
+
def _add_device(mount, tray):
icon = DeviceView(mount)
_icons[mount] = icon
tray.add_device(icon)
-
diff --git a/extensions/globalkey/screenshot.py b/extensions/globalkey/screenshot.py
index 8b4d4c2..b62806f 100644
--- a/extensions/globalkey/screenshot.py
+++ b/extensions/globalkey/screenshot.py
@@ -31,6 +31,7 @@ from jarabe.model import shell
BOUND_KEYS = ['<alt>1', 'Print']
+
def handle_key_press(key):
tmp_dir = os.path.join(env.get_profile_path(), 'data')
fd, file_path = tempfile.mkstemp(dir=tmp_dir)
@@ -87,14 +88,15 @@ def handle_key_press(key):
jobject.destroy()
del jobject
+
def _get_preview_data(screenshot):
preview = screenshot.scale_simple(style.zoom(300), style.zoom(225),
gtk.gdk.INTERP_BILINEAR)
preview_data = []
+
def save_func(buf, data):
data.append(buf)
preview.save_to_callback(save_func, 'png', user_data=preview_data)
return dbus.ByteArray(''.join(preview_data))
-
diff --git a/extensions/globalkey/viewsource.py b/extensions/globalkey/viewsource.py
index df3cd9e..96e7c6b 100644
--- a/extensions/globalkey/viewsource.py
+++ b/extensions/globalkey/viewsource.py
@@ -18,8 +18,10 @@
from jarabe.view.viewsource import setup_view_source
from jarabe.model import shell
+
BOUND_KEYS = ['0xEC', '<alt><shift>v']
+
def handle_key_press(key):
shell_model = shell.get_model()
activity = shell_model.get_active_activity()
diff --git a/src/jarabe/__init__.py b/src/jarabe/__init__.py
index 41b4b1c..ed2f639 100644
--- a/src/jarabe/__init__.py
+++ b/src/jarabe/__init__.py
@@ -23,4 +23,3 @@ refer to a command-line "shell" interface.
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/controlpanel/__init__.py b/src/jarabe/controlpanel/__init__.py
index a9dd95a..85f6a24 100644
--- a/src/jarabe/controlpanel/__init__.py
+++ b/src/jarabe/controlpanel/__init__.py
@@ -13,4 +13,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/controlpanel/cmd.py b/src/jarabe/controlpanel/cmd.py
index 7144b33..6d5f127 100644
--- a/src/jarabe/controlpanel/cmd.py
+++ b/src/jarabe/controlpanel/cmd.py
@@ -23,6 +23,7 @@ import logging
from jarabe import config
+
_RESTART = 1
_same_option_warning = _("sugar-control-panel: WARNING, found more than"
@@ -30,6 +31,7 @@ _same_option_warning = _("sugar-control-panel: WARNING, found more than"
_no_option_error = _("sugar-control-panel: key=%s not an available option")
_general_error = _("sugar-control-panel: %s")
+
def cmd_help():
'''Print the help to the screen'''
# TRANS: Translators, there's a empty line at the end of this string,
@@ -45,11 +47,13 @@ def cmd_help():
-c key clear the current value for the key \n\
')
+
def note_restart():
'''Instructions how to restart sugar'''
print _('To apply your changes you have to restart sugar.\n' +
'Hit ctrl+alt+erase on the keyboard to trigger a restart.')
+
def load_modules():
'''Build a list of pointers to available modules and import them.
'''
@@ -72,6 +76,7 @@ def load_modules():
return modules
+
def main():
try:
options, args = getopt.getopt(sys.argv[1:], "h:s:g:c:l", [])
diff --git a/src/jarabe/controlpanel/gui.py b/src/jarabe/controlpanel/gui.py
index 51d9820..4e2cbd1 100644
--- a/src/jarabe/controlpanel/gui.py
+++ b/src/jarabe/controlpanel/gui.py
@@ -32,9 +32,11 @@ from jarabe.controlpanel.toolbar import MainToolbar
from jarabe.controlpanel.toolbar import SectionToolbar
from jarabe import config
+
_logger = logging.getLogger('ControlPanel')
_MAX_COLUMNS = 5
+
class ControlPanel(gtk.Window):
__gtype_name__ = 'SugarControlPanel'
@@ -333,6 +335,7 @@ class ControlPanel(gtk.Window):
section_is_valid = section_view.props.is_valid
self._section_toolbar.accept_button.set_sensitive(section_is_valid)
+
class ModelWrapper(object):
def __init__(self, module):
self._module = module
@@ -360,6 +363,7 @@ class ModelWrapper(object):
except Exception, detail:
_logger.debug('Error undo option: %s', detail)
+
class _SectionIcon(gtk.EventBox):
__gtype_name__ = "SugarSectionIcon"
diff --git a/src/jarabe/controlpanel/inlinealert.py b/src/jarabe/controlpanel/inlinealert.py
index b1880da..9c08c62 100644
--- a/src/jarabe/controlpanel/inlinealert.py
+++ b/src/jarabe/controlpanel/inlinealert.py
@@ -21,6 +21,7 @@ import pango
from sugar.graphics import style
from sugar.graphics.icon import Icon
+
class InlineAlert(gtk.HBox):
"""UI interface for Inline alerts
@@ -80,4 +81,3 @@ class InlineAlert(gtk.HBox):
def do_get_property(self, pspec):
if pspec.name == 'msg':
return self._msg
-
diff --git a/src/jarabe/controlpanel/sectionview.py b/src/jarabe/controlpanel/sectionview.py
index 4de27a2..5b44161 100644
--- a/src/jarabe/controlpanel/sectionview.py
+++ b/src/jarabe/controlpanel/sectionview.py
@@ -18,6 +18,7 @@ import gobject
import gtk
from gettext import gettext as _
+
class SectionView(gtk.VBox):
__gtype_name__ = 'SugarSectionView'
diff --git a/src/jarabe/controlpanel/toolbar.py b/src/jarabe/controlpanel/toolbar.py
index 320a8eb..72b1be3 100644
--- a/src/jarabe/controlpanel/toolbar.py
+++ b/src/jarabe/controlpanel/toolbar.py
@@ -25,6 +25,7 @@ from sugar.graphics.toolbutton import ToolButton
from sugar.graphics import iconentry
from sugar.graphics import style
+
class MainToolbar(gtk.Toolbar):
""" Main toolbar of the control panel
"""
@@ -38,6 +39,7 @@ class MainToolbar(gtk.Toolbar):
gobject.TYPE_NONE,
([str]))
}
+
def __init__(self):
gtk.Toolbar.__init__(self)
@@ -83,6 +85,7 @@ class MainToolbar(gtk.Toolbar):
def __stop_clicked_cb(self, button):
self.emit('stop-clicked')
+
class SectionToolbar(gtk.Toolbar):
""" Toolbar of the sections of the control panel
"""
@@ -96,6 +99,7 @@ class SectionToolbar(gtk.Toolbar):
gobject.TYPE_NONE,
([]))
}
+
def __init__(self):
gtk.Toolbar.__init__(self)
@@ -154,4 +158,3 @@ class SectionToolbar(gtk.Toolbar):
def __accept_button_clicked_cb(self, widget, data=None):
self.emit('accept-clicked')
-
diff --git a/src/jarabe/desktop/__init__.py b/src/jarabe/desktop/__init__.py
index a9dd95a..85f6a24 100644
--- a/src/jarabe/desktop/__init__.py
+++ b/src/jarabe/desktop/__init__.py
@@ -13,4 +13,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
index 56b3b5f..9476370 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -38,6 +38,7 @@ from jarabe.view.palettes import ActivityPalette
from jarabe.view import launcher
from jarabe.journal import misc
+
class ActivitiesTreeView(gtk.TreeView):
__gtype_name__ = 'SugarActivitiesTreeView'
@@ -154,6 +155,7 @@ class ActivitiesTreeView(gtk.TreeView):
title = model[tree_iter][ListModel.COLUMN_TITLE]
return title is not None and title.lower().find(self._query) > -1
+
class ListModel(gtk.TreeModelSort):
__gtype_name__ = 'SugarListModel'
@@ -238,6 +240,7 @@ class ListModel(gtk.TreeModelSort):
def refilter(self):
self._model_filter.refilter()
+
class CellRendererFavorite(CellRendererIcon):
__gtype_name__ = 'SugarCellRendererFavorite'
@@ -252,6 +255,7 @@ class CellRendererFavorite(CellRendererIcon):
self.props.prelit_stroke_color = style.COLOR_BUTTON_GREY.get_svg()
self.props.prelit_fill_color = style.COLOR_BUTTON_GREY.get_svg()
+
class CellRendererActivityIcon(CellRendererIcon):
__gtype_name__ = 'SugarCellRendererActivityIcon'
@@ -290,6 +294,7 @@ class CellRendererActivityIcon(CellRendererIcon):
def __erase_activated_cb(self, palette, bundle_id):
self.emit('erase-activated', bundle_id)
+
class ActivitiesList(gtk.VBox):
__gtype_name__ = 'SugarActivitiesList'
@@ -373,6 +378,7 @@ class ActivitiesList(gtk.VBox):
bundle = registry.get_bundle(bundle_id)
registry.uninstall(bundle, delete_profile=True)
+
class ActivityListPalette(ActivityPalette):
__gtype_name__ = 'SugarActivityListPalette'
@@ -452,4 +458,3 @@ class ActivityListPalette(ActivityPalette):
def __erase_activate_cb(self, menu_item):
self.emit('erase-activated', self._bundle_id)
-
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index 7b847ac..433dd2d 100644
--- a/src/jarabe/desktop/favoriteslayout.py
+++ b/src/jarabe/desktop/favoriteslayout.py
@@ -29,6 +29,7 @@ from sugar.graphics import style
from jarabe.model import bundleregistry
from jarabe.desktop.grid import Grid
+
_logger = logging.getLogger('FavoritesLayout')
_CELL_SIZE = 4
@@ -109,6 +110,7 @@ class FavoritesLayout(gobject.GObject, hippo.CanvasLayout):
def allow_dnd(self):
return False
+
class RandomLayout(FavoritesLayout):
"""Lay out icons randomly; try to nudge them around to resolve overlaps."""
@@ -189,6 +191,7 @@ class RandomLayout(FavoritesLayout):
def allow_dnd(self):
return True
+
_MINIMUM_RADIUS = style.XLARGE_ICON_SIZE / 2 + style.DEFAULT_SPACING + \
style.STANDARD_ICON_SIZE * 2
_MAXIMUM_RADIUS = (gtk.gdk.screen_height() - style.GRID_CELL_SIZE) / 2 - \
@@ -351,6 +354,7 @@ class RingLayout(FavoritesLayout):
else:
return 0
+
_SUNFLOWER_CONSTANT = style.STANDARD_ICON_SIZE * .75
"""Chose a constant such that STANDARD_ICON_SIZE icons are nicely spaced."""
@@ -376,6 +380,7 @@ This is the golden angle: http://en.wikipedia.org/wiki/Golden_angle
Calculation: math.radians(360) / ( _GOLDEN_RATIO * _GOLDEN_RATIO )
"""
+
class SunflowerLayout(RingLayout):
"""Spiral layout based on Fibonacci ratio in phyllotaxis.
@@ -446,6 +451,7 @@ class SunflowerLayout(RingLayout):
return x, y
+
class BoxLayout(RingLayout):
"""Lay out icons in a square around the XO man."""
@@ -487,6 +493,7 @@ class BoxLayout(RingLayout):
(self, radius, icon_size, index, children_count,
sin=sin, cos=cos)
+
class TriangleLayout(RingLayout):
"""Lay out icons in a triangle around the XO man."""
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index d582433..08c3675 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -48,6 +48,7 @@ from jarabe.desktop import schoolserver
from jarabe.desktop.schoolserver import RegisterError
from jarabe.desktop import favoriteslayout
+
_logger = logging.getLogger('FavoritesView')
_ICON_DND_TARGET = ('activity-icon', gtk.TARGET_SAME_WIDGET, 0)
@@ -509,6 +510,7 @@ class ActivityIcon(CanvasIcon):
self._resume_mode = resume_mode
self._update()
+
class FavoritePalette(ActivityPalette):
__gtype_name__ = 'SugarFavoritePalette'
@@ -557,6 +559,7 @@ class FavoritePalette(ActivityPalette):
if entry is not None:
self.emit('entry-activate', entry)
+
class CurrentActivityIcon(CanvasIcon, hippo.CanvasItem):
def __init__(self):
CanvasIcon.__init__(self, cache=True)
@@ -595,6 +598,7 @@ class CurrentActivityIcon(CanvasIcon, hippo.CanvasItem):
self._home_activity = home_activity
self._update()
+
class OwnerIcon(BuddyIcon):
__gtype_name__ = 'SugarFavoritesOwnerIcon'
@@ -602,6 +606,7 @@ class OwnerIcon(BuddyIcon):
'register-activate' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([]))
}
+
def __init__(self, size):
BuddyIcon.__init__(self, buddy=get_owner_instance(), size=size)
@@ -634,6 +639,7 @@ class OwnerIcon(BuddyIcon):
def remove_register_menu(self):
self.palette.menu.remove(self._register_menu)
+
class FavoritesSetting(object):
_FAVORITES_KEY = "/desktop/sugar/desktop/favorites_layout"
diff --git a/src/jarabe/desktop/friendview.py b/src/jarabe/desktop/friendview.py
index 53b8f5e..8dab35f 100644
--- a/src/jarabe/desktop/friendview.py
+++ b/src/jarabe/desktop/friendview.py
@@ -23,6 +23,7 @@ from sugar.graphics import style
from jarabe.view.buddyicon import BuddyIcon
from jarabe.model import bundleregistry
+
class FriendView(hippo.CanvasBox):
def __init__(self, buddy, **kwargs):
hippo.CanvasBox.__init__(self, **kwargs)
@@ -81,4 +82,3 @@ class FriendView(hippo.CanvasBox):
def __buddy_notify_color_cb(self, buddy, pspec):
# TODO: shouldn't this change self._buddy_icon instead?
self._activity_icon.props.xo_color = buddy.props.color
-
diff --git a/src/jarabe/desktop/grid.py b/src/jarabe/desktop/grid.py
index f3412c9..319ff38 100644
--- a/src/jarabe/desktop/grid.py
+++ b/src/jarabe/desktop/grid.py
@@ -22,17 +22,20 @@ import gtk
from sugar import _sugarext
+
_PLACE_TRIALS = 20
_MAX_WEIGHT = 255
_REFRESH_RATE = 200
_MAX_COLLISIONS_PER_REFRESH = 20
+
class Grid(_sugarext.Grid):
__gsignals__ = {
'child-changed' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT]))
}
+
def __init__(self, width, height):
gobject.GObject.__init__(self)
diff --git a/src/jarabe/desktop/groupbox.py b/src/jarabe/desktop/groupbox.py
index 89043fe..8172f83 100644
--- a/src/jarabe/desktop/groupbox.py
+++ b/src/jarabe/desktop/groupbox.py
@@ -30,8 +30,10 @@ from jarabe.model import friends
from jarabe.desktop.friendview import FriendView
from jarabe.desktop.spreadlayout import SpreadLayout
+
class GroupBox(hippo.Canvas):
__gtype_name__ = 'SugarGroupBox'
+
def __init__(self):
logging.debug("STARTUP: Loading the group view")
diff --git a/src/jarabe/desktop/homebox.py b/src/jarabe/desktop/homebox.py
index 85279ff..beaaf41 100644
--- a/src/jarabe/desktop/homebox.py
+++ b/src/jarabe/desktop/homebox.py
@@ -30,11 +30,13 @@ from sugar.graphics.icon import Icon
from jarabe.desktop import favoritesview
from jarabe.desktop.activitieslist import ActivitiesList
+
_FAVORITES_VIEW = 0
_LIST_VIEW = 1
_AUTOSEARCH_TIMEOUT = 1000
+
class HomeBox(gtk.VBox):
__gtype_name__ = 'SugarHomeBox'
@@ -144,6 +146,7 @@ class HomeBox(gtk.VBox):
def set_resume_mode(self, resume_mode):
self._favorites_view.set_resume_mode(resume_mode)
+
class HomeToolbar(gtk.Toolbar):
__gtype_name__ = 'SugarHomeToolbar'
@@ -246,6 +249,7 @@ class HomeToolbar(gtk.Toolbar):
self.search_entry.activate()
return False
+
class FavoritesButton(RadioToolButton):
__gtype_name__ = 'SugarFavoritesButton'
@@ -295,4 +299,3 @@ class FavoritesButton(RadioToolButton):
def _update_icon(self):
self.props.named_icon = favoritesview.LAYOUT_MAP[self._layout]\
.icon_name
-
diff --git a/src/jarabe/desktop/homewindow.py b/src/jarabe/desktop/homewindow.py
index ae970be..a2ea688 100644
--- a/src/jarabe/desktop/homewindow.py
+++ b/src/jarabe/desktop/homewindow.py
@@ -28,6 +28,7 @@ from jarabe.desktop.transitionbox import TransitionBox
from jarabe.model.shell import ShellModel
from jarabe.model import shell
+
_HOME_PAGE = 0
_GROUP_PAGE = 1
_MESH_PAGE = 2
@@ -192,4 +193,3 @@ def get_instance():
if not _instance:
_instance = HomeWindow()
return _instance
-
diff --git a/src/jarabe/desktop/keydialog.py b/src/jarabe/desktop/keydialog.py
index a83f77b..63099e2 100644
--- a/src/jarabe/desktop/keydialog.py
+++ b/src/jarabe/desktop/keydialog.py
@@ -24,6 +24,7 @@ import dbus
from jarabe.model import network
from jarabe.model.network import Secrets
+
IW_AUTH_ALG_OPEN_SYSTEM = 'open'
IW_AUTH_ALG_SHARED_KEY = 'shared'
@@ -39,6 +40,7 @@ def string_is_hex(key):
is_hex = False
return is_hex
+
def string_is_ascii(string):
try:
string.encode('ascii')
@@ -46,12 +48,14 @@ def string_is_ascii(string):
except UnicodeEncodeError:
return False
+
def string_to_hex(passphrase):
key = ''
for c in passphrase:
key += '%02x' % ord(c)
return key
+
def hash_passphrase(passphrase):
# passphrase must have a length of 64
if len(passphrase) > 64:
@@ -62,11 +66,13 @@ def hash_passphrase(passphrase):
passphrase = hashlib.md5(passphrase).digest()
return string_to_hex(passphrase)[:26]
+
class CanceledKeyRequestError(dbus.DBusException):
def __init__(self):
dbus.DBusException.__init__(self)
self._dbus_error_name = network.NM_SETTINGS_IFACE + '.CanceledError'
+
class KeyDialog(gtk.Dialog):
def __init__(self, ssid, flags, wpa_flags, rsn_flags, dev_caps, settings,
response):
@@ -211,6 +217,7 @@ class WEPKeyDialog(KeyDialog):
self.set_response_sensitive(gtk.RESPONSE_OK, valid)
+
class WPAKeyDialog(KeyDialog):
def __init__(self, ssid, flags, wpa_flags, rsn_flags, dev_caps, settings,
response):
@@ -283,6 +290,7 @@ class WPAKeyDialog(KeyDialog):
self.set_response_sensitive(gtk.RESPONSE_OK, valid)
return False
+
def create(ssid, flags, wpa_flags, rsn_flags, dev_caps, settings, response):
if wpa_flags == network.NM_802_11_AP_SEC_NONE and \
rsn_flags == network.NM_802_11_AP_SEC_NONE:
@@ -296,9 +304,11 @@ def create(ssid, flags, wpa_flags, rsn_flags, dev_caps, settings, response):
key_dialog.connect("destroy", _key_dialog_destroy_cb)
key_dialog.show_all()
+
def _key_dialog_destroy_cb(key_dialog, data=None):
_key_dialog_response_cb(key_dialog, gtk.RESPONSE_CANCEL)
+
def _key_dialog_response_cb(key_dialog, response_id):
response = key_dialog.get_response_object()
secrets = None
@@ -316,4 +326,3 @@ def _key_dialog_response_cb(key_dialog, response_id):
raise RuntimeError("Unhandled key dialog response %d" % response_id)
key_dialog.destroy()
-
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 18e3b1c..ededa6d 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -47,6 +47,7 @@ from jarabe.model.olpcmesh import OlpcMeshManager
from jarabe.model.adhoc import get_adhoc_manager_instance
from jarabe.journal import misc
+
_NM_SERVICE = 'org.freedesktop.NetworkManager'
_NM_IFACE = 'org.freedesktop.NetworkManager'
_NM_PATH = '/org/freedesktop/NetworkManager'
@@ -228,6 +229,7 @@ class DeviceObserver(gobject.GObject):
'access-point-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT]))
}
+
def __init__(self, device):
gobject.GObject.__init__(self)
self._bus = dbus.SystemBus()
diff --git a/src/jarabe/desktop/networkviews.py b/src/jarabe/desktop/networkviews.py
index 87f182f..8cd6303 100644
--- a/src/jarabe/desktop/networkviews.py
+++ b/src/jarabe/desktop/networkviews.py
@@ -41,6 +41,7 @@ from jarabe.model.network import IP4Config
from jarabe.model.network import WirelessSecurity
from jarabe.model.adhoc import get_adhoc_manager_instance
+
_NM_SERVICE = 'org.freedesktop.NetworkManager'
_NM_IFACE = 'org.freedesktop.NetworkManager'
_NM_PATH = '/org/freedesktop/NetworkManager'
@@ -438,6 +439,7 @@ class WirelessNetworkView(CanvasPulsingIcon):
path=self._device.object_path,
dbus_interface=_NM_WIRELESS_IFACE)
+
class SugarAdhocView(CanvasPulsingIcon):
"""To mimic the mesh behavior on devices where mesh hardware is
not available we support the creation of an Ad-hoc network on
@@ -712,4 +714,3 @@ class OlpcMeshView(CanvasPulsingIcon):
signal_name='PropertiesChanged',
path=device_object_path,
dbus_interface=_NM_OLPC_MESH_IFACE)
-
diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py
index f79711e..8dc7d71 100644
--- a/src/jarabe/desktop/schoolserver.py
+++ b/src/jarabe/desktop/schoolserver.py
@@ -33,6 +33,7 @@ from sugar.profile import get_profile
REGISTER_URL = 'http://schoolserver:8080/'
REGISTER_TIMEOUT = 8
+
def generate_serial_number():
""" Generates a serial number based on 3 random uppercase letters
and the last 8 digits of the current unix seconds. """
@@ -48,6 +49,7 @@ def generate_serial_number():
return serial
+
def store_identifiers(serial_number, uuid, backup_url):
""" Stores the serial number, uuid and backup_url
in the identifier folder inside the profile directory
@@ -75,6 +77,7 @@ def store_identifiers(serial_number, uuid, backup_url):
backup_url_file.write(backup_url)
backup_url_file.close()
+
class RegisterError(Exception):
pass
@@ -138,9 +141,11 @@ def register_laptop(url=REGISTER_URL):
return True
+
def have_ofw_tree():
return os.path.exists('/ofw')
+
def read_ofw(path):
path = os.path.join('/ofw', path)
if not os.path.exists(path):
diff --git a/src/jarabe/desktop/snowflakelayout.py b/src/jarabe/desktop/snowflakelayout.py
index 5782cff..e4963ba 100644
--- a/src/jarabe/desktop/snowflakelayout.py
+++ b/src/jarabe/desktop/snowflakelayout.py
@@ -21,11 +21,14 @@ import hippo
from sugar.graphics import style
+
_BASE_DISTANCE = style.zoom(25)
_CHILDREN_FACTOR = style.zoom(3)
+
class SnowflakeLayout(gobject.GObject, hippo.CanvasLayout):
__gtype_name__ = 'SugarSnowflakeLayout'
+
def __init__(self):
gobject.GObject.__init__(self)
self._nflakes = 0
diff --git a/src/jarabe/desktop/spreadlayout.py b/src/jarabe/desktop/spreadlayout.py
index ffc5bc7..9200361 100644
--- a/src/jarabe/desktop/spreadlayout.py
+++ b/src/jarabe/desktop/spreadlayout.py
@@ -22,10 +22,13 @@ from sugar.graphics import style
from jarabe.desktop.grid import Grid
+
_CELL_SIZE = 4.0
+
class SpreadLayout(gobject.GObject, hippo.CanvasLayout):
__gtype_name__ = 'SugarSpreadLayout'
+
def __init__(self):
gobject.GObject.__init__(self)
self._box = None
@@ -80,4 +83,3 @@ class SpreadLayout(gobject.GObject, hippo.CanvasLayout):
def _grid_child_changed_cb(self, grid, child):
child.emit_request_changed()
-
diff --git a/src/jarabe/desktop/transitionbox.py b/src/jarabe/desktop/transitionbox.py
index cf9e0d6..184f62c 100644
--- a/src/jarabe/desktop/transitionbox.py
+++ b/src/jarabe/desktop/transitionbox.py
@@ -23,6 +23,7 @@ from sugar.graphics import animator
from jarabe.model.buddy import get_owner_instance
from jarabe.view.buddyicon import BuddyIcon
+
class _Animation(animator.Animation):
def __init__(self, icon, start_size, end_size):
animator.Animation.__init__(self, 0.0, 1.0)
@@ -35,8 +36,10 @@ class _Animation(animator.Animation):
d = (self.end_size - self.start_size) * current
self._icon.props.size = self.start_size + d
+
class _Layout(gobject.GObject, hippo.CanvasLayout):
__gtype_name__ = 'SugarTransitionBoxLayout'
+
def __init__(self):
gobject.GObject.__init__(self)
self._box = None
@@ -60,6 +63,7 @@ class _Layout(gobject.GObject, hippo.CanvasLayout):
y + (height - child_height) / 2,
child_width, child_height, origin_changed)
+
class TransitionBox(hippo.Canvas):
__gtype_name__ = 'SugarTransitionBox'
diff --git a/src/jarabe/frame/__init__.py b/src/jarabe/frame/__init__.py
index d7aec3d..b3e4b80 100644
--- a/src/jarabe/frame/__init__.py
+++ b/src/jarabe/frame/__init__.py
@@ -16,8 +16,10 @@
from jarabe.frame.frame import Frame
+
_view = None
+
def get_view():
global _view
if not _view:
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 6bd2a1b..05891b4 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -98,7 +98,6 @@ class ActivityButton(RadioToolButton):
self._icon.props.pulsing = False
-
class InviteButton(ToolButton):
"""Invite to shared activity"""
def __init__(self, invite):
@@ -313,6 +312,7 @@ class ActivitiesTray(HTray):
self.add_item(button)
button.show()
+
class BaseTransferButton(ToolButton):
"""Button with a notification attached
"""
@@ -349,6 +349,7 @@ class BaseTransferButton(ToolButton):
filetransfer.FT_REASON_LOCAL_STOPPED:
self.remove()
+
class IncomingTransferButton(BaseTransferButton):
"""UI element representing an ongoing incoming file transfer
"""
@@ -429,6 +430,7 @@ class IncomingTransferButton(BaseTransferButton):
def __dismiss_clicked_cb(self, palette):
self.remove()
+
class OutgoingTransferButton(BaseTransferButton):
"""UI element representing an ongoing outgoing file transfer
"""
@@ -464,6 +466,7 @@ class OutgoingTransferButton(BaseTransferButton):
def __dismiss_clicked_cb(self, palette):
self.remove()
+
class BaseTransferPalette(Palette):
"""Base palette class for frame or notification icon for file transfers
"""
@@ -526,10 +529,12 @@ class BaseTransferPalette(Palette):
total = self._format_size(self.file_transfer.file_size)
self.progress_label.props.label = _('%s of %s') % (transferred, total)
+
class IncomingTransferPalette(BaseTransferPalette):
"""Palette for frame or notification icon for incoming file transfers
"""
__gtype_name__ = "SugarIncomingTransferPalette"
+
def __init__(self, file_transfer):
BaseTransferPalette.__init__(self, file_transfer)
@@ -652,6 +657,7 @@ class IncomingTransferPalette(BaseTransferPalette):
def __dismiss_activate_cb(self, menu_item):
self.emit('dismiss-clicked')
+
class OutgoingTransferPalette(BaseTransferPalette):
"""Palette for frame or notification icon for outgoing file transfers
"""
diff --git a/src/jarabe/frame/clipboardicon.py b/src/jarabe/frame/clipboardicon.py
index 279db08..9c44408 100644
--- a/src/jarabe/frame/clipboardicon.py
+++ b/src/jarabe/frame/clipboardicon.py
@@ -31,6 +31,7 @@ from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.frame.notification import NotificationIcon
import jarabe.frame
+
class ClipboardIcon(RadioToolButton):
__gtype_name__ = 'SugarClipboardIcon'
diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py
index b998110..03c953b 100644
--- a/src/jarabe/frame/clipboardmenu.py
+++ b/src/jarabe/frame/clipboardmenu.py
@@ -35,6 +35,7 @@ from jarabe.frame import clipboard
from jarabe.journal import misc
from jarabe.model import bundleregistry
+
class ClipboardMenu(Palette):
def __init__(self, cb_object):
diff --git a/src/jarabe/frame/clipboardobject.py b/src/jarabe/frame/clipboardobject.py
index e9403f9..90f64e7 100644
--- a/src/jarabe/frame/clipboardobject.py
+++ b/src/jarabe/frame/clipboardobject.py
@@ -24,6 +24,7 @@ from gettext import gettext as _
from sugar import mime
from sugar.bundle.activitybundle import ActivityBundle
+
class ClipboardObject(object):
def __init__(self, object_path, name):
@@ -114,6 +115,7 @@ class ClipboardObject(object):
return format_
+
class Format(object):
def __init__(self, mime_type, data, on_disk):
diff --git a/src/jarabe/frame/clipboardpanelwindow.py b/src/jarabe/frame/clipboardpanelwindow.py
index ac324f4..f7a28a6 100644
--- a/src/jarabe/frame/clipboardpanelwindow.py
+++ b/src/jarabe/frame/clipboardpanelwindow.py
@@ -25,6 +25,7 @@ from jarabe.frame.clipboardtray import ClipboardTray
from jarabe.frame import clipboard
+
class ClipboardPanelWindow(FrameWindow):
def __init__(self, frame, orientation):
FrameWindow.__init__(self, orientation)
@@ -100,4 +101,3 @@ class ClipboardPanelWindow(FrameWindow):
selection.type,
selection.data,
on_disk=False)
-
diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index 8beb6a8..40a1f65 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -27,6 +27,7 @@ from sugar.graphics import style
from jarabe.frame import clipboard
from jarabe.frame.clipboardicon import ClipboardIcon
+
class _ContextMap(object):
"""Maps a drag context to the clipboard object involved in the dragging."""
def __init__(self):
@@ -56,6 +57,7 @@ class _ContextMap(object):
def has_context(self, context):
return context in self._context_map
+
class ClipboardTray(tray.VTray):
MAX_ITEMS = gtk.gdk.screen_height() / style.GRID_CELL_SIZE - 2
@@ -213,4 +215,3 @@ class ClipboardTray(tray.VTray):
return True
else:
return False
-
diff --git a/src/jarabe/frame/devicestray.py b/src/jarabe/frame/devicestray.py
index 72affe3..1acde21 100644
--- a/src/jarabe/frame/devicestray.py
+++ b/src/jarabe/frame/devicestray.py
@@ -23,6 +23,7 @@ from sugar.graphics import tray
from jarabe import config
+
class DevicesTray(tray.HTray):
def __init__(self):
tray.HTray.__init__(self, align=tray.ALIGN_TO_END)
diff --git a/src/jarabe/frame/eventarea.py b/src/jarabe/frame/eventarea.py
index 166aaf5..cdd6f97 100644
--- a/src/jarabe/frame/eventarea.py
+++ b/src/jarabe/frame/eventarea.py
@@ -19,8 +19,10 @@ import gobject
import wnck
import gconf
+
_MAX_DELAY = 1000
+
class EventArea(gobject.GObject):
__gsignals__ = {
'enter': (gobject.SIGNAL_RUN_FIRST,
diff --git a/src/jarabe/frame/frame.py b/src/jarabe/frame/frame.py
index 7dde55b..39dd31e 100644
--- a/src/jarabe/frame/frame.py
+++ b/src/jarabe/frame/frame.py
@@ -35,6 +35,7 @@ from jarabe.frame.clipboardpanelwindow import ClipboardPanelWindow
from jarabe.frame.notification import NotificationIcon, NotificationWindow
from jarabe.model import notifications
+
TOP_RIGHT = 0
TOP_LEFT = 1
BOTTOM_RIGHT = 2
@@ -43,6 +44,7 @@ BOTTOM_LEFT = 3
_FRAME_HIDING_DELAY = 500
_NOTIFICATION_DURATION = 5000
+
class _Animation(animator.Animation):
def __init__(self, frame, end):
start = frame.current_position
@@ -52,6 +54,7 @@ class _Animation(animator.Animation):
def next_frame(self, current):
self._frame.move(current)
+
class _MouseListener(object):
def __init__(self, frame):
self._frame = frame
@@ -79,6 +82,7 @@ class _MouseListener(object):
self._hide_sid = gobject.timeout_add(
_FRAME_HIDING_DELAY, self._hide_frame_timeout_cb)
+
class _KeyListener(object):
def __init__(self, frame):
self._frame = frame
@@ -90,6 +94,7 @@ class _KeyListener(object):
else:
self._frame.show(Frame.MODE_KEYBOARD)
+
class Frame(object):
MODE_MOUSE = 0
MODE_KEYBOARD = 1
@@ -348,4 +353,3 @@ class Frame(object):
# Do nothing for now. Our notification UI is so simple, there's no
# point yet.
pass
-
diff --git a/src/jarabe/frame/frameinvoker.py b/src/jarabe/frame/frameinvoker.py
index e4a13e1..a4abfa8 100644
--- a/src/jarabe/frame/frameinvoker.py
+++ b/src/jarabe/frame/frameinvoker.py
@@ -19,6 +19,7 @@ import gtk
from sugar.graphics import style
from sugar.graphics.palette import WidgetInvoker
+
def _get_screen_area():
frame_thickness = style.GRID_CELL_SIZE
@@ -28,6 +29,7 @@ def _get_screen_area():
return gtk.gdk.Rectangle(x, y, width, height)
+
class FrameWidgetInvoker(WidgetInvoker):
def __init__(self, widget):
WidgetInvoker.__init__(self, widget, widget.child)
diff --git a/src/jarabe/frame/framewindow.py b/src/jarabe/frame/framewindow.py
index a7d8fe7..c77e76c 100644
--- a/src/jarabe/frame/framewindow.py
+++ b/src/jarabe/frame/framewindow.py
@@ -19,6 +19,7 @@ import hippo
from sugar.graphics import style
+
class FrameWindow(gtk.Window):
__gtype_name__ = 'SugarFrameWindow'
diff --git a/src/jarabe/frame/friendstray.py b/src/jarabe/frame/friendstray.py
index 141505b..b387e06 100644
--- a/src/jarabe/frame/friendstray.py
+++ b/src/jarabe/frame/friendstray.py
@@ -24,6 +24,7 @@ from jarabe.model import shell
from jarabe.model.buddy import get_owner_instance
from jarabe.model import neighborhood
+
class FriendIcon(TrayIcon):
def __init__(self, buddy):
TrayIcon.__init__(self, icon_name='computer-xo',
@@ -34,6 +35,7 @@ class FriendIcon(TrayIcon):
self.palette.props.icon_visible = False
self.palette.set_group_id('frame')
+
class FriendsTray(VTray):
def __init__(self):
VTray.__init__(self)
diff --git a/src/jarabe/frame/notification.py b/src/jarabe/frame/notification.py
index 83dc27e..fceb41e 100644
--- a/src/jarabe/frame/notification.py
+++ b/src/jarabe/frame/notification.py
@@ -22,6 +22,7 @@ from sugar.graphics.xocolor import XoColor
from jarabe.view.pulsingicon import PulsingIcon
+
class NotificationIcon(gtk.EventBox):
__gtype_name__ = 'SugarNotificationIcon'
@@ -80,6 +81,7 @@ class NotificationIcon(gtk.EventBox):
palette = property(_get_palette, _set_palette)
+
class NotificationWindow(gtk.Window):
__gtype_name__ = 'SugarNotificationWindow'
@@ -97,4 +99,3 @@ class NotificationWindow(gtk.Window):
color = gtk.gdk.color_parse(style.COLOR_TOOLBAR_GREY.get_html())
self.modify_bg(gtk.STATE_NORMAL, color)
-
diff --git a/src/jarabe/frame/zoomtoolbar.py b/src/jarabe/frame/zoomtoolbar.py
index 2ed3c54..6c10c61 100644
--- a/src/jarabe/frame/zoomtoolbar.py
+++ b/src/jarabe/frame/zoomtoolbar.py
@@ -26,6 +26,7 @@ from sugar.graphics.radiotoolbutton import RadioToolButton
from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.model import shell
+
class ZoomToolbar(gtk.Toolbar):
def __init__(self):
gtk.Toolbar.__init__(self)
@@ -86,4 +87,3 @@ class ZoomToolbar(gtk.Toolbar):
self._activity_button.props.active = True
else:
raise ValueError('Invalid zoom level: %r' % (new_level))
-
diff --git a/src/jarabe/intro/__init__.py b/src/jarabe/intro/__init__.py
index ca4f64d..d2932f1 100644
--- a/src/jarabe/intro/__init__.py
+++ b/src/jarabe/intro/__init__.py
@@ -8,6 +8,7 @@ from sugar.profile import get_profile
from jarabe.intro.window import IntroWindow
from jarabe.intro.window import create_profile
+
def check_profile():
profile = get_profile()
diff --git a/src/jarabe/intro/colorpicker.py b/src/jarabe/intro/colorpicker.py
index a939857..997199b 100644
--- a/src/jarabe/intro/colorpicker.py
+++ b/src/jarabe/intro/colorpicker.py
@@ -20,6 +20,7 @@ from sugar.graphics.icon import CanvasIcon
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
+
class ColorPicker(hippo.CanvasBox, hippo.CanvasItem):
def __init__(self, **kwargs):
hippo.CanvasBox.__init__(self, **kwargs)
diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
index 35c0cda..4c8d224 100644
--- a/src/jarabe/intro/window.py
+++ b/src/jarabe/intro/window.py
@@ -32,8 +32,10 @@ from sugar.graphics.xocolor import XoColor
from jarabe.intro import colorpicker
+
_BACKGROUND_COLOR = style.COLOR_WHITE
+
def create_profile(name, color=None, pixbuf=None):
if not pixbuf:
path = os.path.join(os.path.dirname(__file__), 'default-picture.png')
@@ -60,6 +62,7 @@ def create_profile(name, color=None, pixbuf=None):
else:
logging.error("Keypair exists, skip generation.")
+
class _Page(hippo.CanvasBox):
__gproperties__ = {
'valid' : (bool, None, None, False,
@@ -81,6 +84,7 @@ class _Page(hippo.CanvasBox):
def activate(self):
pass
+
class _NamePage(_Page):
def __init__(self, intro):
_Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER,
@@ -118,6 +122,7 @@ class _NamePage(_Page):
def activate(self):
self._entry.props.widget.grab_focus()
+
class _ColorPage(_Page):
def __init__(self, **kwargs):
_Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER,
@@ -138,6 +143,7 @@ class _ColorPage(_Page):
def get_color(self):
return self._cp.get_color()
+
class _IntroBox(hippo.CanvasBox):
__gsignals__ = {
'done': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
@@ -255,6 +261,7 @@ class _IntroBox(hippo.CanvasBox):
self.emit('done', name, color)
+
class IntroWindow(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
diff --git a/src/jarabe/journal/detailview.py b/src/jarabe/journal/detailview.py
index b4a2339..6a04a44 100644
--- a/src/jarabe/journal/detailview.py
+++ b/src/jarabe/journal/detailview.py
@@ -27,6 +27,7 @@ from sugar.graphics.icon import CanvasIcon
from jarabe.journal.expandedentry import ExpandedEntry
from jarabe.journal import model
+
class DetailView(gtk.VBox):
__gtype_name__ = 'DetailView'
@@ -84,6 +85,7 @@ class DetailView(gtk.VBox):
metadata = gobject.property(
type=object, getter=get_metadata, setter=set_metadata)
+
class BackBar(hippo.CanvasBox):
def __init__(self):
hippo.CanvasBox.__init__(self,
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 725c0f9..9271313 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -36,6 +36,7 @@ from jarabe.journal.palettes import ObjectPalette, BuddyPalette
from jarabe.journal import misc
from jarabe.journal import model
+
class Separator(hippo.CanvasBox, hippo.CanvasItem):
def __init__(self, orientation):
hippo.CanvasBox.__init__(self,
@@ -46,6 +47,7 @@ class Separator(hippo.CanvasBox, hippo.CanvasItem):
else:
self.props.box_height = style.LINE_WIDTH
+
class BuddyList(hippo.CanvasBox):
def __init__(self, buddies):
hippo.CanvasBox.__init__(self, xalign=hippo.ALIGNMENT_START,
@@ -61,6 +63,7 @@ class BuddyList(hippo.CanvasBox):
hbox.append(icon)
self.append(hbox)
+
class ExpandedEntry(hippo.CanvasBox):
def __init__(self):
hippo.CanvasBox.__init__(self)
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index 3b6fed9..5272f92 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -46,6 +46,7 @@ from jarabe.journal.modalalert import ModalAlert
from jarabe.journal import model
from jarabe.journal.journalwindow import JournalWindow
+
J_DBUS_SERVICE = 'org.laptop.Journal'
J_DBUS_INTERFACE = 'org.laptop.Journal'
J_DBUS_PATH = '/org/laptop/Journal'
@@ -106,6 +107,7 @@ class JournalActivityDBusService(dbus.service.Object):
def ObjectChooserCancelled(self, chooser_id):
pass
+
class JournalActivity(JournalWindow):
def __init__(self):
logging.debug("STARTUP: Loading the journal")
@@ -370,6 +372,6 @@ def get_journal():
_journal.show()
return _journal
+
def start():
get_journal()
-
diff --git a/src/jarabe/journal/journalentrybundle.py b/src/jarabe/journal/journalentrybundle.py
index 41777c7..9ce676e 100644
--- a/src/jarabe/journal/journalentrybundle.py
+++ b/src/jarabe/journal/journalentrybundle.py
@@ -25,6 +25,7 @@ from sugar.bundle.bundle import Bundle, MalformedBundleException
from jarabe.journal import model
+
class JournalEntryBundle(Bundle):
"""A Journal entry bundle
@@ -91,4 +92,3 @@ class JournalEntryBundle(Bundle):
def is_installed(self):
# These bundles can be reinstalled as many times as desired.
return False
-
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index c6bd0fb..08c8b2f 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -43,6 +43,7 @@ from jarabe.model import bundleregistry
from jarabe.journal import misc
from jarabe.journal import model
+
_AUTOSEARCH_TIMEOUT = 1000
_ACTION_ANYTIME = 0
@@ -68,6 +69,7 @@ class MainToolbox(Toolbox):
self.add_toolbar(_('Search'), self.search_toolbar)
self.search_toolbar.show()
+
class SearchToolbar(gtk.Toolbar):
__gtype_name__ = 'SearchToolbar'
@@ -355,6 +357,7 @@ class SearchToolbar(gtk.Toolbar):
self._when_search_combo.set_active(0)
self._favorite_button.props.active = False
+
class DetailToolbox(Toolbox):
def __init__(self):
Toolbox.__init__(self)
@@ -363,12 +366,14 @@ class DetailToolbox(Toolbox):
self.add_toolbar('', self.entry_toolbar)
self.entry_toolbar.show()
+
class EntryToolbar(gtk.Toolbar):
__gsignals__ = {
'volume-error': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([str, str]))
}
+
def __init__(self):
gtk.Toolbar.__init__(self)
diff --git a/src/jarabe/journal/keepicon.py b/src/jarabe/journal/keepicon.py
index 2c692c6..1253afc 100644
--- a/src/jarabe/journal/keepicon.py
+++ b/src/jarabe/journal/keepicon.py
@@ -22,6 +22,7 @@ from sugar.graphics.icon import CanvasIcon
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
+
class KeepIcon(CanvasIcon):
def __init__(self, keep):
CanvasIcon.__init__(self, icon_name='emblem-favorite',
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 3378350..fb50ea3 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -29,10 +29,12 @@ from sugar import util
from jarabe.journal import model
from jarabe.journal import misc
+
DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
+
class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
__gtype_name__ = 'JournalListModel'
@@ -219,4 +221,3 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
return True
return False
-
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 3d6281a..bca9f2c 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -34,11 +34,13 @@ from jarabe.journal.palettes import ObjectPalette, BuddyPalette
from jarabe.journal import model
from jarabe.journal import misc
+
UPDATE_INTERVAL = 300
MESSAGE_EMPTY_JOURNAL = 0
MESSAGE_NO_MATCH = 1
+
class TreeView(gtk.TreeView):
__gtype_name__ = 'JournalTreeView'
@@ -58,6 +60,7 @@ class TreeView(gtk.TreeView):
if tree_model is not None:
tree_model.view_is_resizing = False
+
class BaseListView(gtk.Bin):
__gtype_name__ = 'JournalBaseListView'
@@ -460,6 +463,7 @@ class BaseListView(gtk.Bin):
self.update_dates()
return True
+
class ListView(BaseListView):
__gtype_name__ = 'JournalListView'
@@ -538,6 +542,7 @@ class ListView(BaseListView):
def __editing_canceled_cb(self, cell):
self.cell_title.props.editable = False
+
class CellRendererFavorite(CellRendererIcon):
__gtype_name__ = 'JournalCellRendererFavorite'
@@ -552,6 +557,7 @@ class CellRendererFavorite(CellRendererIcon):
self.props.prelit_stroke_color = style.COLOR_BUTTON_GREY.get_svg()
self.props.prelit_fill_color = style.COLOR_BUTTON_GREY.get_svg()
+
class CellRendererDetail(CellRendererIcon):
__gtype_name__ = 'JournalCellRendererDetail'
@@ -568,6 +574,7 @@ class CellRendererDetail(CellRendererIcon):
self.props.prelit_stroke_color = style.COLOR_TRANSPARENT.get_svg()
self.props.prelit_fill_color = style.COLOR_BLACK.get_svg()
+
class CellRendererActivityIcon(CellRendererIcon):
__gtype_name__ = 'JournalCellRendererActivityIcon'
@@ -610,6 +617,7 @@ class CellRendererActivityIcon(CellRendererIcon):
show_palette = gobject.property(type=bool, default=True,
setter=set_show_palette)
+
class CellRendererBuddy(CellRendererIcon):
__gtype_name__ = 'JournalCellRendererBuddy'
@@ -643,4 +651,3 @@ class CellRendererBuddy(CellRendererIcon):
self.props.xo_color = xo_color
buddy = gobject.property(type=object, setter=set_buddy)
-
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 0b46796..7d91cbb 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -40,6 +40,7 @@ from jarabe.journal.journalentrybundle import JournalEntryBundle
from jarabe.journal import model
from jarabe.journal import journalwindow
+
def _get_icon_for_mime(mime_type):
generic_types = mime.get_all_generic_types()
for generic_type in generic_types:
@@ -55,6 +56,7 @@ def _get_icon_for_mime(mime_type):
if file_name is not None:
return file_name
+
def get_icon_name(metadata):
file_name = None
@@ -84,6 +86,7 @@ def get_icon_name(metadata):
return file_name
+
def get_date(metadata):
""" Convert from a string in iso format to a more human-like format. """
if metadata.has_key('timestamp'):
@@ -95,6 +98,7 @@ def get_date(metadata):
else:
return _('No date')
+
def get_bundle(metadata):
try:
if is_activity_bundle(metadata):
@@ -123,6 +127,7 @@ def get_bundle(metadata):
logging.exception('Incorrect bundle')
return None
+
def _get_activities_for_mime(mime_type):
registry = bundleregistry.get_registry()
result = registry.get_activities_for_type(mime_type)
@@ -133,6 +138,7 @@ def _get_activities_for_mime(mime_type):
result.append(activity)
return result
+
def get_activities(metadata):
activities = []
@@ -151,6 +157,7 @@ def get_activities(metadata):
return activities
+
def resume(metadata, bundle_id=None):
registry = bundleregistry.get_registry()
@@ -206,7 +213,6 @@ def resume(metadata, bundle_id=None):
bundle = registry.get_bundle(bundle_id)
-
if metadata.get('mountpoint', '/') == '/':
object_id = metadata['uid']
else:
@@ -215,6 +221,7 @@ def resume(metadata, bundle_id=None):
launch(bundle, activity_id=activity_id, object_id=object_id,
color=get_icon_color(metadata))
+
def _launch_bundle(bundle):
registry = bundleregistry.get_registry()
logging.debug('activityfactory.creating bundle with id %r',
@@ -226,6 +233,7 @@ def _launch_bundle(bundle):
logging.error('Bundle %r is not installed.',
bundle.get_bundle_id())
+
def launch(bundle, activity_id=None, object_id=None, uri=None, color=None,
invited=False):
if activity_id is None or not activity_id:
@@ -250,6 +258,7 @@ def launch(bundle, activity_id=None, object_id=None, uri=None, color=None,
object_id=object_id, uri=uri, invited=invited)
activityfactory.create(bundle, activity_handle)
+
def _downgrade_option_alert(bundle):
alert = ConfirmationAlert()
alert.props.title = _('Older Version Of %s Activity') % (bundle.get_name())
@@ -259,6 +268,7 @@ def _downgrade_option_alert(bundle):
journalwindow.get_journal_window().add_alert(alert)
alert.show()
+
def _downgrade_alert_response_cb(alert, response_id, bundle):
if response_id is gtk.RESPONSE_OK:
journalwindow.get_journal_window().remove_alert(alert)
@@ -268,21 +278,26 @@ def _downgrade_alert_response_cb(alert, response_id, bundle):
elif response_id is gtk.RESPONSE_CANCEL:
journalwindow.get_journal_window().remove_alert(alert)
+
def is_activity_bundle(metadata):
mime_type = metadata.get('mime_type', '')
return mime_type == ActivityBundle.MIME_TYPE or \
mime_type == ActivityBundle.DEPRECATED_MIME_TYPE
+
def is_content_bundle(metadata):
return metadata.get('mime_type', '') == ContentBundle.MIME_TYPE
+
def is_journal_bundle(metadata):
return metadata.get('mime_type', '') == JournalEntryBundle.MIME_TYPE
+
def is_bundle(metadata):
return is_activity_bundle(metadata) or is_content_bundle(metadata) or \
is_journal_bundle(metadata)
+
def get_icon_color(metadata):
if metadata is None or not 'icon-color' in metadata:
client = gconf.client_get_default()
diff --git a/src/jarabe/journal/modalalert.py b/src/jarabe/journal/modalalert.py
index c7c6a0a..c306b9e 100644
--- a/src/jarabe/journal/modalalert.py
+++ b/src/jarabe/journal/modalalert.py
@@ -22,6 +22,7 @@ from sugar.graphics.icon import Icon
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
+
class ModalAlert(gtk.Window):
__gtype_name__ = 'SugarModalAlert'
@@ -94,4 +95,3 @@ class ModalAlert(gtk.Window):
'''The opener will listen on the destroy signal
'''
self.destroy()
-
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index bbc3778..4a9a8c8 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -32,6 +32,7 @@ from sugar import dispatch
from sugar import mime
from sugar import util
+
DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
@@ -192,6 +193,7 @@ class BaseResultSet(object):
return self._cache[self._position - self._offset]
+
class DatastoreResultSet(BaseResultSet):
"""Encapsulates the result of a query on the datastore
"""
@@ -219,6 +221,7 @@ class DatastoreResultSet(BaseResultSet):
return entries, total_count
+
class InplaceResultSet(BaseResultSet):
"""Encapsulates the result of a query on a mount point
"""
@@ -350,6 +353,7 @@ class InplaceResultSet(BaseResultSet):
except Exception:
logging.exception('Error reading file %r', full_path)
+
def _get_file_metadata(path, stat):
client = gconf.client_get_default()
return {'uid': path,
@@ -376,15 +380,19 @@ def _get_datastore():
return _datastore
+
def _datastore_created_cb(object_id):
created.send(None, object_id=object_id)
+
def _datastore_updated_cb(object_id):
updated.send(None, object_id=object_id)
+
def _datastore_deleted_cb(object_id):
deleted.send(None, object_id=object_id)
+
def find(query_, page_size):
"""Returns a ResultSet
"""
@@ -399,6 +407,7 @@ def find(query_, page_size):
else:
return InplaceResultSet(query, page_size, mount_points[0])
+
def _get_mount_point(path):
dir_path = os.path.dirname(path)
while True:
@@ -407,6 +416,7 @@ def _get_mount_point(path):
else:
dir_path = dir_path.rsplit(os.sep, 1)[0]
+
def get(object_id):
"""Returns the metadata for an object
"""
@@ -419,6 +429,7 @@ def get(object_id):
metadata['mountpoint'] = '/'
return metadata
+
def get_file(object_id):
"""Returns the file for an object
"""
@@ -433,6 +444,7 @@ def get_file(object_id):
else:
return None
+
def get_file_size(object_id):
"""Return the file size for an object
"""
@@ -448,12 +460,14 @@ def get_file_size(object_id):
return 0
+
def get_unique_values(key):
"""Returns a list with the different values a property has taken
"""
empty_dict = dbus.Dictionary({}, signature='ss')
return _get_datastore().get_uniquevaluesfor(key, empty_dict)
+
def delete(object_id):
"""Removes an object from persistent storage
"""
@@ -463,6 +477,7 @@ def delete(object_id):
else:
_get_datastore().delete(object_id)
+
def copy(metadata, mount_point):
"""Copies an object to another mount point
"""
@@ -474,6 +489,7 @@ def copy(metadata, mount_point):
return write(metadata, file_path, transfer_ownership=False)
+
def write(metadata, file_path='', update_mtime=True, transfer_ownership=True):
"""Creates or updates an entry for that id
"""
@@ -508,6 +524,7 @@ def write(metadata, file_path='', update_mtime=True, transfer_ownership=True):
return object_id
+
def _get_file_name(title, mime_type):
file_name = title
@@ -532,6 +549,7 @@ def _get_file_name(title, mime_type):
return file_name
+
def _get_unique_file_name(mount_point, file_name):
if os.path.exists(os.path.join(mount_point, file_name)):
i = 1
@@ -544,6 +562,7 @@ def _get_unique_file_name(mount_point, file_name):
return file_name
+
def is_editable(metadata):
mountpoint = metadata.get('mountpoint', '/')
return mountpoint == '/'
diff --git a/src/jarabe/journal/objectchooser.py b/src/jarabe/journal/objectchooser.py
index 16e6c4b..97139f8 100644
--- a/src/jarabe/journal/objectchooser.py
+++ b/src/jarabe/journal/objectchooser.py
@@ -29,6 +29,7 @@ from jarabe.journal.listmodel import ListModel
from jarabe.journal.journaltoolbox import SearchToolbar
from jarabe.journal.volumestoolbar import VolumesToolbar
+
class ObjectChooser(gtk.Window):
__gtype_name__ = 'ObjectChooser'
@@ -136,6 +137,7 @@ class ObjectChooser(gtk.Window):
visible = event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED
self._list_view.set_is_visible(visible)
+
class TitleBox(VolumesToolbar):
__gtype_name__ = 'TitleBox'
@@ -162,6 +164,7 @@ class TitleBox(VolumesToolbar):
self.insert(tool_item, -1)
tool_item.show()
+
class ChooserListView(BaseListView):
__gtype_name__ = 'ChooserListView'
@@ -196,4 +199,3 @@ class ChooserListView(BaseListView):
self.emit('entry-activated', uid)
return False
-
diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py
index d4a62b0..b2ecd1c 100644
--- a/src/jarabe/journal/palettes.py
+++ b/src/jarabe/journal/palettes.py
@@ -35,6 +35,7 @@ from jarabe.model import mimeregistry
from jarabe.journal import misc
from jarabe.journal import model
+
class ObjectPalette(Palette):
__gtype_name__ = 'ObjectPalette'
@@ -154,6 +155,7 @@ class ObjectPalette(Palette):
filetransfer.start_transfer(buddy, file_name, title, description,
mime_type)
+
class FriendsMenu(gtk.Menu):
__gtype_name__ = 'JournalFriendsMenu'
diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py
index 4208c17..d4caade 100644
--- a/src/jarabe/journal/volumestoolbar.py
+++ b/src/jarabe/journal/volumestoolbar.py
@@ -30,6 +30,7 @@ from sugar.graphics.xocolor import XoColor
from jarabe.journal import model
from jarabe.view.palettes import VolumePalette
+
class VolumesToolbar(gtk.Toolbar):
__gtype_name__ = 'VolumesToolbar'
@@ -130,6 +131,7 @@ class VolumesToolbar(gtk.Toolbar):
button = self._get_button_for_mount(mount)
button.props.active = True
+
class BaseButton(RadioToolButton):
__gsignals__ = {
'volume-error': (gobject.SIGNAL_RUN_FIRST,
@@ -167,6 +169,7 @@ class BaseButton(RadioToolButton):
_('Error while copying the entry. %s') % e.strerror,
_('Error'))
+
class VolumeButton(BaseButton):
def __init__(self, mount):
self._mount = mount
@@ -197,6 +200,7 @@ class VolumeButton(BaseButton):
#palette.set_group_id('frame')
return palette
+
class JournalButton(BaseButton):
def __init__(self):
BaseButton.__init__(self, mount_point='/')
@@ -206,4 +210,3 @@ class JournalButton(BaseButton):
client = gconf.client_get_default()
color = XoColor(client.get_string('/desktop/sugar/user/color'))
self.props.xo_color = color
-
diff --git a/src/jarabe/model/__init__.py b/src/jarabe/model/__init__.py
index a9dd95a..85f6a24 100644
--- a/src/jarabe/model/__init__.py
+++ b/src/jarabe/model/__init__.py
@@ -13,4 +13,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/model/adhoc.py b/src/jarabe/model/adhoc.py
index 99fc880..a3f2927 100644
--- a/src/jarabe/model/adhoc.py
+++ b/src/jarabe/model/adhoc.py
@@ -24,6 +24,7 @@ from jarabe.model.network import Settings
from sugar.util import unique_id
from jarabe.model.network import IP4Config
+
_NM_SERVICE = 'org.freedesktop.NetworkManager'
_NM_IFACE = 'org.freedesktop.NetworkManager'
_NM_PATH = '/org/freedesktop/NetworkManager'
diff --git a/src/jarabe/model/buddy.py b/src/jarabe/model/buddy.py
index 46a9366..dd0ad4f 100644
--- a/src/jarabe/model/buddy.py
+++ b/src/jarabe/model/buddy.py
@@ -28,6 +28,7 @@ from sugar.profile import get_profile
from jarabe.util.telepathy import connection_watcher
+
CONNECTION_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo'
_owner_instance = None
@@ -92,6 +93,7 @@ class BaseBuddyModel(gobject.GObject):
class OwnerBuddyModel(BaseBuddyModel):
__gtype_name__ = 'SugarOwnerBuddyModel'
+
def __init__(self):
BaseBuddyModel.__init__(self)
@@ -192,6 +194,7 @@ def get_owner_instance():
class BuddyModel(BaseBuddyModel):
__gtype_name__ = 'SugarBuddyModel'
+
def __init__(self, **kwargs):
self._account = None
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 8e037a8..da37118 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -459,4 +459,3 @@ def get_registry():
if not _instance:
_instance = BundleRegistry()
return _instance
-
diff --git a/src/jarabe/model/filetransfer.py b/src/jarabe/model/filetransfer.py
index 7d2d5dd..45c1bc4 100644
--- a/src/jarabe/model/filetransfer.py
+++ b/src/jarabe/model/filetransfer.py
@@ -33,6 +33,7 @@ from sugar import dispatch
from jarabe.util.telepathy import connection_watcher
from jarabe.model import neighborhood
+
FT_STATE_NONE = 0
FT_STATE_PENDING = 1
FT_STATE_ACCEPTED = 2
@@ -63,6 +64,7 @@ class StreamSplicer(gobject.GObject):
gobject.TYPE_NONE,
([])),
}
+
def __init__(self, input_stream, output_stream):
gobject.GObject.__init__(self)
@@ -108,6 +110,7 @@ class StreamSplicer(gobject.GObject):
gobject.PRIORITY_LOW,
user_data=data)
+
class BaseFileTransfer(gobject.GObject):
def __init__(self, connection):
@@ -179,6 +182,7 @@ class BaseFileTransfer(gobject.GObject):
def cancel(self):
self.channel[CHANNEL].Close()
+
class IncomingFileTransfer(BaseFileTransfer):
def __init__(self, connection, object_path, props):
BaseFileTransfer.__init__(self, connection)
@@ -223,6 +227,7 @@ class IncomingFileTransfer(BaseFileTransfer):
self._splicer = StreamSplicer(input_stream, output_stream)
self._splicer.start()
+
class OutgoingFileTransfer(BaseFileTransfer):
def __init__(self, buddy, file_name, title, description, mime_type):
@@ -286,6 +291,7 @@ class OutgoingFileTransfer(BaseFileTransfer):
def cancel(self):
self.channel[CHANNEL].Close()
+
def _new_channels_cb(connection, channels):
for object_path, props in channels:
if props[CHANNEL + '.ChannelType'] == CHANNEL_TYPE_FILE_TRANSFER and \
@@ -297,17 +303,21 @@ def _new_channels_cb(connection, channels):
object_path, props)
new_file_transfer.send(None, file_transfer=incoming_file_transfer)
+
def _monitor_connection(connection):
logging.debug('connection added %r', connection)
connection[CONNECTION_INTERFACE_REQUESTS].connect_to_signal('NewChannels',
lambda channels: _new_channels_cb(connection, channels))
+
def _connection_added_cb(conn_watcher, connection):
_monitor_connection(connection)
+
def _connection_removed_cb(conn_watcher, connection):
logging.debug('connection removed %r', connection)
+
def init():
conn_watcher = connection_watcher.get_instance()
conn_watcher.connect('connection-added', _connection_added_cb)
@@ -316,11 +326,13 @@ def init():
for connection in conn_watcher.get_connections():
_monitor_connection(connection)
+
def start_transfer(buddy, file_name, title, description, mime_type):
outgoing_file_transfer = OutgoingFileTransfer(buddy, file_name, title,
description, mime_type)
new_file_transfer.send(None, file_transfer=outgoing_file_transfer)
+
def file_transfer_available():
conn_watcher = connection_watcher.get_instance()
for connection in conn_watcher.get_connections():
@@ -353,4 +365,3 @@ if __name__ == '__main__':
loop = gobject.MainLoop()
loop.run()
-
diff --git a/src/jarabe/model/friends.py b/src/jarabe/model/friends.py
index ffd655b..b317130 100644
--- a/src/jarabe/model/friends.py
+++ b/src/jarabe/model/friends.py
@@ -91,6 +91,7 @@ class FriendBuddyModel(BuddyModel):
handle = gobject.property(type=object, getter=get_handle)
+
class Friends(gobject.GObject):
__gsignals__ = {
'friend-added': (gobject.SIGNAL_RUN_FIRST,
diff --git a/src/jarabe/model/invites.py b/src/jarabe/model/invites.py
index 7020b8f..8fbc398 100644
--- a/src/jarabe/model/invites.py
+++ b/src/jarabe/model/invites.py
@@ -38,6 +38,7 @@ from jarabe.model import bundleregistry
from jarabe.model import neighborhood
from jarabe.journal import misc
+
CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = \
'org.laptop.Telepathy.ActivityProperties'
@@ -107,6 +108,7 @@ class ActivityInvite(object):
else:
logging.debug('__handle_with_reply_cb')
+
class Invites(gobject.GObject):
__gsignals__ = {
'invite-added': (gobject.SIGNAL_RUN_FIRST,
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 3885b38..ec825ac 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -48,6 +48,7 @@ from sugar.profile import get_profile
from jarabe.model.buddy import BuddyModel, get_owner_instance
from jarabe.model import bundleregistry
+
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
CHANNEL_DISPATCHER_SERVICE = 'org.freedesktop.Telepathy.ChannelDispatcher'
@@ -79,6 +80,7 @@ class ActivityModel(gobject.GObject):
'buddy-removed': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([object])),
}
+
def __init__(self, activity_id, room_handle):
gobject.GObject.__init__(self)
@@ -154,6 +156,7 @@ class ActivityModel(gobject.GObject):
current_buddies = gobject.property(type=object, getter=get_current_buddies)
+
class _Account(gobject.GObject):
__gsignals__ = {
'activity-added': (gobject.SIGNAL_RUN_FIRST,
@@ -617,6 +620,7 @@ class _Account(gobject.GObject):
def __set_enabled_cb(self):
logging.debug('_Account.__set_enabled_cb success')
+
class Neighborhood(gobject.GObject):
__gsignals__ = {
'activity-added': (gobject.SIGNAL_RUN_FIRST,
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index d76e408..20fd192 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -34,6 +34,7 @@ from sugar import dispatch
from sugar import env
from sugar.util import unique_id
+
DEVICE_TYPE_802_3_ETHERNET = 1
DEVICE_TYPE_802_11_WIRELESS = 2
DEVICE_TYPE_GSM_MODEM = 3
@@ -147,6 +148,7 @@ _conn_counter = 0
_nm_device_state_reason_description = None
+
def get_error_by_reason(reason):
global _nm_device_state_reason_description
@@ -242,7 +244,6 @@ def get_error_by_reason(reason):
return _nm_device_state_reason_description[reason]
-
def frequency_to_channel(frequency):
"""Returns the channel matching a given radio channel frequency. If a
frequency is not in the dictionary channel 1 will be returned.
@@ -263,6 +264,7 @@ def frequency_to_channel(frequency):
return 1
return ftoc[frequency]
+
def is_sugar_adhoc_network(ssid):
"""Checks whether an access point is a sugar Ad-hoc network.
@@ -294,6 +296,7 @@ class WirelessSecurity(object):
wireless_security['group'] = self.group
return wireless_security
+
class Wireless(object):
nm_name = "802-11-wireless"
@@ -352,6 +355,7 @@ class Connection(object):
connection['timestamp'] = self.timestamp
return connection
+
class IP4Config(object):
def __init__(self):
self.method = None
@@ -362,6 +366,7 @@ class IP4Config(object):
ip4_config['method'] = self.method
return ip4_config
+
class Serial(object):
def __init__(self):
self.baud = None
@@ -374,6 +379,7 @@ class Serial(object):
return serial
+
class Ppp(object):
def __init__(self):
pass
@@ -382,6 +388,7 @@ class Ppp(object):
ppp = {}
return ppp
+
class Gsm(object):
def __init__(self):
self.apn = None
@@ -400,6 +407,7 @@ class Gsm(object):
return gsm
+
class Settings(object):
def __init__(self, wireless_cfg=None):
self.connection = Connection()
@@ -422,6 +430,7 @@ class Settings(object):
settings['ipv4'] = self.ip4_config.get_dict()
return settings
+
class Secrets(object):
def __init__(self, settings):
self.settings = settings
@@ -447,6 +456,7 @@ class Secrets(object):
return settings
+
class SettingsGsm(object):
def __init__(self):
self.connection = Connection()
@@ -466,6 +476,7 @@ class SettingsGsm(object):
return settings
+
class SecretsGsm(object):
def __init__(self):
self.password = None
@@ -482,6 +493,7 @@ class SecretsGsm(object):
secrets['puk'] = self.puk
return {'gsm': secrets}
+
class NMSettings(dbus.service.Object):
def __init__(self):
bus = dbus.SystemBus()
@@ -509,6 +521,7 @@ class NMSettings(dbus.service.Object):
self.secrets_request.send(self, connection=sender,
response=kwargs['response'])
+
class SecretsResponse(object):
''' Intermediate object to report the secrets from the dialog
back to the connection object and which will inform NM
@@ -525,6 +538,7 @@ class SecretsResponse(object):
def set_error(self, error):
self._error_cb(error)
+
class NMSettingsConnection(dbus.service.Object):
def __init__(self, path, settings, secrets):
bus = dbus.SystemBus()
@@ -649,6 +663,7 @@ class NMSettingsConnection(dbus.service.Object):
else:
raise Exception('The stored GSM secret has already been supplied ')
+
class AccessPoint(gobject.GObject):
__gsignals__ = {
'props-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
@@ -757,6 +772,7 @@ class AccessPoint(gobject.GObject):
path=self.model.object_path,
dbus_interface=NM_ACCESSPOINT_IFACE)
+
def get_settings():
global _nm_settings
if _nm_settings is None:
@@ -767,6 +783,7 @@ def get_settings():
load_connections()
return _nm_settings
+
def find_connection_by_ssid(ssid):
connections = get_settings().connections
@@ -778,6 +795,7 @@ def find_connection_by_ssid(ssid):
return None
+
def add_connection(uuid, settings, secrets=None):
global _conn_counter
@@ -788,6 +806,7 @@ def add_connection(uuid, settings, secrets=None):
_nm_settings.add_connection(uuid, conn)
return conn
+
def load_wifi_connections():
profile_path = env.get_profile_path()
config_path = os.path.join(profile_path, 'nm', 'connections.cfg')
@@ -893,10 +912,12 @@ def load_gsm_connection():
else:
logging.exception("No gsm connection was set in GConf.")
+
def load_connections():
load_wifi_connections()
load_gsm_connection()
+
def find_gsm_connection():
connections = get_settings().connections
diff --git a/src/jarabe/model/notifications.py b/src/jarabe/model/notifications.py
index b5a6822..47185f1 100644
--- a/src/jarabe/model/notifications.py
+++ b/src/jarabe/model/notifications.py
@@ -23,6 +23,7 @@ from sugar import dispatch
from jarabe import config
+
_DBUS_SERVICE = "org.freedesktop.Notifications"
_DBUS_IFACE = "org.freedesktop.Notifications"
_DBUS_PATH = "/org/freedesktop/Notifications"
@@ -76,7 +77,6 @@ class NotificationService(dbus.service.Object):
def GetServerInformation(self, name, vendor, version):
return 'Sugar Shell', 'Sugar', config.version
-
@dbus.service.signal(_DBUS_IFACE, signature="uu")
def NotificationClosed(self, notification_id, reason):
pass
@@ -92,6 +92,6 @@ def get_service():
_instance = NotificationService()
return _instance
+
def init():
get_service()
-
diff --git a/src/jarabe/model/olpcmesh.py b/src/jarabe/model/olpcmesh.py
index 7873692..ceb7e37 100644
--- a/src/jarabe/model/olpcmesh.py
+++ b/src/jarabe/model/olpcmesh.py
@@ -24,6 +24,7 @@ from jarabe.model.network import Settings
from jarabe.model.network import OlpcMesh as OlpcMeshSettings
from sugar.util import unique_id
+
_NM_SERVICE = 'org.freedesktop.NetworkManager'
_NM_IFACE = 'org.freedesktop.NetworkManager'
_NM_PATH = '/org/freedesktop/NetworkManager'
@@ -43,6 +44,7 @@ DEVICE_STATE_IP_CONFIG = 7
DEVICE_STATE_ACTIVATED = 8
DEVICE_STATE_FAILED = 9
+
class OlpcMeshManager(object):
def __init__(self, mesh_device):
self._bus = dbus.SystemBus()
@@ -211,4 +213,3 @@ class OlpcMeshManager(object):
self._connection_queue.append((6, _XS_ANYCAST))
self._connection_queue.append((1, _XS_ANYCAST))
self._try_next_connection_from_queue()
-
diff --git a/src/jarabe/model/screen.py b/src/jarabe/model/screen.py
index 4403c1c..965317d 100644
--- a/src/jarabe/model/screen.py
+++ b/src/jarabe/model/screen.py
@@ -18,12 +18,14 @@ import logging
import dbus
+
_HARDWARE_MANAGER_INTERFACE = 'org.freedesktop.ohm.Keystore'
_HARDWARE_MANAGER_SERVICE = 'org.freedesktop.ohm'
_HARDWARE_MANAGER_OBJECT_PATH = '/org/freedesktop/ohm/Keystore'
_ohm_service = None
+
def _get_ohm():
global _ohm_service
if _ohm_service is None:
@@ -35,9 +37,9 @@ def _get_ohm():
return _ohm_service
+
def set_dcon_freeze(frozen):
try:
_get_ohm().SetKey("display.dcon_freeze", frozen)
except dbus.DBusException:
logging.error('Cannot unfreeze the DCON')
-
diff --git a/src/jarabe/model/session.py b/src/jarabe/model/session.py
index 9e0f087..531b7a5 100644
--- a/src/jarabe/model/session.py
+++ b/src/jarabe/model/session.py
@@ -24,8 +24,10 @@ import logging
from sugar import session
from sugar import env
+
_session_manager = None
+
class SessionManager(session.SessionManager):
MODE_LOGOUT = 0
MODE_SHUTDOWN = 1
@@ -81,6 +83,7 @@ class SessionManager(session.SessionManager):
# killed by the X (dis)connection
sys.exit()
+
def get_session_manager():
global _session_manager
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index 65d1c26..624648c 100644
--- a/src/jarabe/model/shell.py
+++ b/src/jarabe/model/shell.py
@@ -638,4 +638,3 @@ def get_model():
if _model is None:
_model = ShellModel()
return _model
-
diff --git a/src/jarabe/model/sound.py b/src/jarabe/model/sound.py
index 16e69b5..9e1e748 100644
--- a/src/jarabe/model/sound.py
+++ b/src/jarabe/model/sound.py
@@ -20,6 +20,7 @@ from sugar import env
from sugar import _sugarext
from sugar import dispatch
+
VOLUME_STEP = 10
muted_changed = dispatch.Signal()
@@ -31,9 +32,11 @@ _volume = _sugarext.VolumeAlsa()
def get_muted():
return _volume.get_mute()
+
def get_volume():
return _volume.get_volume()
+
def set_volume(new_volume):
old_volume = _volume.get_volume()
_volume.set_volume(new_volume)
@@ -41,6 +44,7 @@ def set_volume(new_volume):
volume_changed.send(None)
save()
+
def set_muted(new_state):
old_state = _volume.get_mute()
_volume.set_mute(new_state)
@@ -48,11 +52,13 @@ def set_muted(new_state):
muted_changed.send(None)
save()
+
def save():
if env.is_emulator() is False:
client = gconf.client_get_default()
client.set_int('/desktop/sugar/sound/volume', get_volume())
+
def restore():
if env.is_emulator() is False:
client = gconf.client_get_default()
diff --git a/src/jarabe/model/telepathyclient.py b/src/jarabe/model/telepathyclient.py
index 189e344..c6fbac1 100644
--- a/src/jarabe/model/telepathyclient.py
+++ b/src/jarabe/model/telepathyclient.py
@@ -26,6 +26,7 @@ from telepathy.server import DBusProperties
from sugar import dispatch
+
SUGAR_CLIENT_SERVICE = 'org.freedesktop.Telepathy.Client.Sugar'
SUGAR_CLIENT_PATH = '/org/freedesktop/Telepathy/Client/Sugar'
diff --git a/src/jarabe/util/__init__.py b/src/jarabe/util/__init__.py
index 1610dd0..9c80ecb 100644
--- a/src/jarabe/util/__init__.py
+++ b/src/jarabe/util/__init__.py
@@ -16,4 +16,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/util/emulator.py b/src/jarabe/util/emulator.py
index b6ce9dc..afcac30 100644
--- a/src/jarabe/util/emulator.py
+++ b/src/jarabe/util/emulator.py
@@ -118,6 +118,7 @@ def _start_window_manager():
gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH)
+
def _setup_env(display, scaling, emulator_pid):
os.environ['SUGAR_EMULATOR'] = 'yes'
os.environ['GABBLE_LOGFILE'] = os.path.join(
@@ -136,6 +137,7 @@ def _setup_env(display, scaling, emulator_pid):
if scaling:
os.environ['SUGAR_SCALING'] = scaling
+
def main():
"""Script-level operations"""
diff --git a/src/jarabe/util/telepathy/__init__.py b/src/jarabe/util/telepathy/__init__.py
index 387d09c..eee4abb 100644
--- a/src/jarabe/util/telepathy/__init__.py
+++ b/src/jarabe/util/telepathy/__init__.py
@@ -16,4 +16,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/util/telepathy/connection_watcher.py b/src/jarabe/util/telepathy/connection_watcher.py
index 27ac018..2e073ae 100644
--- a/src/jarabe/util/telepathy/connection_watcher.py
+++ b/src/jarabe/util/telepathy/connection_watcher.py
@@ -104,6 +104,7 @@ def get_instance():
_instance = ConnectionWatcher()
return _instance
+
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
diff --git a/src/jarabe/view/__init__.py b/src/jarabe/view/__init__.py
index a9dd95a..85f6a24 100644
--- a/src/jarabe/view/__init__.py
+++ b/src/jarabe/view/__init__.py
@@ -13,4 +13,3 @@
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
diff --git a/src/jarabe/view/buddyicon.py b/src/jarabe/view/buddyicon.py
index 332c0c8..a274605 100644
--- a/src/jarabe/view/buddyicon.py
+++ b/src/jarabe/view/buddyicon.py
@@ -19,6 +19,7 @@ from sugar.graphics import style
from jarabe.view.buddymenu import BuddyMenu
+
class BuddyIcon(CanvasIcon):
def __init__(self, buddy, size=style.STANDARD_ICON_SIZE):
CanvasIcon.__init__(self, icon_name='computer-xo', size=size)
@@ -60,4 +61,3 @@ class BuddyIcon(CanvasIcon):
self._greyed_out = (self._buddy.get_nick().lower().find(query) == -1) \
and not self._buddy.is_owner()
self._update_color()
-
diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py
index 0ba6cc1..b4bb492 100644
--- a/src/jarabe/view/buddymenu.py
+++ b/src/jarabe/view/buddymenu.py
@@ -31,6 +31,7 @@ from jarabe.model import friends
from jarabe.model.session import get_session_manager
from jarabe.controlpanel.gui import ControlPanel
+
class BuddyMenu(Palette):
def __init__(self, buddy):
self._buddy = buddy
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
index 93ddf47..794092d 100644
--- a/src/jarabe/view/keyhandler.py
+++ b/src/jarabe/view/keyhandler.py
@@ -32,10 +32,12 @@ from jarabe.model.shell import ShellModel
from jarabe import config
from jarabe.journal import journalactivity
+
_VOLUME_STEP = sound.VOLUME_STEP
_VOLUME_MAX = 100
_TABBING_MODIFIER = gtk.gdk.MOD1_MASK
+
_actions_table = {
'F1' : 'zoom_mesh',
'F2' : 'zoom_group',
@@ -241,4 +243,3 @@ def setup(frame):
del _instance
_instance = KeyHandler(frame)
-
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py
index 43612d4..6104538 100644
--- a/src/jarabe/view/palettes.py
+++ b/src/jarabe/view/palettes.py
@@ -35,6 +35,7 @@ from jarabe.model import shell
from jarabe.view.viewsource import setup_view_source
from jarabe.journal import misc
+
class BasePalette(Palette):
def __init__(self, home_activity):
Palette.__init__(self)
@@ -147,6 +148,7 @@ class ActivityPalette(Palette):
self.popdown(immediate=True)
misc.launch(self._activity_info)
+
class JournalPalette(BasePalette):
def __init__(self, home_activity):
self._home_activity = home_activity
@@ -198,6 +200,7 @@ class JournalPalette(BasePalette):
self._free_space_label.props.label = _('%(free_space)d MB Free') % \
{'free_space': free_space / (1024 * 1024)}
+
class VolumePalette(Palette):
def __init__(self, mount):
Palette.__init__(self, label=mount.get_name())
@@ -247,4 +250,3 @@ class VolumePalette(Palette):
self._progress_bar.props.fraction = fraction
self._free_space_label.props.label = _('%(free_space)d MB Free') % \
{'free_space': free_space / (1024 * 1024)}
-
diff --git a/src/jarabe/view/pulsingicon.py b/src/jarabe/view/pulsingicon.py
index 43ec358..392a404 100644
--- a/src/jarabe/view/pulsingicon.py
+++ b/src/jarabe/view/pulsingicon.py
@@ -21,9 +21,11 @@ import gobject
from sugar.graphics.icon import Icon, CanvasIcon
+
_INTERVAL = 100
_STEP = math.pi / 10 # must be a fraction of pi, for clean caching
+
class Pulser(object):
def __init__(self, icon):
self._pulse_hid = None
@@ -83,6 +85,7 @@ class Pulser(object):
return True
+
class PulsingIcon(Icon):
__gtype_name__ = 'SugarPulsingIcon'
@@ -161,6 +164,7 @@ class PulsingIcon(Icon):
if self._palette is not None:
self._palette.destroy()
+
class CanvasPulsingIcon(CanvasIcon):
__gtype_name__ = 'SugarCanvasPulsingIcon'
diff --git a/src/jarabe/view/service.py b/src/jarabe/view/service.py
index 7af778a..16299de 100644
--- a/src/jarabe/view/service.py
+++ b/src/jarabe/view/service.py
@@ -23,10 +23,12 @@ import gtk
from jarabe.model import shell
from jarabe.model import bundleregistry
+
_DBUS_SERVICE = "org.laptop.Shell"
_DBUS_SHELL_IFACE = "org.laptop.Shell"
_DBUS_PATH = "/org/laptop/Shell"
+
class UIService(dbus.service.Object):
"""Provides d-bus service to script the shell's operations
@@ -86,4 +88,3 @@ class UIService(dbus.service.Object):
in_signature="s", out_signature="")
def NotifyLaunchFailure(self, activity_id):
shell.get_model().notify_launch_failed(activity_id)
-
diff --git a/src/jarabe/view/tabbinghandler.py b/src/jarabe/view/tabbinghandler.py
index f52bda3..0889792 100644
--- a/src/jarabe/view/tabbinghandler.py
+++ b/src/jarabe/view/tabbinghandler.py
@@ -21,8 +21,10 @@ import gtk
from jarabe.model import shell
+
_RAISE_DELAY = 250
+
class TabbingHandler(object):
def __init__(self, frame, modifier):
self._frame = frame
@@ -145,4 +147,3 @@ class TabbingHandler(object):
def is_tabbing(self):
return self._tabbing
-
diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
index 290df18..e6e7e36 100644
--- a/src/jarabe/view/viewsource.py
+++ b/src/jarabe/view/viewsource.py
@@ -37,11 +37,13 @@ from sugar.bundle.activitybundle import ActivityBundle
from sugar.datastore import datastore
from sugar import mime
+
_SOURCE_FONT = pango.FontDescription('Monospace %d' % style.FONT_SIZE)
_logger = logging.getLogger('ViewSource')
map_activity_to_window = {}
+
def setup_view_source(activity):
service = activity.get_service()
if service is not None:
@@ -89,6 +91,7 @@ def setup_view_source(activity):
map_activity_to_window[window_xid] = view_source
view_source.show()
+
class ViewSource(gtk.Window):
__gtype_name__ = 'SugarViewSource'
@@ -195,6 +198,7 @@ class ViewSource(gtk.Window):
else:
self._source_display.file_path = None
+
class DocumentButton(RadioToolButton):
__gtype_name__ = 'SugarDocumentButton'
@@ -251,6 +255,7 @@ class DocumentButton(RadioToolButton):
logging.debug('Error saving Source object to datastore: %s', err)
self._jobject.destroy()
+
class Toolbar(gtk.Toolbar):
__gtype_name__ = 'SugarViewSourceToolbar'
@@ -339,6 +344,7 @@ class Toolbar(gtk.Toolbar):
if button.props.active:
self.emit('source-selected', path)
+
class FileViewer(gtk.ScrolledWindow):
__gtype_name__ = 'SugarFileViewer'
@@ -405,6 +411,7 @@ class FileViewer(gtk.ScrolledWindow):
file_path = model.get_value(tree_iter, 1)
self.emit('file-selected', file_path)
+
class SourceDisplay(gtk.ScrolledWindow):
__gtype_name__ = 'SugarSourceDisplay'
@@ -461,4 +468,3 @@ class SourceDisplay(gtk.ScrolledWindow):
return self._file_path
file_path = property(_get_file_path, _set_file_path)
-
--
1.7.2.3
More information about the Sugar-devel
mailing list