def build_widget(self): v = widgetset.VBox(8) run_at_startup_cbx = widgetset.Checkbox(_( "Automatically run %(appname)s when I log in.", {'appname': app.config.get(prefs.SHORT_APP_NAME)})) attach_boolean(run_at_startup_cbx, prefs.RUN_AT_STARTUP) v.pack_start(run_at_startup_cbx) warn_if_downloading_cbx = widgetset.Checkbox(_("Warn me if I attempt to quit with downloads in progress.")) attach_boolean(warn_if_downloading_cbx, prefs.WARN_IF_DOWNLOADING_ON_QUIT) v.pack_start(warn_if_downloading_cbx) warn_if_converting_cbx = widgetset.Checkbox(_("Warn me if I attempt to quit with conversions in progress.")) attach_boolean(warn_if_converting_cbx, prefs.WARN_IF_CONVERTING_ON_QUIT) v.pack_start(warn_if_converting_cbx) # FIXME - need to automatically generate list of available languages # in correct language lang_options = gtcache.get_languages() lang_options.insert(0, ("system", _("System default"))) lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options]) attach_combo(lang_option_menu, prefs.LANGUAGE, [op[0] for op in lang_options]) v.pack_start(widgetutil.align_left( widgetutil.build_control_line((widgetset.Label(_("Language:")), lang_option_menu)))) v.pack_start(widgetutil.align_left( dialogwidgets.note(_("(Changing the language requires you to restart Miro.)")))) pack_extras(v, "general") return v
def build_first_page(self): vbox = widgetset.VBox(spacing=5) vbox.pack_start(_build_title(_("Choose Language"))) lab = widgetset.Label(_( "Welcome to the %(name)s first time setup!\n" "\n" "The next few screens will help you set up %(name)s so that " "it works best for you.\n" "\n" "What language would you like Miro to be in?", {'name': app.config.get(prefs.SHORT_APP_NAME)})) lab.set_wrap(True) lab.set_size_request(400, -1) vbox.pack_start(widgetutil.align_left(lab)) lang_options = gtcache.get_languages() lang_options.insert(0, ("system", _("System default"))) lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options]) lang = app.config.get(prefs.LANGUAGE) try: lang_option_menu.set_selected([op[0] for op in lang_options].index(lang)) except ValueError: lang_option_menu.set_selected(1) def update_clicked(widget): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set(prefs.LANGUAGE, str(lang_options[lang_option_menu.get_selected()][0])) gtcache.init() self.this_page(rebuild=True) def next_clicked(widget): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set(prefs.LANGUAGE, str(lang_options[lang_option_menu.get_selected()][0])) gtcache.init() self.next_page(rebuild=True) update_button = widgetset.Button(_("Update")) update_button.connect('clicked', update_clicked) hbox = widgetset.HBox() hbox.pack_start(widgetset.Label(_("Language:")), padding=0) hbox.pack_start(lang_option_menu, padding=5) hbox.pack_start(update_button, padding=5) vbox.pack_start(hbox) vbox.pack_start(widgetset.Label(" "), expand=True) next_button = widgetset.Button(_("Next >")) next_button.connect('clicked', next_clicked) vbox.pack_start(widgetutil.align_right(next_button)) return vbox
def build_language_page(self): vbox = widgetset.VBox(spacing=5) vbox.pack_start( _build_paragraph_text( _( "Welcome to %(name)s! We have a couple of questions " "to help you get started.", {'name': app.config.get(prefs.SHORT_APP_NAME)}))) vbox.pack_start( _build_title_question( _("What language would you like %(name)s to be in?", {'name': app.config.get(prefs.SHORT_APP_NAME)}))) lang_options = gtcache.get_languages() lang_options.insert(0, ("system", _("System default"))) def update_language(widget, index): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set(prefs.LANGUAGE, str(lang_options[index][0])) gtcache.init() # FIXME - this is totally awful and may break at some # point. what happens is that widgetconst translates at # import time, so if someone changes the language, then # the translations have already happened. we reload the # module to force them to happen again. bug 17515 if "miro.frontends.widgets.widgetconst" in sys.modules: reload(sys.modules["miro.frontends.widgets.widgetconst"]) self.this_page(rebuild=True) lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options]) lang = app.config.get(prefs.LANGUAGE) try: lang_option_menu.set_selected([op[0] for op in lang_options].index(lang)) except ValueError: lang_option_menu.set_selected(1) lang_option_menu.connect('changed', update_language) def next_clicked(widget): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set( prefs.LANGUAGE, str(lang_options[lang_option_menu.get_selected()][0])) gtcache.init() self.next_page(rebuild=True) hbox = widgetset.HBox() hbox.pack_start(widgetset.Label(_("Language:")), padding=0) hbox.pack_start(lang_option_menu, padding=5) vbox.pack_start(widgetutil.align_center(hbox)) vbox.pack_start(self._force_space_label()) next_button = widgetset.Button(_("Next >")) next_button.connect('clicked', next_clicked) vbox.pack_start(widgetutil.align_bottom( widgetutil.align_right(widgetutil.build_hbox((next_button, )))), expand=True) vbox = widgetutil.pad(vbox) return vbox
def build_language_page(self): vbox = widgetset.VBox(spacing=5) vbox.pack_start(_build_paragraph_text(_( "Welcome to %(name)s! We have a couple of questions " "to help you get started.", {'name': app.config.get(prefs.SHORT_APP_NAME)}))) vbox.pack_start(_build_title_question(_( "What language would you like %(name)s to be in?", {'name': app.config.get(prefs.SHORT_APP_NAME)}))) lang_options = gtcache.get_languages() lang_options.insert(0, ("system", _("System default"))) def update_language(widget, index): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set(prefs.LANGUAGE, str(lang_options[index][0])) gtcache.init() # FIXME - this is totally awful and may break at some # point. what happens is that widgetconst translates at # import time, so if someone changes the language, then # the translations have already happened. we reload the # module to force them to happen again. bug 17515 if "miro.frontends.widgets.widgetconst" in sys.modules: reload(sys.modules["miro.frontends.widgets.widgetconst"]) self.this_page(rebuild=True) lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options]) lang = app.config.get(prefs.LANGUAGE) try: lang_option_menu.set_selected([op[0] for op in lang_options].index(lang)) except ValueError: lang_option_menu.set_selected(1) lang_option_menu.connect('changed', update_language) def next_clicked(widget): os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE app.config.set(prefs.LANGUAGE, str(lang_options[lang_option_menu.get_selected()][0])) gtcache.init() self.next_page(rebuild=True) hbox = widgetset.HBox() hbox.pack_start(widgetset.Label(_("Language:")), padding=0) hbox.pack_start(lang_option_menu, padding=5) vbox.pack_start(widgetutil.align_center(hbox)) vbox.pack_start(self._force_space_label()) next_button = widgetset.Button(_("Next >")) next_button.connect('clicked', next_clicked) vbox.pack_start( widgetutil.align_bottom(widgetutil.align_right( widgetutil.build_hbox((next_button,)))), expand=True) vbox = widgetutil.pad(vbox) return vbox