Exemplo n.º 1
0
    def create_dropdown(self):
        """
        Create a dropdown box.
        """
        self.dropdown = DropDown()
        roles = ["Top", "Jungle", "Middle", "ADC", "Support"]

        for role in roles:
            # When adding widgets, we need to specify the height manually
            # (disabling the size_hint_y) so the dropdown can calculate
            # the area it needs.
            btn = Button(text=role, size_hint_y=None, height=44)

            # for each button, attach a callback that will call the select() method
            # on the dropdown. We'll pass the text of the button as the data of the
            # selection.
            btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))

            self.dropdown.add_widget(btn)

        # Display the button's text as the selected text
        self.dropdown.bind(on_select=lambda instance, x:
                           setattr(self.dropdown_button, 'text', x))
        # Enable the go button
        self.dropdown.bind(on_select=self.enable_go_button)
Exemplo n.º 2
0
class DropBut(Button):
    def __init__(self, **kwargs):
        super(DropBut, self).__init__(**kwargs)
        self.drop_list = None
        self.drop_list = DropDown()
        self.picked = False
        self.id = self.get_id()

        for ing in supported_ings:
            btn = Button(text=ing, size_hint_y=None, height=25)
            btn.bind(on_release=lambda btn: self.drop_list.select(btn.text))
            self.drop_list.add_widget(btn)

        self.bind(on_release=self.drop_list.open)
        self.drop_list.bind(on_select=self.pick_ing)

    def get_id(self):
        dp_btns.append(True)
        return str(len(dp_btns) - 1)

    def pick_ing(self, instance, x):
        setattr(self, 'text', x)
        if not self.picked:
            inputs.append(x)
            self.picked = True
        else:
            inputs[int(self.id)] = x
        print(inputs)
Exemplo n.º 3
0
class acilirKutu(App):

    def secim(self, nesne):
        # Önceden seçilmiş bir düğme var ise, arka plan rengini
        # ön tanımlı renge dönüştürelim
        if self.acilirkutu.secim:
            self.acilirkutu.secim.background_color= [1, 1, 1, 1]
            
        self.acilirkutu.select(nesne.text)
        self.anadugme.text=nesne.text
        
        # secim özelliğine yeni nesneyi ekleyelim ve
        # arka plan rengini kırmızı yapalım
        self.acilirkutu.secim=nesne
        nesne.background_color= 1, 0, 0, 1

    def build(self):
        duzen = BoxLayout()
        self.anadugme = Button(text='Başlat', size_hint=(None, None))

        self.acilirkutu = DropDown()
        self.acilirkutu.secim=None
        
        for x in ( "Mustafa", "Dilek", "Fatih", "Melike"):
            dugme=Button(text=x, size_hint_y=None, height=25)
            dugme.bind(on_release=self.secim)
            self.acilirkutu.add_widget(dugme)

        self.anadugme.bind(on_release=self.acilirkutu.open)
        duzen.add_widget(self.anadugme)
 
        return duzen
    def __init__(self, entries=[], **kwargs):
        super(DropdownBox, self).__init__(orientation='horizontal',
                                          spacing=0,
                                          **kwargs)

        self.dropdown = DropDown()
        self.selected_text = LabelB(bcolor=(0, 0, 0, 0.3))

        self.dropdown.bind(on_select=lambda instance, x: setattr(
            self.selected_text, 'text', x))

        v_button = LabelB(text='V',
                          bcolor=(0, 0, 0, 0.8),
                          size_hint=(None, None))

        # Set the V button to a square size equal to the size of the Dropdown Box
        self.bind(size=lambda obj, size: v_button.setter('size')
                  (v_button, (size[1], size[1])))
        self.bind(on_release=lambda x: self.dropdown.open(self))
        self.bind(mouse_hover=lambda instance, hover: partial(
            DropdownBox.highlight_selection, self.selection_color, v_button,
            hover)())
        self.bind(values=self.updated_values)
        self.bind(default=self.updated_default)

        self.add_widget(self.selected_text)
        self.add_widget(v_button)

        self.selected_text.bind(text=self.setter('text'))
        self.values = entries
Exemplo n.º 5
0
    def create_dropdown(self, *args):

        self.dropdown_list = DropDown()

        for player in self.root.players:
            player_name = player.name.upper()
            # button for dropdown list 1
            btn = Button(
                text=f'[b][color=#ffffff]{player_name}[/b][/color]', size_hint_y=None,
                height=self.width // 25,
                markup=True
            )

            # Storing the btn references into a list
            self.btns[player_name] = btn

            # Create the binding function
            btn.bind(on_release=lambda btn: self.dropdown_list.select(btn.text))

            # Add the widget to the dropdown window
            self.dropdown_list.add_widget(btn)

        # Bind the select name btns to opening the dropdown window
        self.ids.select_name_btn.bind(on_release=self.dropdown_list.open)

        # Binding the select name btns to also update their text values
        self.dropdown_list.bind(
            on_select=functools.partial(self.select_player, self.ids.select_name_btn)
        )
Exemplo n.º 6
0
class SettingsScreen(ActionBarScreen):
    STR_SETTINGS = StringProperty()
    STR_RESET_DEFAULTS = StringProperty()
    STR_RESET_DEFAULTS_HELP = StringProperty()
    STR_RESET = StringProperty()
    STR_LANGUAGE_CHANGE = StringProperty()
    def __init__(self, **kwargs):   # inicializace
        self.root = kwargs['root']
        self.root.insertStrings.append((self, ))
        super(SettingsScreen, self).__init__(**kwargs)
        self.dropdown = DropDown()
        for index in LANGUAGES.itervalues():
            btn = Button(text=index, size_hint_y=None, height=44, font_size='24dp', font_name="font/Roboto-Regular.ttf")
            btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
            self.dropdown.add_widget(btn)
        self.language.bind(on_release=self.dropdown.open)
        self.dropdown.bind(on_select=lambda instance, x: setattr(self.language, 'text', x))
        self.language.bind(text=self.change)
    
    def reset_defaults(self, *args):
        # Výmaz konfiguračního souboru po stisku tlačítka reset
        self.root.Cfg = ['' for y in range(4)]
        self.root.refreshCfg()
    
    def on_pre_enter(self, *args):
        # Před vstupem na obrazovku načte jazyky
        self.language.text = LANGUAGES.get(self.root.Cfg[0])
    
    def change(self, *args):
        # Změní jazyk, znovu načte řetězce
        self.root.Cfg[0] = [y[0] for y in LANGUAGES.items() if y[1] == self.language.text][0]
        self.root.refreshCfg()
        self.root.doStrInsert()
Exemplo n.º 7
0
    def __init__(self, **kwargs):
        super(FileMenu, self).__init__(**kwargs)

        self.dropdown = DropDown()
        self.dropdown.add_widget(NewFileButton(ctxt=self._ctxt))
        self.dropdown.add_widget(OpenFileButton(ctxt=self._ctxt))
        self.dropdown.add_widget(SaveFileButton(ctxt=self._ctxt))
