Exemplo n.º 1
0
    def __init__(self, parent, pos = (-1,0), size = (.025, -1),
                 anchor = constants.TOP_RIGHT, scroll_pos = 0,
                 elements = 15, window = 5, horizontal = False):
        super(Scrollbar, self).__init__(parent, pos, size, anchor)

        self.scroll_pos = scroll_pos
        self.elements = elements
        self.window = window
        self.horizontal = horizontal

        self.slider = slider.UpdateSlider(self, (-.5,-.5), None,
                                          border_color = "scrollbar_border",
                                          background_color = "scrollbar_background",
                                          slider_color = "scrollbar_background_slider",
                                          anchor = constants.MID_CENTER,
                                          horizontal = horizontal,
                                          update_func = self.on_change)

        self.button1 = _ArrowButton(self, (0,0), None,
                                    anchor = constants.TOP_LEFT,
                                    first = True, horizontal = horizontal,
                                    priority = 90)

        self.button2 = _ArrowButton(self, (-1,-1), None,
                                    anchor = constants.BOTTOM_RIGHT,
                                    first = False, horizontal = horizontal,
                                    priority = 90)
Exemplo n.º 2
0
    def make_item(self, canvas):
        # Dirty, underhanded trick to make the canvas into a progress bar.
        canvas.__class__ = text.ProgressText
        canvas.progress = 0
        canvas.progress_color = "progress_background_progress"

        canvas.research_name = text.Text(canvas, (-.01, -.01), (-.70, -.5),
                                         align=constants.LEFT,
                                         background_color="clear")
        canvas.research_name.visible = False
        canvas.alloc_cpus = text.Text(canvas, (-.99, -.01), (-.21, -.5),
                                      anchor=constants.TOP_RIGHT,
                                      text="1,000,000,000",
                                      align=constants.RIGHT,
                                      background_color="clear")
        canvas.alloc_cpus.visible = False
        canvas.slider = slider.UpdateSlider(canvas, (-.01, -.55), (-.98, -.40),
                                            anchor=constants.TOP_LEFT,
                                            horizontal=True,
                                            priority=150)
        canvas.slider.visible = False

        canvas.help_button = button.FunctionButton(canvas, (-.11, -.55),
                                                   (0, -.40),
                                                   text=" ??? ",
                                                   text_shrink_factor=1,
                                                   base_font="normal",
                                                   function=self.show_help)
Exemplo n.º 3
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)
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        super(AudioPane, self).__init__(*args, **kwargs)

        self.sound_label = button.HotkeyText(self, (-.49, .01), (.10, .05),
                                             anchor=constants.TOP_RIGHT,
                                             align=constants.LEFT,
                                             autohotkey=True,
                                             background_color="clear")
        self.sound_toggle = OptionButton(self, (-.51, .01), (.07, .05),
                                         anchor=constants.TOP_LEFT,
                                         text_shrink_factor=.75,
                                         force_underline=-1,
                                         function=self.set_sound,
                                         args=(button.TOGGLE_VALUE, ))
        self.sound_label.hotkey_target = self.sound_toggle

        self.gui_label = text.Text(self, (.01, .08), (.22, .05),
                                   anchor=constants.TOP_LEFT,
                                   align=constants.LEFT,
                                   background_color="clear")
        self.gui_slider = slider.UpdateSlider(self, (.24, .08), (.53, .05),
                                              anchor=constants.TOP_LEFT,
                                              horizontal=True,
                                              priority=150,
                                              slider_max=100,
                                              slider_size=5)
        self.gui_slider.update_func = self.on_gui_volume_change

        self.music_label = text.Text(self, (.01, .15), (.22, .05),
                                     anchor=constants.TOP_LEFT,
                                     align=constants.LEFT,
                                     background_color="clear")
        self.music_slider = slider.UpdateSlider(self, (.24, .15), (.53, .05),
                                                anchor=constants.TOP_LEFT,
                                                horizontal=True,
                                                priority=150,
                                                slider_max=100,
                                                slider_size=5)
        self.music_slider.update_func = self.on_music_volume_change

        self.soundbuf_label = text.Text(self, (.01, .22), (.25, .05),
                                        text=_("Sound buffering:"),
                                        align=constants.LEFT,
                                        background_color="clear")
        self.soundbuf_group = button.ButtonGroup()

        self.soundbuf_low = OptionButton(self, (.24, .22), (.14, .05),
                                         text=_("&LOW"),
                                         autohotkey=True,
                                         function=self.set_soundbuf,
                                         args=(1024, ))
        self.soundbuf_group.add(self.soundbuf_low)

        self.soundbuf_normal = OptionButton(self, (.42, .22), (.17, .05),
                                            text=_("&NORMAL"),
                                            autohotkey=True,
                                            function=self.set_soundbuf,
                                            args=(1024 * 2, ))
        self.soundbuf_group.add(self.soundbuf_normal)

        self.soundbuf_high = OptionButton(self, (.63, .22), (.14, .05),
                                          text=_("&HIGH"),
                                          autohotkey=True,
                                          function=self.set_soundbuf,
                                          args=(1024 * 4, ))
        self.soundbuf_group.add(self.soundbuf_high)