def rebuild_video_details(self): # this removes the child widget if there is one self.remove() if not self.item_info: self.add(HBox()) return info = self.item_info outer_hbox = HBox(5) if not info.is_external: if info.expiration_date is not None: text = displaytext.expiration_date(info.expiration_date) self._expiration_label = Label(text) self._expiration_label.set_size(0.77) self._expiration_label.set_color((152.0 / 255.0, 152.0 / 255.0, 152.0 / 255.0)) outer_hbox.pack_start(_align_middle(self._expiration_label)) outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) lab = make_label(_("Keep"), self.handle_keep, info.expiration_date is not None) outer_hbox.pack_start(_align_middle(lab)) outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) self._subtitles_link = make_label(_("Subtitles"), self.handle_subtitles) outer_hbox.pack_start(_align_middle(self._subtitles_link)) subtitles_image = make_image_button('images/subtitles_down.png', self.handle_subtitles) outer_hbox.pack_start(_align_middle(subtitles_image)) outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) self._delete_link = make_label(_("Delete"), self.handle_delete) outer_hbox.pack_start(_align_middle(self._delete_link)) if not info.is_external: outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) self._share_link = make_label(_("Share"), self.handle_share, info.has_sharable_url) outer_hbox.pack_start(_align_middle(self._share_link)) outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) if info.commentslink: self._permalink_link = make_label(_("Comments"), self.handle_commentslink, info.commentslink) else: self._permalink_link = make_label(_("Permalink"), self.handle_permalink, info.permalink) outer_hbox.pack_start(_align_middle(self._permalink_link)) outer_hbox.pack_start(_align_middle(Divider(), top_pad=3, bottom_pad=3, left_pad=5, right_pad=5)) if app.playback_manager.is_fullscreen: fullscreen_link = make_label(_("Exit fullscreen"), self.handle_fullscreen) outer_hbox.pack_start(_align_middle(fullscreen_link)) fullscreen_image = make_image_button('images/fullscreen_exit.png', self.handle_fullscreen) outer_hbox.pack_start(_align_middle(fullscreen_image)) else: fullscreen_link = make_label(_("Fullscreen"), self.handle_fullscreen) outer_hbox.pack_start(_align_middle(fullscreen_link)) fullscreen_image = make_image_button('images/fullscreen_enter.png', self.handle_fullscreen) outer_hbox.pack_start(_align_middle(fullscreen_image)) if app.playback_manager.detached_window is not None: popin_link = make_label(_("Pop-in"), self.handle_popin_popout) outer_hbox.pack_start(_align_middle(popin_link)) popin_image = make_image_button('images/popin.png', self.handle_popin_popout) outer_hbox.pack_start(_align_middle(popin_image)) else: popout_link = make_label(_("Pop-out"), self.handle_popin_popout) outer_hbox.pack_start(_align_middle(popout_link)) popout_image = make_image_button('images/popout.png', self.handle_popin_popout) outer_hbox.pack_start(_align_middle(popout_image)) self.add(_align_right(outer_hbox, left_pad=15, right_pad=15))
def expiration_date_text(self): return displaytext.expiration_date(self.expiration_date)