rgb = self.cs.get_current_color()
rgb = rgb.red, rgb.green, rgb.blue
rgb = [int(x / 65535.0 * 255.0) for x in rgb]
- self.set_background(rgb)
+ pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, N, N)
+ arr = helpers.gdkpixbuf2numpy(pixbuf)
+ arr[:,:] = rgb
+ self.set_background(pixbuf)
def save_as_default_cb(self, widget):
- pixbuf = self.app.drawWindow.doc.get_background_pixbuf()
+ pixbuf = self.current_background_pixbuf
pixbuf.save(os.path.join(self.app.confpath, 'backgrounds', 'default.png'), 'png')
- self.set_background(pixbuf)
- def set_background(self, obj):
+ def set_background(self, pixbuf):
doc = self.app.drawWindow.doc
- doc.set_background(obj)
+ doc.set_background(pixbuf)
+ self.current_background_pixbuf = pixbuf
def add_color_to_patterns_cb(self, widget):
- pixbuf = self.app.drawWindow.doc.get_background_pixbuf()
+ pixbuf = self.current_background_pixbuf
i = 1
while 1:
filename = os.path.join(self.app.confpath, 'backgrounds', 'color%02d.png' % i)
# FIXME: hack, to be removed
filename = os.path.join(self.app.datapath, 'backgrounds', '03_check1.png')
pixbuf = gdk.pixbuf_new_from_file(filename)
- self.tdw.neutral_background_pixbuf = backgroundsurface.Background(helpers.gdkpixbuf2numpy(pixbuf))
+ self.tdw.neutral_background_pixbuf = backgroundsurface.Background(pixbuf)
self.zoomlevel_values = [1.0/8, 2.0/11, 0.25, 1.0/3, 0.50, 2.0/3, 1.0, 1.5, 2.0, 3.0, 4.0, 5.5, 8.0]
self.zoomlevel = self.zoomlevel_values.index(1.0)
self.invalidate_all()
- def get_background_pixbuf(self):
- pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, N, N)
- arr = helpers.gdkpixbuf2numpy(pixbuf)
- arr[:,:,:] = self.background
- return pixbuf
-
def load_from_pixbuf(self, pixbuf):
self.clear()
self.load_layer_from_pixbuf(pixbuf)