예제 #1
0
 def _reskin_turtle(self, payload):
     if len(payload) > 0:
         [nick, [width, height, data]] = data_from_string(payload)
         if nick != self._tw.nick:
             if self._tw.running_sugar:
                 tmp_path = get_path(self._tw.activity, 'instance')
             else:
                 tmp_path = '/tmp'
             file_name = base64_to_image(data, tmp_path)
             pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
                 file_name, width, height)
             self._tw.turtles.set_turtle(nick)
             self._tw.turtles.get_active_turtle().set_shapes([pixbuf])
 def _reskin_turtle(self, payload):
     if len(payload) > 0:
         [nick, [width, height, data]] = data_from_string(payload)
         if nick != self._tw.nick:
             if self._tw.running_sugar:
                 tmp_path = get_path(self._tw.activity, 'instance')
             else:
                 tmp_path = '/tmp'
             file_name = base64_to_image(data, tmp_path)
             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(file_name,
                                                             width, height)
             self._tw.turtles.set_turtle(nick)
             self._tw.turtles.get_active_turtle().set_shapes([pixbuf])
예제 #3
0
 def _draw_pixbuf(self, payload):
     if len(payload) > 0:
         [nick, [a, b, x, y, w, h, width, height, data]] =\
             data_from_string(payload)
         if nick != self._tw.nick:
             if self._tw.running_sugar:
                 tmp_path = get_path(self._tw.activity, 'instance')
             else:
                 tmp_path = '/tmp'
             file_name = base64_to_image(data, tmp_path)
             pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
                 file_name, width, height)
             pos = self._tw.turtles.turtle_to_screen_coordinates((x, y))
             self._tw.turtles.get_active_turtle().draw_pixbuf(
                 pixbuf, a, b, pos[0], pos[1], w, h, file_name, False)
 def _draw_pixbuf(self, payload):
     if len(payload) > 0:
         [nick, [a, b, x, y, w, h, width, height, data]] =\
             data_from_string(payload)
         if nick != self._tw.nick:
             if self._tw.running_sugar:
                 tmp_path = get_path(self._tw.activity, 'instance')
             else:
                 tmp_path = '/tmp'
             file_name = base64_to_image(data, tmp_path)
             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(file_name,
                                                             width, height)
             pos = self._tw.turtles.turtle_to_screen_coordinates((x, y))
             self._tw.turtles.get_active_turtle().draw_pixbuf(
                 pixbuf, a, b, pos[0], pos[1], w, h, file_name, False)
예제 #5
0
 def _draw_pixbuf(self, payload):
     if len(payload) > 0:
         [nick, [a, b, x, y, w, h, width, height, data]] =\
             data_from_string(payload)
         if nick != self._tw.nick:
             if self._tw.running_sugar:
                 tmp_path = get_path(self._tw.activity, 'instance')
             else:
                 tmp_path = '/tmp'
             file_name = base64_to_image(data, tmp_path)
             pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file_name,
                                                           width, height)
             x, y = self._tw.canvas.turtle_to_screen_coordinates(x, y)
             self._tw.canvas.draw_pixbuf(pixbuf, a, b, x, y, w, h,
                                         file_name, False)