def __init__(self, app=None, **kwargs): PhotoContentItem.__init__(self, border_right=6, **kwargs) self.__app = None self.__description_mode = False self._logger = logging.getLogger('bigboard.AppDisplay') self.__photo = CanvasMugshotURLImage(scale_width=30, scale_height=30) self.set_photo(self.__photo) self.__box = CanvasVBox(spacing=2, border_right=4) sub_kwargs = {} if kwargs.has_key('color'): sub_kwargs['color'] = kwargs['color'] self.__title = ActionLink(font="14px",xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, **sub_kwargs) self.__title.connect("activated", lambda t: self.emit("title-clicked")) self.__subtitle = hippo.CanvasText(font="10px",xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END) attrs = pango.AttrList() attrs.insert(pango.AttrForeground(0x6666, 0x6666, 0x6666, 0, 0xFFFF)) self.__subtitle.set_property("attributes", attrs) self.__box.append(self.__title) self.__box.append(self.__subtitle) self.set_child(self.__box) self.__description = hippo.CanvasText(size_mode=hippo.CANVAS_SIZE_WRAP_WORD, **sub_kwargs) self.__box.append(self.__description) if app: self.set_app(app)
def __init__(self, app_location, app=None, **kwargs): if app_location == AppLocation.STOCK: kwargs['enable_theme'] = True PhotoContentItem.__init__(self, border_right=6, **kwargs) self.__app = None self.__description_mode = False self._logger = logging.getLogger('bigboard.AppDisplay') self.__photo = CanvasMugshotURLImage(scale_width=30, scale_height=30) self.set_photo(self.__photo) self.__box = CanvasVBox(spacing=2, border_right=4) sub_kwargs = {} if kwargs.has_key('color'): sub_kwargs['color'] = kwargs['color'] title_kwargs = dict(sub_kwargs) title_kwargs.update({'font': '14px', 'xalign': hippo.ALIGNMENT_START, 'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END }) if app_location == AppLocation.STOCK: self.__title = ThemedLink(**title_kwargs) else: self.__title = ActionLink(**title_kwargs) self.__title.connect("activated", lambda t: self.emit("title-clicked")) subtitle_kwargs = {'font': '10px', 'xalign': hippo.ALIGNMENT_START, 'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END } if app_location == AppLocation.STOCK: self.__subtitle = ThemedText(theme_hints=['subforeground'], **subtitle_kwargs) else: self.__subtitle = hippo.CanvasText(**subtitle_kwargs) self.__box.append(self.__title) self.__box.append(self.__subtitle) self.set_child(self.__box) self.__description = hippo.CanvasText(size_mode=hippo.CANVAS_SIZE_WRAP_WORD, **sub_kwargs) self.__box.append(self.__description) self.__photo.set_clickable(True) self.__box.set_clickable(True) self.__app_location = app_location if app: self.set_app(app)
def __init__(self, **kwargs): PhotoContentItem.__init__(self, **kwargs) self.__entity = None self.__photo = CanvasMugshotURLImage(scale_width=30, scale_height=30, border=1, border_color=0x000000ff) self.set_photo(self.__photo) self.__name = hippo.CanvasText(xalign=hippo.ALIGNMENT_FILL, yalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END) self.set_child(self.__name) self.connect('button-press-event', self.__handle_button_press) self.connect('button-release-event', self.__handle_button_release) self.__pressed = False
def __init__(self, person, themed=False, **kwargs): PhotoContentItem.__init__(self, **kwargs) self.person = person self.__themed = themed if themed: self.set_themed() model = DataModel(bigboard.globals.server_name) self.set_clickable(True) self.__photo = CanvasMugshotURLImage(scale_width=45, scale_height=45, border=1, border_color=0x000000ff) self.set_photo(self.__photo) self.__details_box = CanvasVBox() self.set_child(self.__details_box) nameklass = themed and ThemedText or hippo.CanvasText self.__name = nameklass(xalign=hippo.ALIGNMENT_START, yalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END) self.__details_box.append(self.__name) self.__presence_box = CanvasHBox(spacing=4) self.__details_box.append(self.__presence_box) self.__statuses = [] self.__status_box = CanvasHBox() self.__details_box.append(self.__status_box) self.connect('button-press-event', self.__handle_button_press) self.connect('button-release-event', self.__handle_button_release) self.__pressed = False self.__aim_icon = None self.__xmpp_icon = None self.__current_track = None self.__current_track_timeout = None if self.person.is_contact: try: user = self.person.resource.user except AttributeError: user = None if user: query = model.query_resource(user, "currentTrack +;currentTrackPlayTime") query.execute() user.connect(self.__update_current_track, 'currentTrack') user.connect(self.__update_current_track, 'currentTrackPlayTime') self.__update_current_track(user) self.person.connect('display-name-changed', self.__update) self.person.connect('icon-url-changed', self.__update) self.person.connect('aim-buddy-changed', self.__update_aim_buddy) self.person.connect('xmpp-buddy-changed', self.__update_xmpp_buddy) self.__update(self.person) self.__update_aim_buddy(self.person) self.__update_xmpp_buddy(self.person)