def _pack_extra_buttons(self, vbox): self.sync_unwatched = widgetset.Checkbox(_("Only sync unplayed items")) self.sync_unwatched.connect('toggled', self.unwatched_toggled) self.expire_podcasts = widgetset.Checkbox( _("Delete expired podcasts from my device")) self.expire_podcasts.connect('toggled', self.expire_podcasts_toggled) vbox.pack_start(widgetutil.pad(self.sync_unwatched, left=20)) vbox.pack_start(widgetutil.pad(self.expire_podcasts, left=20))
def __init__(self): self.device = None self.bulk_change = False RoundedVBox.__init__(self) self.create_signal('changed') top_vbox = widgetset.VBox() self.sync_library = widgetset.Checkbox(self.title) self.sync_library.connect('toggled', self.sync_library_toggled) top_vbox.pack_start(self.sync_library) self._pack_extra_buttons(top_vbox) self.pack_start(widgetutil.pad(top_vbox, 20, 20, 20, 20)) bottom_vbox = widgetset.VBox() self.feed_list = widgetset.VBox() self.feed_list.set_size_request(450, -1) self.info_map = {} feeds = self.get_feeds() if feeds: for info in feeds: checkbox = widgetset.Checkbox(info.name) checkbox.connect('toggled', self.feed_toggled, info) self.feed_list.pack_start(checkbox) self.info_map[self.info_key(info)] = checkbox else: self.sync_library.disable() background = widgetset.SolidBackground(self.BG_COLOR) background.add(self.feed_list) scroller = widgetset.Scroller(False, True) scroller.set_child(background) self.feed_list.disable() bottom_vbox.pack_start(scroller, expand=True) line = widgetset.HBox(spacing=5) button = widgetutil.TitlebarButton(_("Select none")) button.connect('clicked', self.select_clicked, False) line.pack_end(button) button = widgetutil.TitlebarButton(_("Select all")) button.connect('clicked', self.select_clicked, True) line.pack_end(button) bottom_vbox.pack_start(widgetutil.pad(line, top=5)) self.pack_start(widgetutil.pad(bottom_vbox, 20, 20, 20, 20), expand=True)
def build_extra_widget(self, window): self.checkbox = widgetset.Checkbox(self.dialog.checkbox_text) self.checkbox.set_checked(self.dialog.checkbox_value) self.entry = widgetset.TextEntry(self.dialog.textbox_value) self.entry.set_activates_default(True) vbox = widgetset.VBox() vbox.pack_start(self.checkbox) vbox.pack_start(self.entry) window.set_extra_widget(vbox)
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 run_dialog(self): """ Returns (directory, show-in-sidebar) or None """ try: extra = widgetset.VBox(spacing=10) if self.previous_error: extra.pack_start(widgetset.Label(self.previous_error)) self.folder_entry = widgetset.TextEntry() self.folder_entry.set_activates_default(True) self.folder_entry.set_text(filename_to_unicode(self.path)) self.folder_entry.set_size_request(300, -1) choose_button = widgetset.Button(_("Choose...")) choose_button.connect('clicked', self.handle_choose) h = widgetset.HBox(spacing=5) h.pack_start( widgetutil.align_middle(widgetset.Label(_("Directory:")))) h.pack_start(widgetutil.align_middle(self.folder_entry)) h.pack_start(widgetutil.align_middle(choose_button)) extra.pack_start(h) self.visible_checkbox = widgetset.Checkbox( _("Show in my sidebar as a podcast")) self.visible_checkbox.set_checked(True) extra.pack_start(self.visible_checkbox) self.vbox = extra self.set_extra_widget(extra) self.add_button(BUTTON_ADD_FOLDER.text) self.add_button(BUTTON_CANCEL.text) ret = self.run() if ret == 0: # 17407 band-aid - don't init with PlatformFilenameType since # str use ascii codec dir = self.folder_entry.get_text() if PlatformFilenameType == str: dir = dir.encode('utf-8') return (dir, self.visible_checkbox.get_checked()) return None except StandardError: logging.exception("newwatchedfolder threw exception.")
def rundialog(title, description, cbx_label, pref_key): window = dialogs.MainDialog(title, description) try: window.add_button(dialogs.BUTTON_QUIT.text) window.add_button(dialogs.BUTTON_CANCEL.text) cbx = widgetset.Checkbox(cbx_label) prefpanel.attach_boolean(cbx, pref_key) window.set_extra_widget(cbx) response = window.run() if response == 0: return True return False finally: window.destroy()
def _general_panel(): extras = [] show_cbx = widgetset.Checkbox(_("Enable tray icon")) attach_boolean(show_cbx, options.SHOW_TRAYICON) extras.append(show_cbx) lab = widgetset.Label(_("When I click the red close button:")) extras.append(widgetutil.align_left(lab)) rbg = widgetset.RadioButtonGroup() rad_close = widgetset.RadioButton(_("Close to tray so that downloads can continue."), rbg) rad_quit = widgetset.RadioButton(_("Quit %(appname)s completely.", {'appname': app.config.get(prefs.SHORT_APP_NAME)}), rbg) attach_radio([(rad_close, True), (rad_quit, False)], prefs.MINIMIZE_TO_TRAY) extras.append(widgetutil.align_left(rad_close, left_pad=20)) extras.append(widgetutil.align_left(rad_quit, left_pad=20)) return extras
def _build_auto_download(channel, grid): auto_download_cbx = widgetset.Checkbox( _("Pause auto-downloading when this many items are unplayed:")) grid.pack(auto_download_cbx, grid.ALIGN_RIGHT) max_new_options = [("1", _("1 unplayed item")), ("3", _("3 unplayed items")), ("5", _("5 unplayed items")), ("10", _("10 unplayed items")), ("15", _("15 unplayed items"))] max_new_values = [int(e[0]) for e in max_new_options] max_new_combo = widgetset.OptionMenu([e[1] for e in max_new_options]) if channel.max_new == u"unlimited": auto_download_cbx.set_checked(False) max_new_combo.set_selected(2) max_new_combo.disable() else: auto_download_cbx.set_checked(True) value = channel.max_new if value < 1: value = 1 else: while value not in max_new_values and value > 1: value = value - 1 max_new_combo.set_selected(max_new_values.index(value)) def max_new_changed(widget, index): value = max_new_options[index][0] messages.SetFeedMaxNew(channel, int(value)).send_to_backend() def checkbox_changed(widget): if widget.get_checked(): max_new_combo.enable() max_new_changed(max_new_combo, 2) else: max_new_combo.disable() max_new_changed(max_new_combo, 2) messages.SetFeedMaxNew(channel, u"unlimited").send_to_backend() grid.pack(max_new_combo, grid.ALIGN_LEFT) max_new_combo.connect('changed', max_new_changed) auto_download_cbx.connect('toggled', checkbox_changed)
def __init__(self, field, items, label, readonly=False, multiple=None): self.mixed_values = False if multiple is None: self.common_value = self._find_common_value(field, iter(items)) elif multiple == 'sum': self.common_value = sum(getattr(item, field) for item in items) self.field = field self.label = widgetset.Label(label) self.label_width = 50 self.extra = [] self.inside = False self.right = False self.widget = NotImplemented self.read_only = readonly if not readonly and len(items) > 1 and not self.HAS_MIXED_STATE: self.checkbox = widgetset.Checkbox() if not self.mixed_values: self.checkbox.set_checked(True) else: self.checkbox = None
def run_dialog(self, report): self.report = report try: vbox = widgetset.VBox(spacing=8) lab = widgetset.Label( _("You can help us fix this problem by submitting an " "error report.")) lab.set_wrap(True) lab.set_size_request(600, -1) vbox.pack_start(widgetutil.align_left(lab)) warning = widgetset.Label( _("Note: This error report will not be posted publicly, " "but may include uniquely identifable information " "including file names, website URLs, podcast URLs, " "and disk paths.")) warning.set_wrap(True) warning.set_size_request(600, -1) vbox.pack_start(widgetutil.align_left(warning)) self.see_crash_button = widgetset.Button(_("See crash report")) self.see_crash_button.set_size(widgetconst.SIZE_SMALL) self.see_crash_button.connect('clicked', self.on_see_crash_report) vbox.pack_start(widgetutil.align_right(self.see_crash_button)) cbx = widgetset.Checkbox( _("Include entire program database including all " "filenames, websites, and podcasts with the " "error report.")) vbox.pack_start(widgetutil.align_left(cbx)) lab2 = widgetset.Label( _("What were you doing when you got this message? " "(Helpful, but not required.)")) lab2.set_wrap(True) lab2.set_size_request(600, -1) vbox.pack_start(widgetutil.align_left(lab2)) text = widgetset.MultilineTextEntry() scroller = widgetset.Scroller(True, True) scroller.add(text) scroller.set_size_request(600, 100) vbox.pack_start(widgetutil.align_left(scroller)) hidden_vbox = widgetset.VBox(spacing=5) lab = widgetset.Label(_("Crash Report:")) hidden_vbox.pack_start(widgetutil.align_left(lab)) report_text = widgetset.MultilineTextEntry(self.report) report_text.set_editable(False) scroller = widgetset.Scroller(True, True) scroller.add(report_text) scroller.set_size_request(600, 100) hidden_vbox.pack_start(widgetutil.align_left(scroller)) self.hidden_vbox = widgetutil.HideableWidget(hidden_vbox) self.hidden_vbox.hide() vbox.pack_start(self.hidden_vbox) self.set_extra_widget(vbox) self.add_button(BUTTON_SUBMIT_REPORT.text) self.add_button(BUTTON_IGNORE.text) self.vbox = vbox ret = self.run() if ret == 0: messages.ReportCrash(report, text.get_text(), cbx.get_checked()).send_to_backend() else: return IGNORE_ERRORS except StandardError: logging.exception("crashdialog threw exception.")
def run_dialog(channel_infos, downloaded_items, downloading_items, has_watched_feeds): """Displays the remove feeds dialog. """ title = ngettext('Remove Podcast', 'Remove Podcasts', len(channel_infos)) rc_window = MainDialog(title) try: try: v = widgetset.VBox(spacing=5) lab = widgetset.Label( ngettext("Are you sure you want to remove this podcast:", "Are you sure you want to remove these podcasts:", len(channel_infos))) lab.set_wrap(True) v.pack_start(widgetutil.align_left(lab)) v2 = widgetset.VBox() lab_height = None for mem in channel_infos: lab_mem = widgetset.Label(util.clamp_text(mem.name, 40)) if lab_height is None: dummy, lab_height = lab_mem.get_size_request() v2.pack_start(widgetutil.align_left(lab_mem, left_pad=15)) if len(channel_infos) > 5: scroller = widgetset.Scroller(False, True) scroller.set_has_borders(True) scroller.add(v2) scroller_width, scroller_height = scroller.get_size_request() if scroller_height == 0: scroller.set_size_request(scroller_width, 5 * (lab_height + 1)) v2 = scroller v.pack_start(v2, padding=10) cbx_downloaded = None if downloaded_items: cbx_downloaded = widgetset.Checkbox( _("Keep items that have been downloaded in my library.")) v.pack_start( widgetutil.align_left(cbx_downloaded, bottom_pad=5)) if has_watched_feeds: lab = widgetset.Label( _( "Watched folders will be removed from the sidebar but " "their contents will still appear in your library. " "You can stop watching watched folders completely " "in the %(appname)s preference panel.", {"appname": app.config.get(prefs.SHORT_APP_NAME)})) lab.set_wrap(True) lab.set_size_request(390, -1) v.pack_start(widgetutil.align_left(lab, bottom_pad=5)) if downloading_items: lab_downloading = widgetset.Label( ngettext( "Are you sure you want to remove this podcast? " "The downloads currently in progress will be canceled.", "Are you sure you want to remove these podcasts? " "The downloads currently in progress will be canceled.", len(channel_infos))) lab_downloading.set_wrap(True) lab_downloading.set_size_request(390, -1) v.pack_start(widgetutil.align_left(lab_downloading)) rc_window.set_extra_widget(v) rc_window.add_button(BUTTON_REMOVE.text) rc_window.add_button(BUTTON_CANCEL.text) ret = rc_window.run() if ret == 0: # this is silly, but it sets us up for adding additional # bits later. ret = {KEEP_ITEMS: False} if downloaded_items: ret[KEEP_ITEMS] = cbx_downloaded.get_checked() return ret except StandardError: logging.exception("removefeeds threw exception.") finally: rc_window.destroy()
def _build_daap_section(self, bottom): label = self.build_header( _("%(shortappname)s Sharing", self.trans_data)) bottom.pack_start( widgetutil.align_left(label, left_pad=20, bottom_pad=10)) # Note: "Miro iPad app" is the name of a piece of software-- # don't substitute Miro for %(appname)s here. label = widgetset.Label( _( "%(shortappname)s can stream and download files to and from " "other %(shortappname)ss on your local network and to the " "Miro iPad app. It's awesome!", self.trans_data)) label.set_size(self.TEXT_SIZE) label.set_color(self.TEXT_COLOR) label.set_wrap(True) label.set_size_request(550, -1) bottom.pack_start( widgetutil.align_left(label, left_pad=20, bottom_pad=20)) if not app.sharing_manager.mdns_present: label = widgetset.Label(_("Disabled: Needs Bonjour")) label.set_bold(True) bottom.pack_start( widgetutil.align_left(label, left_pad=20, bottom_pad=20, top_pad=10)) return container = widgetset.HBox() self.share_button = PrettyToggleButton() self.share_button.connect('clicked', self.daap_changed) self.share_button.connect('dragged-left', self.daap_changed) self.share_button.connect('dragged-right', self.daap_changed) self.share_button.set_value(app.config.get(prefs.SHARE_MEDIA)) container.pack_start(widgetutil.pad(self.share_button, right=20)) vbox = widgetset.VBox() hbox = widgetset.HBox(spacing=30) self.share_audio_cbx = widgetset.Checkbox(_("Share Music"), bold=True) self.share_video_cbx = widgetset.Checkbox(_("Share Videos"), bold=True) self.share_warnonquit_cbx = widgetset.Checkbox( _('Warn on quit when others are connected to my media library.')) hbox.pack_start(widgetutil.align_top(self.share_video_cbx)) hbox.pack_start(widgetutil.align_top(self.share_audio_cbx)) prefpanel.attach_boolean(self.share_audio_cbx, prefs.SHARE_AUDIO) prefpanel.attach_boolean(self.share_video_cbx, prefs.SHARE_VIDEO) vbox.pack_start(hbox) label = widgetset.Label( _("My %(shortappname)s Share Name", self.trans_data)) label.set_bold(True) vbox.pack_start(widgetutil.align_left(label, top_pad=15, bottom_pad=5)) hbox = widgetset.HBox() self.share_entry = widgetset.TextEntry() self.share_entry.set_size_request(230, -1) share_error = prefpanel.build_error_image() prefpanel.attach_text(self.share_entry, prefs.SHARE_NAME, share_error, check_function=prefpanel.text_is_not_blank) if not self.share_button.get_value(): self.share_entry.disable() self.share_video_cbx.disable() self.share_audio_cbx.disable() self.share_warnonquit_cbx.disable() hbox.pack_start(self.share_entry) hbox.pack_start(share_error) vbox.pack_start(hbox) vbox.pack_start(widgetutil.pad(self.share_warnonquit_cbx, top=15)) container.pack_start(vbox) bg = widgetutil.RoundedSolidBackground( widgetutil.css_to_color('#e4e4e4')) bg.add(widgetutil.pad(container, 20, 20, 20, 20)) bottom.pack_start(widgetutil.align_left(bg, left_pad=20, bottom_pad=50))
def __init__(self): self.device = None widgetset.VBox.__init__(self) self.button_row = segmented.SegmentedButtonsRow() for key, name in (('main', _('Main')), ('podcasts', _('Podcasts')), ('playlists', _('Playlists')), ('settings', _('Settings'))): button = DeviceTabButtonSegment(key, name, self._tab_clicked) self.button_row.add_button(name.lower(), button) self.button_row.set_active('main') tbc = TabButtonContainer() tbc.add( widgetutil.align_center(self.button_row.make_widget(), top_pad=9)) width = tbc.child.get_size_request()[0] tbc.child.set_size_request(-1, 24) self.pack_start(tbc) self.tabs = {} self.tab_container = widgetset.Background() scroller = widgetset.Scroller(False, True) scroller.add(self.tab_container) self.pack_start(scroller, expand=True) vbox = widgetset.VBox() vbox.pack_start( widgetutil.align_left(tabcontroller.ConnectTab.build_header( _("Individual Files")), top_pad=10)) label = tabcontroller.ConnectTab.build_text( _("Drag individual video and audio files onto " "the device in the sidebar to copy them.")) label.set_size_request(width, -1) label.set_wrap(True) vbox.pack_start(widgetutil.align_left(label, top_pad=10)) vbox.pack_start( widgetutil.align_left(tabcontroller.ConnectTab.build_header( _("Syncing")), top_pad=30)) label = tabcontroller.ConnectTab.build_text( _("Use the tabs above and these options for " "automatic syncing.")) label.set_size_request(width, -1) label.set_wrap(True) vbox.pack_start(widgetutil.align_left(label, top_pad=10)) self.auto_sync = widgetset.Checkbox( _("Sync automatically when this " "device is connected")) self.auto_sync.connect('toggled', self._auto_sync_changed) vbox.pack_start(widgetutil.align_left(self.auto_sync, top_pad=10)) max_fill_label = _( "Don't fill more than %(count)i percent of the " "free space when syncing", {'count': id(self)}) checkbox_label, text_label = max_fill_label.split(unicode(id(self)), 1) self.max_fill_enabled = widgetset.Checkbox(checkbox_label) self.max_fill_enabled.connect('toggled', self._max_fill_enabled_changed) self.max_fill_percent = widgetset.TextEntry() self.max_fill_percent.set_size_request(50, -1) self.max_fill_percent.connect('focus-out', self._max_fill_percent_changed) label = widgetset.Label(text_label) vbox.pack_start( widgetutil.align_left(widgetutil.build_hbox( [self.max_fill_enabled, self.max_fill_percent, label], 0), top_pad=10)) rounded_vbox = RoundedVBox() vbox.pack_start( widgetutil.align_left(tabcontroller.ConnectTab.build_header( _("Auto Fill")), top_pad=30, bottom_pad=10)) self.auto_fill = widgetset.Checkbox( _("After syncing my selections in the tabs above, " "fill remaining space with:")) self.auto_fill.connect('toggled', self._auto_fill_changed) rounded_vbox.pack_start( widgetutil.align_left(self.auto_fill, 20, 20, 20, 20)) names = [(_('Newest Music'), u'recent_music'), (_('Random Music'), u'random_music'), (_('Most Played Songs'), u'most_played_music'), (_('New Playlists'), u'new_playlists'), (_('Most Recent Podcasts'), u'recent_podcasts')] longest = max(names, key=lambda x: len(x[0]))[0] width = widgetset.Label(longest).get_width() less_label = widgetset.Label(_('Less').upper()) less_label.set_size(tabcontroller.ConnectTab.TEXT_SIZE / 2) more_label = widgetset.Label(_('More').upper()) more_label.set_size(tabcontroller.ConnectTab.TEXT_SIZE / 2) label_hbox = widgetutil.build_hbox([ less_label, widgetutil.pad( more_label, left=(200 - less_label.get_width() - more_label.get_width())) ], padding=0) label_hbox.set_size_request(200, -1) scrollers = [widgetutil.align_right(label_hbox, right_pad=20)] self.auto_fill_sliders = {} for name, setting in names: label = widgetutil.align_right(widgetset.Label(name)) label.set_size_request(width, -1) dragger = AutoFillSlider() dragger.connect('released', self._auto_fill_slider_changed, setting) self.auto_fill_sliders[setting] = dragger hbox = widgetutil.build_hbox([label, dragger], 20) scrollers.append(hbox) rounded_vbox.pack_start( widgetutil.align_left(widgetutil.build_vbox(scrollers, 10), 20, 20, 20, 20)) vbox.pack_start(widgetutil.align_left(rounded_vbox)) self.device_size = SizeWidget() self.device_size.sync_button.connect('clicked', self.sync_clicked) self.pack_end(self.device_size) self.add_tab('main', widgetutil.align_center(vbox, 20, 20, 20, 20)) self.add_tab( 'podcasts', widgetutil.align_center(PodcastSyncWidget(), 20, 20, 20, 20)) self.add_tab( 'playlists', widgetutil.align_center(PlaylistSyncWidget(), 20, 20, 20, 20)) self.add_tab( 'settings', widgetutil.align_center(DeviceSettingsWidget(), 20, 20, 20, 20))
def create_table(self): self._background.remove() def _get_conversion_name(id_): if id_ == 'copy': return _('Copy') else: return conversion_manager.lookup_converter(id_).name conversion_details = { 'audio': _get_conversion_name(self.device.info.audio_conversion), 'video': _get_conversion_name(self.device.info.video_conversion) } audio_conversion_names = [ _('Device Default (%(audio)s)', conversion_details), _('Copy') ] self.audio_conversion_values = [None, 'copy'] video_conversion_names = [ _('Device Default (%(video)s)', conversion_details), _('Copy') ] self.video_conversion_values = [None, 'copy'] for section_name, converters in conversion_manager.get_converters(): for converter in converters: if converter.mediatype == 'video': video_conversion_names.append(converter.name) self.video_conversion_values.append(converter.identifier) elif converter.mediatype == 'audio': audio_conversion_names.append(converter.name) self.audio_conversion_values.append(converter.identifier) widgets = [] for text, setting, type_ in ( (_("Name of Device"), u'name', 'text'), (_("Video Conversion"), u'video_conversion', 'video_conversion'), (_("Audio Conversion"), u'audio_conversion', 'audio_conversion'), (_("Store video in this directory"), u'video_path', 'text'), (_("Store audio in this directory"), u'audio_path', 'text'), (_("Always show this device, even if " "'show all devices' is turned off"), u'always_show', 'bool'), (_("Always convert videos before copying to this device, even " "if the video can play without conversion\n(may reduce video " "file sizes, but makes syncing much slower)"), u"always_sync_videos", 'bool')): if type_ == 'text': widget = widgetset.TextEntry() widget.set_size_request(260, -1) elif type_.endswith('conversion'): if type_ == 'video_conversion': options = video_conversion_names elif type_ == 'audio_conversion': options = audio_conversion_names widget = widgetset.OptionMenu(options) widget.set_size_request(260, -1) elif type_ == 'bool': widget = widgetset.Checkbox(text) widget.set_size_request(400, -1) else: raise RuntimeError('unknown settings widget: %r' % type_) self.boxes[setting] = widget if type_ != 'bool': # has a label already widgets.append((widgetset.Label(text), widget)) if type_ == 'text': widget.connect('focus-out', self.setting_changed, setting) else: widget.connect('changed', self.setting_changed, setting) else: widgets.append((widget, )) widget.connect('toggled', self.setting_changed, setting) table = widgetset.Table(2, len(widgets)) for row, widget in enumerate(widgets): if len(widget) == 1: # checkbox table.pack(widget[0], 0, row, column_span=2) else: table.pack(widgetutil.align_right(widget[0]), 0, row) table.pack(widgetutil.align_left(widget[1]), 1, row) table.set_column_spacing(20) table.set_row_spacing(20) self._background.set_child( widgetutil.align_center(table, 20, 20, 20, 20))
def _pack_extra_buttons(self): self.sync_unwatched = widgetset.Checkbox(_("Only sync unplayed items")) self.sync_unwatched.connect('toggled', self.unwatched_toggled) self.pack_start(widgetutil.pad(self.sync_unwatched, left=20))
def _general_panel(): extras = [] cbx = widgetset.Checkbox(_("Enable tray icon")) attach_boolean(cbx, options.SHOW_TRAYICON) extras.append(cbx) return extras
def build_extra_widget(self, window): self.checkbox = widgetset.Checkbox(self.dialog.checkbox_text) self.checkbox.set_checked(self.dialog.checkbox_value) window.set_extra_widget(self.checkbox)