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 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_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 _general_panel(): extras = [] cbx = widgetset.Checkbox(_("Enable tray icon")) attach_boolean(cbx, options.SHOW_TRAYICON) extras.append(cbx) return extras
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 = self.build_text( _("%(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_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_feed_cbx = widgetset.Checkbox(_("Share Podcasts"), 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)) hbox.pack_start(widgetutil.align_top(self.share_feed_cbx)) prefpanel.attach_boolean(self.share_audio_cbx, prefs.SHARE_AUDIO) prefpanel.attach_boolean(self.share_video_cbx, prefs.SHARE_VIDEO) prefpanel.attach_boolean(self.share_feed_cbx, prefs.SHARE_FEED) prefpanel.attach_boolean(self.share_warnonquit_cbx, prefs.SHARE_WARN_ON_QUIT) 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_feed_cbx.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)) widgets = [self.share_button, self.share_entry, self.share_audio_cbx, self.share_video_cbx, self.share_feed_cbx, self.share_warnonquit_cbx] callbacks = (self.sharing_start_volatile, self.sharing_end_volatile) app.sharing_manager.register_interest(self, callbacks, widgets)
def _general_panel(): extras = [] cbx = widgetset.Checkbox(_("Enable tray icon")) attach_boolean(cbx, options.SHOW_TRAYICON) extras.append(cbx) return extras