Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-02-24 22:59:38 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-02-24 22:59:38 (GMT)
commit4541b7697ce70d5308efa43d5b687ab135933b00 (patch)
treeaac14d21af525ba3df4c7febdd113af5c3493c01
parentb20b100fbb6e70c410dfa3119aae2ccf22e2aa98 (diff)
PyLint fixes
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rw-r--r--activity.py23
-rw-r--r--charts.py20
-rw-r--r--utils.py8
3 files changed, 26 insertions, 25 deletions
diff --git a/activity.py b/activity.py
index d939020..2fca52d 100644
--- a/activity.py
+++ b/activity.py
@@ -70,8 +70,8 @@ CHART_FILE = utils.get_chart_file(ACTIVITY_DIR)
print CHART_FILE
# Logging
-log = logging.getLogger('simplegraph-activity')
-log.setLevel(logging.DEBUG)
+_logger = logging.getLogger('simplegraph-activity')
+_logger.setLevel(logging.DEBUG)
logging.basicConfig()
# Tube
@@ -83,6 +83,7 @@ PATH = '/org/sugarlabs/SimpleGraph'
class ChartArea(gtk.DrawingArea):
def __init__(self, parent):
+ """A class for Draw the chart"""
super(ChartArea, self).__init__()
self._parent = parent
self.add_events(gtk.gdk.EXPOSURE_MASK | gtk.gdk.VISIBILITY_NOTIFY_MASK)
@@ -475,7 +476,7 @@ class SimpleGraph(activity.Activity):
def _new_tube_common(self, sharer):
"""Joining and sharing are mostly the same..."""
if self._shared_activity is None:
- log.debug("Error: Failed to share or join activity ... \
+ _logger.debug("Error: Failed to share or join activity ... \
_shared_activity is null in _shared_cb()")
return
@@ -490,11 +491,11 @@ class SimpleGraph(activity.Activity):
'NewTube', self._new_tube_cb)
if sharer:
- log.debug('This is my activity: making a tube...')
+ _logger.debug('This is my activity: making a tube...')
id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube(
SERVICE, {})
else:
- log.debug('I am joining an activity: waiting for a tube...')
+ _logger.debug('I am joining an activity: waiting for a tube...')
self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
reply_handler=self._list_tubes_reply_cb,
error_handler=self._list_tubes_error_cb)
@@ -506,11 +507,11 @@ class SimpleGraph(activity.Activity):
def _list_tubes_error_cb(self, e):
"""Log errors."""
- log.debug('Error: ListTubes() failed: %s' % (e))
+ _logger.debug('Error: ListTubes() failed: %s' % (e))
def _new_tube_cb(self, id, initiator, type, service, params, state):
"""Create a new tube."""
- log.debug('New tube: ID=%d initator=%d type=%d service=%s \
+ _logger.debug('New tube: ID=%d initator=%d type=%d service=%s \
params=%r state=%d' % (id, initiator, type, service, params, state))
if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE):
@@ -542,7 +543,7 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
if self._sharing:
_io_str = StringIO()
simplejson.dump(tuple(data), _io_str)
- log.info('Sending chart data...')
+ _logger.info('Sending chart data...')
self.chattube.SendText(_io_str.getvalue())
@@ -775,7 +776,7 @@ class ChartData(gtk.TreeView):
self.get_column(1),
True)
- log.info("Added: %s, Value: %s" % (label, value))
+ _logger.info("Added: %s, Value: %s" % (label, value))
return path
@@ -789,13 +790,13 @@ class ChartData(gtk.TreeView):
return path
def _label_changed(self, cell, path, new_text, model):
- log.info("Change '%s' to '%s'" % (model[path][0], new_text))
+ _logger.info("Change '%s' to '%s'" % (model[path][0], new_text))
model[path][0] = new_text
self.emit("label-changed", str(path), new_text)
def _value_changed(self, cell, path, new_text, model, activity):
- log.info("Change '%s' to '%s'" % (model[path][1], new_text))
+ _logger.info("Change '%s' to '%s'" % (model[path][1], new_text))
is_number = True
number = new_text.replace(",", ".")
try:
diff --git a/charts.py b/charts.py
index f25a1e3..283cdd5 100644
--- a/charts.py
+++ b/charts.py
@@ -41,7 +41,7 @@ class Chart(gobject.GObject):
self.height = height
def data_set(self, data):
- '''Set chart data (dataSet)'''
+ """Set chart data (dataSet)"""
self.dataSet = (
('Puntos', [(i, l[1]) for i, l in enumerate(data)]),
@@ -73,32 +73,32 @@ class Chart(gobject.GObject):
}
def set_color_scheme(self, color='blue'):
- '''Set the chart color scheme'''
+ """Set the chart color scheme"""
self.options["colorScheme"]["args"] = {'initialColor': color}
def set_line_color(self, color='#d1e5ec'):
- '''Set the chart line color'''
+ """Set the chart line color"""
self.options["background"]["lineColor"] = color
def set_x_label(self, text="X"):
- '''Set the X Label'''
+ """Set the X Label"""
self.options["axis"]["x"]["label"] = str(text)
def set_y_label(self, text="Y"):
- '''Set the Y Label'''
+ """Set the Y Label"""
self.options["axis"]["y"]["label"] = str(text)
def set_type(self, type="vertical"):
- '''Set chart type (vertical, horizontal, line, pie)'''
+ """Set chart type (vertical, horizontal, line, pie)"""
self.type = type
def set_title(self, title="SimpleGraph Chart"):
- '''Set the chart title'''
+ """Set the chart title"""
self.options["title"] = title
def render(self, sg=None):
- '''Draw the chart
- Use the self.surface variable for show the chart'''
+ """Draw the chart
+ Use the self.surface variable for show the chart"""
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
self.width,
self.height)
@@ -123,5 +123,5 @@ class Chart(gobject.GObject):
chart.render()
def as_png(self, file):
- '''Save the chart as png image'''
+ """Save the chart as png image"""
self.surface.write_to_png(file)
diff --git a/utils.py b/utils.py
index c4a2ae5..01741df 100644
--- a/utils.py
+++ b/utils.py
@@ -23,7 +23,7 @@ import gconf
def rgb_to_html(color):
- '''Returns a html string from a Gdk color'''
+ """Returns a html string from a Gdk color"""
red = "%x" % int(color.red / 65535.0 * 255)
if len(red) == 1:
red = "0%s" % red
@@ -44,13 +44,13 @@ def rgb_to_html(color):
def get_user_color():
- '''Returns the user colors'''
+ """Returns the user colors"""
color = gconf.client_get_default().get_string("/desktop/sugar/user/color")
return color.split(",")
def get_chart_file(activity_dir):
- '''Returns a path for write the chart in a png image'''
+ """Returns a path for write the chart in a png image"""
chart_file = os.path.join(activity_dir, "chart-1.png")
num = 0
@@ -62,5 +62,5 @@ def get_chart_file(activity_dir):
def get_decimals(number):
- '''Returns the decimals count of a number'''
+ """Returns the decimals count of a number"""
return str(len(number.split('.')[1]))