Exemplo n.º 8
0
class Uygulama(App):
    def secim(self,nesne):
        if nesne.text=="mavi":
            self.resim.color=(0,0,1,1)
        elif nesne.text=="kirmizi":
            self.resim.color=(1,0,0,1)
        elif nesne.text=="yeşil":
            self.resim.color=(0,1,0,1)
        self.dropdown.select(nesne.text)
        self.anaDugme.text=nesne.text
    def build(self):
        self.renkler=(["mavi"],["kirmizi"],["yeşil"])
        duzen=BoxLayout()
        self.dropdown=DropDown()
        self.resim=Image()
        for renk in self.renkler:
            dugme=Button(text=renk[0],size_hint_y=None,height=50)
            dugme.bind(on_relase=self.secim)
            self.dropdown.add_widget(dugme)
        self.anaDugme=Button(text="Renkler",size_hint=(None,None))
        self.anaDugme.bind(on_relase=self.dropdown.open)
        duzen.add_widget(self.anaDugme)
        duzen.add_widget(self.resim)

        return duzen
Exemplo n.º 9
0
def DropDownCreation(data):
    Dropdown = DropDown()
    for i in data:
        drop_option = Button(text = i, size_hint_y = None, height = 40)
        drop_option.bind(on_release = lambda drop_option: Dropdown.select(drop_option.text))
        Dropdown.add_widget(drop_option)
    return Dropdown
Exemplo n.º 10
0
    def update_action_button(self):
        action_button = self.ids.action_button
        options = (
            ActionButtonOption(text=_('Sign'), func=lambda btn: self.do_sign(), enabled=self.can_sign),
            ActionButtonOption(text=_('Broadcast'), func=lambda btn: self.do_broadcast(), enabled=self.can_broadcast),
            ActionButtonOption(text=_('Bump fee'), func=lambda btn: self.do_rbf(), enabled=self.can_rbf),
            ActionButtonOption(text=_('Remove'), func=lambda btn: self.remove_local_tx(), enabled=self.is_local_tx),
        )
        num_options = sum(map(lambda o: bool(o.enabled), options))
        # if no options available, hide button
        if num_options == 0:
            action_button.disabled = True
            action_button.opacity = 0
            return
        action_button.disabled = False
        action_button.opacity = 1

        if num_options == 1:
            # only one option, button will correspond to that
            for option in options:
                if option.enabled:
                    action_button.text = option.text
                    self._action_button_fn = option.func
        else:
            # multiple options. button opens dropdown which has one sub-button for each
            dropdown = DropDown()
            action_button.text = _('Options')
            self._action_button_fn = dropdown.open
            for option in options:
                if option.enabled:
                    btn = Button(text=option.text, size_hint_y=None, height=48)
                    btn.bind(on_release=option.func)
                    dropdown.add_widget(btn)
Exemplo n.º 11
0
    def update_action_button(self):
        action_button = self.ids.action_button
        options = (
            ActionButtonOption(text=_('Sign'), func=lambda btn: self.do_sign(), enabled=self.can_sign),
            ActionButtonOption(text=_('Broadcast'), func=lambda btn: self.do_broadcast(), enabled=self.can_broadcast),
            ActionButtonOption(text=_('Bump fee'), func=lambda btn: self.do_rbf(), enabled=self.can_rbf),
            ActionButtonOption(text=_('Remove'), func=lambda btn: self.remove_local_tx(), enabled=self.is_local_tx),
        )
        num_options = sum(map(lambda o: bool(o.enabled), options))
        # if no options available, hide button
        if num_options == 0:
            action_button.disabled = True
            action_button.opacity = 0
            return
        action_button.disabled = False
        action_button.opacity = 1

        if num_options == 1:
            # only one option, button will correspond to that
            for option in options:
                if option.enabled:
                    action_button.text = option.text
                    self._action_button_fn = option.func
        else:
            # multiple options. button opens dropdown which has one sub-button for each
            dropdown = DropDown()
            action_button.text = _('Options')
            self._action_button_fn = dropdown.open
            for option in options:
                if option.enabled:
                    btn = Button(text=option.text, size_hint_y=None, height='48dp')
                    btn.bind(on_release=option.func)
                    dropdown.add_widget(btn)
Exemplo n.º 12
0
    def __init__(self, **kwargs):
        super(DropDownButton, self).__init__(**kwargs)
        self.drop_list = DropDown()

        if kwargs.has_key('type'):
            types = kwargs['type']
        else:
            types = ['empty']

        if kwargs.has_key('module') and kwargs.has_key('widget'):
            mod = __import__(kwargs['module'], fromlist=kwargs['widget'])
            widget_name = kwargs['widget']
        else:
            mod = __import__('kivy.uix.button', fromlist=['Button'])
            widget_name = 'Button'

        for i in types:
            attr = getattr(mod, widget_name)
            btn = attr(text=i, size_hint_y=None, height=50)
            btn.bind(on_release=lambda btn: self.drop_list.select(btn.text))

            self.drop_list.add_widget(btn)

        self.bind(on_release=self.drop_list.open)
        self.drop_list.bind(on_select=lambda instance, x: setattr(self, 'text', x))
Exemplo n.º 13
0
    def __init__(self, **kwargs):
        super(GeneScreen, self).__init__(**kwargs)

        # Widget Container
        screen_container = BoxLayout(orientation='vertical',
                                     padding=[1])

        # *Logo----------------------------------------------------------------
        self.logo = HomeButton()
        screen_container.add_widget(self.logo)

        # *Gene Selection Title------------------------------------------------
        screen_container.add_widget(Label(text='Gene Selection',
                                          size_hint=(1, .1),
                                          color=(0, .1, .25, .75)))

        # *Drop Down Menu------------------------------------------------------
        self.dropdown = DropDown()
        self.dropdown.bind(on_select=self.set_gene)
        self.dd_btns = []  # A list of drop down buttons for easy deletion

        #       Populate when top button hit
        self.mainbutton = CustomButton(text='Select a gene',
                                       size_hint=(1, .2))
        self.mainbutton.bind(on_release=self.load_genes)  # Populate dropdown
        self.dropdown.bind(on_select=lambda instance, x:
                           setattr(self.mainbutton, 'text', x))
        #       Place on screen
        screen_container.add_widget(self.mainbutton)

        # *Gene Buttons--------------------------------------------------------
        #       Declarations
        self.button_holder = BoxLayout(orientation='horizontal')

        #       Edit Button
        self.edit_btn = CustomButton(text="Edit",
                                     size_hint=(.3, .3))
        self.edit_btn.bind(on_release=self.switch_screen)

        #       New Button
        self.new_btn = CustomButton(text="New",
                                    size_hint=(.3, .3))
        self.new_btn.bind(on_release=self.switch_screen)

        #       Delete Button
        self.delete_btn = CustomButton(text="Delete",
                                       size_hint=(.3, .3))
        self.delete_btn.bind(on_release=self.delete)

        #       Placement
        self.button_holder.add_widget(self.edit_btn)
        self.button_holder.add_widget(self.new_btn)
        self.button_holder.add_widget(self.delete_btn)
        screen_container.add_widget(self.button_holder)  # Place Container
        #       Pack all widgets
        self.add_widget(screen_container)

        # Reset drop down when screen is loaded
        self.bind(on_enter=self.reset_menu)
