Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-12-25 17:14:29 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-12-25 17:14:29 (GMT)
commite995825e47cadf22de98a80a1390e0ac40c15d8e (patch)
tree61bf647bbcceabd9e3b600c2bb7f58c2a01fdc40
parent2159dd19e08e4c7466d1dffddb4868add40ca9e0 (diff)
add remove button
-rwxr-xr-xactivity.py9
-rwxr-xr-xconozco.py2
-rw-r--r--points_list.py7
3 files changed, 15 insertions, 3 deletions
diff --git a/activity.py b/activity.py
index e6437b5..7b7032a 100755
--- a/activity.py
+++ b/activity.py
@@ -58,6 +58,11 @@ class Activity(activity.Activity):
add_point.set_tooltip(_("Add a point"))
toolbar_box.toolbar.insert(add_point, -1)
+ rem_point = ToolButton("row-remove")
+ rem_point.connect("clicked", self._remove_point)
+ rem_point.set_tooltip(_("Remove the selected point"))
+ toolbar_box.toolbar.insert(rem_point, -1)
+
# separator and stop button
separator = gtk.SeparatorToolItem()
separator.props.draw = False
@@ -123,6 +128,10 @@ class Activity(activity.Activity):
def _add_point(self, widget, label="", value="City"):
pos = self.labels_and_values.add_value(label, value)
+ def _remove_point(self, widget):
+ path = self.labels_and_values.remove_selected_value()
+ self._update_points()
+
def _add_coor(self, pos):
if self._image is not None:
self.labels_and_values.update_selected_value(pos)
diff --git a/conozco.py b/conozco.py
index 0ac2618..86bf4dd 100755
--- a/conozco.py
+++ b/conozco.py
@@ -469,6 +469,7 @@ class Conozco():
x = int(image.get_width() * scale)
y = int(image.get_height() * scale)
self.fondo = pygame.transform.scale(image, (x,y))
+ self.pantalla.fill((0,0,0))
self.pantalla.blit(self.fondo, (shift_x, shift_y))
def showName(self, text, pos, font, color=(0,0,0)):
@@ -478,6 +479,7 @@ class Conozco():
self.pantalla.blit(t, r)
def update_points(self, l):
+ self.pantalla.fill((0,0,0))
self.pantalla.blit(self.fondo, (shift_x, shift_y))
for p in l:
name = p[0]
diff --git a/points_list.py b/points_list.py
index fef1abd..142b615 100644
--- a/points_list.py
+++ b/points_list.py
@@ -61,9 +61,10 @@ class Data(gtk.TreeView):
def remove_selected_value(self):
path, column = self.get_cursor()
- path = path[0]
- model, iter = self.get_selection().get_selected()
- self.model.remove(iter)
+ if path is not None:
+ path = path[0]
+ model, iter = self.get_selection().get_selected()
+ self.model.remove(iter)
return path
def update_selected_value(self, data):