def __init__(self): widgetset.VBox.__init__(self) if not app.sharing_manager.mdns_present: sharing_broken = SharingBroken() sharing_broken.connect('install-clicked', self.daap_install_clicked) self.pack_start(widgetutil.align_center(sharing_broken)) title = widgetset.HBox() logo = widgetset.ImageDisplay( imagepool.get(resources.path('images/icon-connect_large.png'))) title.pack_start(widgetutil.align_middle(logo)) label = widgetset.Label(_("Connect")) label.set_size(widgetutil.font_scale_from_osx_points(30)) label.set_bold(True) title.pack_start(widgetutil.align_middle(label, left_pad=5)) self.pack_start( widgetutil.align_center(title, top_pad=30, bottom_pad=20)) bottom = widgetset.VBox() self._build_daap_section(bottom) self._build_sync_section(bottom) self._build_app_store_section(bottom) self._build_android_section(bottom) self.pack_start(widgetutil.align_center(bottom)) self.callback_handle = app.backend_config_watcher.connect_weak( 'changed', self.on_config_changed)
def _build_sync_section(self, bottom): hbox = widgetset.HBox() vbox = widgetset.VBox() label_line = widgetset.HBox() label = self.build_header(_("Sync a Phone, Tablet, or Digital Camera")) label_line.pack_start( widgetutil.align_left(label, left_pad=20, bottom_pad=10)) help_button = HelpButton() help_button.connect('clicked', self.help_button_clicked) label_line.pack_start(widgetutil.align_top(help_button)) bottom.pack_start(label_line) label = widgetset.Label( _( "Connect the USB cable to sync your Android device with " "%(shortappname)s. Be sure to set your device to 'USB Mass " "Storage' mode in your device settings. Attach your digital " "camera, and convert your video files to be instantly " "web-ready.", self.trans_data)) label.set_size(self.TEXT_SIZE) label.set_color(self.TEXT_COLOR) label.set_size_request(400, -1) label.set_wrap(True) vbox.pack_start( widgetutil.align_left(label, left_pad=20, bottom_pad=20)) show_all_vbox = widgetset.VBox() self.show_unknown = widgetset.Checkbox( _("Show all attached devices and drives")) self.show_unknown.set_checked( app.config.get(prefs.SHOW_UNKNOWN_DEVICES)) self.show_unknown.connect('toggled', self.show_all_devices_toggled) show_all_vbox.pack_start(self.show_unknown) padding = self.show_unknown.get_text_padding() label = widgetset.Label( _( "Use this if your phone doesn't appear in %(shortappname)s when " "you connect it to the computer, or if you want to sync with an " "external drive.", self.trans_data)) label.set_size(self.TEXT_SIZE) label.set_color(self.TEXT_COLOR) label.set_size_request(370 - padding, -1) label.set_wrap(True) show_all_vbox.pack_start(widgetutil.pad(label, top=10, left=padding)) bg = widgetutil.RoundedSolidBackground( widgetutil.css_to_color('#e4e4e4')) bg.set_size_request(400, -1) bg.add(widgetutil.pad(show_all_vbox, 20, 20, 20, 20)) vbox.pack_start(widgetutil.pad(bg, left=20, right=10, bottom=50)) hbox.pack_start(vbox) hbox.pack_start( widgetutil.align_top( widgetset.ImageDisplay( imagepool.get( resources.path('images/connect-android.png'))))) bottom.pack_start(hbox)
def get_image_display(path, size=None): """Returns an ImageDisplay for path. :param path: the filename for the image :param size: if the image needs to fit into a specified sized space, then specify this and get will return a scaled image; if size is not specified, then this returns the default sized image """ return widgetset.ImageDisplay(_imagepool.get((path, size)))
def get_image_display(path, size=None, invalidator=None): """Returns an ImageDisplay for path. :param path: the filename for the image :param size: if the image needs to fit into a specified sized space, then specify this and get will return a scaled image; if size is not specified, then this returns the default sized image :param invalidator: an optional functions which returns True if the cache value is no longer valid """ return widgetset.ImageDisplay( _imagepool.get((path, size), invalidator=invalidator))
def __init__(self): widgetset.VBox.__init__(self) title = widgetset.HBox() logo = widgetset.ImageDisplay( imagepool.get(resources.path('images/icon-playlist_large.png'))) title.pack_start(widgetutil.align_middle(logo)) label = widgetset.Label(_("Playlists")) label.set_size(widgetutil.font_scale_from_osx_points(30)) label.set_bold(True) title.pack_start(widgetutil.align_middle(label, left_pad=5)) self.pack_start( widgetutil.align_center(title, top_pad=30, bottom_pad=20)) bottom = widgetset.VBox() self._build_add_playlist_section(bottom) self.pack_start(widgetutil.align_center(bottom))
def __init__(self): widgetset.VBox.__init__(self) label = widgetset.Label() label.set_text(_('This device is not yet mounted.')) label.set_bold(True) label.set_size(1.5) self.pack_start( widgetutil.align_center(label, left_pad=20, top_pad=50, bottom_pad=20)) self.device_text = widgetset.Label() self.device_text.set_size(1.5) self.device_text.set_wrap(True) self.pack_start( widgetutil.align_center(self.device_text, left_pad=20, bottom_pad=40)) image = widgetset.ImageDisplay( imagepool.get(resources.path('images/sync-unmounted.png'))) self.pack_start( widgetutil.align_center(image, left_pad=20, bottom_pad=20))
def __init__(self): widgetset.VBox.__init__(self) label = widgetset.Label() label.set_text( _("Your device isn't telling us its exact model number.")) self.pack_start( widgetutil.align_center(label, left_pad=20, top_pad=50, bottom_pad=20)) label = widgetset.Label() label.set_text( _('For optimal video conversion, select the device model.')) label.set_bold(True) self.pack_start( widgetutil.align_center(label, left_pad=20, bottom_pad=20)), self.device_choices = widgetset.VBox() self.pack_start( widgetutil.align_center(self.device_choices, left_pad=20, top_pad=20, bottom_pad=20)) image = widgetset.ImageDisplay( imagepool.get(resources.path('images/sync-unknown.png'))) self.pack_start( widgetutil.align_center(image, left_pad=20, bottom_pad=20)) label = widgetset.Label() label.set_text( _("If you don't know the model or it doesn't appear " "in the list, it's fine to choose the 'Generic' " "device option.")) label.set_bold(True) self.pack_start( widgetutil.align_center(label, left_pad=20, bottom_pad=20))
def __init__(self): itemlistwidgets.Titlebar.__init__(self) hbox = widgetset.HBox() self.add(hbox) self.create_signal('browser-reload') self.create_signal('browser-back') self.create_signal('browser-forward') self.create_signal('browser-stop') self.create_signal('browser-home') self.create_signal('address-entered') self.create_signal('browser-download') self.create_signal('browser-open') self.back_button = imagebutton.ImageButton('navback') self.back_button.set_squish_width(True) self.back_button.connect('clicked', self._on_back_button_clicked) self.back_button.disable() hbox.pack_start(widgetutil.align_middle(self.back_button, left_pad=10)) nav_separator = widgetset.ImageDisplay( imagepool.get(resources.path('images/navseparator.png'))) hbox.pack_start(widgetutil.align_middle(nav_separator)) self.forward_button = imagebutton.ImageButton('navforward') self.forward_button.set_squish_width(True) self.forward_button.connect('clicked', self._on_forward_button_clicked) self.forward_button.disable() hbox.pack_start(widgetutil.align_middle(self.forward_button)) self.reload_button = imagebutton.ImageButton('navreload') self.reload_button.connect('clicked', self._on_reload_button_clicked) hbox.pack_start(widgetutil.align_middle(self.reload_button, left_pad=4)) self.stop_button = imagebutton.ImageButton('navstop') self.stop_button.connect('clicked', self._on_stop_button_clicked) hbox.pack_start(widgetutil.align_middle(self.stop_button, left_pad=4)) self.home_button = imagebutton.ImageButton('navhome') self.home_button.connect('clicked', self._on_home_button_clicked) hbox.pack_start(widgetutil.align_middle(self.home_button, left_pad=4)) self.browser_open_button = widgetutil.TitlebarButton( _('Open in browser'), 'navopen') self.browser_open_button.connect('clicked', self._on_browser_open_activate) hbox.pack_end( widgetutil.align_middle(self.browser_open_button, right_pad=10)) self.download_button = widgetutil.TitlebarButton( _("Download this video"), 'navdownload') self.download_button.connect('clicked', self._on_download_button_clicked) self.download_button = widgetutil.HideableWidget(self.download_button) hbox.pack_end( widgetutil.align_middle(self.download_button, right_pad=4)) self.loading_icon = BrowserLoadingImage() hbox.pack_start(widgetutil.align_middle(self.loading_icon), expand=True)