Exemplo n.º 14
0
class FormScreen(GridLayout):

    def submission(self):
        print("Submitted")
        print(self.username.text)
        print(self.password.text)
        print(self.mainbutton.text)

    def __init__(self, **kwargs):
        super(FormScreen, self).__init__(**kwargs)
        self.cols = 2

        self.image = AsyncImage(source='https://www.logolynx.com/images/logolynx/ad/ad0eb0cfc1afa21d427b5bae775fe536.jpeg')
        self.add_widget(self.image)
        self.add_widget(Label(text='Registration Form'))

        # Label and Text Entry
        self.add_widget(Label(text='User Name'))
        self.username = TextInput(multiline=False)
        self.add_widget(self.username)

        # Label and Password Entry
        self.add_widget(Label(text='password'))
        self.password = TextInput(password=True, multiline=False)
        self.add_widget(self.password)

        # Label and Dropdown
        self.add_widget(Label(text='Select Option'))
        self.dropdown = DropDown()

        options = ['One', 'Two', 'Three']

        self.mainbutton = Button(text="One")
        self.add_widget(self.mainbutton)
        self.mainbutton.bind(on_release=self.dropdown.open)

        ## Assigns the selected option
        self.dropdown.bind(on_select=lambda instance, x: setattr(self.mainbutton, 'text', x))


        for option in options:
            # When adding widgets, we need to specify the height manually
            # (disabling the size_hint_y) so the dropdown can calculate
            # the area it needs.

            self.btn = Button(text=option, size_hint_y=None, height=44)

            # for each button, attach a callback that will call the select() method
            # on the dropdown. We'll pass the text of the button as the data of the
            # selection.
            self.btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))

            # then add the button inside the dropdown
            self.dropdown.add_widget(self.btn)

        # Submit Button
        self.submitbtn = Button(text="Submit")
        self.add_widget(self.submitbtn)
        self.submitbtn.bind(on_release=lambda x:self.submission())
Exemplo n.º 15
0
    def __init__(self, screen_manager, **kwargs):
        super(ChatScreen, self).__init__(**kwargs)

        self.screen_manager = screen_manager
        self.database = None
        self.client_transport = None
        self.contact = None
        self.client_login = None

        self.main_layout = GridLayout(cols=1)

        self.header_layout = GridLayout(cols=3, size_hint=(1, 0.1))
        self.scroll_view = ScrollView(size_hint=(1, 0.8),
                                      size=(100, 100),
                                      scroll_y=0)
        self.footer_layout = GridLayout(cols=2, size_hint=(1, 0.1))

        self.contact_list_button = Button(text='<=', size_hint=(0.1, 1))
        self.contact_list_button.on_press = self.go_to_contact_list
        self.label = CLabel(text="Chat with bla bla", size_hint=(0.9, 1))

        self.contact_menu = DropDown()
        for name in ['Info', 'Delete']:
            btn = Button(text=f'{name}', size_hint_y=None, height=30)
            btn.bind(on_release=lambda btn: self.contact_menu.select(btn.text))
            self.contact_menu.add_widget(btn)
        self.main_button = Button(text=':', size_hint=(.1, .3))
        self.main_button.bind(on_release=self.contact_menu.open)

        self.contact_menu.bind(
            on_select=lambda instance, x: self.menu_contact(x))

        self.messages = []
        self.messages_layout = GridLayout(cols=1,
                                          padding=(30, 0, 30, 0),
                                          size_hint_y=None,
                                          row_force_default=True,
                                          row_default_height=40)
        self.messages_layout.bind(
            minimum_height=self.messages_layout.setter('height'))

        self.scroll_view.add_widget(self.messages_layout)

        self.text_input = TextInput(size_hint=(0.9, 1))
        self.send_button = Button(text='>>', size_hint=(0.1, 1))
        self.send_button.on_press = self.send_message

        self.header_layout.add_widget(self.contact_list_button)
        self.header_layout.add_widget(self.label)
        self.header_layout.add_widget(self.main_button)

        self.footer_layout.add_widget(self.text_input)
        self.footer_layout.add_widget(self.send_button)

        self.main_layout.add_widget(self.header_layout)
        self.main_layout.add_widget(self.scroll_view)
        self.main_layout.add_widget(self.footer_layout)

        self.add_widget(self.main_layout)
Exemplo n.º 16
0
    def __init__(
        self,
        title,
        base_value,
        modifier=[],
        test_type=TestType.OTHER,
        damage=None,
        damage_bonus=0,
        **kwargs,
    ):
        super(TestPopup, self).__init__(**kwargs)
        self.title = "{} Test".format(title)
        self.base_value = base_value
        self.difficulty = 0
        self.misc_mod = 0
        self.roll = 0
        self.current_value = self.base_value
        self.modifier = modifier.copy()
        self.test_type = test_type
        self.damage = damage
        self.damage_bonus = damage_bonus
        self.difficulty_dropdown = DropDown()
        for difficulty in test_difficulties:
            button = DropdownButton(*difficulty)
            button.bind(on_release=lambda btn: self.difficulty_dropdown.select(
                [btn.text, btn.modifier]))
            self.difficulty_dropdown.add_widget(button)
        self.ids["button_difficulty"].bind(
            on_release=self.difficulty_dropdown.open)
        self.difficulty_dropdown.bind(on_select=self.set_difficulty)
        self.ids["modifier_box"].height = 0
        fatigue_mod = {"name": "Fatigue", "bonus": -10, "type": "status"}
        char = CHARACTER.get("character")
        if char["status"]["fatigue"] > 0:
            fatigue_mod["on"] = True
            self.current_value += fatigue_mod["bonus"]
        else:
            fatigue_mod["on"] = False
        self.modifier.append(fatigue_mod)
        for mod in self.modifier:
            modifier_box = ModifierBox(mod)
            modifier_box.ids["checkbox_on"].bind(
                active=self.modify_current_value)
            self.ids["modifier_box"].add_widget(modifier_box)
            self.ids["modifier_box"].height += modifier_box.height

        dos_config = DoSAlgorithm(config.get("config")["dos_algorithm"])
        if dos_config == DoSAlgorithm.DARK_HERESY_2:
            self.dos_func = utils.calculate_dos_dh2
        elif dos_config == DoSAlgorithm.ROGUE_TRADER:
            self.dos_func = utils.calculate_dos_rt
        if dos_config == DoSAlgorithm.MIXED and test_type == TestType.OTHER:
            self.dos_func = utils.calculate_dos_rt
        if dos_config == DoSAlgorithm.MIXED and test_type == TestType.FIGHT:
            self.dos_func = utils.calculate_dos_dh2

        if test_type == TestType.FIGHT:
            self.ids["button_damage"].on_press = self.roll_damage
        self.open()
Exemplo n.º 17
0
    def test_on_release(self):
        w = DropDown()
        w.on_select = MagicMock()
        a = MatiereOption(dropdown=w)
        a.trigger_action(0)

        assert w.on_select.called
        assert w.on_select.call_args == call(a)
Exemplo n.º 18
0
 def create_loc_drop(self):
     self.loc_drop = DropDown(size_hint=(None, None),
                              size=(200, 30),
                              scroll_type=["bars", "content"],
                              effect_cls="ScrollEffect",
                              bar_width=10)
     self.create_location_buttons(self.loc_drop)
     self.loc_drop.bind(on_select=self.on_loc_select_clicked)
Exemplo n.º 19
0
 def create_dropdown(self):
     self.dropdown2 = DropDown()
     for time in self.times:
         btn = Button(text= time, size_hint_y=None, height=44)
         btn.bind(on_release=lambda btn: self.dropdown2.select(btn.text))
         self.dropdown2.add_widget(btn)
     self.btnResult.bind(on_release=self.dropdown2.open)
     self.dropdown2.bind(on_select=lambda instance, x: self.display_posture(x))
