diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-03-04 21:25:55 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-03-04 21:25:55 (GMT) |
commit | 23fb24b4b0dadbe2129e9d45b2fb020ffbdf946e (patch) | |
tree | 5d7aca41acd5593a6fea796f2a4ffc1ef1277db8 /toolbar.py | |
parent | 2bbf396d78e254be56c855837b026bba880a9c73 (diff) |
Added support for saving to and opening from the journal.
Diffstat (limited to 'toolbar.py')
-rw-r--r-- | toolbar.py | 229 |
1 files changed, 106 insertions, 123 deletions
@@ -16,8 +16,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import logging -import gtk -import pango import abiword import hippo @@ -25,143 +23,128 @@ from sugar.graphics.toolbar import Toolbar from sugar.graphics.iconbutton import IconButton class AbiToolbar(object): - def __init__(self, hippoCanvasBox, abiword_canvas): - toolbar = Toolbar() - hippoCanvasBox.append(toolbar) - - self._abiword_canvas = abiword_canvas - - self._open = IconButton(icon_name='theme:stock-open') - self._open.connect("activated", self._open_cb) - toolbar.append(self._open) - - self._save = IconButton(icon_name='theme:stock-save') - self._save.connect("activated", self._save_cb) - self._abiword_canvas.connect("is-dirty", self._isDirty_cb) - toolbar.append(self._save) - -# self._insert_separator() - - self._undo = IconButton(icon_name='theme:stock-undo') - self._undo.connect("activated", self._undo_cb) - self._abiword_canvas.connect("can_undo", self._canUndo_cb) - toolbar.append(self._undo) - - self._redo = IconButton(icon_name='theme:stock-redo') - self._redo.connect("activated", self._redo_cb) - self._abiword_canvas.connect("can_redo", self._canRedo_cb) - toolbar.append(self._redo) - -# self._insert_separator() - - self._underline = IconButton(icon_name='theme:stock-underline') - self._underline_id = self._underline.connect("activated", self._underline_cb) - self._abiword_canvas.connect("underline", self._isUnderline_cb) - toolbar.append(self._underline) - - self._bold = IconButton(icon_name='theme:stock-bold') - self._bold_id = self._bold.connect("activated", self._bold_cb) - self._abiword_canvas.connect("bold", self._isBold_cb) - toolbar.append(self._bold) - -# self._insert_separator() - - self._align_left = IconButton(icon_name='theme:stock-justify-left') - self._align_left_id = self._align_left.connect("activated", self._align_left_cb) - self._abiword_canvas.connect("left-align", self._isLeftAlign_cb) - toolbar.append(self._align_left) - - self._align_center = IconButton(icon_name='theme:stock-justify-center') - self._align_center_id = self._align_center.connect("activated", self._align_center_cb) - self._abiword_canvas.connect("center-align", self._isCenterAlign_cb) - toolbar.append(self._align_center) - - self._align_right = IconButton(icon_name='theme:stock-justify-right') - self._align_right_id = self._align_right.connect("activated", self._align_right_cb) - self._abiword_canvas.connect("right-align", self._isRightAlign_cb) - toolbar.append(self._align_right) + def __init__(self, hippoCanvasBox, abiword_canvas): + toolbar = Toolbar() + hippoCanvasBox.append(toolbar) + + self._abiword_canvas = abiword_canvas + +# self._insert_separator() + + self._undo = IconButton(icon_name='theme:stock-undo') + self._undo.connect("activated", self._undo_cb) + self._abiword_canvas.connect("can_undo", self._canUndo_cb) + toolbar.append(self._undo) + + self._redo = IconButton(icon_name='theme:stock-redo') + self._redo.connect("activated", self._redo_cb) + self._abiword_canvas.connect("can_redo", self._canRedo_cb) + toolbar.append(self._redo) + +# self._insert_separator() + + self._underline = IconButton(icon_name='theme:stock-underline') + self._underline_id = self._underline.connect("activated", self._underline_cb) + self._abiword_canvas.connect("underline", self._isUnderline_cb) + toolbar.append(self._underline) + + self._bold = IconButton(icon_name='theme:stock-bold') + self._bold_id = self._bold.connect("activated", self._bold_cb) + self._abiword_canvas.connect("bold", self._isBold_cb) + toolbar.append(self._bold) + +# self._insert_separator() + + self._align_left = IconButton(icon_name='theme:stock-justify-left') + self._align_left_id = self._align_left.connect("activated", self._align_left_cb) + self._abiword_canvas.connect("left-align", self._isLeftAlign_cb) + toolbar.append(self._align_left) + + self._align_center = IconButton(icon_name='theme:stock-justify-center') + self._align_center_id = self._align_center.connect("activated", self._align_center_cb) + self._abiword_canvas.connect("center-align", self._isCenterAlign_cb) + toolbar.append(self._align_center) + + self._align_right = IconButton(icon_name='theme:stock-justify-right') + self._align_right_id = self._align_right.connect("activated", self._align_right_cb) + self._abiword_canvas.connect("right-align", self._isRightAlign_cb) + toolbar.append(self._align_right) # reenable this after march 6th -# self._table = abiword.TableCreator() -# self._table.set_labels("Table", "Cancel") -# self._table.show() -# #self._tableCreate.label().hide() - -# tableContainer = hippo.CanvasWidget() -# tableContainer.props.widget = self._table; -# self._table_id = self._table.connect("selected", self._table_cb) - #self._table_id = self._abiword_canvas.connect("table-state", self._tableState) -# toolbar.append(tableContainer) - -# def _insert_separator(self): -# separator = gtk.SeparatorToolItem() -# separator.set_draw(True) -# self.insert(separator, -1) -# separator.show() +# self._table = abiword.TableCreator() +# self._table.set_labels("Table", "Cancel") +# self._table.show() +# #self._tableCreate.label().hide() + +# tableContainer = hippo.CanvasWidget() +# tableContainer.props.widget = self._table; +# self._table_id = self._table.connect("selected", self._table_cb) + #self._table_id = self._abiword_canvas.connect("table-state", self._tableState) +# toolbar.append(tableContainer) + +# def _insert_separator(self): +# separator = gtk.SeparatorToolItem() +# separator.set_draw(True) +# self.insert(separator, -1) +# separator.show() # -# def setToggleButtonState(self, button, b, id): -# button.handler_block(id) -# button.set_active(b) -# button.handler_unblock(id) - - def _open_cb(self, button): - self._abiword_canvas.file_open() +# def setToggleButtonState(self, button, b, id): +# button.handler_block(id) +# button.set_active(b) +# button.handler_unblock(id) - def _save_cb(self, button): - self._abiword_canvas.file_save() + def _isDirty_cb(self, abi, b): + print "isDirty",b +# self._save.set_sensitive(b) - def _isDirty_cb(self, abi, b): - print "isDirty",b -# self._save.set_sensitive(b) + def _undo_cb(self, button): + self._abiword_canvas.undo() - def _undo_cb(self, button): - self._abiword_canvas.undo() + def _canUndo_cb(self, abi, b): + print "canUndo",b +# self._undo.set_sensitive(b) - def _canUndo_cb(self, abi, b): - print "canUndo",b -# self._undo.set_sensitive(b) + def _redo_cb(self, button): + self._abiword_canvas.redo() - def _redo_cb(self, button): - self._abiword_canvas.redo() + def _canRedo_cb(self, abi ,b): + print "canRedo",b +# self._redo.set_sensitive(b) - def _canRedo_cb(self, abi ,b): - print "canRedo",b -# self._redo.set_sensitive(b) + def _underline_cb(self, button): + self._abiword_canvas.toggle_underline() - def _underline_cb(self, button): - self._abiword_canvas.toggle_underline() + def _isUnderline_cb(self, abi, b): + print "isUnderline",b +# self.setToggleButtonState(self._underline, b, self._underline_id) - def _isUnderline_cb(self, abi, b): - print "isUnderline",b -# self.setToggleButtonState(self._underline, b, self._underline_id) + def _bold_cb(self, button): + self._abiword_canvas.toggle_bold() - def _bold_cb(self, button): - self._abiword_canvas.toggle_bold() + def _isBold_cb(self, abi, b): + print "isBold",b +# self.setToggleButtonState(self._bold,b,self._bold_id) - def _isBold_cb(self, abi, b): - print "isBold",b -# self.setToggleButtonState(self._bold,b,self._bold_id) + def _align_left_cb(self, button): + self._abiword_canvas.align_left() - def _align_left_cb(self, button): - self._abiword_canvas.align_left() + def _isLeftAlign_cb(self, abi, b): + print "isLeftAlign",b +# self.setToggleButtonState(self._align_left,b,self._align_left_id) - def _isLeftAlign_cb(self, abi, b): - print "isLeftAlign",b -# self.setToggleButtonState(self._align_left,b,self._align_left_id) + def _align_center_cb(self, button): + self._abiword_canvas.align_center() - def _align_center_cb(self, button): - self._abiword_canvas.align_center() + def _isCenterAlign_cb(self, abi, b): + print "isCenterAlign",b +# self.setToggleButtonState(self._align_center,b,self._align_center_id) - def _isCenterAlign_cb(self, abi, b): - print "isCenterAlign",b -# self.setToggleButtonState(self._align_center,b,self._align_center_id) + def _align_right_cb(self, button): + self._abiword_canvas.align_right() - def _align_right_cb(self, button): - self._abiword_canvas.align_right() + def _isRightAlign_cb(self, abi, b): + print "isRightAlign",b +# self.setToggleButtonState(self._align_right,b,self._align_right_id) - def _isRightAlign_cb(self, abi, b): - print "isRightAlign",b -# self.setToggleButtonState(self._align_right,b,self._align_right_id) - -# def _table_cb(self, abi, rows, cols): -# self._abiword_canvas.insert_table(rows,cols) +# def _table_cb(self, abi, rows, cols): +# self._abiword_canvas.insert_table(rows,cols) |