diff options
-rwxr-xr-x | activity.py | 24 | ||||
-rwxr-xr-x | conozco.py | 9 | ||||
-rw-r--r-- | points_list.py | 16 |
3 files changed, 24 insertions, 25 deletions
diff --git a/activity.py b/activity.py index 94d7e06..ce36ce2 100755 --- a/activity.py +++ b/activity.py @@ -31,7 +31,8 @@ class Activity(activity.Activity): def init_vars(self): self._image = None - self._places = {} + + def build_toolbar(self): @@ -83,16 +84,10 @@ class Activity(activity.Activity): self.table.attach(self.box1, 0, 1, 0, 1) self.table.attach(self.box2, 1, 2, 0, 1) - - # buttons to add - #table = gtk.Table(5, 3, False) self.labels_and_values = Data(self) self.box2.add(self.labels_and_values) - - - #self.box2.add(table) self.set_canvas(self.table) @@ -119,29 +114,24 @@ class Activity(activity.Activity): if f is not None: self._image = pygame.image.load(f) self.actividad.set_background(self._image) - #self.actividad.fondo = self._image - #self.actividad.pantalla.blit(self._image, (0, 0)) + def _add_point(self, widget, label="", value="City"): #data = (label, float(value)) #if not data in self.chart_data: pos = self.labels_and_values.add_value(label, value) print 'new pos', pos - self._places[pos] = [value, (0,0)] + #self.chart_data.insert(pos, data) #self._update_chart_data() def _add_coor(self, pos): path = self.labels_and_values.update_selected_value(pos) - self._places[path][1] = pos + self._update_points() def _update_points(self): - self.actividad.update_points(self._places) - - def read_file(self, file_path): - pass + l = self.labels_and_values.get_info() + self.actividad.update_points(l) - def write_file(self, file_path): - pass @@ -475,12 +475,11 @@ class Conozco(): t = font.render(text, 1, color) self.pantalla.blit(t, pos) - def update_points(self, data): + def update_points(self, l): self.pantalla.blit(self.fondo, (shift_x, shift_y)) - for p in data: - info = data[p] - name = info[0] - pos = info[1] + for p in l: + name = p[0] + pos = p[1] self.pantalla.blit(self.simboloCiudad, pos) self.showName(name, pos, self.fuente9) diff --git a/points_list.py b/points_list.py index 25f739b..0f5ce28 100644 --- a/points_list.py +++ b/points_list.py @@ -81,7 +81,7 @@ class Data(gtk.TreeView): def _label_changed(self, cell, path, new_text, model): model[path][0] = new_text - + self.emit("label-changed", str(path), new_text) def _value_changed(self, cell, path, new_text, model, activity): @@ -90,6 +90,16 @@ class Data(gtk.TreeView): self.emit("value-changed", str(path), new_text) - - + def get_info(self): + l = [] + for row in self.model: + name = row[1] + pos = row[0] + pos = pos.replace('(', '') + pos = pos.replace(')', '') + pos = pos.split(',') + pos = [float(pos[0]), float(pos[1])] + pos = (int(pos[0]), int(pos[1])) + l.append((name, pos)) + return l |