Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-09-08 20:19:09 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-09-08 20:19:09 (GMT)
commit077623fe0f4c1ccc5a00b75402a102b0c9e744d9 (patch)
treee555fbd1636e3e73ba9ad80de7b8b573cd6bcb50
parent53b69319f335bc91cd2f310633c767be2605a63d (diff)
Pylint cleanups
-rw-r--r--AbiWordActivity.py36
-rw-r--r--toolbar.py60
-rw-r--r--widgets.py10
3 files changed, 57 insertions, 49 deletions
diff --git a/AbiWordActivity.py b/AbiWordActivity.py
index b9a2f00..f6c54fa 100644
--- a/AbiWordActivity.py
+++ b/AbiWordActivity.py
@@ -19,8 +19,6 @@
from gettext import gettext as _
import logging
import os
-import time
-import shutil
# Abiword needs this to happen as soon as possible
import gobject
@@ -31,17 +29,27 @@ import gtk
import telepathy
import telepathy.client
-from sugar.graphics.toolcombobox import ToolComboBox
-from sugar.graphics.toolbarbox import ToolbarButton, ToolbarBox
+from abiword import Canvas
+
from sugar.activity import activity
-from sugar.activity.widgets import *
+from sugar.activity.widgets import StopButton
+from sugar.activity.widgets import ActivityToolbarButton
+from sugar.activity.activity import get_bundle_path
+
from sugar.presence import presenceservice
+
+from sugar.graphics.toolbarbox import ToolbarButton, ToolbarBox
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.colorbutton import ColorToolButton
from sugar.graphics import style
-from abiword import Canvas
-from toolbar import *
-from widgets import *
-from sugar.activity.activity import get_bundle_path
+from toolbar import EditToolbar
+from toolbar import ViewToolbar
+from toolbar import TextToolbar
+from toolbar import ListToolbar
+from toolbar import InsertToolbar
+from toolbar import ParagraphToolbar
+from widgets import ExportButton
logger = logging.getLogger('write-activity')
@@ -169,7 +177,7 @@ class AbiWordActivity (activity.Activity):
int(newcolor.green / 256.0),
int(newcolor.blue / 256.0))
- def _setToggleButtonState(self,button,b,id):
+ def _setToggleButtonState(self, button, b, id):
button.handler_block(id)
button.set_active(b)
button.handler_unblock(id)
@@ -340,7 +348,7 @@ class AbiWordActivity (activity.Activity):
if state == telepathy.TUBE_STATE_LOCAL_PENDING:
self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id)
- initiator_path = None;
+ initiator_path = None
contacts = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].GetDBusNames(id)
#print 'dbus contact mapping',self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].GetDBusNames(id)
for i, struct in enumerate(contacts):
@@ -349,7 +357,7 @@ class AbiWordActivity (activity.Activity):
if handle == initiator:
logger.debug('found initiator dbus path: %s', path)
initiator_path = path
- break;
+ break
if initiator_path is None:
logger.error('Unable to get the dbus path of the tube initiator')
@@ -433,10 +441,10 @@ class AbiWordActivity (activity.Activity):
# if we were viewing the source of a file,
# then always save as plain text
- actual_mimetype = self.metadata['mime_type'];
+ actual_mimetype = self.metadata['mime_type']
if 'source' in self.metadata and self.metadata['source'] == '1':
logger.debug('Writing file as type source (text/plain)')
actual_mimetype = 'text/plain'
self.metadata['fulltext'] = self.abiword_canvas.get_content(extension_or_mimetype=".txt")[:3000]
- self.abiword_canvas.save('file://' + file_path, actual_mimetype, '');
+ self.abiword_canvas.save('file://' + file_path, actual_mimetype, '')
diff --git a/toolbar.py b/toolbar.py
index 83ae23c..6e0253e 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -22,22 +22,18 @@ import logging
import abiword
import gtk
-from sugar.graphics.radiopalette import RadioMenuButton
-from sugar.graphics.icon import Icon
from sugar.graphics.toolbutton import ToolButton
-from sugar.graphics.toggletoolbutton import ToggleToolButton
-from sugar.graphics.colorbutton import ColorToolButton
from sugar.graphics.toolcombobox import ToolComboBox
-from sugar.graphics.objectchooser import ObjectChooser
from sugar.graphics import iconentry
-from sugar.activity import activity
-from sugar.activity.widgets import *
-from sugar.graphics.palette import Palette
-from sugar import mime
+from sugar.activity.widgets import CopyButton
+from sugar.activity.widgets import PasteButton
+from sugar.activity.widgets import UndoButton
+from sugar.activity.widgets import RedoButton
from port import chooser
-import sugar.profile
-import widgets
+from widgets import AbiButton
+from widgets import FontCombo
+from widgets import FontSizeCombo
logger = logging.getLogger('write-activity')
@@ -102,20 +98,20 @@ class EditToolbar(gtk.Toolbar):
'system-search')
self._search_entry.connect('activate', self._search_entry_activated_cb)
self._search_entry.connect('changed', self._search_entry_changed_cb)
- self._search_entry.add_clear_button();
+ self._search_entry.add_clear_button()
self._add_widget(self._search_entry, expand=True)
self._findprev = ToolButton('go-previous-paired')
self._findprev.set_tooltip(_('Find previous'))
self.insert(self._findprev, -1)
self._findprev.show()
- self._findprev.connect('clicked', self._findprev_cb);
+ self._findprev.connect('clicked', self._findprev_cb)
self._findnext = ToolButton('go-next-paired')
self._findnext.set_tooltip(_('Find next'))
self.insert(self._findnext, -1)
self._findnext.show()
- self._findnext.connect('clicked', self._findnext_cb);
+ self._findnext.connect('clicked', self._findnext_cb)
# set the initial state of the search controls
# note: we won't simple call self._search_entry_changed_cb
@@ -198,22 +194,26 @@ class InsertToolbar(gtk.Toolbar):
self._table_rows_after = ToolButton('row-insert')
self._table_rows_after.set_tooltip(_('Insert Row'))
- self._table_rows_after_id = self._table_rows_after.connect('clicked', self._table_rows_after_cb)
+ self._table_rows_after_id = self._table_rows_after.connect( \
+ 'clicked', self._table_rows_after_cb)
self.insert(self._table_rows_after, -1)
self._table_delete_rows = ToolButton('row-remove')
self._table_delete_rows.set_tooltip(_('Delete Row'))
- self._table_delete_rows_id = self._table_delete_rows.connect('clicked', self._table_delete_rows_cb)
+ self._table_delete_rows_id = self._table_delete_rows.connect( \
+ 'clicked', self._table_delete_rows_cb)
self.insert(self._table_delete_rows, -1)
self._table_cols_after = ToolButton('column-insert')
self._table_cols_after.set_tooltip(_('Insert Column'))
- self._table_cols_after_id = self._table_cols_after.connect('clicked', self._table_cols_after_cb)
+ self._table_cols_after_id = self._table_cols_after.connect( \
+ 'clicked', self._table_cols_after_cb)
self.insert(self._table_cols_after, -1)
self._table_delete_cols = ToolButton('column-remove')
self._table_delete_cols.set_tooltip(_('Delete Column'))
- self._table_delete_cols_id = self._table_delete_cols.connect('clicked', self._table_delete_cols_cb)
+ self._table_delete_cols_id = self._table_delete_cols.connect( \
+ 'clicked', self._table_delete_cols_cb)
self.insert(self._table_delete_cols, -1)
separator = gtk.SeparatorToolItem()
@@ -236,7 +236,7 @@ class InsertToolbar(gtk.Toolbar):
chooser.pick(what=chooser.IMAGE, cb=cb)
def _table_cb(self, abi, rows, cols):
- self._abiword_canvas.insert_table(rows,cols)
+ self._abiword_canvas.insert_table(rows, cols)
def _table_rows_after_cb(self, button):
self._abiword_canvas.invoke_cmd('insertRowsAfter', '', 0, 0)
@@ -261,7 +261,7 @@ class ViewToolbar(gtk.Toolbar):
gtk.Toolbar.__init__(self)
self._abiword_canvas = abiword_canvas
- self._zoom_percentage = 0;
+ self._zoom_percentage = 0
self._zoom_out = ToolButton('zoom-out')
self._zoom_out.set_tooltip(_('Zoom Out'))
@@ -278,7 +278,8 @@ class ViewToolbar(gtk.Toolbar):
# TODO: fix the initial value
self._zoom_spin_adj = gtk.Adjustment(0, 25, 400, 25, 50, 0)
self._zoom_spin = gtk.SpinButton(self._zoom_spin_adj, 0, 0)
- self._zoom_spin_id = self._zoom_spin.connect('value-changed', self._zoom_spin_cb)
+ self._zoom_spin_id = self._zoom_spin.connect('value-changed',
+ self._zoom_spin_cb)
self._zoom_spin.set_numeric(True)
self._zoom_spin.show()
tool_item_zoom = gtk.ToolItem()
@@ -307,7 +308,8 @@ class ViewToolbar(gtk.Toolbar):
self._page_spin_adj = gtk.Adjustment(0, 1, 0, 1, 1, 0)
self._page_spin = gtk.SpinButton(self._page_spin_adj, 0, 0)
- self._page_spin_id = self._page_spin.connect('value-changed', self._page_spin_cb)
+ self._page_spin_id = self._page_spin.connect('value-changed',
+ self._page_spin_cb)
self._page_spin.set_numeric(True)
self._page_spin.show()
tool_item_page = gtk.ToolItem()
@@ -354,8 +356,8 @@ class ViewToolbar(gtk.Toolbar):
self._abiword_canvas.set_zoom_percentage(self._zoom_percentage)
def _page_spin_cb(self, button):
- self._page_num = self._page_spin.get_value_as_int()
- self._abiword_canvas.set_current_page(self._page_num)
+ page_num = self._page_spin.get_value_as_int()
+ self._abiword_canvas.set_current_page(page_num)
def _page_count_cb(self, canvas, count):
current_page = canvas.get_current_page_num()
@@ -374,10 +376,10 @@ class TextToolbar(gtk.Toolbar):
def __init__(self, abiword_canvas):
gtk.Toolbar.__init__(self)
- font_name = ToolComboBox(widgets.FontCombo(abiword_canvas))
+ font_name = ToolComboBox(FontCombo(abiword_canvas))
self.insert(font_name, -1)
- font_size = ToolComboBox(widgets.FontSizeCombo(abiword_canvas))
+ font_size = ToolComboBox(FontSizeCombo(abiword_canvas))
self.insert(font_size, -1)
# MAGIC NUMBER WARNING: Secondary toolbars are not a standard height?
@@ -390,7 +392,7 @@ class ParagraphToolbar(gtk.Toolbar):
gtk.Toolbar.__init__(self)
def append(icon_name, tooltip, do_abi_cb, on_abi_cb):
- button = widgets.AbiButton(abi, 'style-name', do_abi_cb, on_abi_cb)
+ button = AbiButton(abi, 'style-name', do_abi_cb, on_abi_cb)
button.props.icon_name = icon_name
button.props.group = group
button.props.tooltip = tooltip
@@ -437,7 +439,7 @@ class ParagraphToolbar(gtk.Toolbar):
self.insert(gtk.SeparatorToolItem(), -1)
def append(icon_name, tooltip, do_abi_cb, style_name):
- button = widgets.AbiButton(abi, style_name, do_abi_cb)
+ button = AbiButton(abi, style_name, do_abi_cb)
button.props.icon_name = icon_name
button.props.group = group
button.props.tooltip = tooltip
@@ -465,7 +467,7 @@ class ListToolbar(gtk.Toolbar):
gtk.Toolbar.__init__(self)
def append(icon_name, tooltip, do_abi_cb, on_abi_cb):
- button = widgets.AbiButton(abi, 'style-name', do_abi_cb, on_abi_cb)
+ button = AbiButton(abi, 'style-name', do_abi_cb, on_abi_cb)
button.props.icon_name = icon_name
button.props.group = group
button.props.tooltip = tooltip
diff --git a/widgets.py b/widgets.py
index c8c26fc..ecdaf19 100644
--- a/widgets.py
+++ b/widgets.py
@@ -13,7 +13,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
-import gtk
import dbus
import time
from gettext import gettext as _
@@ -22,7 +21,6 @@ import logging
from sugar.graphics.radiotoolbutton import RadioToolButton
from sugar.graphics.combobox import ComboBox
from sugar.graphics.palette import Palette
-from sugar.graphics.radiopalette import RadioPalette
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.menuitem import MenuItem
from sugar.datastore import datastore
@@ -61,7 +59,7 @@ class FontCombo(ComboBox):
for i, f in enumerate(self._fonts):
if f == font_family:
font_index = i
- break;
+ break
# if we don't know this font yet, then add it (temporary) to the list
if font_index == -1:
@@ -120,7 +118,7 @@ class FontSizeCombo(ComboBox):
self.handler_block(self._changed_id)
self.set_active(i)
self.handler_unblock(self._changed_id)
- break;
+ break
class AbiButton(RadioToolButton):
def __init__(self, abi, abi_signal, do_abi_cb, on_abi_cb=None, **kwargs):
@@ -195,13 +193,13 @@ class ExportButton(ToolButton):
# special case HTML export to set the activity name as the HTML title
if format['mime_type'] == "text/html":
- exp_props += " title:" + activity.metadata['title'] + ';';
+ exp_props += " title:" + activity.metadata['title'] + ';'
# create a new journal item
fileObject = datastore.create()
act_meta = activity.metadata
fileObject.metadata['title'] = \
- act_meta['title'] + ' (' + format['jpostfix'] + ')';
+ act_meta['title'] + ' (' + format['jpostfix'] + ')'
fileObject.metadata['title_set_by_user'] = act_meta['title_set_by_user']
fileObject.metadata['mime_type'] = format['mime_type']
fileObject.metadata['fulltext'] = abi.get_content(