changeset 37853053c942 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=37853053c942
description: merge

diffstat:

 data/glade/whiteboard_widget.glade |  15 ++++++++++++++-
 src/whiteboardwidget.py            |  25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)

diffs (88 lines):

diff -r d3a8c41969c8 -r 37853053c942 data/glade/whiteboard_widget.glade
--- a/data/glade/whiteboard_widget.glade        Fri Jul 31 19:43:45 2009 -0700
+++ b/data/glade/whiteboard_widget.glade        Fri Jul 31 19:44:24 2009 -0700
@@ -43,6 +43,19 @@
                 <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
+            </child><child>
+              <widget class="GtkButton" id="line_button">
+                <property name="label" translatable="yes">Line Tool</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="on_line_button_clicked"/>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
             </child>
             <child>
               <widget class="GtkButton" id="export_button">
@@ -55,7 +68,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
diff -r d3a8c41969c8 -r 37853053c942 src/whiteboardwidget.py
--- a/src/whiteboardwidget.py   Fri Jul 31 19:43:45 2009 -0700
+++ b/src/whiteboardwidget.py   Fri Jul 31 19:44:24 2009 -0700
@@ -49,6 +49,9 @@
 
        def on_oval_button_clicked(self, widget):
                self.draw_tool = 'oval'
+       
+       def on_line_button_clicked(self, widget):
+               self.draw_tool = 'line'
 
        def on_export_button_clicked(self, widget):
                self.image.print_xml()
@@ -75,6 +78,9 @@
                        
                elif self.draw_tool == 'oval':
                        self.item_data = True
+                       
+               if self.draw_tool == 'line':
+                       self.item_data = 'M %s,%s L' % (x, y)
 
        def motion_notify_event(self, widget, event):
                x = event.x
@@ -97,6 +103,11 @@
                                        radius_y=abs(y - 
self.item_temp_coords[1]) / 2,
                                        stroke_color=self.color,
                                        line_width=self.line_width)
+                       elif self.draw_tool == 'line':
+                               self.item_data = 'M %s,%s L' % 
self.item_temp_coords
+                               self.item_data = self.item_data + ' %s,%s' % 
(x,y)
+                               self.item_temp = self.item_temp = 
goocanvas.Path(parent=self.root,
+                                       data=self.item_data, 
line_width=self.line_width)
 
        def button_release_event(self, widget, event):
                x = event.x
@@ -123,6 +134,20 @@
                        ry = abs(y - self.item_temp_coords[1]) / 2
                        self.image.add_ellipse(cx, cy, rx, ry, self.line_width, 
self.color)
 
+               if self.draw_tool == 'line':
+                       self.item_data = 'M %s,%s L' % self.item_temp_coords
+                       self.item_data = self.item_data + ' %s,%s' % (x,y)
+                       if x == self.item_temp_coords[0] and y == 
self.item_temp_coords[1]:
+                               goocanvas.Ellipse(parent=self.root,
+                                       center_x=x,
+                                       center_y=y,
+                                       radius_x=1,
+                                       radius_y=1,
+                                       stroke_color='black',
+                                       fill_color='black',
+                                       line_width=self.line_width)
+                       self.image.add_path(self.item_data, self.line_width)
+
                self.item_data = None
                if self.item_temp is not None:
                        self.item_temp.remove()
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to