Fixed a bunch of issues reported by pylint
This commit is contained in:
@@ -2,8 +2,6 @@ import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
|
||||
import sugar.env
|
||||
|
||||
class AddressEntry(gtk.HBox):
|
||||
def __init__(self, callback):
|
||||
gtk.HBox.__init__(self)
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
from xml.sax import saxutils
|
||||
|
||||
import dbus
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
import geckoembed
|
||||
import urllib
|
||||
|
||||
from sugar.shell import activity
|
||||
from sugar.browser import NotificationBar
|
||||
from sugar.browser import NavigationToolbar
|
||||
|
||||
_BROWSER_ACTIVITY_TYPE = "_web_browser_olpc._udp"
|
||||
|
||||
class BrowserActivity(activity.Activity):
|
||||
SOLO = 1
|
||||
FOLLOWING = 2
|
||||
LEADING = 3
|
||||
|
||||
def __init__(self, uri):
|
||||
def __init__(self, group, uri):
|
||||
activity.Activity.__init__(self)
|
||||
|
||||
self.uri = uri
|
||||
self._group = group
|
||||
self._mode = BrowserActivity.SOLO
|
||||
|
||||
def _update_shared_location(self):
|
||||
@@ -84,14 +85,14 @@ class BrowserActivity(activity.Activity):
|
||||
self._setup_shared(self.uri)
|
||||
|
||||
def publish(self):
|
||||
print 'Publish %s' % self.get_id()
|
||||
print 'Publish %s' % self.activity_get_id()
|
||||
|
||||
def get_embed(self):
|
||||
return self.embed
|
||||
|
||||
def share(self):
|
||||
url = self.embed.get_address()
|
||||
self._model = self._group.get_store().create_model(url)
|
||||
address = self.embed.get_address()
|
||||
self._model = self._group.get_store().create_model(address)
|
||||
self._model.set_value('owner', self._group.get_owner().get_nick_name())
|
||||
self._update_shared_location()
|
||||
self.set_mode(BrowserActivity.LEADING)
|
||||
@@ -100,8 +101,8 @@ class BrowserActivity(activity.Activity):
|
||||
proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
||||
chat_shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.ChatShell')
|
||||
|
||||
escaped_title = urllib.quote(self.embed.get_title())
|
||||
escaped_url = urllib.quote(url)
|
||||
escaped_title = saxutils.escape(self.embed.get_title())
|
||||
escaped_address = saxutils.escape(address)
|
||||
chat_shell.send_text_message('<richtext><link href="' + escaped_address +
|
||||
'">' + escaped_title + '</link></richtext>')
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import dbus
|
||||
import geckoembed
|
||||
import threading
|
||||
import gobject
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
|
||||
import sugar.env
|
||||
|
||||
from sugar.browser.BrowserActivity import BrowserActivity
|
||||
|
||||
class BrowserShell(dbus.service.Object):
|
||||
def __init__(self, object_path = '/com/redhat/Sugar/Browser'):
|
||||
def __init__(self, bus_name, object_path = '/com/redhat/Sugar/Browser'):
|
||||
dbus.service.Object.__init__(self, bus_name, object_path)
|
||||
|
||||
geckoembed.set_profile_path(sugar.env.get_user_dir())
|
||||
self.__browsers = []
|
||||
|
||||
def start():
|
||||
def start(self):
|
||||
gtk.main()
|
||||
|
||||
@dbus.service.method('com.redhat.Sugar.BrowserShell')
|
||||
@@ -30,6 +31,6 @@ class BrowserShell(dbus.service.Object):
|
||||
|
||||
@dbus.service.method('com.redhat.Sugar.BrowserShell')
|
||||
def open_browser(self, uri):
|
||||
browser = BrowserActivity(uri)
|
||||
browser = BrowserActivity(None, uri)
|
||||
self.__browsers.append(browser)
|
||||
browser.connect_to_shell()
|
||||
|
||||
Reference in New Issue
Block a user