Exemplo n.º 20
0
 def create_dropdown(self):
     self.dropdown = DropDown()
     for session in self.sessions:
         btn = Button(text= session, size_hint_y=None, height=44)
         btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
         self.dropdown.add_widget(btn)
     self.btnSession.bind(on_release=self.dropdown.open)
     self.dropdown.bind(on_select=lambda instance, x: setattr(self.btnSession, 'text', x))
Exemplo n.º 21
0
 def __init__(self, value):
     self.value = value
     self.dropDown = DropDown()
     if self.value.__len__() > 0:
         for index in range(self.value.__len__()):
             btn = Button(text= self.value[index], size_hint_y=None, height=50)
             btn.bind(on_release=lambda btn: self.dropDown.select(btn.text))
             self.dropDown.add_widget(btn)
Exemplo n.º 22
0
 def buildDropdown(self, langs):
     languages = DropDown()
     for index in range(len(langs)):
         btn = Button(text=langs[index], size_hint_y=None, height=22)
         btn.bind(on_release=lambda btn: self.languages.select(btn.text))
         btn.bind(on_press=lambda btn: self.changeLanguage(btn.text))
         languages.add_widget(btn)
     return languages
Exemplo n.º 23
0
 def CreateDataFilenameDropdown(self, datadir):
     dropdown = DropDown()
     for (dirpath, dirnames, filenames) in os.walk(datadir):
         for filename in sorted(filenames):
             if filename.endswith('.csv'):
                 btn = Button(text=filename, size_hint_y=None, height=44)
                 btn.bind(on_release=lambda btn: dropdown.select(btn.text))
                 dropdown.add_widget(btn)
     return dropdown
Exemplo n.º 24
0
 def __init__(self, container_buttons_height_ratio=2., **kwargs):
     super(DropDownButton, self).__init__(**kwargs)
     self.container_buttons_height_ratio = container_buttons_height_ratio
     self.dropdown = DropDown()
     self.add_dropdown_contents()
     self.add_widget(self.dropdown)
     self.bind(on_release=self.dropdown.open)
     self.set_initial_dropdown_selection()
     self.dropdown.dismiss()
Exemplo n.º 25
0
 def __init__(self, **kwargs):
     super(Menu, self).__init__(**kwargs)
     self.ids.player1select.text = 'Select Player 1'
     self.ids.player2select.text = 'Select Player 2'
     self.dropdown1 = DropDown()
     self.dropdown2 = DropDown()
     self._get_players()
     self._create_dropdowns(self.ids.player1select, self.dropdown1)
     self._create_dropdowns(self.ids.player2select, self.dropdown2)
Exemplo n.º 26
0
    def __init__(self, **kwargs):
        super(templateScreen, self).__init__(**kwargs)
        self.monitor_button_dict = dict()
        # display space
        self.layout_line = GridLayout(cols=3,
                                      spacing=20,
                                      padding=20,
                                      size_hint_y=None)
        self.layout_line.bind(minimum_height=self.layout_line.setter('height'))

        self.scroll = ScrollView(size_hint=(1, 1.5))
        self.scroll.add_widget(self.layout_line)

        self.work_space = BoxLayout(orientation='vertical')
        self.work_space.add_widget(self.scroll)

        # button menu
        self.button_menu = BoxLayout(orientation='horizontal',
                                     size_hint_y=.2,
                                     spacing=10,
                                     padding=10)

        # drop down list for monitor type set up
        self.dropdown_monitor_type = DropDown()
        self.mainbutton_monitor_type = Button(text='Monitor type')
        self.mainbutton_monitor_type.bind(
            on_release=self.dropdown_monitor_type.open)
        self.dropdown_monitor_type.bind(on_select=lambda instance, x: setattr(
            self.mainbutton_monitor_type, 'text', x))

        # drop down list for location selection set up
        self.dropdown = DropDown()
        self.mainbutton = Button(text="location list insert")
        self.mainbutton.bind(on_release=self.dropdown.open)
        self.dropdown.bind(
            on_select=lambda instance, x: setattr(self.mainbutton, 'text', x))

        # add button
        self.add_btn = Button(text="Add", background_color=(0, 0, 255, 1))
        self.add_btn.bind(on_press=self.add_location)

        # navigating button
        self.navigate_btn = Button(text="Switch to [destination]",
                                   background_color=(0, 0, 1, 255))
        self.navigate_btn.bind(on_press=self.navigation)

        # push all buttons into button menu
        self.button_menu.add_widget(self.add_btn)
        self.button_menu.add_widget(self.mainbutton_monitor_type)
        self.button_menu.add_widget(self.mainbutton)
        self.button_menu.add_widget(self.navigate_btn)

        # add button menu into work space layout
        self.work_space.add_widget(self.button_menu)

        # add work space layout to the screen
        self.add_widget(self.work_space)
Exemplo n.º 27
0
 def __init__(self, trade_screen=None, **kwargs):
     super(SymbolSearch, self).__init__(**kwargs)
     self.font_size = 40
     self.multiline = False
     self.dropdown = DropDown()
     self.dropdown_items = []
     self.dropdown.max_height = Window.size[1] * .2
     self.dropdown.background_color = (1,1,1,1)
     self.trade_screen = trade_screen
Exemplo n.º 28
0
    def __init__(self, *args, **kwargs):
        super(MapScreen, self).__init__(*args, **kwargs)

        # Заголовок
        self.head = AviaLabel(size_hint=(.3, .1),
                              font_size=25,
                              pos_hint={
                                  'center_x': 0.15,
                                  'center_y': .95
                              })
        self.head.text = 'Карта'
        self.add_widget(self.head)

        # Окно поиска
        self.dropdown = DropDown()

        self.search = TextInput(
            multiline=False,
            size_hint=(1, 0.1),
            font_size=40,
            pos_hint={
                'center_x': .5,
                'center_y': .85
            },
            #on_text_validate=self.dropdown.open
        )
        self.search.bind(text=self.update_dropdown)
        #Действие в момент выбора
        #self.dropdown.bind(on_select=lambda instance, x: setattr(self.search, 'text', x))
        self.add_widget(self.search)

        # Карта
        self.airport = Image(source='airport.png',
                             size_hint=(1 * 4, 0.7 * 4),
                             pos_hint={
                                 'center_x': .5,
                                 'center_y': .45
                             })
        self.add_widget(self.airport, 5)

        #Кнопка приближения
        self.plus_button = Button(text="+",
                                  size_hint=(None, None),
                                  size=(80, 80),
                                  pos=(Window.size[0] - 90,
                                       Window.size[1] * 0.2 + 90))
        self.plus_button.bind(on_release=self.big_map)
        self.add_widget(self.plus_button)
        #Кнопка отдаления
        self.minus_button = Button(text="-",
                                   size_hint=(None, None),
                                   size=(80, 80),
                                   pos=(Window.size[0] - 90,
                                        Window.size[1] * 0.2))
        self.minus_button.bind(on_release=self.small_map)
        self.add_widget(self.minus_button)
