+Sat March 24 2007 Shyouzou Sugitani <shy@users.sourceforge.jp>
+ * メニューアイコンの管理を各ゴーストからApplicationクラスに移した.
+
Sun December 10 2006 Shyouzou Sugitani <shy@users.sourceforge.jp>
* バージョン3.9.3リリース.
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# $Id: alias.py,v 1.8 2005/09/07 03:52:04 shy Exp $
+# $Id: alias.py,v 1.9 2007/03/24 03:51:08 shy Exp $
#
import __builtin__
if not line:
continue
buf.append(line)
+ f.close()
return new_alias(buf)
def new_alias(buf):
self.sstp.append((x, y)) # sstp message
# arrow pixmaps and masks
x, y = self.arrow[0]
- pixbuf = self.pixbuf['arrow0'][0]
+ pixbuf, (w, h) = self.pixbuf['arrow0']
scale = self.get_scale()
- w = max(1, int(pixbuf.get_width() * scale / 100))
- h = max(1, int(pixbuf.get_height() * scale / 100))
+ w = max(1, int(w * scale / 100))
+ h = max(1, int(h * scale / 100))
pixmap, mask = pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR).render_pixmap_and_mask(255)
self.arrow0_pixmap = pixmap, mask, (w, h)
self.arrow0_gc = self.new_mask_gc(mask, x, y)
x, y = self.arrow[1]
- pixbuf = self.pixbuf['arrow1'][0]
- w = max(1, int(pixbuf.get_width() * scale / 100))
- h = max(1, int(pixbuf.get_height() * scale / 100))
+ pixbuf, (w, h) = self.pixbuf['arrow1']
+ w = max(1, int(w * scale / 100))
+ h = max(1, int(h * scale / 100))
pixmap, mask = pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR).render_pixmap_and_mask(255)
self.arrow1_pixmap = pixmap, mask, (w, h)
# sstp marker pixmap and mask
if self.side == 0 and 'sstp' in self.pixbuf:
x, y = self.sstp[0]
- pixbuf = self.pixbuf['sstp'][0]
- w = max(1, int(pixbuf.get_width() * scale / 100))
- h = max(1, int(pixbuf.get_height() * scale / 100))
+ pixbuf, (w, h) = self.pixbuf['sstp']
+ w = max(1, int(w * scale / 100))
+ h = max(1, int(h * scale / 100))
pixmap, mask = pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR).render_pixmap_and_mask(255)
self.sstp_pixmap = pixmap, mask, (w, h)
x, y = self.sstp[0]
w, h = self.sstp_pixmap[2]
if self.sstp_message:
- pixmap = self.sstp_pixmap[0]
self.darea.window.draw_drawable(
- self.sstp_gc, pixmap, 0, 0, x, y, w, h)
+ self.sstp_gc, self.sstp_pixmap[0], 0, 0, x, y, w, h)
else:
self.redraw_area(x, y, w, h)
# draw/erase sstp message
def redraw_arrow0(self, clear=1):
x, y = self.arrow[0]
- pixmap, mask, (w, h) = self.arrow0_pixmap
+ w, h = self.arrow0_pixmap[2]
if self.lineno > 0:
self.darea.window.draw_drawable(
- self.arrow0_gc, pixmap, 0, 0, x, y, w, h)
+ self.arrow0_gc, self.arrow0_pixmap[0], 0, 0, x, y, w, h)
elif clear:
self.redraw_area(x, y, w, h)
def redraw_arrow1(self, clear=1):
x, y = self.arrow[1]
- pixmap, mask, (w, h) = self.arrow1_pixmap
+ w, h = self.arrow1_pixmap[2]
if self.lineno + self.lines < len(self.text_buffer) or \
self.sakura.script_mode == self.sakura.PAUSE_MODE:
self.darea.window.draw_drawable(
- self.arrow1_gc, pixmap, 0, 0, x, y, w, h)
+ self.arrow1_gc, self.arrow1_pixmap[0], 0, 0, x, y, w, h)
elif clear:
self.redraw_area(x, y, w, h)
x, y, self.layout)
for l, c in self.sstp_marker:
if l == i:
- pixmap, mask, (mw, mh) = self.sstp_pixmap
+ mw, mh = self.sstp_pixmap[2]
self.layout.set_text(self.text_buffer[i][:c])
text_w, text_h = self.layout.get_pixel_size()
mx = x + text_w
my = y + (self.font_height + self.line_space) / 2
my = my - mh / 2
- gc = self.new_mask_gc(mask, mx, my)
+ gc = self.new_mask_gc(self.sstp_pixmap[1], mx, my)
self.darea.window.draw_drawable(
- gc, pixmap, 0, 0, mx, my, mw, mh)
+ gc, self.sstp_pixmap[0], 0, 0, mx, my, mw, mh)
i += 1
line += 1
if self.side == 0 and self.sstp_message:
self.darea.queue_draw_area(x, y, w, h)
for l, c in self.sstp_marker:
if l == line:
- pixmap, mask, (mw, mh) = self.sstp_pixmap
+ mw, mh = self.sstp_pixmap[2]
self.layout.set_text(self.text_buffer[l][:c])
text_w, text_h = self.layout.get_pixel_size()
mx = x + text_w
my = y + (self.font_height + self.line_space) / 2
my = my - mh / 2
- gc = self.new_mask_gc(mask, mx, my)
+ gc = self.new_mask_gc(self.sstp_pixmap[1], mx, my)
self.darea.window.draw_drawable(
- gc, pixmap, 0, 0, mx, my, mw, mh)
+ gc, self.sstp_pixmap[0], 0, 0, mx, my, mw, mh)
else:
self.redraw()
while line >= self.lineno + self.lines:
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# $Id: config.py,v 1.13 2005/09/07 03:53:19 shy Exp $
+# $Id: config.py,v 1.14 2007/03/24 03:51:08 shy Exp $
#
import __builtin__
if not line.strip():
continue
buf.append(line)
+ f.close()
return new_config(buf)
def new_config(buf):
h = max(1, int(h * self.scale / 100))
balloon_pixbuf = balloon_pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR)
- balloon_pixmap, self.mask_pixmap = balloon_pixbuf.render_pixmap_and_mask(1)
+ balloon_pixmap, mask_pixmap = balloon_pixbuf.render_pixmap_and_mask(1)
if self.position == 'lefttop':
pass
elif self.position == 'leftbottom':
self.top = int(int(data['disparea.top']) * self.scale / 100)
if 'disparea.bottom' in data:
self.bottom = int(int(data['disparea.bottom']) * self.scale / 100)
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
+ self.window.shape_combine_mask(mask_pixmap, 0, 0)
self.script = None
self.darea = gtk.DrawingArea()
self.darea.set_events(gtk.gdk.EXPOSURE_MASK)
path = os.path.join(self.data['dir'], self.data['base'])
try:
self.pixbuf = ninix.pix.create_pixbuf_from_file(path)
- surface_pixbuf = self.pixbuf.copy()
if self.__scale != 100:
- w = max(1, surface_pixbuf.get_width() * self.__scale / 100)
- h = max(1, surface_pixbuf.get_height() * self.__scale / 100)
- surface_pixbuf = surface_pixbuf.scale_simple(
+ w = max(1, self.pixbuf.get_width() * self.__scale / 100)
+ h = max(1, self.pixbuf.get_height() * self.__scale / 100)
+ surface_pixbuf = self.pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR)
image, mask = surface_pixbuf.render_pixmap_and_mask(255)
except: ## FIXME
## FIXME
self.w, self.h = image.get_size()
self.set_position()
- self.surface_pixmap = image
- self.mask_pixmap = mask
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
+ self.window.shape_combine_mask(mask, 0, 0)
self.darea = gtk.DrawingArea()
self.darea.set_events(gtk.gdk.EXPOSURE_MASK)
self.darea.connect('expose_event', self.redraw)
def redraw(self, widget, event): ## FIXME
pass
- def show_surface(self):
- self.darea.window.set_back_pixmap(self.surface_pixmap, False)
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
- #print 'DRAW:', dir(self.darea)
- #self.darea.queue_draw_area(0, 0, w, h)
- self.darea.queue_draw()
-
def get_pixbuf(self, surface_id):
path = os.path.join(self.data['dir'], ''.join(('surface', str(surface_id), '.png')))
if os.path.exists(path):
h = max(1, surface_pixbuf.get_height() * self.__scale / 100)
surface_pixbuf = surface_pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR)
- self.surface_pixmap, self.mask_pixmap = \
- surface_pixbuf.render_pixmap_and_mask(255)
+ image, mask = surface_pixbuf.render_pixmap_and_mask(255)
self.w, self.h = self.surface_pixmap.get_size()
- self.show_surface()
+ self.darea.window.set_back_pixmap(image, False)
+ self.window.shape_combine_mask(mask, 0, 0)
+ #print 'DRAW:', dir(self.darea)
+ #self.darea.queue_draw_area(0, 0, w, h)
+ self.darea.queue_draw()
def terminate(self):
self.seriko.terminate()
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# $Id: main.py,v 1.138 2006/10/05 15:16:44 shy Exp $
+# $Id: main.py,v 1.139 2007/03/24 03:51:08 shy Exp $
#
import getopt
icon_path = None
else:
icon_path = None
+ if icon_path is not None:
+ try:
+ pixbuf = ninix.pix.create_pixbuf_from_file(icon_path, is_pnr=0)
+ except:
+ pixbuf = None
+ if pixbuf is not None:
+ icon = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
+ else:
+ icon = None
+ else:
+ icon = None
name = desc.get('name',
''.join((unicode(_('Ghost'), 'utf-8'),
'#%d' % (i + 1))))
shell_list.append((shell_name, value))
item = {}
item['name'] = name
- item['icon'] = icon_path
+ item['icon'] = icon
item['shell'] = shell_list
item['instance'] = None
return item
sidebar_width, 0, width, height,
0, 0,
1.0, 1.0, gtk.gdk.INTERP_BILINEAR, 255)
- pixbuf = new_pixbuf
self.__sidebar_width = sidebar_width
- pixmap, mask = pixbuf.render_pixmap_and_mask(255)
+ pixmap, mask = new_pixbuf.render_pixmap_and_mask(255)
else:
self.__sidebar_width = 0
self.__pixmap_with_sidebar = pixmap
sidebar_width, 0, width, height,
0, 0,
1.0, 1.0, gtk.gdk.INTERP_BILINEAR, 255)
- pixbuf = new_pixbuf
- pixmap, mask = pixbuf.render_pixmap_and_mask(255)
+ pixmap, mask = new_pixbuf.render_pixmap_and_mask(255)
self.__pixmap_prelight_with_sidebar = pixmap
def __set_mayuna_menu(self, side):
self.__menu_list['Recommend'][3] = 1 # changed
def __update_ghost_menu(self, set_list):
- ##if self.__ghost_list is None:
- ## self.__create_ghost_menu(set_list)
- ##else:
ghost_menu = gtk.Menu()
for i in range(len(set_list)):
if set_list[i] is None:
continue
name = set_list[i]['name']
- icon_path = set_list[i]['icon']
- pixbuf = None
- if icon_path is not None:
- try:
- pixbuf = ninix.pix.create_pixbuf_from_file(icon_path,
- is_pnr=0)
- except:
- pixbuf = None
+ icon = set_list[i]['icon']
shell_list = set_list[i]['shell']
- if pixbuf is not None:
- pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
+ if icon is not None:
image = gtk.Image()
- image.set_from_pixbuf(pixbuf)
+ image.set_from_pixbuf(icon)
image.show()
item = gtk.ImageMenuItem(name)
item.set_image(image)
menuitem = self.ui_manager.get_widget(''.join(('/popup/', 'Change')))
menuitem.set_submenu(ghost_menu)
self.__menu_list['Change'][3] = 1
- self.__ghost_list = set_list
+ ##self.__ghost_list = set_list
def __set_ghost_menu(self):
ghosts = self.__ghost.app.get_ghost_list() ## FIXME
- self.__update_ghost_menu(ghosts)
- self.__update_summon_menu(ghosts)
+ if ghosts != self.__ghost_list or self.__ghost_list is None:
+ self.__update_ghost_menu(ghosts)
+ self.__update_summon_menu(ghosts)
def __update_summon_menu(self, set_list):
- ##if self.__ghost_list is None:
- ## self.__create_ghost_menu(set_list)
- ##else:
ghost_menu = gtk.Menu()
for i in range(len(set_list)):
if set_list[i] is None:
continue
name = set_list[i]['name']
- icon_path = set_list[i]['icon']
- pixbuf = None
- if icon_path is not None:
- try:
- pixbuf = ninix.pix.create_pixbuf_from_file(icon_path,
- is_pnr=0)
- except:
- pixbuf = None
+ icon = set_list[i]['icon']
shell_list = set_list[i]['shell']
- if pixbuf is not None:
- pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
+ if icon is not None:
image = gtk.Image()
- image.set_from_pixbuf(pixbuf)
+ image.set_from_pixbuf(icon)
image.show()
item = gtk.ImageMenuItem(name)
item.set_image(image)
menuitem = self.ui_manager.get_widget(''.join(('/popup/', 'Summon')))
menuitem.set_submenu(ghost_menu)
self.__menu_list['Summon'][3] = 1
- self.__ghost_list = set_list
+ ##self.__ghost_list = set_list
def __update_shell_menu(self, set_list):
##if self.__shell_list is None:
self.nekoninni.finalize()
return
self.w, self.h = image.get_size()
- self.mask_pixmap = mask
self.darea.set_size_request(self.w, self.h)
self.darea.window.set_back_pixmap(image, False)
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
+ self.window.shape_combine_mask(mask, 0, 0)
def set_position(self, reset=0):
scrn_w = gtk.gdk.screen_width()
self.nekoninni.finalize()
return
self.w, self.h = image.get_size()
- self.mask_pixmap = mask
self.darea.set_size_request(self.w, self.h)
self.darea.window.set_back_pixmap(image, False)
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
+ self.window.shape_combine_mask(mask, 0, 0)
self.darea.queue_draw_area(0, 0, self.w, self.h)
def load(self, data):
dest_y = y
overlay.composite(pixbuf, dest_x, dest_y,
w, h, x, y, 1.0, 1.0,
- gtk.gdk.INTERP_BILINEAR, 255)
+ gtk.gdk.INTERP_BILINEAR, 255)
return pixbuf
def get_pixbuf(self, pixbuf_id):
h = max(1, surface_pixbuf.get_height() * self.__scale / 100)
surface_pixbuf = surface_pixbuf.scale_simple(
w, h, gtk.gdk.INTERP_BILINEAR)
- surface_pixmap, self.mask_pixmap = \
- surface_pixbuf.render_pixmap_and_mask(1)
+ surface_pixmap, mask_pixmap = surface_pixbuf.render_pixmap_and_mask(1)
+ self.window.shape_combine_mask(mask_pixmap, 0, 0)
self.current_surface_pixbuf = surface_pixbuf
self.darea.queue_draw()
cr.paint()
cr.set_source_pixbuf(self.current_surface_pixbuf, 0, 0)
cr.paint_with_alpha(self.__alpha_channel)
- self.window.shape_combine_mask(self.mask_pixmap, 0, 0)
if self.debug & 4096:
self.draw_region()
# PURPOSE. See the GNU General Public License for more details.
#
-NUMBER = '3.9.3'
+NUMBER = '3.9.4'
CODENAME = '"I see no more YASAGURE here."'
VERSION = '%s (%s)' % (NUMBER, CODENAME)