Update of /cvsroot/freevo/freevo/skins/dischi1 In directory sc8-pr-cvs1:/tmp/cvs-serv30273
Modified Files: blue1_big.xml listing_area.py skin_utils.py view_area.py xml_skin.py Log Message: First version of the extended menu with image support. Try the music menu and press DISPLAY Index: blue1_big.xml =================================================================== RCS file: /cvsroot/freevo/freevo/skins/dischi1/blue1_big.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** blue1_big.xml 7 Mar 2003 17:29:43 -0000 1.11 --- blue1_big.xml 7 Mar 2003 22:54:11 -0000 1.12 *************** *** 70,74 **** <area x="0" y="0" width="800" height="600"/> </screen> ! <title layout="title0" visible="yes"> <area x="10" y="10" width="780" height="60"/> </title> --- 70,74 ---- <area x="0" y="0" width="800" height="600"/> </screen> ! <title layout="title1" visible="yes"> <area x="10" y="10" width="780" height="60"/> </title> *************** *** 76,80 **** <area x="580" y="110" width="200" height="300"/> </view> ! <listing layout="list0" visible="yes"> <area x="20" y="110" width="540" height="250"/> </listing> --- 76,80 ---- <area x="580" y="110" width="200" height="300"/> </view> ! <listing layout="image list" visible="yes"> <area x="20" y="110" width="540" height="250"/> </listing> *************** *** 124,127 **** --- 124,131 ---- </layout> + <layout label="title1"> + <content x="210" type="item" font="white big" align="center"/> + </layout> + <!-- default listing area --> <layout label="list0"> *************** *** 131,134 **** --- 135,149 ---- <rectangle bgcolor="0xa0000000" size="0" x="-5" y="-3" width="max+10" height="max+6"/> + </item> + </content> + </layout> + + <!-- listing area with images --> + <layout label="image list"> + <content type="image" spacing="4"> + <item type="default" width="100" height="100"/> + <item type="selected" width="100" height="100"> + <rectangle bgcolor="0xa0000000" size="0" x="-5" y="-5" width="max+10" + height="max+10"/> </item> </content> Index: listing_area.py =================================================================== RCS file: /cvsroot/freevo/freevo/skins/dischi1/listing_area.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** listing_area.py 7 Mar 2003 17:28:19 -0000 1.5 --- listing_area.py 7 Mar 2003 22:54:11 -0000 1.6 *************** *** 10,13 **** --- 10,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.6 2003/03/07 22:54:11 dischi + # First version of the extended menu with image support. Try the music menu + # and press DISPLAY + # # Revision 1.5 2003/03/07 17:28:19 dischi # small fixes *************** *** 79,85 **** import pygame from area import Skin_Area - osd = osd.get_singleton() # Set to 1 for debug output --- 83,91 ---- import pygame + osd = osd.get_singleton() + from area import Skin_Area + from skin_utils import * # Set to 1 for debug output *************** *** 116,121 **** content = self.calc_geometry(layout.content, copy_object=TRUE) ! items_w = content.width ! items_h = 0 possible_types = {} --- 122,131 ---- content = self.calc_geometry(layout.content, copy_object=TRUE) ! if content.type == 'text': ! items_w = content.width ! items_h = 0 ! elif content.type == 'image': ! items_w = 0 ! items_h = 0 possible_types = {} *************** *** 138,161 **** # get the max height of a text item ! for t in possible_types: ! ct = possible_types[t] ! if not settings.font.has_key(ct.font): ! print '*** font <%s> not found' % ct.font ! break ! font = settings.font[ct.font] ! font_w, font_h = osd.stringsize('Arj', font=font.name, ptsize=font.size) ! rh = 0 ! rw = 0 ! if ct.rectangle: ! rw, rh, r = self.get_item_rectangle(ct.rectangle, content.width, font_h) ! hskip = min(hskip, r.x) ! vskip = min(vskip, r.y) ! items_h = max(items_h, font_h, rh) ! items_w = max(items_w, font_w, rw) # restore self.area_val, self.layout = backup --- 148,185 ---- # get the max height of a text item ! if content.type == 'text': ! for t in possible_types: ! ct = possible_types[t] ! if not settings.font.has_key(ct.font): ! print '*** font <%s> not found' % ct.font ! break ! font = settings.font[ct.font] ! font_w, font_h = osd.stringsize('Arj', font=font.name, ptsize=font.size) ! rh = 0 ! rw = 0 ! if ct.rectangle: ! rw, rh, r = self.get_item_rectangle(ct.rectangle, content.width, font_h) ! hskip = min(hskip, r.x) ! vskip = min(vskip, r.y) ! items_h = max(items_h, font_h, rh) ! items_w = max(items_w, font_w, rw) + elif content.type == 'image': + for t in possible_types: + ct = possible_types[t] + rh = 0 + rw = 0 + if ct.rectangle: + rw, rh, r = self.get_item_rectangle(ct.rectangle, ct.width, ct.height) + hskip = min(hskip, r.x) + vskip = min(vskip, r.y) + + items_h = max(items_h, ct.height, rh) + items_w = max(items_w, ct.width, rw) + # restore self.area_val, self.layout = backup *************** *** 217,220 **** --- 241,250 ---- y0 = content.y + current_col = 1 + + if content.type == 'image': + width = hspace - content.spacing + height = vspace - content.spacing + for choice in menuw.menu_items: if choice == menu.selected: *************** *** 230,237 **** if not settings.font.has_key(val.font): ! print '*** font <%s> not found' % val.font ! break ! font = settings.font[val.font] --- 260,269 ---- if not settings.font.has_key(val.font): ! if content.type == 'text': ! print '*** font <%s> not found' % val.font ! break ! else: ! font = settings.font[val.font] *************** *** 259,275 **** if val.rectangle: ! None, None, r = self.get_item_rectangle(val.rectangle, width, font_h) self.drawroundbox(x0 + hskip + r.x + icon_x, y0 + vskip + r.y, r.width - icon_x, r.height, r) ! self.write_text(text, font, content, x=x0 + hskip + icon_x, y=y0 + vskip, ! width=width-icon_x, height=-1, align_h=val.align, ! mode='hard') else: print 'no support for content type %s' % content.type ! y0 += vspace ! self.last_choices = (menu.selected, copy.copy(menuw.menu_items)) --- 291,326 ---- if val.rectangle: ! r = self.get_item_rectangle(val.rectangle, width, font_h)[2] self.drawroundbox(x0 + hskip + r.x + icon_x, y0 + vskip + r.y, r.width - icon_x, r.height, r) ! if content.type == 'text': ! self.write_text(text, font, content, x=x0 + hskip + icon_x, ! y=y0 + vskip, width=width-icon_x, height=-1, ! align_h=val.align, mode='hard') + + elif content.type == 'image': + if val.rectangle: + r = self.get_item_rectangle(val.rectangle, val.width, val.height)[2] + self.drawroundbox(x0 + hskip + r.x, y0 + vskip + r.y, + r.width, r.height, r) + + + image = format_image(settings, choice, val.width, val.height, force=TRUE) + if image: + self.draw_image(image, (x0 + hskip, y0+vskip)) + else: print 'no support for content type %s' % content.type ! if current_col == cols: ! x0 = content.x ! y0 += vspace ! current_col = 1 ! else: ! x0 += hspace ! current_col += 1 ! self.last_choices = (menu.selected, copy.copy(menuw.menu_items)) Index: skin_utils.py =================================================================== RCS file: /cvsroot/freevo/freevo/skins/dischi1/skin_utils.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** skin_utils.py 2 Mar 2003 11:46:32 -0000 1.2 --- skin_utils.py 7 Mar 2003 22:54:12 -0000 1.3 *************** *** 10,13 **** --- 10,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.3 2003/03/07 22:54:12 dischi + # First version of the extended menu with image support. Try the music menu + # and press DISPLAY + # # Revision 1.2 2003/03/02 11:46:32 dischi # Added GetPopupBoxStyle to return popup box styles to the gui *************** *** 45,63 **** import pygame import osd ! osd = osd.get_singleton() ! def format_image(item, width, height): if hasattr(item, 'display_type'): type = item.display_type else: type = item.type ! if item.image: image = osd.loadbitmap('thumb://%s' % item.image) ! if not image: return None ! if type == 'audio': m = min(height, width) --- 49,87 ---- import pygame import osd ! import os osd = osd.get_singleton() ! def format_image(settings, item, width, height, force=0): if hasattr(item, 'display_type'): type = item.display_type else: type = item.type ! ! image = None if item.image: image = osd.loadbitmap('thumb://%s' % item.image) ! ! if not image: ! if not force: return None ! ! if item.type == 'dir': ! if os.path.isfile('%s/mimetypes/folder_%s.png' % \ ! (settings.icon_dir, item.display_type)): ! image = '%s/mimetypes/folder_%s.png' % \ ! (settings.icon_dir, item.display_type) ! else: ! image = '%s/mimetypes/folder.png' % settings.icon_dir ! ! elif os.path.isfile('%s/mimetypes/%s.png' % (settings.icon_dir, item.type)): ! image = '%s/mimetypes/%s.png' % (settings.icon_dir, item.type) ! ! if not image: ! return ! ! image = osd.loadbitmap('thumb://%s' % image) ! ! if type == 'audio': m = min(height, width) Index: view_area.py =================================================================== RCS file: /cvsroot/freevo/freevo/skins/dischi1/view_area.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** view_area.py 5 Mar 2003 21:56:12 -0000 1.3 --- view_area.py 7 Mar 2003 22:54:12 -0000 1.4 *************** *** 10,13 **** --- 10,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.4 2003/03/07 22:54:12 dischi + # First version of the extended menu with image support. Try the music menu + # and press DISPLAY + # # Revision 1.3 2003/03/05 21:56:12 dischi # Small changes to integrate the audio player *************** *** 122,126 **** addy = content.y + content.spacing ! image = format_image(item, width, height) if not image: --- 126,130 ---- addy = content.y + content.spacing ! image = format_image(self.settings, item, width, height) if not image: Index: xml_skin.py =================================================================== RCS file: /cvsroot/freevo/freevo/skins/dischi1/xml_skin.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** xml_skin.py 7 Mar 2003 17:28:40 -0000 1.21 --- xml_skin.py 7 Mar 2003 22:54:12 -0000 1.22 *************** *** 10,13 **** --- 10,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.22 2003/03/07 22:54:12 dischi + # First version of the extended menu with image support. Try the music menu + # and press DISPLAY + # # Revision 1.21 2003/03/07 17:28:40 dischi # added support for extended menus *************** *** 412,416 **** type = attr_str(subnode, "type", '') if type and not self.types.has_key(type): ! self.types[type] = XML_data(('font', 'align', 'valign')) self.types[type].rectangle = None self.types[type].cdata = '' --- 416,421 ---- type = attr_str(subnode, "type", '') if type and not self.types.has_key(type): ! self.types[type] = XML_data(('font', 'align', 'valign', 'height', ! 'width')) self.types[type].rectangle = None self.types[type].cdata = '' ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog