Mercurial > MadButterfly
changeset 1066:292fbb86d8f3
Merge from the HEAD
author | wycc |
---|---|
date | Tue, 30 Nov 2010 03:57:36 +0800 |
parents | eb3719020866 (diff) 09c1ef31884f (current diff) |
children | 7b4e80ab671a afa42d5836cc |
files | nodejs/X_supp_njs.c nodejs/X_supp_njs.h |
diffstat | 4 files changed, 122 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/examples/mce/epg.js Sun Nov 28 13:19:57 2010 +0800 +++ b/nodejs/examples/mce/epg.js Tue Nov 30 03:57:36 2010 +0800 @@ -146,13 +146,42 @@ EPG.prototype.onLoad = function(res) { cats = res['ProgramCat']; this.pend = cats.length; + this.maincat = cats; for (i in cats) { c = cats[i]; httpGetFile(c['ProgramPIC'],'cat'+i+'.png',this); } } +EPG.prototype.getList=function(item,func) { + var epgsrv = http.createClient(8080, '211.23.50.144'); + var cmd = '{"Protocol":"EPG-CSP","Command":"SearchRequest","ProgramSub":"'+item.Category+'"}'; + var headers={ + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Host':'211.23.50.144:8080', + 'User-Agent':'MadButterfly', + 'Content-Type':'application/x-www-form-urlencoded' + }; + headers['Content-Length'] = cmd.length; + var request = epgsrv.request('POST', '/IPTV_EPG/EPGService.do?timestamp='+new Date().getTime(),headers); + var self = this; + sys.puts("aaaa"); + var js = ''; + request.write(cmd); + request.end(); + request.on('response', function(res) { + sys.puts("connected"); + res.on('data',function (data) { + js = js + data; + }); + res.on('end', function () { + res = JSON.parse(js); + sys.puts("parsed"); + func(); + }); + }); +} EPG.prototype.onInitDone=function() { if (this.loadCallback) this.loadCallback();
--- a/nodejs/examples/mce/main.svg Sun Nov 28 13:19:57 2010 +0800 +++ b/nodejs/examples/mce/main.svg Tue Nov 30 03:57:36 2010 +0800 @@ -56,10 +56,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" - inkscape:cx="574.12471" + inkscape:cx="206.98185" inkscape:cy="483.73232" inkscape:document-units="px" - inkscape:current-layer="Layer 1s1841" + inkscape:current-layer="Layer 1s235" showgrid="false" inkscape:window-width="1680" inkscape:window-height="976" @@ -109,7 +109,7 @@ <g id="Layer 1s1841" inkscape:groupmode="layer" - style="display:inline"> + style="display:none"> <g transform="translate(7.14163,8.5714057)" id="g2999" @@ -175,7 +175,7 @@ inkscape:bbox-height="291.09415" /> </g> <g - transform="translate(7.14163,8.5714057)" + transform="translate(7.14163,8.571406)" id="g2926" inkscape:label="cat2" inkscape:bbox-x="599.07141" @@ -334,7 +334,7 @@ <g id="Layer 1s235" inkscape:groupmode="layer" - style="display:none"> + style="display:inline"> <rect x="0" y="0" @@ -349,6 +349,28 @@ id="image3245" x="0" y="-27.637817" /> + <g + transform="matrix(1.1857143,0,0,1.2748252,-274.497,-403.36247)" + id="g29230" + inkscape:label="current" + inkscape:bbox-x="359.21432" + inkscape:bbox-y="455.42856" + inkscape:bbox-width="200" + inkscape:bbox-height="291.09415"> + <image + sodipodi:absref="/home/wycc/devel/md7/MadButterfly/nodejs/examples/mce/./cat1.png" + xlink:href="./cat1.png" + inkscape:bbox-height="291.09415" + inkscape:bbox-width="200" + inkscape:bbox-y="455.42856" + inkscape:bbox-x="359.21432" + inkscape:label="" + width="200" + height="291.09415" + id="image3116-4" + x="330.29868" + y="458.24133" /> + </g> </g> </g> </svg>
--- a/nodejs/examples/mce/mainmenu.js Sun Nov 28 13:19:57 2010 +0800 +++ b/nodejs/examples/mce/mainmenu.js Tue Nov 30 03:57:36 2010 +0800 @@ -16,6 +16,7 @@ var self = this; var epg = new EPG.EPG(); epg.registerInitDone(function() { self.init();}); + app.epg = epg; //self.init(); } MainMenu.prototype.init=function() @@ -127,12 +128,15 @@ MainMenu.prototype.key_enter=function() { + var self = this; var target = this.items[this.item]; - var sx = 500 - target.center.x; - var sy = 220 - target.center.y; - var an = new animate.shift(this.app,target,sx,sy); - var self = this; - animate.run([an],0,2.5,function() {self.changePage();}); + var an = new animate.scale(this.app, target, 1/1.1, 1/1.5); + animate.run([an], 0, 0.3,function() { + var sx = 259 - target.center.x; + var sy = 355 - target.center.y; + var an1 = new animate.shift(self.app,target,sx,sy); + animate.run([an1],0,1,function() {self.changePage(self.item);}); + }); for(i=0;i<this.items.length;i++) { if (i == this.item) continue; if (i > this.item) { @@ -149,8 +153,11 @@ } } -MainMenu.prototype.changePage=function() { +MainMenu.prototype.onNextPage=function() { this.app.changeScene(2); } +MainMenu.prototype.changePage=function(item) { + this.epg.getList(item,self.onNextPage()); +} exports.MainMenu=MainMenu;
--- a/pyink/MBScene.py Sun Nov 28 13:19:57 2010 +0800 +++ b/pyink/MBScene.py Tue Nov 30 03:57:36 2010 +0800 @@ -3,11 +3,13 @@ # vim: sw=4:ts=8:sts=4 import pygtk import gtk +import glib from copy import deepcopy from lxml import etree import random import traceback import time +import pybInkscape # Please refer to # http://www.assembla.com/wiki/show/MadButterfly/Inkscape_extention @@ -55,7 +57,32 @@ _scenes = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scenes' _scene = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scene' - +class LayerAttributeWatcher(pybInkscape.PYNodeObserver): + def __init__(self,ui): + self.ui = ui + def notifyChildAdded(self,node,child,prev): + pass + def notifyChildRemoved(self,node,child,prev): + pass + def notifyChildOrderChanged(self,node,child,prev): + pass + def notifyContentChanged(self,node,old_content,new_content): + pass + def notifyAttributeChanged(self,node, name, old_value, new_value): + self.ui.updateUI() +class LayerAddRemoveWatcher(pybInkscape.PYNodeObserver): + def __init__(self,ui): + self.ui = ui + def notifyChildAdded(self,node,child,prev): + self.ui.updateUI() + def notifyChildRemoved(self,node,child,prev): + self.ui.updateUI() + def notifyChildOrderChanged(self,node,child,prev): + self.ui.updateUI() + def notifyContentChanged(self,node,old_content,new_content): + self.ui.updateUI() + def notifyAttributeChanged(self,node, name, old_value, new_value): + self.ui.updateUI() class MBScene(): def __init__(self,desktop,win): self.desktop = desktop @@ -63,6 +90,8 @@ self.layers = [] self.layers.append(Layer(None)) self.scenemap = None + self.top = None + self.last_update = None pass def confirm(self,msg): @@ -156,13 +185,17 @@ self.scenemap = None doc = self.desktop.doc().root() + #obs = pybInkscape.PYNodeObserver() + obs = LayerAddRemoveWatcher(self) + doc.repr.addObserver(obs) for node in doc.childList(): if node.repr.name() == 'svg:metadata': self.parseMetadata(node) pass elif node.repr.name() == 'svg:g': oldscene = None - #print layer.attrib.get("id") + obs = LayerAttributeWatcher(self) + node.repr.addObserver(obs) lyobj = Layer(node) self.layers.append(lyobj) lyobj.current_scene = [] @@ -465,7 +498,10 @@ def _update_framelines(self): for frameline in self._framelines: layer = frameline.layer - frameline.label.set_text(frameline.node.label()) + if frameline.node.label()==None: + frameline.label.set_text('???') + else: + frameline.label.set_text(frameline.node.label()) for scene in layer.scenes: frameline.add_keyframe(scene.start-1,scene.node.repr) if scene.start != scene.end: @@ -530,19 +566,24 @@ gtk.main_quit() pass - + def updateUI(self): + if self.last_update!= None: + glib.source_remove(self.last_update) + self.last_update = glib.timeout_add(300,self.show) def show(self): self.OK = True self.parseScene() self._create_framelines() self._update_framelines() - vbox = gtk.VBox(False,0) - self.desktop.getToplevel().child.child.pack_end(vbox,expand=False) - self.window = vbox + if self.top == None: + self.top = gtk.VBox(False,0) + self.desktop.getToplevel().child.child.pack_end(self.top,expand=False) + else: + self.top.remove(self.startWindow) vbox = gtk.VBox(False,0) - self.window.pack_start(vbox,expand=False) + self.startWindow = vbox + self.top.pack_start(vbox,expand=False) vbox.pack_start(self.scrollwin,expand=False) - self.vbox = vbox hbox=gtk.HBox(False,0) self.addButtons(hbox) vbox.pack_start(hbox,expand=False) @@ -551,6 +592,7 @@ # self.window.connect("destroy", gtk.main_quit) # self.window.set_position(gtk.WIN_POS_MOUSE) - self.window.show_all() - pass + self.top.show_all() + self.last_update = None + return False pass