From e995825e47cadf22de98a80a1390e0ac40c15d8e Mon Sep 17 00:00:00 2001 From: Alan Aguiar Date: Wed, 25 Dec 2013 17:14:29 +0000 Subject: add remove button --- 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): -- cgit v0.9.1