def display_quit(self): self.remove_all() self.append( ui.Box(self, (10, 39), (80, 22), constants.button_box_color)) self.append( ui.Text(self, i18n.get_text(self.language, 1105), (10, 40), (80, 10), self.fonts, constants.text_color, 1)) self.quit_yes = ui.TextBox(self, i18n.get_text(self.language, 100), (10, 50), (40, 10), self.fonts, constants.text_color, 11, constants.stop_icon) self.quit_no = ui.TextBox(self, i18n.get_text(self.language, 101), (50, 50), (40, 10), self.fonts, constants.text_color, 11, constants.go_next_icon) self.append(self.quit_yes) self.append(self.quit_no) self.page_type = "DIALOG_BOX_QUIT" self.draw() return [self.screen.get_rect()]
def select_level(self, levels) : self.append(self.second_background_image) self.go_back_icon = ui.Image(self, constants.go_left_icon_pos, constants.go_left_icon_size, constants.go_left_icon) self.append(self.go_back_icon) self.append(ui.Rounded_Box(self, (10, 10), (80, 83), constants.button_box_color)) self.append(ui.Text(self, i18n.get_text(self.language, 1106), (10, 25), (80, 10), self.fonts, constants.text_color, 1)) step_x = 80.0 / len(levels) offset_x = 50.0 - (step_x * (len(levels) / 2.0)) index = 0 for level in levels : level_image = ui.Image(self, (offset_x, 51) , (step_x, 23), level.get_difficulty_level_image()) level_image.set_associated_object(level) offset_x = offset_x + step_x self.append(level_image) index = index + 1 self.page_type = "SELECT_LEVEL" self.draw() return [self.screen.get_rect()]
def __init__(self) : (self.language, foo) = common.get_user_lang() self.globalvars = common.GlobalVars() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title(i18n.get_text(self.language, 105)) self.window.set_border_width(10) self.window.connect("delete_event", self.delete_event) self.notebook = gtk.Notebook() self.notebook.set_tab_pos(gtk.POS_LEFT) general_panel = General_panel(self) language_panel = Language_panel(self) self.window.add(self.notebook) self.window.show_all()
def display_quit(self) : self.remove_all() self.append(ui.Box(self, (10, 39), (80,22), constants.button_box_color)) self.append(ui.Text(self, i18n.get_text(self.language, 1105), (10, 40), (80, 10), self.fonts, constants.text_color, 1)) self.quit_yes = ui.TextBox(self, i18n.get_text(self.language, 100), (10, 50), (40, 10), self.fonts, constants.text_color, 11, constants.stop_icon) self.quit_no = ui.TextBox(self, i18n.get_text(self.language, 101), (50, 50), (40, 10), self.fonts, constants.text_color, 11, constants.go_next_icon) self.append(self.quit_yes) self.append(self.quit_no) self.page_type = "DIALOG_BOX_QUIT" self.draw() return [self.screen.get_rect()]
def display_restart(self) : if (self.restart_text == None) : self.restart_text = ui.Text(self, i18n.get_text(self.language, 210), constant_restart_text_pos, constant_restart_text_size, self.fonts, constant_hud_color, 1) self.append(self.restart_text) return self.restart_text.draw() else : return []
def display_restart(self): if (self.restart_text == None): self.restart_text = ui.Text(self, i18n.get_text(self.language, 210), constant_restart_text_pos, constant_restart_text_size, self.fonts, constant_hud_color, 1) self.append(self.restart_text) return self.restart_text.draw() else: return []
def select_level(self, levels): self.append(self.second_background_image) self.go_back_icon = ui.Image(self, constants.go_left_icon_pos, constants.go_left_icon_size, constants.go_left_icon) self.append(self.go_back_icon) self.append( ui.Rounded_Box(self, (10, 10), (80, 83), constants.button_box_color)) self.append( ui.Text(self, i18n.get_text(self.language, 1106), (10, 25), (80, 10), self.fonts, constants.text_color, 1)) step_x = 80.0 / len(levels) offset_x = 50.0 - (step_x * (len(levels) / 2.0)) index = 0 for level in levels: level_image = ui.Image(self, (offset_x, 51), (step_x, 23), level.get_difficulty_level_image()) level_image.set_associated_object(level) offset_x = offset_x + step_x self.append(level_image) index = index + 1 self.page_type = "SELECT_LEVEL" self.draw() return [self.screen.get_rect()]
def __init__(self): (self.language, foo) = common.get_user_lang() self.globalvars = common.GlobalVars() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title(i18n.get_text(self.language, 105)) self.window.set_border_width(10) self.window.connect("delete_event", self.delete_event) self.notebook = gtk.Notebook() self.notebook.set_tab_pos(gtk.POS_LEFT) general_panel = General_panel(self) language_panel = Language_panel(self) self.window.add(self.notebook) self.window.show_all()
def display_main_menu(self): self.remove_all() self.quit_icon = ui.Image(self, constants.stop_icon_pos, constants.stop_icon_size, constants.stop_icon) self.append(self.quit_icon) self.options_icon = ui.Image(self, constants.options_icon_pos, constants.options_icon_size, constants.options_icon_file) self.options_icon.set_associated_text(i18n.get_text( self.language, 105)) self.append(self.options_icon) self.listen_to_mouse_over(self.options_icon) self.tag_icons = [] for tag_def in self.tag_defs: tag = tag_def.tag games_with_this_tag = self.games_list.get_games_by_tag_and_language( tag, self.language) if (len(games_with_this_tag) > 0): image_filename = tag_def.image_filename text = tag_def.get_text(self.language) tag_icon = ui.Image(self, (0, 0), (11, 11), image_filename) tag_icon.set_associated_text(text) self.append(tag_icon) self.listen_to_mouse_over(tag_icon) tag_icon.set_associated_object(tag_def) self.tag_icons.append(tag_icon) self.igloo_image = ui.Image_Absolute( self, self.igloo_page.surface_to_zoom_rect.topleft, self.igloo_page.surface_to_zoom_rect.size, self.igloo_page.igloo_reduced_surface) self.igloo_image.set_associated_text(i18n.get_text( self.language, 1020)) self.append(self.igloo_image) self.listen_to_mouse_over(self.igloo_image) self.init_country_flags() (igloo_width, igloo_height) = constants.igloo_size self.language_image = ui.Image( self, (((self.igloo_page.flag_mast_pos_x * igloo_width) / 100.0), constants.main_flag_pos_y + ((self.igloo_page.flag_mast_pos_y * igloo_height) / 100.0)), constants.main_flag_size, i18n.countries_prefix + self.countries[self.country_index] + i18n.countries_suffix, 255, 100, "BOTTOMLEFT") self.language_image.outline(constants.flag_outline_color, constants.flag_outline_width) self.language_image.set_associated_text( i18n.get_text(self.language, self.language)) self.append(self.language_image) self.listen_to_mouse_over(self.language_image) # will play the sound of the 'next' language when the user clicks the language textbox next_lang_index = constants.supported_languages.index( self.language) + 1 if (next_lang_index >= len(constants.supported_languages)): next_lang_index = 0 self.language_image.associated_sounds = i18n.language_sound[ constants.supported_languages[next_lang_index]] circle_icons = Circle_icons(self, self.omnitux_logo_image.rect.center, self.omnitux_logo_image.rect.size, 2.1, len(self.tag_icons)) for tag_icon in self.tag_icons: tag_icon.set_center_abs(circle_icons.get_center()) self.append( ui.Text(self, i18n.get_text(self.language, 1102), (0, 94), (100, 3), self.fonts, constants.text_color, 1)) self.append( ui.Text(self, i18n.get_text(self.language, 1103), (0, 97), (100, 3), self.fonts, constants.text_color, 1)) self.page_type = "MAIN" return [self.screen.get_rect()]
def update(self): ui.Page.update(self) # finish the background self.omnitux_logo_image = ui.Image(self, (35, 25), (30, 30), constants.omnitux_logo) self.append_back(self.omnitux_logo_image) self.append_back( ui.Image(self, constant_topimage_pos, constant_topimage_size, constant_topimage_file, 255, 100, "FILL")) self.append_back( ui.Image(self, constant_bottomimage_pos, constant_bottomimage_size, constant_bottomimage_file, 255, 100, "FILL")) self.draw_back() self.go_back_icon = ui.Image(self, constants.go_left_icon_pos, constants.go_left_icon_size, constants.go_left_icon) self.append(self.go_back_icon) # screen resolution self.append( ui.Text(self, i18n.get_text(self.language, 200), constant_resolution_text_pos, constant_resolution_text_size, self.fonts, constant_hud_color, 2)) self.resolution_minus = ui.TextBox(self, "-", constant_resolution_minus_pos, constant_resolution_minus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_minus) (self.globalvars.screen_width, self.globalvars.screen_height) = (self.screen.get_size()) self.resolution_value = ui.TextBox( self, str(self.globalvars.screen_width) + "x" + str(self.globalvars.screen_height), constant_resolution_value_pos, constant_resolution_value_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_value) self.resolution_plus = ui.TextBox(self, "+", constant_resolution_plus_pos, constant_resolution_plus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_plus) self.available_resolutions = pygame.display.list_modes() self.current_resolution_index = self.available_resolutions.index( (self.globalvars.screen_width, self.globalvars.screen_height)) # music volume self.append( ui.Text(self, i18n.get_text(self.language, 201), constant_music_text_pos, constant_music_text_size, self.fonts, constant_hud_color, 2)) self.music_minus = ui.TextBox(self, "-", constant_music_minus_pos, constant_music_minus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_minus) self.music_value = ui.TextBox( self, str(int(self.globalvars.music_volume * 100)) + "%", constant_music_value_pos, constant_music_value_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_value) self.music_plus = ui.TextBox(self, "+", constant_music_plus_pos, constant_music_plus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_plus) # igloo yes/no self.append( ui.Text(self, i18n.get_text(self.language, 1020), constant_igloo_text_pos, constant_igloo_text_size, self.fonts, constant_hud_color, 2)) self.display_igloo = ui.TextBox( self, i18n.bool_to_text(self.language, self.globalvars.display_igloo), constant_display_igloo_pos, constant_display_igloo_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.display_igloo) # "no stress" vs "arcade" => commented until the feature will be developped #### self.append(ui.Text(self, i18n.get_text(self.language, 220), constant_arcade_mode_text_pos, constant_arcade_mode_text_size, self.fonts, constant_hud_color, 2)) self.arcade_mode = ui.TextBox( self, i18n.bool_to_text(self.language, self.globalvars.arcade_mode), constant_arcade_mode_pos, constant_arcade_mode_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) #### self.append(self.arcade_mode) self.draw()
def __init__(self, options_screen): self.globalvars = options_screen.globalvars self.language = options_screen.language self.vbox = gtk.VBox(False, constants.vpad) default_language_frame = gtk.Frame(i18n.get_text( self.language, 250)) # language at startup vbox = gtk.VBox() self.default_language_system_button = gtk.RadioButton( None, i18n.get_text(self.language, 251)) # system value self.default_language_system_button.connect( "toggled", self.toggle_default_language_mode, "system") vbox.pack_start(self.default_language_system_button, False) hbox = gtk.HBox(False, constants.hpad) self.default_language_user_button = gtk.RadioButton( self.default_language_system_button, i18n.get_text(self.language, 252)) # user value : hbox.pack_start(self.default_language_user_button, False) self.default_language_user_button.connect( "toggled", self.toggle_default_language_mode, "user") self.language_combo = gtk.combo_box_new_text() self.language_combo.connect("changed", self.change_user_default_language) i = 0 for language in self.globalvars.active_languages: # TODO use editor language !! self.language_combo.append_text(i18n.get_text(language, language)) if (cmp(language, self.globalvars.main_language) == 0): self.language_combo.set_active(i) i = i + 1 hbox.pack_start(self.language_combo, False) vbox.pack_start(hbox, False) if (cmp(self.globalvars.main_language_mode, "user") == 0): self.default_language_user_button.set_active(True) else: self.language_combo.set_sensitive(False) default_language_frame.add(vbox) self.vbox.pack_start(default_language_frame) hbox = gtk.HBox(False, constants.hpad) UN_image = gtk.Image() UN_image.set_from_file( common.find_file(constants.UN_image_filename, self.globalvars)) hbox.pack_start(UN_image, True, True, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 253)) hbox.pack_start(label, True, True, constants.hpad) UN_image.show() label.show() hbox.show() options_screen.notebook.append_page(self.vbox, hbox)
def __init__(self, options_screen): # TODO : more on this self.language = options_screen.language self.globalvars = options_screen.globalvars self.vbox = gtk.VBox(False, constants.vpad) # Screen resolution selection ### display options ### display_frame = gtk.Frame(i18n.get_text(self.language, 202)) # Display hbox = gtk.HBox(False, 10) label = gtk.Label(i18n.get_text(self.language, 200)) # Screen resolution hbox.pack_start(label, False) self.resolution_combo = gtk.combo_box_new_text() self.resolution_combo.connect("changed", self.change_resolution) self.resolution_combo.set_wrap_width(4) self.available_resolutions = pygame.display.list_modes() i = 0 for resolution in self.available_resolutions: (width, height) = resolution self.resolution_combo.append_text(str(width) + "x" + str(height)) if ((self.globalvars.screen_width == width) and (self.globalvars.screen_height == height)): self.resolution_combo.set_active(i) i = i + 1 hbox.pack_start(self.resolution_combo, False) display_frame.add(hbox) self.vbox.pack_start(display_frame, False) ### sound options ### sound_frame = gtk.Frame(i18n.get_text(self.language, 203)) # Sound # Music volume vbox = gtk.VBox(False, constants.vpad) hbox = gtk.HBox(False, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 201)) hbox.pack_start(label, False, True, constants.hpad) self.volume_buttons = [] self.volume_buttons.append(gtk.RadioButton(None, "0")) self.volume_buttons[0].connect("toggled", self.toggle_music_volume, 0) hbox.pack_start(self.volume_buttons[0], False, True, constants.hpad) for volume in range(1, 5): self.volume_buttons.append( gtk.RadioButton(self.volume_buttons[0], str(volume * 25))) self.volume_buttons[volume].connect("toggled", self.toggle_music_volume, volume / 4.0) if (self.globalvars.music_volume == volume / 4.0): self.volume_buttons[volume].set_active(True) hbox.pack_start(self.volume_buttons[volume], False, True, constants.hpad) vbox.pack_start(hbox, False) congrats_frame = gtk.Frame(i18n.get_text(self.language, 208)) vbox2 = gtk.VBox(False, constants.vpad) self.congrats_sounds_checkbutton = gtk.CheckButton( i18n.get_text(self.language, 204)) # Congratulations sounds self.congrats_sounds_checkbutton.set_active( self.globalvars.congrats_sounds_active) self.congrats_sounds_checkbutton.connect("toggled", self.toggle) vbox2.pack_start(self.congrats_sounds_checkbutton, False) self.congrats_voices_checkbutton = gtk.CheckButton( i18n.get_text(self.language, 205)) # Congratulations voices self.congrats_voices_checkbutton.set_active( self.globalvars.congrats_voices_active) self.congrats_voices_checkbutton.connect("toggled", self.toggle) vbox2.pack_start(self.congrats_voices_checkbutton, False) congrats_frame.add(vbox2) vbox.pack_start(congrats_frame, False) sound_frame.add(vbox) self.vbox.pack_start(sound_frame, False) ### misc options ### misc_frame = gtk.Frame(i18n.get_text(self.language, 206)) # misc # igloo yes / no misc_vbox = gtk.VBox() self.igloo_checkbutton = gtk.CheckButton( i18n.get_text(self.language, 1020)) self.igloo_checkbutton.set_active(self.globalvars.display_igloo) self.igloo_checkbutton.connect("toggled", self.toggle) misc_vbox.pack_start(self.igloo_checkbutton, False) # arcade mode yes / no self.arcade_checkbutton = gtk.CheckButton( i18n.get_text(self.language, 220)) self.arcade_checkbutton.set_active(self.globalvars.arcade_mode) self.arcade_checkbutton.connect("toggled", self.toggle) misc_vbox.pack_start(self.arcade_checkbutton, False) misc_frame.add(misc_vbox) self.vbox.pack_start(misc_frame, False) hbox = gtk.HBox(False, constants.hpad) omnitux_logo_image = gtk.Image() omnitux_logo_image.set_from_file(constants.omnitux_logo_small) hbox.pack_start(omnitux_logo_image, True, True, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 207)) hbox.pack_start(label, False, True, constants.hpad) omnitux_logo_image.show() label.show() hbox.show() options_screen.notebook.append_page(self.vbox, hbox)
def display_main_menu(self) : self.remove_all() self.quit_icon = ui.Image(self, constants.stop_icon_pos, constants.stop_icon_size, constants.stop_icon) self.append(self.quit_icon) self.options_icon = ui.Image(self, constants.options_icon_pos, constants.options_icon_size, constants.options_icon_file) self.options_icon.set_associated_text(i18n.get_text(self.language, 105)) self.append(self.options_icon) self.listen_to_mouse_over(self.options_icon) self.tag_icons = [] for tag_def in self.tag_defs : tag = tag_def.tag games_with_this_tag = self.games_list.get_games_by_tag_and_language(tag, self.language) if (len(games_with_this_tag) > 0) : image_filename = tag_def.image_filename text = tag_def.get_text(self.language) tag_icon = ui.Image(self, (0,0), (11,11), image_filename) tag_icon.set_associated_text(text) self.append(tag_icon) self.listen_to_mouse_over(tag_icon) tag_icon.set_associated_object(tag_def) self.tag_icons.append(tag_icon) self.igloo_image = ui.Image_Absolute(self, self.igloo_page.surface_to_zoom_rect.topleft, self.igloo_page.surface_to_zoom_rect.size , self.igloo_page.igloo_reduced_surface) self.igloo_image.set_associated_text(i18n.get_text(self.language, 1020)) self.append(self.igloo_image) self.listen_to_mouse_over(self.igloo_image) self.init_country_flags() (igloo_width, igloo_height) = constants.igloo_size self.language_image = ui.Image(self, (((self.igloo_page.flag_mast_pos_x * igloo_width)/100.0), constants.main_flag_pos_y + ((self.igloo_page.flag_mast_pos_y * igloo_height)/100.0)), constants.main_flag_size, i18n.countries_prefix + self.countries[self.country_index] + i18n.countries_suffix, 255, 100, "BOTTOMLEFT") self.language_image.outline(constants.flag_outline_color, constants.flag_outline_width) self.language_image.set_associated_text(i18n.get_text(self.language, self.language)) self.append(self.language_image) self.listen_to_mouse_over(self.language_image) # will play the sound of the 'next' language when the user clicks the language textbox next_lang_index = constants.supported_languages.index(self.language) + 1 if (next_lang_index >= len(constants.supported_languages)) : next_lang_index = 0 self.language_image.associated_sounds = i18n.language_sound[constants.supported_languages[next_lang_index]] circle_icons = Circle_icons(self, self.omnitux_logo_image.rect.center, self.omnitux_logo_image.rect.size, 2.1, len(self.tag_icons)) for tag_icon in self.tag_icons : tag_icon.set_center_abs(circle_icons.get_center()) self.append(ui.Text(self, i18n.get_text(self.language, 1102), (0,94), (100, 3), self.fonts, constants.text_color, 1)) self.append(ui.Text(self, i18n.get_text(self.language, 1103), (0,97), (100, 3), self.fonts, constants.text_color, 1)) self.page_type = "MAIN" return [self.screen.get_rect()]
def update(self) : ui.Page.update(self) # finish the background self.omnitux_logo_image = ui.Image(self, (35,25), (30, 30), constants.omnitux_logo) self.append_back(self.omnitux_logo_image) self.append_back(ui.Image(self, constant_topimage_pos, constant_topimage_size, constant_topimage_file, 255, 100, "FILL")) self.append_back(ui.Image(self, constant_bottomimage_pos, constant_bottomimage_size, constant_bottomimage_file, 255, 100, "FILL")) self.draw_back() self.go_back_icon = ui.Image(self, constants.go_left_icon_pos, constants.go_left_icon_size, constants.go_left_icon) self.append(self.go_back_icon) # screen resolution self.append(ui.Text(self, i18n.get_text(self.language, 200), constant_resolution_text_pos, constant_resolution_text_size, self.fonts, constant_hud_color, 2)) self.resolution_minus = ui.TextBox(self, "-", constant_resolution_minus_pos, constant_resolution_minus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_minus) (self.globalvars.screen_width, self.globalvars.screen_height) = (self.screen.get_size()) self.resolution_value = ui.TextBox(self, str(self.globalvars.screen_width)+"x"+str(self.globalvars.screen_height), constant_resolution_value_pos, constant_resolution_value_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_value) self.resolution_plus = ui.TextBox(self, "+", constant_resolution_plus_pos, constant_resolution_plus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.resolution_plus) self.available_resolutions = pygame.display.list_modes() self.current_resolution_index = self.available_resolutions.index((self.globalvars.screen_width, self.globalvars.screen_height)) # music volume self.append(ui.Text(self, i18n.get_text(self.language, 201), constant_music_text_pos, constant_music_text_size, self.fonts, constant_hud_color, 2)) self.music_minus = ui.TextBox(self, "-", constant_music_minus_pos, constant_music_minus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_minus) self.music_value = ui.TextBox(self, str(int(self.globalvars.music_volume * 100))+"%", constant_music_value_pos, constant_music_value_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_value) self.music_plus = ui.TextBox(self, "+", constant_music_plus_pos, constant_music_plus_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.music_plus) # igloo yes/no self.append(ui.Text(self, i18n.get_text(self.language, 1020), constant_igloo_text_pos, constant_igloo_text_size, self.fonts, constant_hud_color, 2)) self.display_igloo = ui.TextBox(self, i18n.bool_to_text(self.language, self.globalvars.display_igloo), constant_display_igloo_pos, constant_display_igloo_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) self.append(self.display_igloo) # "no stress" vs "arcade" => commented until the feature will be developped #### self.append(ui.Text(self, i18n.get_text(self.language, 220), constant_arcade_mode_text_pos, constant_arcade_mode_text_size, self.fonts, constant_hud_color, 2)) self.arcade_mode = ui.TextBox(self, i18n.bool_to_text(self.language, self.globalvars.arcade_mode), constant_arcade_mode_pos, constant_arcade_mode_size, self.fonts, constant_negative_hud_color, 1, None, 255, constant_hud_color) #### self.append(self.arcade_mode) self.draw()
def __init__(self, options_screen) : self.globalvars = options_screen.globalvars self.language = options_screen.language self.vbox = gtk.VBox(False, constants.vpad) default_language_frame = gtk.Frame(i18n.get_text(self.language, 250)) # language at startup vbox = gtk.VBox() self.default_language_system_button = gtk.RadioButton(None, i18n.get_text(self.language, 251)) # system value self.default_language_system_button.connect("toggled", self.toggle_default_language_mode, "system") vbox.pack_start(self.default_language_system_button, False) hbox = gtk.HBox(False, constants.hpad) self.default_language_user_button = gtk.RadioButton(self.default_language_system_button, i18n.get_text(self.language, 252)) # user value : hbox.pack_start(self.default_language_user_button, False) self.default_language_user_button.connect("toggled", self.toggle_default_language_mode, "user") self.language_combo = gtk.combo_box_new_text() self.language_combo.connect("changed", self.change_user_default_language) i = 0 for language in self.globalvars.active_languages : # TODO use editor language !! self.language_combo.append_text(i18n.get_text(language, language)) if (cmp(language, self.globalvars.main_language) == 0) : self.language_combo.set_active(i) i = i + 1 hbox.pack_start(self.language_combo, False) vbox.pack_start(hbox, False) if (cmp(self.globalvars.main_language_mode, "user") == 0) : self.default_language_user_button.set_active(True) else : self.language_combo.set_sensitive(False) default_language_frame.add(vbox) self.vbox.pack_start(default_language_frame) hbox = gtk.HBox(False, constants.hpad) UN_image = gtk.Image() UN_image.set_from_file(common.find_file(constants.UN_image_filename, self.globalvars)) hbox.pack_start(UN_image, True, True, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 253)) hbox.pack_start(label, True, True, constants.hpad) UN_image.show() label.show() hbox.show() options_screen.notebook.append_page(self.vbox, hbox)
def __init__(self, options_screen) : # TODO : more on this self.language = options_screen.language self.globalvars = options_screen.globalvars self.vbox = gtk.VBox(False, constants.vpad) # Screen resolution selection ### display options ### display_frame = gtk.Frame(i18n.get_text(self.language, 202)) # Display hbox = gtk.HBox(False, 10) label = gtk.Label(i18n.get_text(self.language, 200)) # Screen resolution hbox.pack_start(label, False) self.resolution_combo = gtk.combo_box_new_text() self.resolution_combo.connect("changed", self.change_resolution) self.resolution_combo.set_wrap_width(4) self.available_resolutions = pygame.display.list_modes() i = 0 for resolution in self.available_resolutions : (width, height) = resolution self.resolution_combo.append_text(str(width)+"x"+str(height)) if ((self.globalvars.screen_width == width) and (self.globalvars.screen_height == height)) : self.resolution_combo.set_active(i) i = i + 1 hbox.pack_start(self.resolution_combo, False) display_frame.add(hbox) self.vbox.pack_start(display_frame, False) ### sound options ### sound_frame = gtk.Frame(i18n.get_text(self.language, 203)) # Sound # Music volume vbox = gtk.VBox(False, constants.vpad) hbox = gtk.HBox(False, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 201)) hbox.pack_start(label, False, True, constants.hpad) self.volume_buttons = [] self.volume_buttons.append(gtk.RadioButton(None, "0")) self.volume_buttons[0].connect("toggled", self.toggle_music_volume, 0) hbox.pack_start(self.volume_buttons[0], False, True, constants.hpad) for volume in range(1, 5) : self.volume_buttons.append(gtk.RadioButton(self.volume_buttons[0], str(volume * 25))) self.volume_buttons[volume].connect("toggled", self.toggle_music_volume, volume/4.0) if (self.globalvars.music_volume == volume / 4.0) : self.volume_buttons[volume].set_active(True) hbox.pack_start(self.volume_buttons[volume], False, True, constants.hpad) vbox.pack_start(hbox, False) congrats_frame = gtk.Frame(i18n.get_text(self.language, 208)) vbox2 = gtk.VBox(False, constants.vpad) self.congrats_sounds_checkbutton = gtk.CheckButton(i18n.get_text(self.language, 204)) # Congratulations sounds self.congrats_sounds_checkbutton.set_active(self.globalvars.congrats_sounds_active) self.congrats_sounds_checkbutton.connect("toggled", self.toggle) vbox2.pack_start(self.congrats_sounds_checkbutton, False) self.congrats_voices_checkbutton = gtk.CheckButton(i18n.get_text(self.language, 205)) # Congratulations voices self.congrats_voices_checkbutton.set_active(self.globalvars.congrats_voices_active) self.congrats_voices_checkbutton.connect("toggled", self.toggle) vbox2.pack_start(self.congrats_voices_checkbutton, False) congrats_frame.add(vbox2) vbox.pack_start(congrats_frame, False) sound_frame.add(vbox) self.vbox.pack_start(sound_frame, False) ### misc options ### misc_frame = gtk.Frame(i18n.get_text(self.language, 206)) # misc # igloo yes / no misc_vbox = gtk.VBox() self.igloo_checkbutton = gtk.CheckButton(i18n.get_text(self.language, 1020)) self.igloo_checkbutton.set_active(self.globalvars.display_igloo) self.igloo_checkbutton.connect("toggled", self.toggle) misc_vbox.pack_start(self.igloo_checkbutton, False) # arcade mode yes / no self.arcade_checkbutton = gtk.CheckButton(i18n.get_text(self.language, 220)) self.arcade_checkbutton.set_active(self.globalvars.arcade_mode) self.arcade_checkbutton.connect("toggled", self.toggle) misc_vbox.pack_start(self.arcade_checkbutton, False) misc_frame.add(misc_vbox) self.vbox.pack_start(misc_frame, False) hbox = gtk.HBox(False, constants.hpad) omnitux_logo_image = gtk.Image() omnitux_logo_image.set_from_file(constants.omnitux_logo_small) hbox.pack_start(omnitux_logo_image, True, True, constants.hpad) label = gtk.Label(i18n.get_text(self.language, 207)) hbox.pack_start(label, False, True, constants.hpad) omnitux_logo_image.show() label.show() hbox.show() options_screen.notebook.append_page(self.vbox, hbox)