+ def move_fp_up(self, *args):
+ selection = self.treeview.get_selection()
+ model, path = selection.get_selected()
+ if not path:
+ return
+
+ pos = model[path][0]
+ newpos = max(pos - 1, 0)
+ self.balls.insert(newpos, self.balls.pop(pos))
+
+ # normalizing the position of elements.
+ for index, item in enumerate(self.balls):
+ item.position = index
+
+ self.load_balls_to_treeview()
+ selection.select_path(str(newpos))
+
+ def move_fp_down(self, *args):
+ selection = self.treeview.get_selection()
+ model, path = selection.get_selected()
+ if not path:
+ return
+
+ pos = model[path][0]
+ newpos = min(pos + 1, len(self.balls))
+ self.balls.insert(newpos, self.balls.pop(pos))
+
+ # normalizing the position of elements.
+ for index, item in enumerate(self.balls):
+ item.position = index
+
+ self.load_balls_to_treeview()
+ selection.select_path(str(newpos))
+