Beispiel #1
0
 def __init__(self, map_screen):
     super(GameMenuDialog, self).__init__(parent=map_screen)
     self._map_screen = map_screen
     self.options_dialog = OptionsScreen(self)
     self.savename_dialog = dialog.TextEntryDialog(self)
     self.load_dialog = savegame.SavegameScreen(self,
                                                (.5, .5), (.90, .90),
                                                anchor=constants.MID_CENTER)
     self._buttons = [
         button.FunctionButton(None, None, None,
                               text=_("&SAVE GAME"), autotranslate=True,
                               function=self.save_game),
         button.FunctionButton(None, None, None,
                               text=_("&LOAD GAME"), autotranslate=True,
                               function=self.load_game),
         button.DialogButton(None, None, None,
                             text=_("&OPTIONS"), autotranslate=True,
                             dialog=self.options_dialog),
         button.ExitDialogButton(None, None, None,
                                 text=_("&QUIT"), autotranslate=True,
                                 exit_code=True, default=False),
         button.ExitDialogButton(None, None, None, text=_("&BACK"), autotranslate=True,
                                 exit_code=False),
     ]
     self.needs_rebuild = True
Beispiel #2
0
    def __init__(self, map_screen):
        super(GameMenuDialog, self).__init__(parent=map_screen)
        self._map_screen = map_screen
        self.options_dialog = OptionsScreen(self)
        self.savename_dialog = dialog.TextEntryDialog(self)
        self.load_dialog = savegame.SavegameScreen(self, (.5, .5), (.75, .75),
                                                   anchor=constants.MID_CENTER)

        self._rebuild_menu_buttons()
        self.needs_rebuild = True
Beispiel #3
0
    def __init__(self, map_screen):
        super(GameMenuDialog, self).__init__(parent=map_screen)
        self._map_screen = map_screen
        self.options_dialog = OptionsScreen(self)
        self.savename_dialog = dialog.TextEntryDialog(self)
        self.load_dialog = savegame.SavegameScreen(self, (.5, .5), (.90, .90),
                                                   anchor=constants.MID_CENTER)
        self._buttons = [
            button.FunctionButton(None,
                                  None,
                                  None,
                                  text=_("&SAVE GAME"),
                                  autotranslate=True,
                                  function=self.save_game),
            button.FunctionButton(None,
                                  None,
                                  None,
                                  text=_("&LOAD GAME"),
                                  autotranslate=True,
                                  function=self.load_game),
            button.DialogButton(None,
                                None,
                                None,
                                text=_("&OPTIONS"),
                                autotranslate=True,
                                dialog=self.options_dialog),
            button.ExitDialogButton(None,
                                    None,
                                    None,
                                    text=_("&QUIT"),
                                    autotranslate=True,
                                    exit_code=True,
                                    default=False),
            button.ExitDialogButton(None,
                                    None,
                                    None,
                                    text=_("&BACK"),
                                    autotranslate=True,
                                    exit_code=False),
        ]
        # Hide hotkeys (#289) to avoid confusion due to poor focus visibility
        self.savename_dialog.ok_button.force_underline = -1
        self.savename_dialog.cancel_button.force_underline = -1

        self.needs_rebuild = True
Beispiel #4
0
 def rebuild(self):
     self._rebuild_menu_buttons()
     self.steal_amount_dialog = dialog.TextEntryDialog(
         self, text=_("How much money?"))
     super(CheatMenuDialog, self).rebuild()
Beispiel #5
0
    def __init__(self, *args, **kwargs):
        super(LocationScreen, self).__init__(*args, **kwargs)
        self.pos = (-.5, -.5)
        self.anchor = constants.MID_CENTER
        self.size = (.75, .70)

        self.name_display = text.Text(self, (0,0), (-1, -.08),
                                      anchor=constants.TOP_LEFT,
                                      borders=constants.ALL,
                                      border_color="pane_background",
                                      background_color="pane_background_empty",
                                      shrink_factor=1, bold=True)
        self.modifier_display = text.Text(self, (-.75, -.01), (-.25, -.06),
                                          anchor=constants.TOP_LEFT,
                                          background_color="clear")

        self.open_button = \
            button.FunctionButton(self, (0, -.8), (-.3, -.09),
                                  autotranslate=True,
                                  text=N_("&OPEN BASE"),
                                  anchor=constants.TOP_LEFT,
                                  autohotkey=True,
                                  function=self.open_base)


        self.listbox = listbox.CustomListbox(self, (0,-.09), (-1, -.69),
                                             remake_func=self.make_item,
                                             rebuild_func=self.update_item,
                                             on_double_click_on_item=self.open_button.activated,
                                             )

        self.rename_button = \
            button.FunctionButton(self, (-.50, -.8), (-.3, -.09),
                                  autotranslate=True,
                                  text=N_("&RENAME BASE"),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.rename_base)

        self.power_button = \
            button.FunctionButton(self, (-1, -.8), (-.3, -.09),
                                  autotranslate=True,
                                  text=N_("&POWER STATE"),
                                  anchor=constants.TOP_RIGHT,
                                  autohotkey=True,
                                  function=self.power_state)

        self.new_button = \
            button.FunctionButton(self, (0, -.91), (-.3, -.09),
                                  autotranslate=True,
                                  text=N_("&NEW BASE"),
                                  autohotkey=True,
                                  function=self.new_base)
        self.destroy_button = \
            button.FunctionButton(self, (-.50, -.91), (-.3, -.09),
                                  autotranslate=True,
                                  text=N_("&DESTROY BASE"),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.destroy_base)
        self.back_button = button.ExitDialogButton(self, (-1, -.9), (-.3, -.09),
                                                   autotranslate=True,
                                                   text=N_("&BACK"),
                                                   anchor=constants.TOP_RIGHT,
                                                   autohotkey=True)

        self.confirm_destroy = \
            dialog.YesNoDialog(self, (-.5, 0), (-.35, -.7),
                               autotranslate=True,
                               text=N_("Are you sure you want to destroy this base?"),
                               shrink_factor=.5)

        self.cannot_destroy_last_base = \
            dialog.MessageDialog(self,
                                 autotranslate=True,
                                 text=N_("Destroying my last active base would be suicidal.  I cannot do that."),
                                 pos=(-.5, 0),
                                 size=(-.35, -.7),
                                 shrink_factor=.5)

        self.new_base_dialog = NewBaseDialog(self)
        self.location = None

        self.name_dialog = dialog.TextEntryDialog(self)

        self.base_dialog = basescreen.BaseScreen(self, (0,0),
                                                 anchor=constants.TOP_LEFT)