Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/toolbar.py
diff options
context:
space:
mode:
authorMarc Maurer <uwog@uwog.net>2007-05-09 11:03:37 (GMT)
committer Marc Maurer <uwog@uwog.net>2007-05-09 11:03:37 (GMT)
commitc2b8d69db23e95e8740e4116295b88f936e8eb35 (patch)
treea24df8ec1b082ef92cd27d2002d30712d66cafea /toolbar.py
parent5767418bee5f942d075d808d75faf7b9844d3c40 (diff)
Allow setting of font colors
Diffstat (limited to 'toolbar.py')
-rw-r--r--toolbar.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/toolbar.py b/toolbar.py
index dddbde9..ac900cb 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -31,6 +31,8 @@ class TextToolbar(gtk.Toolbar):
_ACTION_ALIGNMENT_RIGHT = 2
def __init__(self, abiword_canvas):
+ self._colorseldlg = None
+
gtk.Toolbar.__init__(self)
self._abiword_canvas = abiword_canvas
@@ -53,6 +55,12 @@ class TextToolbar(gtk.Toolbar):
self.insert(self._underline, -1)
self._underline.show()
+ self._text_color = ToolButton('')
+ self._text_color_id = self._text_color.connect('clicked', self._text_color_cb)
+# self._abiword_canvas.connect('text-color', self._isUnderline_cb)
+ self.insert(self._text_color, -1)
+ self._text_color.show()
+
separator = gtk.SeparatorToolItem()
separator.set_draw(True)
self.insert(separator, -1)
@@ -108,6 +116,13 @@ class TextToolbar(gtk.Toolbar):
button.set_active(b)
button.handler_unblock(id)
+ 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 _italic_cb(self, button):
self._abiword_canvas.toggle_italic()
@@ -122,12 +137,14 @@ class TextToolbar(gtk.Toolbar):
print 'isUnderline',b
self.setToggleButtonState(self._underline, b, self._underline_id)
- 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 _text_color_cb(self, button):
+ if self._colorseldlg == None:
+ self._colorseldlg = gtk.ColorSelectionDialog('Select text color')
+ response = self._colorseldlg.run()
+ if response == gtk.RESPONSE_OK:
+ newcolor = self._colorseldlg.colorsel.get_current_color()
+ self._abiword_canvas.set_text_color(newcolor.red // 256.0, newcolor.green // 256.0, newcolor.blue // 256.0)
+ self._colorseldlg.hide()
def _font_changed_cb(self, combobox):
if self._font_combo.get_active() != -1: