예제 #1
0
파일: main.py 프로젝트: millejoh/Islands
    def __init__(self, *args, **kwargs):
        view = WindowView(
            'Character',
            layout_options=LayoutOptions(top=7, right=10, bottom=7, left=10),
            subviews=[
                LabelView('Name:',
                          layout_options=LayoutOptions(height=1,
                                                       top=1,
                                                       bottom=None)),
                SingleLineTextInputView(
                    callback=self.print_name,
                    layout_options=LayoutOptions.centered(
                        'intrinsic', 'intrinsic').with_updates(top=2,
                                                               bottom=None)),
                LabelView('Strength:',
                          layout_options=LayoutOptions(height=1,
                                                       top=4,
                                                       bottom=None)),
                IntStepperView(value=10,
                               min_value=1,
                               max_value=20,
                               callback=lambda x: print(x),
                               layout_options=LayoutOptions.centered(
                                   'intrinsic',
                                   'intrinsic').with_updates(top=5)),
                ButtonView(text='Cancel',
                           callback=lambda: self.director.pop_scene(),
                           layout_options=LayoutOptions.row_bottom(3)),
            ])
        super().__init__(view, *args, **kwargs)

        self.covers_screen = True
예제 #2
0
파일: run.py 프로젝트: irskep/beepboop
    def __init__(self, *args, **kwargs):
        self.tile_size = get_game_config()['cellsize']
        self.font_size = get_game_config()['fontsize']

        self.button_tile_size = ButtonView(
            text=self.tile_size,
            callback=self.rotate_tile_size)

        view = WindowView(
            'Settings',
            layout_options=LayoutOptions.centered(50, 20),
            subviews=[
            ListView(
                [
                    ('Tile size', self.button_tile_size),
                ] + [
                    ('Filler ' + str(i), ButtonView(text='Hi', callback=lambda: None))
                    for i in range(50)
                ],
                layout_options=LayoutOptions(bottom=3)),
            ButtonView(
                text='Apply', callback=self.apply,
                layout_options=LayoutOptions.row_bottom(3).with_updates(right=0.5)),
            ButtonView(
                text='Cancel', callback=lambda: self.director().pop_scene(),
                layout_options=LayoutOptions.row_bottom(3).with_updates(left=0.5)),
        ])
        super().__init__(view, *args, **kwargs)

        self.covers_screen = False
예제 #3
0
 def __init__(self, *args, **kwargs):
     views = [
         LabelView(
             LOGO[1:].rstrip(),
             layout_options=LayoutOptions.row_top(0.5)),
         LabelView(
             "Try resizing the window!",
             layout_options=LayoutOptions.centered('intrinsic', 'intrinsic')),
         ButtonView(
             text="Play", callback=self.play,
             color_bg='#000000', color_fg='#00ff00',
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.2, width=0.2, right=None)),
         ButtonView(
             text="Settings", callback=self.show_settings,
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.4, width=0.2, right=None)),
         ButtonView(
             text="[color=red]Quit",
             callback=lambda: self.director.pop_scene(),
             # [color=red] messes up auto size calculations
             size=Size(4, 1),
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.6, width=0.2, right=None)),
     ]
     super().__init__(views, *args, **kwargs)
예제 #4
0
파일: main.py 프로젝트: millejoh/Islands
    def __init__(self, *args, **kwargs):
        view = WindowView(
            'Settings',
            layout_options=LayoutOptions.centered(60, 20),
            subviews=[
                SettingsListView(
                    [(k,
                      CyclingButtonView(
                          v, v[0], callback=lambda _: None, align_horz='left'))
                     for k, v in sorted(SettingsScene.OPTIONS.items())],
                    value_column_width=20,
                    layout_options=LayoutOptions(bottom=5)),
                ButtonView(
                    text='Apply',
                    callback=self.apply,
                    layout_options=LayoutOptions.row_bottom(5).with_updates(
                        right=0.5)),
                ButtonView(
                    text='Cancel',
                    callback=lambda: self.director.pop_scene(),
                    layout_options=LayoutOptions.row_bottom(5).with_updates(
                        left=0.5)),
            ])
        super().__init__(view, *args, **kwargs)

        # this lets the main screen show underneath
        self.covers_screen = False
예제 #5
0
 def __init__(self, score, *args, **kwargs):
     view = WindowView(
         'Game Over',
         layout_options=LayoutOptions.centered(80, 30),
         subviews=[
             LabelView(TEXT_GAME_OVER,
                       layout_options=LayoutOptions.centered(
                           'intrinsic', 'intrinsic')),
             LabelView(
                 "Your score: {}".format(score),
                 layout_options=LayoutOptions.row_bottom(1).with_updates(
                     bottom=6)),
             ButtonView(text='Aaauuuuggghhhhhh...',
                        callback=self.done,
                        layout_options=LayoutOptions.row_bottom(3)),
         ])
     super().__init__(view, *args, **kwargs)
     self.covers_screen = False
예제 #6
0
 def __init__(self, *args, **kwargs):
     view = WindowView(
         'Pause',
         layout_options=LayoutOptions.centered(40, 10),
         subviews=[
             ButtonView(text='Resume',
                        callback=self.resume,
                        layout_options=LayoutOptions.row_top(5)),
             ButtonView(text='Quit',
                        callback=self.quit,
                        layout_options=LayoutOptions.row_bottom(5)),
         ])
     super().__init__(view, *args, **kwargs)
     self.covers_screen = False
예제 #7
0
 def __init__(self, *args, **kwargs):
     views = [
         LabelView(TITLE[1:].rstrip(),
                   layout_options=LayoutOptions.row_top(0.5)),
         LabelView(ABOUT,
                   color_fg='#ffcb00',
                   layout_options=LayoutOptions.centered(
                       'intrinsic', 'intrinsic').with_updates(top=28)),
         ButtonView(
             text="Descend the stairs",
             callback=self.play,
             layout_options=LayoutOptions.row_bottom(10).with_updates(
                 left=0.2, width=0.2, right=None)),
         ButtonView(
             text="Quit",
             callback=lambda: self.director.pop_scene(),
             layout_options=LayoutOptions.row_bottom(10).with_updates(
                 left=0.6, width=0.2, right=None)),
     ]
     super().__init__(views, *args, **kwargs)