Exemplo n.º 29
0
    def __init__(self, callback=None, *args, **kwargs):
        super(MainWidget, self).__init__(*args, **kwargs)

        self.callback = callback
        self.is_fm = True

        x = y = 300
        points = []
        for i in range(50, self.size[0] - 150):
            points.extend([i, y])
        self.s = SignalDraw(points=points,
                            size=[self.size[0] - 100, self.size[1]])

        self.add_widget(self.s)

        self.b = Button(text='Submit',
                        size=[100, 100],
                        pos=[self.size[0] - 100, 0])
        self.b.bind(on_press=self.submit)
        self.add_widget(self.b)

        self.dropdown = DropDown()

        btn = Button(text='Sine', size_hint_y=None, height=44)
        btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
        self.dropdown.add_widget(btn)

        btn = Button(text='Cosine', size_hint_y=None, height=44)
        btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
        self.dropdown.add_widget(btn)

        btn = Button(text='Square', size_hint_y=None, height=44)
        btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
        self.dropdown.add_widget(btn)

        self.am_button = Button(text='Frequency Modulation (FM)',
                                size=[100, 100],
                                pos=[self.size[0] - 100, 100])
        self.am_button.bind(
            on_release=lambda btn: self.set_am_fm(self.am_button.text))
        self.add_widget(self.am_button)

        self.mainbutton = Button(text='Choose signal',
                                 size_hint=(None, None),
                                 size=[100, 100],
                                 pos=[self.size[0] - 100, 200])
        self.mainbutton.bind(on_release=self.dropdown.open)
        self.dropdown.bind(on_select=self.dropdown_select)

        self.add_widget(self.mainbutton)

        self.slider = Slider(min=1,
                             max=30,
                             value=3 * math.pi,
                             pos=[self.size[0] - 100, 300])
        self.add_widget(self.slider)
Exemplo n.º 30
0
 def __init__(self, default_text='', **kwargs):
     super(DropDownMenu, self).__init__(**kwargs)
     self.drop_list = None
     self.drop_list = DropDown()
     self.text = default_text
     self.name = ''
     """Button bindings"""
     self.bind(on_release=self.drop_list.open)
     """Dropdown bindings"""
     self.drop_list.bind(on_select=self.set_text)
Exemplo n.º 31
0
    def build(self):
        self.root = Builder.load_string(kv)
        self.acilirkutu = DropDown()

        for x in ("Mustafa", "Dilek", "Fatih", "Melike"):
            dugme = Button(text=x, size_hint_y=None, height=25)
            dugme.bind(on_release=self.secim)
            self.acilirkutu.add_widget(dugme)

        return self.root
Exemplo n.º 32
0
    def __init__(self, **kwargs):
        self.email_db = []
        if EMAILS_LIST.exists():
            with EMAILS_LIST.open() as femails:
                self.email_db = set(
                    map(lambda e: e.strip(), femails.readlines()))

        self.drop_down = DropDown()
        self.drop_down.bind(on_select=self.on_select)
        super(ComboEdit, self).__init__(**kwargs)
Exemplo n.º 33
0
 def __init__(self, **kwargs):
     self.connectionHandler = kwargs.get('connectionHandler', None)
     self.screenManager = kwargs.get('screenManager', None)
     self.name = kwargs.get('channel_info', 'ChannelScreen')
     super(ChannelScreen, self).__init__()
     self.channelbutton = self.ids.channels
     self.backbutton = self.ids.back
     self.backbutton.bind(on_press=self.goBack)
     self.channelbutton.bind(on_press=self.drop_down_ch)
     self.dropdown = DropDown()
Exemplo n.º 34
0
    def __init__(self, **kwargs):
        super(UpdateScreen, self).__init__(**kwargs)
        self.cols = 2

        dropDown = DropDown()
        for index in range(10):
            btn = Button(Text="Value %d" % index, size_hint_y=None, height=44)
            dropDown.add_widget(btn)

        self.add_widget(dropDown)
Exemplo n.º 35
0
 def buildDropDown(self, args):
     self.ids.dropdown_item.text = self.initial_selected_text
     self.menu = DropDown()
     for each in self.menu_items:
         btn = DropItem(text=each.split(".")[0], icon="music-note",
                        icon_color=random.choice(clr))
         btn.bind(on_release=lambda btn: self.set_item(self.menu, btn))
         self.menu.add_widget(btn)
         self.menu.spacing = 0
         self.menu.add_widget(MDSeparator())
Exemplo n.º 36
0
class Color_Picker(Selection):
    colors = {"Sky Blue": (0.529, 0.808, 0.922)}

    browse_btn = Button(text="Browse")

    #browse_btn.bind(on_release=lambda x : x.root.browse(x))
    # bind button to static FileBrowser' browse() function
    #browse_btn.bind(on_release=lambda x : FileBrowser.open(FileBrowser.instance))

    def __init__(self, **kwargs):
        super(Color_Picker, self).__init__(**kwargs)
        # Layout for selecting items
        self.dropdown = DropDown()
        self.app = MDApp.get_running_app()
        self.picker_btn.text = "Choose Color"
        self.picker_btn.bind(on_release=self.dropdown.open)

        # Add colors to dropdown
        for color in self.colors:
            btn = Button(text=color, size_hint_y=None, height=40)
            # When a color is selected the name is passed to dropdown object
            btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
            self.dropdown.add_widget(btn)

        self.dropdown.bind(
            on_select=lambda instance, x: setattr(self, 'selection', x))

    def dismiss(self):
        self.dropdown.dismiss()

    def on_leave(self):
        self.dropdown.clear_widgets()
Exemplo n.º 37
0
 def addButtons(self):
     for i, button_text_label in enumerate(self.buttonList):
         temp_button = MyButton(text = button_text_label)
         #if these two colors are not redefined in the inherited class, the default is used
         temp_button.color = self.menu_color_letters
         temp_button.background_color =  [.8, .7,0, .9]
         #now add dropdown buttons
         dropdown = DropDown()
         #if in parameter settings, combine dict to string
         if i is 1:
             for y in self.paradigm_setup_values:
                 submenu_string = y+': '+str(self.paradigm_setup_values[y])
                 btn = Button(text=submenu_string, size_hint_y=None, height=44)
                 btn.background_color =  [.8, .9,.7, .9]
                 btn.bind(on_release=lambda btn: dropdown.select(btn.text))
                 dropdown.add_widget(btn)
         else:
             for submenu_string in self.menu_items[i]:
                 # when adding widgets, we need to specify the height manually (disabling
                 # the size_hint_y) so the dropdown can calculate the area it needs.
                 btn = Button(text=submenu_string, size_hint_y=None, height=44)
                 btn.background_color =  [.8, .9,.7, .9]
                 # for each button, attach a callback that will call the select() method
                 # on the dropdown. We'll pass the text of the button as the data of the
                 # selection.
                 btn.bind(on_release=lambda btn: dropdown.select(btn.text))
                 #then add the button inside the dropdown
                 dropdown.add_widget(btn)
         #bind the dropdown to the main menu button
         temp_button.bind(on_release = dropdown.open) 
         dropdown.bind(on_select=lambda instance, x: self.menu_function_handler(x))
         #get info about what has been pressed
         #dropdown.bind(on_select=lambda instance, x: setattr(temp_button, 'text', x))
         self.layout_top_menu.add_widget(temp_button)
