? build ? lib/mevas/build ? lib/pyepg/build ? lib/pyimlib2/build ? lib/pyimlib2/config.h Index: freevo_config.py =================================================================== RCS file: /cvsroot/freevo/freevo/freevo_config.py,v retrieving revision 1.385 diff -u -r1.385 freevo_config.py --- freevo_config.py 20 Jan 2005 20:38:44 -0000 1.385 +++ freevo_config.py 2 Feb 2005 16:35:42 -0000 @@ -188,6 +188,10 @@ FREEVO_CONF_VERSION = setup_freevo.CONFIG_VERSION +def print_config_changes(a,b,c): + print a,b,c + + if int(str(CONF.version).split('.')[0]) != \ int(str(FREEVO_CONF_VERSION).split('.')[0]): print "\nERROR: The version information in freevo_config.py does't" Index: lib/mevas/mevas/container.py =================================================================== RCS file: /cvsroot/freevo/freevo/lib/mevas/mevas/container.py,v retrieving revision 1.10 diff -u -r1.10 container.py --- lib/mevas/mevas/container.py 18 Oct 2004 13:48:05 -0000 1.10 +++ lib/mevas/mevas/container.py 2 Feb 2005 16:35:44 -0000 @@ -221,6 +221,20 @@ return left, top + def _get_child_draw_rect(self, child): #should be in childs, right? + """to avoid duplicate code in _get_drawing_rect & get_objects_at""" + if isinstance(child, CanvasContainer): + r = child._get_drawing_rect() + if not r: + return False #would it be better to raise an exception? + child_x1, child_y1, child_x2, child_y2 = r + else: + child_x1, child_y1 = child.get_pos() + w, h = child.get_size() + child_x2 = child_x1 + w + child_y2 = child_y1 + h + return child_x1, child_y1, child_x2, child_y2 + def _get_drawing_rect(self): """ This function returns the values were something is drawn @@ -229,27 +243,36 @@ x1 = y1 = 10000 x2 = y2 = 0 for child in self.children: - if isinstance(child, CanvasContainer): - r = child._get_drawing_rect() - if not r: - continue + r = self._get_child_draw_rect(child) + if r: child_x1, child_y1, child_x2, child_y2 = r - else: - child_x1, child_y1 = child.get_pos() - w, h = child.get_size() - child_x2 = child_x1 + w - child_y2 = child_y1 + h - - x1 = min(x1, child_x1) - y1 = min(y1, child_y1) - x2 = max(x2, child_x2) - y2 = max(y2, child_y2) + x1 = min(x1, child_x1) + y1 = min(y1, child_y1) + x2 = max(x2, child_x2) + y2 = max(y2, child_y2) + if x2 == 0 or y2 == 0: # nothing visible return None x, y = self.get_pos() return x+x1, y+y1, x+x2, y+y2 + def get_objects_at(self, point): + """ + Returns the child objects that are drawn at a certain point + """ + def contains(ob, point): + x, y = point + r = self._get_child_draw_rect(ob) + if r: + x1, y1, x2, y2 = r + c = x > x1 and y > y1 and x < x2 and y < y2 + return c + else: + return False + + return [child for child in self.children if contains(child, point)] + def render_to_image(self): img = self._get_backing_store()[0] if self.alpha != 255: Index: src/event.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/event.py,v retrieving revision 1.55 diff -u -r1.55 event.py --- src/event.py 27 Sep 2004 18:42:10 -0000 1.55 +++ src/event.py 2 Feb 2005 16:35:44 -0000 @@ -161,6 +161,9 @@ MENU_PAGEUP = Event('MENU_PAGEUP') MENU_PAGEDOWN = Event('MENU_PAGEDOWN') MENU_REBUILD = Event('MENU_REBUILD') + +#for pointing input +MENU_POINT = Event('MENU_POINT', (0,0)) #will have pox (x,y) MENU_GOTO_MAINMENU = Event('MENU_GOTO_MAINMENU') MENU_BACK_ONE_MENU = Event('MENU_BACK_ONE_MENU') Index: src/menu.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/menu.py,v retrieving revision 1.116 diff -u -r1.116 menu.py --- src/menu.py 22 Jan 2005 13:11:57 -0000 1.116 +++ src/menu.py 2 Feb 2005 16:35:44 -0000 @@ -141,6 +141,22 @@ len(self.choices) - 1) self.selected = self.choices[self.selected_pos] + def select_in_point(self, areahandler, point): + """ select a new item based on a point (x,y) on the display. + + returns a boolean based on whether there was an item or not, + i.e. if the selection was actually made or discarded. + """ + item = areahandler.get_item_at(point) + + try: + self.selected_pos = self.choices.index(item) + except: #the pointed item is not among possible choices + print item, "not a choice?" + return False + else: + self.selected = item + return True def set_selection(self, item): """ @@ -496,6 +512,15 @@ self.refresh() return True + if event == MENU_POINT: + if menu.select_in_point(self.engine, event.arg): #areahandler & point + #a selection was actually made + self.refresh() + event = MENU_SELECT #causes action below + #does not return, 'cause finishes via MENU_SELECT handling + else: + return False #did not point an item - nothing was done. + if event == MENU_RIGHT: menu.change_selection(1) Index: src/plugin.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/plugin.py,v retrieving revision 1.81 diff -u -r1.81 plugin.py --- src/plugin.py 8 Jan 2005 11:52:53 -0000 1.81 +++ src/plugin.py 2 Feb 2005 16:35:45 -0000 @@ -214,8 +214,8 @@ class InputPlugin(Plugin): """ - Plugin for input devices such as keyboard and lirc. A plugin of this - type should be in input/plugins + Plugin for input devices such as keyboard and lirc. Optional support for pointer devices (e.g. mouse, for touchsceen use) added too. A plugin of this + type should be in input/plugins. """ def __init__(self): Plugin.__init__(self) @@ -242,6 +242,36 @@ log.warning('no event mapping for key %s in context %s' % \ (key, self._eventhandler.context)) + def post_point(self, position): #diff. buttons not separated now + """ Send a pointing event to the event queue. + + Now only argument is the position (x,y) where pointing (mouseclick / finger touch) happened. Different buttons are not supported, 'cause it does not make sense in the touchscreen context.""" + if not position: + return None #this should never happen. why accepted? following post__key.. + + #testing in menu context only + e = self.config.EVENTS['input']['POINT'] #this selects pointed item + e.arg = position + self._eventhandler.queue.append(e) + + #this selects the newly selected item, entering menu or starting play + #not good: selects previously selected, if pointed at empty + #e = self.config.EVENTS['menu']['SELECT'] + #self._eventhandler.queue.append(e) + + ## for c in (self._eventhandler.context, 'global'): +## try: +## e = self.config.EVENTS[c}[] +## e.context = self._eventhandler.context +## self._eventhandler.queue.append(e) +## break +## except KeyError: +## pass +## else: +## log.warning('no event mapping for pointing in context %s' % \ +## (self._eventhandler.context)) + + # # Some plugin names to avoid typos # Index: src/gui/areas/area.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/gui/areas/area.py,v retrieving revision 1.23 diff -u -r1.23 area.py --- src/gui/areas/area.py 1 Jan 2005 17:04:56 -0000 1.23 +++ src/gui/areas/area.py 2 Feb 2005 16:35:46 -0000 @@ -396,7 +396,6 @@ self.layer.add_child(i) return i - def __del__(self): """ delete function of memory debugging Index: src/gui/areas/handler.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/gui/areas/handler.py,v retrieving revision 1.20 diff -u -r1.20 handler.py --- src/gui/areas/handler.py 31 Dec 2004 11:57:41 -0000 1.20 +++ src/gui/areas/handler.py 2 Feb 2005 16:35:46 -0000 @@ -378,3 +378,34 @@ print i print raise UnicodeError, e + + def get_item_at(self, point): + """ returns (the first) item in a given point (x,y) """ + content_container = self.layer[1] + + #these widgets are in the given point on the screen + widgets = content_container.get_objects_at(point) + print widgets + + #now trying to get item that the widget represents + #only need texts(?) in listing_area. + #let's take the first text among the widgets.. + #only texts are now mapped to items so no need + #for w in widgets: + + item = None + + for a in self.areas: + try: + for widget in widgets: + item = a.widget2item[widget] + if item is not None: + print item + break + #break + except: + pass + + return item + + Index: src/gui/areas/listing_area.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/gui/areas/listing_area.py,v retrieving revision 1.15 diff -u -r1.15 listing_area.py --- src/gui/areas/listing_area.py 30 Dec 2004 11:28:07 -0000 1.15 +++ src/gui/areas/listing_area.py 2 Feb 2005 16:35:47 -0000 @@ -74,6 +74,9 @@ self.imagecache = ObjectCache(100, desc='item_image') self.__default_val = None + #maps drawn gui objects (widgets) to the items they represent + self.widget2item = {} + def clear(self, keep_settings=False): """ @@ -141,7 +144,6 @@ return mod_x, l[3] return 0, l[3] - def __get_items_geometry(self, menu): """ Get the geometry of the items. How many items per row/col, spaces @@ -249,7 +251,7 @@ """ Draw an item for the text menu. This function is called from update and is only used once to split the huge update function into smaller - once. + ones. """ icon_x = 0 icon = None @@ -329,6 +331,7 @@ self.settings.box_under_icon * icon_x, r.height, r) gui_objects.append(b) + self.widget2item[b] = choice # # special handling for tv shows @@ -437,8 +440,10 @@ s = self.drawstring(text, val.font, settings, x=x + hskip + x_icon, y=y + vskip, width=width-icon_x, height=-1, align_h=val.align, mode='hard', dim=True) + if s: gui_objects.append(s) + self.widget2item[s] = choice def __draw_image_listing_item(self, choice, (x, y), settings, val, hspace, @@ -469,7 +474,8 @@ else: r = val.rectangle.calculate(val.width, height)[2] b = self.drawbox(x + r.x, y + r.y, r.width, r.height, r) - gui_objects.append(b) + #gui_objects.append(b) + #self.widget2item[b] = choice image = self.imagelib.item_image(choice, (val.width, val.height), self.settings.icon_dir, force=True, @@ -499,6 +505,7 @@ i = Image(image, (x + addx, y + addy)) self.layer.add_child(i) gui_objects.append(i) + self.widget2item[i] = choice if settings.type == 'image+text': s = self.drawstring(choice.name, val.font, settings, x=x, @@ -506,9 +513,8 @@ align_h=val.align, mode='hard', ellipses='', dim=False) gui_objects.append(s) - - - + self.widget2item[s] = choice + def __cache_next_image(self): """ @@ -702,3 +708,8 @@ self.arrows.append(i) except Exception, e: log.error(e) + + def get_item_at(self, point): + x, y = point + for item in self.item2rect.iterkeys(): + pass Index: src/input/eventmap.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/input/eventmap.py,v retrieving revision 1.1 diff -u -r1.1 eventmap.py --- src/input/eventmap.py 27 Sep 2004 18:40:34 -0000 1.1 +++ src/input/eventmap.py 2 Feb 2005 16:35:47 -0000 @@ -56,7 +56,8 @@ '9' : INPUT_9, '0' : INPUT_0, 'CH+' : MENU_PAGEUP, - 'CH-' : MENU_PAGEDOWN + 'CH-' : MENU_PAGEDOWN, + 'POINT' : MENU_POINT } TV_EVENTS = { Index: src/input/plugins/event_device.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/input/plugins/event_device.py,v retrieving revision 1.8 diff -u -r1.8 event_device.py Binary files /tmp/cvsAetGwB and event_device.py differ Index: src/input/plugins/sdl.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/input/plugins/sdl.py,v retrieving revision 1.4 diff -u -r1.4 sdl.py --- src/input/plugins/sdl.py 20 Nov 2004 18:23:03 -0000 1.4 +++ src/input/plugins/sdl.py 2 Feb 2005 16:35:47 -0000 @@ -113,4 +113,7 @@ if event.key in self.keymap: self.post_key(self.keymap[event.key]) + if event.type == locals.MOUSEBUTTONUP: #best for touchscreen? + self.post_point(event.pos) + return True