Exemple #1
0
    def __init__(self, parent, *args, **kwargs):
        super(SavegameScreen, self).__init__(parent, *args, yes_type="load", **kwargs)

        self.yes_button.pos = (-.03,-.99)
        self.yes_button.exit_code_func = self.return_savegame

        self.no_button.pos = (-.97,-.99)
        self.no_button.exit_code = None

        self._all_savegames_sorted = []

        self.label = text.Text(self, (-.01, -.01), (-.20, -.08),
                               borders=constants.ALL,
                               anchor=constants.TOP_LEFT,
                               base_font="normal")
        self.text_field = text.UpdateEditableText(self, (-.21, -.01), (-.78, -.08),
                                                  borders=constants.ALL,
                                                  anchor=constants.TOP_LEFT,
                                                  update_func=self._search_for_savegame,
                                                  base_font="normal")

        self.delete_button = button.FunctionButton(self, (-.50,-.99), (-.3,-.1),
                                                   anchor=constants.BOTTOM_CENTER,
                                                   autohotkey=True,
                                                   function=self.delete_savegame)

        self.add_handler(constants.KEY, self._got_key, priority=5)
Exemple #2
0
    def __init__(self, parent, *args, **kwargs):
        super(MultipleBuildDialog, self).__init__(parent, *args, **kwargs)

        self.listbox.size = (-.53, -.75)
        self.description_pane.size = (-.45, -.75)

        self.count_label = text.Text(self, (.01, -.87), (-.25, -.1),
                                     autotranslate=True,
                                     text=N_("Number of items"),
                                     anchor=constants.BOTTOM_LEFT,
                                     valign=constants.MID,
                                     borders=(constants.TOP, constants.BOTTOM,
                                              constants.LEFT),
                                     shrink_factor=.88,
                                     background_color="pane_background")

        self.count_field = text.UpdateEditableText(
            self, (-.26, -.87), (-.10, -.1),
            anchor=constants.BOTTOM_LEFT,
            borders=constants.ALL,
            update_func=self.on_field_change,
            allowed_characters=constants.DIGIT_CHARS,
            base_font="normal")

        self.count_slider = slider.UpdateSlider(
            self, (-.37, -.87), (-.62, -.1),
            anchor=constants.BOTTOM_LEFT,
            horizontal=True,
            priority=150,
            update_func=self.on_slider_change,
            slider_size=2)
    def __init__(self, parent, *args, **kwargs):
        super(SavegameScreen, self).__init__(parent,
                                             *args,
                                             yes_type=N_("&LOAD"),
                                             **kwargs)

        self.yes_button.pos = (-.03, -.99)
        self.yes_button.size = (-.22, -.1)
        self.yes_button.function = self.exit_savegame
        self.yes_button.force_underline = -1  # Work around #224

        self.no_button.pos = (-.97, -.99)
        self.no_button.size = (-.22, -.1)
        self.no_button.exit_code = None
        self.no_button.force_underline = -1  # Work around #224

        self._all_savegames_sorted = []

        self.label = text.Text(self, (-.01, -.01), (-.20, -.08),
                               autotranslate=True,
                               text=N_("Filter: "),
                               borders=constants.ALL,
                               anchor=constants.TOP_LEFT,
                               base_font="normal")
        self.text_field = text.UpdateEditableText(
            self, (-.21, -.01), (-.78, -.08),
            borders=constants.ALL,
            anchor=constants.TOP_LEFT,
            update_func=self._search_for_savegame,
            background_color="text_entry_background",
            base_font="normal")

        self.convert_button = button.FunctionButton(
            self, (-.27, -.99), (-.22, -.1),
            autotranslate=True,
            text=N_("Upgrade"),
            anchor=constants.BOTTOM_LEFT,
            function=self.convert_save)

        self.delete_button = button.FunctionButton(
            self, (-.51, -.99), (-.22, -.1),
            autotranslate=True,
            text=N_("Delete"),
            anchor=constants.BOTTOM_LEFT,
            function=self.delete_savegame)

        self.add_handler(constants.KEY, self._got_key, priority=5)