class LeaderBoardLayout(Widget):
    def __init__(self, **kwargs):
        """ Creates the buttons, text inputs and labels to be used by the other functions
        :param kwargs:
        :return:
        """
        super(LeaderBoardLayout, self).__init__(**kwargs)
        self.choice_button = Button(text="Get results")
        self.results_label = Label(text="High scores", font_size="20sp")
        self.name_input = TextInput(text="Enter username here.", multiline=False)
        self.options_dropdown = DropDown()
        self.dropdown_button = Button(text="Select an option")
        self.dropdown_button.bind(on_release=self.options_dropdown.open)
        self.layout = GridLayout(rows=5)
        self.drop_down_options = ["Top 10 Scores", "Add New User", "Top scores for user"]
        self.selected_url = "None"

    def create_layout(self):
        """Adds the objects created in __init__ to a GridLayout and creates a drop down
        :return:
        """
        self.choice_button.bind(on_press=self.callback)

        for d in self.drop_down_options:
            btn = Button(text=d, size_hint_y=None, height=44)
            btn.bind(on_release=lambda btn: self.options_dropdown.select(btn.text))
            self.options_dropdown.add_widget(btn)
        self.options_dropdown.bind(on_select=lambda instance, x: setattr(self.dropdown_button, "text", x))

        self.layout.add_widget(self.dropdown_button)
        self.layout.add_widget(self.name_input)
        self.layout.add_widget(self.choice_button)
        self.layout.add_widget(self.results_label)
        return self.layout

    def server_results(self, request, results):
        """ Outputs the request result into a label
        """
        self.results_label.text = str(results)

    def callback(self, event):
        """Depending on which drop down option was selected a request a URL is
        chosen to request data from teh server. """
        playername = self.name_input.text[:3]
        self.name_input.text = playername
        self.results_label.text = "Getting scores"

        if self.dropdown_button.text == "Top 10 Scores":
            self.selected_url = "http://bsccg04.ga.fal.io/top10.py"
        elif self.dropdown_button.text == "Add New User":
            self.selected_url = "http://bsccg04.ga.fal.io/new_user.py?playername=" + playername
        elif self.dropdown_button.text == "Top scores for user":
            self.selected_url = "http://bsccg04.ga.fal.io/users_high_score.py?playername=" + playername

        request = UrlRequest(self.selected_url, self.server_results)
Exemplo n.º 39
0
 def populate_drop_down(self, entries, attribute, location):
     """Populate a drop down menu."""
     drop_down = DropDown()
     for entry in entries:
         Logger.info("populate dropdown for {}: {}"
                     "".format(attribute, entry))
         button = Button(
             text=entry.name, height=44, size_hint_y=None,
             on_release=lambda a, entry=entry:
                 setattr(self, attribute, entry))
         drop_down.add_widget(button)
     drop_down.open(location)
Exemplo n.º 40
0
class MyDrop(App):
    def __init__(self, **kwargs):
        super(MyDrop, self).__init__(**kwargs)

        api = 'http://127.0.0.1:3000/api/1.0/places.json'
        resp = requests.get(api)
        places = []

        try:
            if not resp.status_code == 200:
                raise Exception('ApiException', 'Error found while calling the API backend')

            for data in [resp.json()[key] for key in resp.json().keys() if key == 'data']:
                for place in data:
                    places.append(place['name'])

            self.lista = tuple(places)
        except Exception as err:
            return err

    def d(self, n):
        self.dropdown.select(n.text)

    def build(self):
        self.box = FloatLayout()
        self.l = Label(pos_hint={'x': 0.5 / 2, 'center_y': 0.9},
                       size_hint=(0.5, 0.2),
                       text='[color=ff3333][b][size=35]TARIFAS DE TAXI[/b][/color]',
                       markup=True)
        self.dropdown = DropDown()

        for i in self.lista:
            b1 = Button(text=i, size_hint_y=None, height=50)
            b1.bind(on_release=self.d)
            self.dropdown.add_widget(b1)

        self.b2 = Button(pos_hint={'x': 0, 'center_y': .4},
                         size_hint=(0.5, 0.2),
                         text='[color=3333ff][size=24]ORIGEN[/color]',
                         markup=True)
        self.b2.bind(on_release=self.dropdown.open)
        self.b3 = Button(pos_hint={'x': 0.5, 'center_y': .4}, size_hint=(0.5, 0.2),
                         text='[color=3333ff][size=24]DESTINO[/color]', markup=True)
        self.b3.bind(on_release=self.dropdown.open)
        self.b_calcular = Button(pos_hint={'x': 0.5 / 2, 'center_y': .1}, size_hint=(0.5, 0.2),
                                 text='[color=3333ff][size=24]CALCULAR TARIFA[/color]', markup=True)
        self.b_calcular.bind()
        self.box.add_widget(self.b2)
        self.box.add_widget(self.b3)
        self.box.add_widget(self.b_calcular)
        self.box.add_widget(self.l)
        return self.box
Exemplo n.º 41
0
  def __init__(self, widget, **kwargs):
    super(DataBindingEditor, self).__init__(**kwargs)
    dropdown = DropDown()
    
    for variable in variables:
      # when adding widgets, we need to specify the height manually (disabling
      # the size_hint_y) so the dropdown can calculate the area it needs.
      btn = Button(text='%s' % variable, size_hint_y=None, height=40)

      # for each button, attach a callback that will call the select() method
      # on the dropdown. We'll pass the text of the button as the data of the
      # selection.
      btn.bind(on_release=lambda btn: dropdown.select(btn.text))

      # then add the button inside the dropdown
      dropdown.add_widget(btn)

    # create a big main button
    mainbutton = Button(text=widget.variable.name, size_hint=(None, None), pos_hint={'center_x': 0.5, 'center_y': 0.5})

    # show the dropdown menu when the main button is released
    # note: all the bind() calls pass the instance of the caller (here, the
    # mainbutton instance) as the first argument of the callback (here,
    # dropdown.open.).
    mainbutton.bind(on_release=dropdown.open)

    # one last thing, listen for the selection in the dropdown list and
    # assign the data to the button text.
    dropdown.bind(on_select=lambda instance, x: setattr(mainbutton, 'text', x))
    dropdown.bind(on_select=lambda instance, x: widget.set_var(x))
    

    self.add_widget(mainbutton)
Exemplo n.º 42
0
 def __init__(self, player, **kwargs):
     BoxLayout.__init__(self, **kwargs)
     self.queue = Queue()
     self.activeslider = False
     self.dropdown = DropDown()
     self.stationdropdown = DropDown()
     self.currentplayer = player
     self.playerstatus = "Pending ...."
     self.playername = self.currentplayer.group.label
     self.rendering = self.currentplayer.renderingControl.subscribe(
         event_queue=self.queue)
     self.info = self.currentplayer.avTransport.subscribe(
         event_queue=self.queue)
     self.timer = Clock.schedule_interval(self.monitor, 0)
    def __init__(self, **kwargs):
        super(Root, self).__init__(**kwargs)

        self.sm.transition = BlurTransition()

        for slide, name in self.slides:
            self.sm.add_widget(slide, name)

        self.dropdown = DropDown()
        for name in self.sm.slide_names:
            btn = Button(text=name, size_hint_y=None, height="40dp")
            btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
            self.dropdown.add_widget(btn)

        self.sm.add_widget(Factory.EndSlide, "Fine della presentazione")

        def dd_open_wrapper(*args, **kwargs):
            self.dd_open = True
            return self.dropdown.open(*args, **kwargs)
        def dd_dismiss_wrapper(*args):
            self.dd_open = False

        self.controls.ddbutton.bind(on_release=dd_open_wrapper)
        self.dropdown.bind(on_select=lambda instance, x: setattr(self.controls.ddbutton, 'text', x),
                           on_dismiss=dd_dismiss_wrapper)
        self.dropdown.bind(on_select=lambda instance, x: self.sm.switch_to_slide(x))

        self.controls.ddbutton.text = self.sm.current
        self.sm.bind(current=self.controls.ddbutton.setter("text"))
