Ejemplo n.º 1
0
 def make_listbox(self):
     return listbox.CustomListbox(self, (0, 0), (-1, -.85),
                                  anchor=constants.TOP_LEFT,
                                  align=constants.LEFT,
                                  item_borders=False,
                                  item_selectable=False,
                                  remake_func=self.make_item,
                                  rebuild_func=self.update_item)
Ejemplo n.º 2
0
 def make_listbox(self):
     return listbox.CustomListbox(
         self, (0, -.10), (-1, -.77),
         list_item_height=0.06,
         anchor=constants.TOP_LEFT,
         remake_func=self.make_item,
         rebuild_func=self.update_item,
         on_double_click_on_item=self.yes_button.activated)
Ejemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        super(LocationScreen, self).__init__(*args, **kwargs)
        self.pos = (-.5, -.5)
        self.anchor = constants.MID_CENTER
        self.size = (-.75, -.5)
        self.name_display = text.Text(self, (0, 0), (-1, -.08),
                                      background_color="clear")
        self.listbox = listbox.CustomListbox(self, (0, -.08), (-1, -.70),
                                             remake_func=self.make_item,
                                             rebuild_func=self.update_item)

        self.open_button = \
            button.FunctionButton(self, (0, -.8), (-.3, -.09),
                                  anchor=constants.TOP_LEFT,
                                  autohotkey=True,
                                  function=self.open_base)

        self.rename_button = \
            button.FunctionButton(self, (-.50, -.8), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.rename_base)

        self.power_button = \
            button.FunctionButton(self, (-1, -.8), (-.3, -.09),
                                  anchor=constants.TOP_RIGHT,
                                  autohotkey=True,
                                  function=self.power_state)

        self.new_button = \
            button.FunctionButton(self, (0, -.91), (-.3, -.09),
                                  autohotkey=True,
                                  function=self.new_base)
        self.destroy_button = \
            button.FunctionButton(self, (-.50, -.91), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.destroy_base)
        self.back_button = button.ExitDialogButton(self, (-1, -.9),
                                                   (-.3, -.09),
                                                   anchor=constants.TOP_RIGHT,
                                                   autohotkey=True)

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

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

        self.name_dialog = \
            dialog.TextEntryDialog(self, text=g.strings["name_base_text"])

        self.base_dialog = basescreen.BaseScreen(self, (0, 0),
                                                 anchor=constants.TOP_LEFT)
Ejemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        super(LocationScreen, self).__init__(*args, **kwargs)
        self.pos = (-.5, -.5)
        self.anchor = constants.MID_CENTER
        self.size = (-.75, -.5)
        self.name_display = text.Text(self, (0,0), (-1, -.08),
                                      background_color=gg.colors["clear"])
        self.listbox = listbox.CustomListbox(self, (0,-.08), (-1, -.70),
                                             remake_func=self.make_item,
                                             rebuild_func=self.update_item)

        self.open_button = \
            button.FunctionButton(self, (-.33, -.8), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  text="OPEN BASE", hotkey="o",
                                  function=self.open_base)
        self.power_button = \
            button.FunctionButton(self, (-.67, -.8), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  text="POWER STATE", hotkey="p",
                                  function=self.power_state)

        self.new_button = \
            button.FunctionButton(self, (0, -.91), (-.3, -.09),
                                  text="NEW BASE", hotkey="n",
                                  function=self.new_base)
        self.destroy_button = \
            button.FunctionButton(self, (-.50, -.91), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  text="DESTROY BASE", hotkey="d",
                                  function=self.destroy_base)
        self.back_button = button.ExitDialogButton(self, (-1, -.9), (-.3, -.09),
                                                   anchor=constants.TOP_RIGHT,
                                                   text="BACK", hotkey="b")

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

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

        from code import screens
        self.base_dialog = screens.base.BaseScreen(self, (0,0),
                                                   anchor=constants.TOP_LEFT)
Ejemplo n.º 5
0
    def __init__(self, parent, pos=(.5, .1), size=(.93, .63), *args, **kwargs):
        self.dirty_count = True
        super(ResearchScreen, self).__init__(parent, pos, size, *args, **kwargs)
        self.listbox.remove_hooks()
        self.listbox = listbox.CustomListbox(self, (0,0), (.53, .55),
                                             list_size=-40,
                                             remake_func=self.make_item,
                                             rebuild_func=self.update_item,
                                             update_func=self.handle_update)
        self.description_pane.size = (.39, .55)

        self.desc_func = self.on_select

        self.add_key_handler(pygame.K_LEFT, self.adjust_slider)
        self.add_key_handler(pygame.K_RIGHT, self.adjust_slider)

        self.help_dialog = dialog.MessageDialog(self)

        self.yes_button.remove_hooks()
        self.no_button.pos = (-.5,-.99)
        self.no_button.anchor = constants.BOTTOM_CENTER
Ejemplo n.º 6
0
 def make_listbox(self):
     return listbox.CustomListbox(self, (0, 0), (-1, -.85),
                                  anchor=constants.TOP_LEFT,
                                  remake_func=self.make_item,
                                  rebuild_func=self.update_item)
Ejemplo n.º 7
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),
                                  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),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.rename_base)

        self.power_button = \
            button.FunctionButton(self, (-1, -.8), (-.3, -.09),
                                  anchor=constants.TOP_RIGHT,
                                  autohotkey=True,
                                  function=self.power_state)

        self.new_button = \
            button.FunctionButton(self, (0, -.91), (-.3, -.09),
                                  autohotkey=True,
                                  function=self.new_base)
        self.destroy_button = \
            button.FunctionButton(self, (-.50, -.91), (-.3, -.09),
                                  anchor=constants.TOP_CENTER,
                                  autohotkey=True,
                                  function=self.destroy_base)
        self.back_button = button.ExitDialogButton(self, (-1, -.9),
                                                   (-.3, -.09),
                                                   anchor=constants.TOP_RIGHT,
                                                   autohotkey=True)

        self.confirm_destroy = \
            dialog.YesNoDialog(self, (-.5,0), (-.35, -.7),
                            shrink_factor=.5)

        self.cannot_destroy_last_base = \
            dialog.MessageDialog(self,
                                 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)