#4424 NORM 10.1.3: Insert table while image is selected
Zarro Boogs per Child
bugtracker at laptop.org
Wed Oct 27 06:52:39 EDT 2010
#4424: Insert table while image is selected
------------------------------------------------+---------------------------
Reporter: uwog | Owner: uwog
Type: enhancement | Status: new
Priority: normal | Milestone: 10.1.3
Component: write-activity (abiword) | Version:
Resolution: | Keywords:
Next_action: review | Verified: 0
Deployment_affected: | Blockedby:
Blocking: |
------------------------------------------------+---------------------------
Changes (by erikos):
* cc: godiard (added)
* next_action: => review
* milestone: Future Release => 10.1.3
Comment:
Interesting: So the current behavior is that when you have an image
selected and add a table the table is created over the image. With the
patch from #7405 applied, the image is deleted and the table is placed
instead (as a side note).
So your patch does disable the button when an image is selected. Wouldn't
that be enough?
{{{
diff --git a/toolbar.py b/toolbar.py
index 6b85077..9afdf98 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -228,12 +228,14 @@ class InsertToolbar(gtk.Toolbar):
self.show_all()
self._abiword_canvas.connect('table-state', self._isTable_cb)
- #self._abiword_canvas.connect('image-selected',
self._image_selected_cb)
+ self._abiword_canvas.connect('image-selected',
self._image_selected_cb)
+ self._abiword_canvas.connect('selection_cleared',
+ self._image_selection_cleared_cb)
def _image_cb(self, button):
def cb(object):
logging.debug('ObjectChooser: %r' % object)
- self._abiword_canvas.insert_image(object.file_path, True)
+ self._abiword_canvas.insert_image(object.file_path, False)
chooser.pick(parent=self._abiword_canvas.get_toplevel(),
what=chooser.IMAGE, cb=cb)
def _table_cb(self, abi, rows, cols):
@@ -257,6 +259,12 @@ class InsertToolbar(gtk.Toolbar):
self._table_cols_after.set_sensitive(b)
self._table_delete_cols.set_sensitive(b)
+ def _image_selected_cb(self, abi, image_selected):
+ self._table.set_sensitive(False)
+
+ def _image_selection_cleared_cb(self, abi, selection_cleared):
+ self._table.set_sensitive(True)
+
class ViewToolbar(gtk.Toolbar):
def __init__(self, abiword_canvas):
gtk.Toolbar.__init__(self)
}}}
About code style: the method names of callbacks should be extended by
'cb'. And they should be made private by two leading underscores (see PEP8
"Method Names and Instance Variables"). I did not do it in the patch
pasted above, as the callbacks around do not do it neither. We should do
change them all in a separate cleanup go.
Don't forget to add yourself in cc to not miss updates to the ticket :)
You should maybe assign the ticket as well to you as you are working on
it.
--
Ticket URL: <http://dev.laptop.org/ticket/4424#comment:2>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list