Exemplo n.º 44
0
class acilirKutuKv(App):

    def secim(self, nesne):
        self.acilirkutu.select(nesne.text)
        self.root.ids.anadugme.text=nesne.text

    def build(self):
        self.root=Builder.load_string(kv)
        self.acilirkutu = DropDown()

        for x in ( "Mustafa", "Dilek", "Fatih", "Melike"):
            dugme=Button(text=x, size_hint_y=None, height=25)
            dugme.bind(on_release=self.secim)
            self.acilirkutu.add_widget(dugme)

        return self.root
Exemplo n.º 45
0
    def loaded(self, event):
        if self.auto:
            self.client.register(self.client.config.get('connection', '_id'))
            return
        
        self.layout.remove_widget(self.connecting_label)
        del self.connecting_label
        
        self.dropdown = DropDown()
        
        for stage in sorted(self.client.meteor.find('stages'), key=lambda x: x['title']):
            self.dropdown.add_widget(Label(text = stage['title'], size_hint_y = None, height = 40))
            
            seen = []
            for minion in sorted(self.client.meteor.find('minions', 
                    selector = {'stage': stage['_id'], 'type': 'media'}), key=lambda x: x['title']):
                # workaround for python-meteor bug
                if not minion['stage'] == stage['_id']: continue
                
                if minion['_id'] in seen: continue
                else: seen.append(minion['_id'])

                button = Button(text = minion['title'], size_hint_y = None, height = 30)
                button.minion_id = minion['_id']
                button.bind(on_press = self.do_register)
                self.dropdown.add_widget(button)
        
        self.dropdown_button = Button(text = 'Select Minion')
        self.dropdown_button.bind(on_release = self.dropdown.open)
        self.layout.add_widget(self.dropdown_button)
            
        self.auto_checkbox = CheckBox()
        self.auto_label = Label(text = 'Connect automatically on start')
        self.layout.add_widget(self.auto_checkbox)
        self.layout.add_widget(self.auto_label)        
Exemplo n.º 46
0
 def build(self):
     self.recent_path=os.getcwd()
     self.cursor=None
     self.set_language('en')
     self.conn=None
     self.table_dropdown = DropDown()
     return Builder.load_file('main.kv')
Exemplo n.º 47
0
    def make_dropdown(self):
        self.dropdown = DropDown()
        for folder in os.listdir( self.parent.cfg_path ):
            if '.' not in folder:
                # When adding widgets, we need to specify the height manually
                # (disabling the size_hint_y) so the dropdown can calculate
                # the area it needs.

                btn = Button(text=folder, size_hint_y=None, height=44)

                # for each button, attach a callback that will call the select() method
                # on the dropdown. We'll pass the text of the button as the data of the
                # selection.
                btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))

                # then add the button inside the dropdown
                self.dropdown.add_widget(btn)
        
        # create a big main button
        mainbutton = Button(text=self.parent.profile, size_hint=(None, None), height=44)

        # show the dropdown menu when the main button is released
        # note: all the bind() calls pass the instance of the caller (here, the
        # mainbutton instance) as the first argument of the callback (here,
        # dropdown.open.).
        mainbutton.bind(on_release=self.dropdown.open)

        def profile_select(instance, x):
           setattr(mainbutton, 'text', x)
           self.parent.profile = x
        # one last thing, listen for the selection in the dropdown list and
        # assign the data to the button text.
        self.dropdown.bind( on_select=profile_select )

        return mainbutton
Exemplo n.º 48
0
    def create_dropdown(self):
        self.dropdownlist = DropDown()

        for ix in self.linked_dataframe.index:
        # when adding widgets, we need to specify the height manually
        # (disabling the size_hint_y) so the dropdown can calculate the
        # area it needs.
            btn = DtbObjctDPbutton(
                            linked_dataframe = self.linked_dataframe,
                            objct_id = ix,
                            attr_displayed_list = self.attr_displayed_list,
                            attr_backcolor = self.attr_backcolor,
                            size_hint = (None,None),
                            size = self.size
                                  )

            # for each button, attach a callback that will call the select()
            # method on the dropdown. We'll pass the text of the button as
            # the data of the selection.
            btn.bind(
                    on_release=lambda btn:
                    self.dropdownlist.select(btn.objct_id)
                    )

            # then add the button inside the dropdown
            self.dropdownlist.add_widget(btn)

        # one last thing, listen for the selection in the dropdown list and
        # assign the data to the button text.
        self.dropdownlist.bind(
                                on_select=lambda instance,
                                x: self.new_objct_id(objct_id = x)
                              )
Exemplo n.º 49
0
    def build(self):
        self.box = FloatLayout()
        self.l = Label(pos_hint={'x': 0.5 / 2, 'center_y': 0.9},
                       size_hint=(0.5, 0.2),
                       text='[color=ff3333][b][size=35]TARIFAS DE TAXI[/b][/color]',
                       markup=True)
        self.dropdown = DropDown()

        for i in self.lista:
            b1 = Button(text=i, size_hint_y=None, height=50)
            b1.bind(on_release=self.d)
            self.dropdown.add_widget(b1)

        self.b2 = Button(pos_hint={'x': 0, 'center_y': .4},
                         size_hint=(0.5, 0.2),
                         text='[color=3333ff][size=24]ORIGEN[/color]',
                         markup=True)
        self.b2.bind(on_release=self.dropdown.open)
        self.b3 = Button(pos_hint={'x': 0.5, 'center_y': .4}, size_hint=(0.5, 0.2),
                         text='[color=3333ff][size=24]DESTINO[/color]', markup=True)
        self.b3.bind(on_release=self.dropdown.open)
        self.b_calcular = Button(pos_hint={'x': 0.5 / 2, 'center_y': .1}, size_hint=(0.5, 0.2),
                                 text='[color=3333ff][size=24]CALCULAR TARIFA[/color]', markup=True)
        self.b_calcular.bind()
        self.box.add_widget(self.b2)
        self.box.add_widget(self.b3)
        self.box.add_widget(self.b_calcular)
        self.box.add_widget(self.l)
        return self.box
