diff options
Diffstat (limited to 'src/YalpClients/EflClient')
| -rwxr-xr-x | src/YalpClients/EflClient/client.py | 44 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/client.py | 36 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/client.sh | 2 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/corba_example/huhu.idl | 22 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/python_idl.sh | 2 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/server.py | 63 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/server.sh | 5 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example_mod/client.py | 39 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example_mod/client.sh | 2 | ||||
| -rwxr-xr-x | src/YalpClients/EflClient/main.py | 10 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/media.py | 36 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/medialist.py | 40 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/playlist.py | 43 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/searchframe.py | 20 | ||||
| -rw-r--r-- | src/YalpClients/EflClient/yalp_gui.edc | 200 |
15 files changed, 359 insertions, 205 deletions
diff --git a/src/YalpClients/EflClient/client.py b/src/YalpClients/EflClient/client.py new file mode 100755 index 0000000..073e6e2 --- /dev/null +++ b/src/YalpClients/EflClient/client.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +import sys +from omniORB import CORBA +import YalpInterfaces, CosNaming, YalpInterfaces__POA +import medialist +import media + +class Corba(object): + def __init__(self, win, c): + self.win = win + self.c = c + + self.orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + self.obj = self.orb.resolve_initial_references("NameService") + self.root_context = self.obj._narrow(CosNaming.NamingContextExt) + if self.root_context is None: + print "Failed to narrow the root naming context" + sys.exit(1) + + self.name = ("YALP_Server") + try: + self.obj = self.root_context.resolve_str(self.name) + + except CosNaming.NamingContext.NotFound, ex: + print "Name not found", ex + sys.exit(1) + + self.blubb = self.obj._narrow(YalpInterfaces.ServerControlInterface) + if self.blubb is None: + print "obj ref is not an dbsfeditf::dependency" + sys.exit(1) + + def corba_search(self,searchentry): + mlist = [] + mlist.append (YalpInterfaces.VIDEO) + mlist.append (YalpInterfaces.SOUND) + deps = self.blubb.search(searchentry, mlist) + m = medialist.Medias(self.win, self.c) + print deps[0] + for dep in deps[0]: + current = media.Media(dep, self.blubb, self.win, self.c) + m.add_media(current) + diff --git a/src/YalpClients/EflClient/corba_example/client.py b/src/YalpClients/EflClient/corba_example/client.py new file mode 100755 index 0000000..b6eff0a --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/client.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +import sys +from omniORB import CORBA +import HuhuItf, CosNaming + +orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + +obj = orb.resolve_initial_references("NameService") +root_context = obj._narrow(CosNaming.NamingContext) + +if root_context is None: + print "Failed to narrow the root naming context" + sys.exit(1) + +name = [CosNaming.NameComponent("huhu", "project"), + CosNaming.NameComponent("blubb", "object")] + +try: + obj = root_context.resolve(name) + +except CosNaming.NamingContext.NotFound, ex: + print "Name not found" + sys.exit(1) + +blubb = obj._narrow(HuhuItf.Blubb) + +if blubb is None: + print "obj ref is not an dbsfeditf::dependency" + sys.exit(1) + +pkg = HuhuItf.Package("e17-data","0.16.999.063-1","now","amd64"); +deps = blubb.get_something(pkg) + +for dep in deps: + print dep.name, dep.version diff --git a/src/YalpClients/EflClient/corba_example/client.sh b/src/YalpClients/EflClient/corba_example/client.sh new file mode 100755 index 0000000..38dc635 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/client.sh @@ -0,0 +1,2 @@ +#!/bin/bash +./client.py -ORBInitRef NameService=corbaloc:iiop:localhost:1055/NameService diff --git a/src/YalpClients/EflClient/corba_example/huhu.idl b/src/YalpClients/EflClient/corba_example/huhu.idl new file mode 100644 index 0000000..e455509 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/huhu.idl @@ -0,0 +1,22 @@ +module HuhuItf +{ + struct Package + { + string name; + string version; + string repo; + string arch; + }; + + struct Dependency + { + string name; + string version; + }; + typedef sequence<Dependency> Dependency_list; + + interface Blubb + { + Dependency_list get_something(in Package request); + }; +}; diff --git a/src/YalpClients/EflClient/corba_example/python_idl.sh b/src/YalpClients/EflClient/corba_example/python_idl.sh new file mode 100755 index 0000000..f470887 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/python_idl.sh @@ -0,0 +1,2 @@ +#!/bin/bash +omniidl -bpython huhu.idl diff --git a/src/YalpClients/EflClient/corba_example/server.py b/src/YalpClients/EflClient/corba_example/server.py new file mode 100755 index 0000000..d12f773 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/server.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import sys +import os +from omniORB import CORBA, PortableServer +import CosNaming, HuhuItf, HuhuItf__POA + +class Blubb_i (HuhuItf__POA.Blubb): + + def get_something (self, request): + + pkg_no = 10 + cdeps = [] + + while pkg_no > 0: + cdep = HuhuItf.Dependency ("hallo du", str (pkg_no)) + cdeps.append (cdep) + pkg_no = pkg_no - 1 + + return cdeps + +orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) +poa = orb.resolve_initial_references("RootPOA") + +blubb_i = Blubb_i() +blubb_o = blubb_i._this() +print orb.object_to_string(blubb_o) + +obj = orb.resolve_initial_references("NameService") +root_context = obj._narrow(CosNaming.NamingContext) + +if root_context is None: + print "Failed to narrow the root naming context" + sys.exit(1) + +name = [CosNaming.NameComponent("huhu", "project")] + +try: + huhu_context = root_context.bind_new_context(name) + print "dbsfed:project bound to naming service" + +except CosNaming.NamingContext.AlreadyBound, ex: + print "dbsfed:project already bount to naming service" + obj = root_context.resolve(name) + huhu_context = obj._narrow(CosNaming.NamingContext) + if huhu_context is None: + print "dbsfed:project exists but is not a naming context" + sys.exit(1) + +name = [CosNaming.NameComponent("blubb", "object")] + +try: + huhu_context.bind(name, blubb_o) + print "new aptd:apt object bound" + +except CosNaming.NamingContext.AlreadyBound: + huhu_context.rebind(name, blubb_o) + print "aptd:apt binding already existed, rebound" + +poaManager = poa._get_the_POAManager() +poaManager.activate() + +orb.run() diff --git a/src/YalpClients/EflClient/corba_example/server.sh b/src/YalpClients/EflClient/corba_example/server.sh new file mode 100755 index 0000000..dd1e68d --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/server.sh @@ -0,0 +1,5 @@ +#!/bin/bash +orbd -ORBInitialPort 1055 & +sleep 3 +./server.py -ORBInitRef NameService=corbaloc:iiop:localhost:1055/NameService +killall -9 orbd diff --git a/src/YalpClients/EflClient/corba_example_mod/client.py b/src/YalpClients/EflClient/corba_example_mod/client.py new file mode 100755 index 0000000..ea32ab2 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example_mod/client.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +import sys +from omniORB import CORBA +import YalpInterfaces, CosNaming, YalpInterfaces__POA + +orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + +obj = orb.resolve_initial_references("NameService") +root_context = obj._narrow(CosNaming.NamingContextExt) + +if root_context is None: + print "Failed to narrow the root naming context" + sys.exit(1) + +name = ("YALP_Server") + +try: + obj = root_context.resolve_str(name) + +except CosNaming.NamingContext.NotFound, ex: + print "Name not found", ex + sys.exit(1) + +blubb = obj._narrow(YalpInterfaces.ServerControlInterface) + +if blubb is None: + print "obj ref is not an dbsfeditf::dependency" + sys.exit(1) + +#pkg = HuhuItf.Package("e17-data","0.16.999.063-1","now","amd64"); +mlist = [] +mlist.append (YalpInterfaces.VIDEO) +mlist.append (YalpInterfaces.SOUND) +deps = blubb.search("huhu", mlist) +print deps + +for dep in deps: + print dep.name, dep.version diff --git a/src/YalpClients/EflClient/corba_example_mod/client.sh b/src/YalpClients/EflClient/corba_example_mod/client.sh new file mode 100755 index 0000000..c88cb1c --- /dev/null +++ b/src/YalpClients/EflClient/corba_example_mod/client.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python2.5 ./client.py -ORBInitRef NameService=corbaloc:iiop:192.168.178.20:1050/NameService diff --git a/src/YalpClients/EflClient/main.py b/src/YalpClients/EflClient/main.py index 867d7d0..dadbc53 100755 --- a/src/YalpClients/EflClient/main.py +++ b/src/YalpClients/EflClient/main.py @@ -13,6 +13,7 @@ import elementary import searchframe import medialist import playlist +import YalpInterfaces def destroy(obj, event, data): print "Bye bye" @@ -25,16 +26,15 @@ def gui(): win.title_set("YALP") win.autodel_set(True) - win.destroy = destroy + #win.destroy = destroy - vid = emotion.Emotion(win.canvas,module_filename="xine"); + #vid = emotion.Emotion(win.canvas,module_filename="xine"); edje_file = os.path.join(os.path.dirname(sys.argv[0]),"yalp_gui.edj") c = edje.Edje(win.canvas, file=edje_file, group = "yalp") - m = medialist.Medias(win, c) s = searchframe.Search(win, c) - video = playlist.Selection(win, c, vid) + + #video = playlist.Selection(win, c, vid) - m.fill_medialist(win, c) c.show() win.resize(800,600) win.show() diff --git a/src/YalpClients/EflClient/media.py b/src/YalpClients/EflClient/media.py new file mode 100644 index 0000000..4ab5448 --- /dev/null +++ b/src/YalpClients/EflClient/media.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import socket +import emotion +import playlist +import YalpInterfaces, CosNaming, YalpInterfaces__POA +import evas.c_evas + +class Media(object): + def __init__(self, result, servercon, win, c): + self.result = result + self.servercon = servercon + self.win = win + self.c = c + #self.c.signal_callback_add("hide_frames", "medialist",self.hide_frames) + + def callback(self, obj, str): + songlist = [] + songlist.append(self.result) + ip = socket.gethostbyname(socket.gethostname()) + + #self.c.signal_callback_add("hide_frames", "medialist",self.hide_frames) + + + info = YalpInterfaces.AccessInfo("huhu", "huhu", "xine", "openmoko", + YalpInterfaces.STREAM) + stream = YalpInterfaces.Output(0, info, songlist, YalpInterfaces.CREATE, ip) + ret = self.servercon.control(stream) + stream.outputAction = YalpInterfaces.START + ret = self.servercon.control(stream) + print "stream.info:", stream.info + #video = playlist.Selection(self.win, self.c, vid, startstream) + video = playlist.Selection(self.win, self.c, stream) + + #def hide_frames(self, obj, signal, source): + #self.c.signal_emit("signal_from_python", "") + diff --git a/src/YalpClients/EflClient/medialist.py b/src/YalpClients/EflClient/medialist.py index c3a3e70..ac54a69 100644 --- a/src/YalpClients/EflClient/medialist.py +++ b/src/YalpClients/EflClient/medialist.py @@ -14,37 +14,25 @@ class Medias(object): self.win = win self.c = c self.add_button() - - def huhu(self, obj, str, x): - print "guck guck" + self.medialist = elementary.List(self.win); + self.medialist.size_hint_weight_set(1.0, 1.0) + self.medialist.size_hint_align_set(-1.0, -1.0) + self.c.part_swallow("medialist", self.medialist) + # ???: + self.c.signal_callback_add("hide_frames", self.medialist.item,self.hide_frames) - def fill_medialist(self, win, c): - items = [("huhu", self.huhu), - ("haha", self.huhu), - ("hoho", self.huhu), - ("hehe", self.huhu), - ("hihi", self.huhu), - ("12345", self.huhu), - ("abcde", self.huhu), - ("fghij", self.huhu), - ("klmno", self.huhu), - ("pqrst", self.huhu), - ("uvwxyz", self.huhu)] + def add_media(self, media): + self.medialist.item_append(media.result.name, None, None, media.callback) + self.medialist.show() + self.medialist.go() - medialist = elementary.List(win); - medialist.size_hint_weight_set(1.0, 1.0) - medialist.size_hint_align_set(-1.0, -1.0) - c.part_swallow("medialist", medialist) - - for item in items: - #print item[0] - medialist.item_append(item[0], None, None, item[1]) - - medialist.show() - medialist.go() def add_button(self): addbutton = elementary.Button(self.win) addbutton.label_set("Add to Playlist") self.c.part_swallow("medialist_buttonframe", addbutton) addbutton.show() + + def hide_frames(self, obj, signal, source): + self.c.signal_emit("signal_from_python", "") + diff --git a/src/YalpClients/EflClient/playlist.py b/src/YalpClients/EflClient/playlist.py index 69f3ba3..242aa76 100644 --- a/src/YalpClients/EflClient/playlist.py +++ b/src/YalpClients/EflClient/playlist.py @@ -9,41 +9,24 @@ import emotion import evas import elementary +import media + class Selection(object): - def __init__(self, win, c, vid): + def __init__(self, win, c, stream): self.win = win self.c = c - self.vid = vid - self.add_button() - - def fill_playlist(self, obj, str, x): - playlist = elementary.List(self.win); - playlist.size_hint_weight_set(1.0, 1.0) - playlist.size_hint_align_set(-1.0, -1.0) - box1 = elementary.Box(self.win) - self.win.resize_object_add(box1) - self.c.part_swallow("playlist", playlist) - box1.pack_end(playlist) - playlist.show() - playlist.item_append(str, None, None, None) - playlist.go() - box1.show() - - def playbutton_clicked(self, obj, signal, source): - self.play_video() - + self.vid = emotion.Emotion(win.canvas, module_filename="gstreamer") + self.stream = stream + self.play_video () + def play_video(self): - #vid = emotion.Emotion(win.canvas,module_filename="xine"); - self.vid.file_set("Lordi.mpg"); + print self.stream + # ip = self.stream[0][0].destIp THIS CHRASHES!!! -> I know :-) + ip = "127.0.0.1" + port = 9993 + print "stream from", ip, port + self.vid.file_set("udp://"+ip+":"+str(port)) self.c.part_swallow("video", self.vid) self.vid.show() self.vid.play = True - def add_button(self): - playbutton = elementary.Button(self.win) - playbutton.label_set("Play") - self.c.part_swallow("playlist_buttonframe", playbutton) - self.c.signal_callback_add("mouse,clicked,1","playlist_buttonframe", - self.playbutton_clicked) - playbutton.show() - diff --git a/src/YalpClients/EflClient/searchframe.py b/src/YalpClients/EflClient/searchframe.py index 8fec876..574315a 100644 --- a/src/YalpClients/EflClient/searchframe.py +++ b/src/YalpClients/EflClient/searchframe.py @@ -9,15 +9,22 @@ import emotion import evas import elementary +import client + class Search(object): def __init__(self, win, c): self.win = win self.c = c + self.searchfield() self.add_button() c.signal_callback_add("mouse,clicked,1","find_buttonframe", self.findbutton_clicked) def findbutton_clicked(self, obj, signal,source): - print "Huhu"; + searchentry = textfield.entry_get() + print searchentry + co = client.Corba(self.win, self.c) + co.corba_search(searchentry) + def add_button(self): findbutton = elementary.Button(self.win) @@ -25,5 +32,12 @@ class Search(object): self.c.part_swallow("find_buttonframe", findbutton) findbutton.show() - - + def searchfield(self): + global textfield + textfield = elementary.Entry(self.win) + #textfield.color(95,95,95,95) + textfield.single_line_set(True) + textfield.entry_set("Enter Title") + self.c.part_swallow("searcharea", textfield) + textfield.editable_set(True) + textfield.show() diff --git a/src/YalpClients/EflClient/yalp_gui.edc b/src/YalpClients/EflClient/yalp_gui.edc index f15187e..24c593f 100644 --- a/src/YalpClients/EflClient/yalp_gui.edc +++ b/src/YalpClients/EflClient/yalp_gui.edc @@ -1,12 +1,3 @@ -styles -{ - style - { - name: "searchfield_style"; - base: "font=Edje-Vera font_size=12 valign=bottom color=#000 wrap=word"; - } -} - collections { group @@ -19,7 +10,7 @@ collections { name: "main"; type: RECT; - mouse_events: 0; + mouse_events: 1; description { state: "default" 0.0; @@ -40,6 +31,7 @@ collections { name: "video"; type: SWALLOW; + mouse_events: 1; description { state: "default" 0.0; aspect: 1.7 1.8; @@ -138,120 +130,9 @@ collections } } } - - part - { - name: "playlist_buttonframe"; - type: SWALLOW; - mouse_events: 1; - description - { - state: "default" 0.0; - align: 0 0; - color: 30 89 114 150; - rel1 - { - relative: 0.66 0.85; - } - rel2 - { - relative: 0.86 0.9; - } - } - description - { - state: "default" 1.0; - align: 0 0; - color: 0 0 0 0; - rel1 - { - relative: 1.0 0.85; - } - rel2 - { - relative: 1.0 0.9; - } - } - } part { - name: "playlist"; - type: SWALLOW; - mouse_events: 1; - description - { - state: "default" 0.0; - align: 0 0; - color: 30 89 114 150; - rel1 - { - relative: 0.51 0.2; - offset: 0 0; - } - rel2 - { - relative: 1.0 0.8; - offset: 0 0; - } - } - description - { - state: "default" 1.0; - align: 0 0; - color: 0 0 0 0; - rel1 - { - relative: 1.0 0.01; - offset: 0 0; - } - rel2 - { - relative: 1.0 0.8; - offset: 0 0; - } - } - } - - part - { - name: "controlframe"; - type: RECT; - mouse_events: 1; - - description - { - state: "default" 0.0; - align: 0 0; - color: 30 89 114 175; - - rel1 - { - relative: 0.0 0.97; - offset: 0 0; - } - rel2 - { - relative: 1.0 1.0; - offset: 0 0; - } - } - description - { - state: "default" 1.0; - color: 30 89 114 175; - rel1 - { - relative: 0.0 0.8; - } - rel2 - { - relative: 1.0 1.0; - } - } - } - part - { name: "find_buttonframe"; type: SWALLOW; mouse_events: 1; @@ -275,7 +156,7 @@ collections description { state: "default" 1.0; - color: 0 0 0 0; + color: 211 168 234 255; rel1 { relative: 0.8 0.0; @@ -288,7 +169,7 @@ collections } } } - + /* part { name: "medialist_buttonframe"; @@ -324,53 +205,90 @@ collections } } + */ + part { name: "searcharea"; - type: TEXTBLOCK; - mouse_events: 0; - entry_mode: EDITABLE; + type: SWALLOW; + mouse_events: 1; description { state: "default" 0.0; - color: 255 255 255 255; - visible: 1; + color: 0 0 0 0; rel1 { - to: "searchframe"; - relative: 0.0 0.00; + relative: 0.15 0.07; } rel2 { - to: "searchframe"; - relative: 1.0 1.0; + relative: 0.65 0.13; + } + } + + description + { + state: "default" 1.0; + color: 0 0 0 0; + rel1 + { + relative: 0.15 0.0; } - text + rel2 { - text: "Suchbegriff eingeben"; - style: "searchfield_style"; - min: 0 0; + relative: 0.65 0.0; } } } } programs { + /* program { name: "hide_searchframe"; - source: "playlist_buttonframe"; + source: "medialist"; signal: "mouse,clicked,1"; action: STATE_SET "default" 1.0; target: "searchframe"; - target: "medialist_buttonframe"; - target: "playlist_buttonframe"; target: "find_buttonframe"; target: "medialist"; - target: "playlist"; - target: "controlframe"; + target: "searcharea"; + transition:SINUSOIDAL 1; + } + program + { + name: "show_frames"; + //source: "video"; + source: "main"; + signal: "mouse,clicked,1"; + action: STATE_SET "default" 0.0; + target: "find_buttonframe"; + target: "medialist"; + target: "searcharea"; transition:SINUSOIDAL 1; } + */ + program + { + name: "button_clicked_signal_program"; + signal: "mouse,clicked,1"; + source: "medialist"; + + action: SIGNAL_EMIT "hide_frames" "medialist"; + } + + program + { + name: "handle_python_signal_hide"; + signal: "signal_from_python"; + + action: STATE_SET "default" 1.0; + target: "searchframe"; + target: "find_buttonframe"; + target: "medialist"; + target: "searcharea"; + } } } } |