Exemplo n.º 50
0
class ProcesoPopup(Popup):
	
	def __init__(self, sistema):
		Popup.__init__(self)

		self.sistema = sistema
		self.lista_recursos = DropDown()

		self.btn_lista.bind(on_release=self.lista_recursos.open)
		self.lista_recursos.bind(on_select=self.usar_recurso)

	def agregar_recurso(self, recurso):

		btn = Button(text=recurso, size_hint_y=None, height=44)
		btn.bind(on_release=lambda btn: self.lista_recursos.select(btn.text))

		self.lista_recursos.add_widget(btn)

	def usar_recurso(self, btn, recurso):
		self.txt_recursos.text = self.txt_recursos.text + recurso + ", "

	def info_nuevo(self):
		return {}

	def limpiar(self):

		self.txt_nombre.text = ""
		self.txt_tiempo.text = ""
		self.txt_recursos.text = ""
		self.txt_procesador.text= ""

		self.dismiss()

	def agregar(self):

		nombre = self.txt_nombre.text
		tiempo = int(self.txt_tiempo.text)
		recursos = self.txt_recursos.text.replace(" ", "").split(",")
		
		if '' in recursos: 
			recursos.remove('')
		
		n_procesador = int(self.txt_procesador.text)

		self.sistema.agregar_proceso(nombre, tiempo, recursos, n_procesador, **self.info_nuevo())

		self.limpiar()
Exemplo n.º 51
0
 def update_profile_dropdown(self):
     self.load_profile_names()
     self.profile_dropdown = DropDown(do_scroll_x=False, size_hint=(1, None), size=(Window.width, Window.height), bar_width=20) #do_scroll_x=False, size_hint=(1, None), size=(Window.width, Window.height), bar_width=20)
     for name in self.profile_file_names:
         self.button = Button(text=name[:-5], size_hint=(1, None), height=44)
         self.button.bind(on_release=self.load_profile)
         self.profile_dropdown.add_widget(self.button)
     self.select_profile_button.bind(on_release=self.profile_dropdown.open)
Exemplo n.º 52
0
 def __init__(self, on_release, **kwargs):
     self.on_release = on_release
     super(ChoicePopup, self).__init__(**kwargs)
     self.dropdown = DropDown()
     self.choice_input.bind(text=self.make_dropdown, focus=self.on_focus)
     self.dropdown.bind(
         on_select=lambda instance, x: setattr(self.choice_input, 'text', x)
     )
Exemplo n.º 53
0
class PlayerPerformanceScreen(Screen):
    top_graph = ObjectProperty(None)
    item_texture = ObjectProperty(None)

    item_drop_btn = ObjectProperty(None)
    _item_dropdown = None


    def _item_selected(self, local_item_name):
        # convert local to key name
        try:
            item = [k for k,v in dotalocal.item.iteritems() if v == local_item_name][0]
        except IndexError:
            log.error('_item_selected: Invalid item name {}'.format(local_item_name))
            return
        self.item_drop_btn.text = local_item_name
        self.item_texture = pas_agg.create_item_graph(squeeze.my_id, item)

    def _init_item_dropdown(self):
        self._item_dropdown = DropDown()
        for item_name in sorted(dotalocal.item.itervalues()):
            btn = Button(text=item_name, size_hint_y=None, height=32)
            btn.bind(on_release=lambda btn: self._item_dropdown.select(btn.text))
            self._item_dropdown.add_widget(btn)

        self.item_drop_btn.bind(on_release=self._item_dropdown.open)
        self._item_dropdown.bind(on_select=lambda inst, x: self._item_selected(x))

    def load_replays(self, replay_list):
        if not self._item_dropdown:
            self._init_item_dropdown()

        pas_agg.d2rp_list = []

        for replay_id in replay_list:
            # skip replays the player did not play in
            player = squeeze.player_from_replay(squeeze.my_id, replay_id)
            if player is None:
                continue

            squeeze.dump_demo(replay_id)
            match = squeeze.replay(replay_id)
            d2rp = D2RP(squeeze.fs_replay_path(replay_id))
            pas_agg.d2rp_list.append(d2rp)

        self.top_graph.texture = pas_agg.create_cs_graph(squeeze.my_id)
Exemplo n.º 54
0
	def __init__(self, sistema):
		Popup.__init__(self)

		self.sistema = sistema
		self.lista_recursos = DropDown()

		self.btn_lista.bind(on_release=self.lista_recursos.open)
		self.lista_recursos.bind(on_select=self.usar_recurso)
Exemplo n.º 55
0
 def __init__(self,**kwargs):
     super (ScreenMain,self).__init__(**kwargs)
     self.dropdown = DropDown()
     
     self.messages_grid = self.ids.messages_grid
     self.child_id = 0
     self.msg_id =10
     Clock.schedule_once(self.prepare, 0)
Exemplo n.º 56
0
    def _init_item_dropdown(self):
        self._item_dropdown = DropDown()
        for item_name in sorted(dotalocal.item.itervalues()):
            btn = Button(text=item_name, size_hint_y=None, height=32)
            btn.bind(on_release=lambda btn: self._item_dropdown.select(btn.text))
            self._item_dropdown.add_widget(btn)

        self.item_drop_btn.bind(on_release=self._item_dropdown.open)
        self._item_dropdown.bind(on_select=lambda inst, x: self._item_selected(x))
Exemplo n.º 57
0
    def __setup_player_dropdown(self):
        self.dropdown_player = DropDown()
        self.dropdown_player.bind(on_select=self.on_player_select)

        players = sorted(PlayerData.get_players(), key=lambda player: player['name'])
        for player in players:
            btn = PlayerButton(data=player)
            btn.bind(on_release=lambda btn: self.dropdown_player.select(btn.data))
            self.dropdown_player.add_widget(btn)
Exemplo n.º 58
0
    def init_type_dropdown(self):
        d = DropDown()
        action_types = ['say', 'listen', 'play']
        for action_type in action_types:
            b = Button(text=action_type, size_hint_y=None, height=dp(30))

            def action_select_callback(button):
                d.select(button.text)
                # reset parameters when changing action type
                if self.action_type != button.text:
                    self.parameters = None
                self.action_type = button.text
            b.bind(on_release=action_select_callback)
            d.add_widget(b)

        d.bind(on_select=\
                lambda instance, text: setattr(self.type_button_wid, 'text', text))
        self.type_button_wid.bind(on_release=d.open)
Exemplo n.º 59
0
  def Initialize(self, path):
    self.sample, self.contents, self.line_nos = ParseData(path)
    platforms = DropDown()
    for platform in sorted(self.contents.itervalues().next().keys()):
      btn = Button(text = platform, size_hint_y = None, height = 33)
      btn.bind(on_release = lambda btn: self.SetPlatform(btn.text, platforms))
      platforms.add_widget(btn)
      self.plat_list.append(platform)
    self.plat_btn.bind(on_release = platforms.open)
    platforms.bind(on_select = lambda instance, x: setattr(self.plat_btn, 'text', x))

    test_filter = DropDown()
    for filter_type in ["None", "Matching", "MatchingPlat", "Matching+NoRes", "MatchingPlat+NoRes"]:
      btn = Button(text = filter_type, size_hint_y = None, height = 33)
      btn.bind(on_release = lambda btn: self.SetFilter(btn.text, test_filter))
      test_filter.add_widget(btn)
    self.filter_btn.bind(on_release = test_filter.open)
    test_filter.bind(on_select = lambda instance, x: setattr(self.filter_btn, 'text', x))
Exemplo n.º 60
0
    def build(self):
        self.root=Builder.load_string(kv)
        self.acilirkutu = DropDown()

        for x in ( "Mustafa", "Dilek", "Fatih", "Melike"):
            dugme=Button(text=x, size_hint_y=None, height=25)
            dugme.bind(on_release=self.secim)
            self.acilirkutu.add_widget(dugme)

        return self.root