Exemplo n.º 1
0
    def on_dict(self, instance, value):
        # 2020_03_10 Sim: Why only import Spinner here? at the top of the file
        # it was causing a crash when starting in a thread - no idea why
        from kivy.uix.spinner import Spinner
        for n, topic in enumerate(sorted(value)):
            check_box = CheckBox()
            self.add_widget(check_box)
            self.add_widget(TextInput(text=str(n)))
            spinner = Spinner(
                values=['dvs', 'frame', 'pose6q', 'cam', 'imu', 'flowMap'])
            if 'events' in topic:
                spinner.text = 'dvs'
                check_box.active = True
            elif 'image' in topic or 'depthmap' in topic:
                spinner.text = 'frame'
                check_box.active = True
            elif 'pose' in topic:
                spinner.text = 'pose6q'
                check_box.active = True
            elif 'flow' in topic:
                spinner.text = 'flowMap'
                check_box.active = True

            self.add_widget(spinner)
            self.add_widget(TextInput(text=topic))
    def add_check_box_group(self, comp, item, existing_level=None):
        chigh = CheckBox()
        chigh.color = [1, 3, 1, 3]
        cmed = CheckBox()
        cmed.color = [1, 3, 1, 3]
        clow = CheckBox()
        clow.color = [1, 3, 1, 3]

        if existing_level:
            if existing_level.lower() == 'high':
                chigh.active = True
                self.checked_values[item] = {'value': chigh, 'level': "High"}
            if existing_level.lower() == 'medium':
                cmed.active = True
                self.checked_values[item] = {'value': cmed, 'level': "Medium"}
            if existing_level.lower() == 'low':
                clow.active = True
                self.checked_values[item] = {'value': clow, 'level': "Low"}

        def on_checkbox_high(checkbox, value):
            if value:
                cmed.active = False
                clow.active = False
                CheckboxModal.intensity_levels[item] = 'High'
                self.checked_values[item] = {'value': chigh, 'level': "High"}
            else:
                CheckboxModal.intensity_levels[item] = None
                self.checked_values.pop(item, None)

        def on_checkbox_med(checkbox, value):
            if value:
                chigh.active = False
                clow.active = False
                CheckboxModal.intensity_levels[item] = 'Medium'
                self.checked_values[item] = {'value': cmed, 'level': "Medium"}
            else:
                CheckboxModal.intensity_levels[item] = None
                self.checked_values.pop(item, None)

        def on_checkbox_low(checkbox, value):
            if value:
                cmed.active = False
                chigh.active = False
                CheckboxModal.intensity_levels[item] = 'Low'
                self.checked_values[item] = {'value': clow, 'level': "Low"}
            else:
                CheckboxModal.intensity_levels[item] = None
                self.checked_values.pop(item, None)

        chigh.bind(active=on_checkbox_high)
        cmed.bind(active=on_checkbox_med)
        clow.bind(active=on_checkbox_low)

        l = Label(bold=True, font_size=20, text=str(item))
        comp.add_widget(l)
        comp.add_widget(chigh)
        comp.add_widget(cmed)
        comp.add_widget(clow)
Exemplo n.º 3
0
    def test_tb_lr_stacklayout(self):
        from kivy.uix.checkbox import CheckBox
        a = CheckBox(allow_no_selection=False, group='check')
        b = CheckBox(allow_no_selection=False, group='check')

        a.active = True
        self.assertTrue(a.active)
        self.assertEqual(a.state, 'down')

        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.active = True
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        a.state = 'down'
        self.assertTrue(a.active)
        self.assertEqual(a.state, 'down')

        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.state = 'down'
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        b.state = 'normal'
        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')
        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.state = 'down'
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        b.active = False
        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')
        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')
Exemplo n.º 4
0
 def __init__(self, title, choices, key, callback, *, description='', keep_choice_order=False):
     Factory.Popup.__init__(self)
     self.description = description
     if keep_choice_order:
         orig_index = {choice: i for (i, choice) in enumerate(choices)}
         sort_key = lambda x: orig_index[x[0]]
     else:
         sort_key = lambda x: x
     if type(choices) is list:
         choices = dict(map(lambda x: (x,x), choices))
     layout = self.ids.choices
     layout.bind(minimum_height=layout.setter('height'))
     for k, v in sorted(choices.items(), key=sort_key):
         l = Label(text=v)
         l.height = '48dp'
         l.size_hint_x = 4
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         cb.size_hint_x = 1
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         layout.add_widget(l)
         layout.add_widget(cb)
     layout.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
Exemplo n.º 5
0
 def __init__(self, title, choices, key, callback):
     Factory.Popup.__init__(self)
     if type(choices) is list:
         choices = dict(map(lambda x: (x,x), choices))
     layout = self.ids.choices
     layout.bind(minimum_height=layout.setter('height'))
     for k, v in sorted(choices.items()):
         l = Label(text=v)
         l.height = '48dp'
         l.size_hint_x = 4
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         cb.size_hint_x = 1
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         layout.add_widget(l)
         layout.add_widget(cb)
     layout.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
Exemplo n.º 6
0
    def __init__(self, title, choices, key, callback):
        Factory.Popup.__init__(self)
        print(choices, type(choices))
        if type(choices) is list:
            choices = dict(map(lambda x: (x, x), choices))
        layout = self.ids.choices
        layout.bind(minimum_height=layout.setter('height'))
        for k, v in sorted(choices.items()):
            l = Label(text=v)
            l.height = '48dp'
            l.size_hint_x = 4
            cb = CheckBox(group='choices')
            cb.value = k
            cb.height = '48dp'
            cb.size_hint_x = 1

            def f(cb, x):
                if x: self.value = cb.value

            cb.bind(active=f)
            if k == key:
                cb.active = True
            layout.add_widget(l)
            layout.add_widget(cb)
        layout.add_widget(Widget(size_hint_y=1))
        self.callback = callback
        self.title = title
        self.value = key
        self.app = App.get_running_app()
Exemplo n.º 7
0
 def __init__(self, title, choices, key, callback, keep_choice_order=False):
     Factory.Popup.__init__(self)
     print(choices, type(choices))
     if keep_choice_order:
         orig_index = {choice: i for (i, choice) in enumerate(choices)}
         sort_key = lambda x: orig_index[x[0]]
     else:
         sort_key = lambda x: x
     if type(choices) is list:
         choices = dict(map(lambda x: (x,x), choices))
     layout = self.ids.choices
     layout.bind(minimum_height=layout.setter('height'))
     for k, v in sorted(choices.items(), key=sort_key):
         l = Label(text=v)
         l.height = '48dp'
         l.size_hint_x = 4
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         cb.size_hint_x = 1
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         layout.add_widget(l)
         layout.add_widget(cb)
     layout.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
Exemplo n.º 8
0
 def feature_listing(self):
     count = 0
     file = open("./feature_list.txt", "r")
     feature = file.read().split("\n") # Current feature list
     for each in feature:
         if each == "":
             break
         new_box = SBox()
         new_box.id = each
         new_box.orientation = "horizontal"
         new_box.size_hint = (1, .1)
         new_checkbox = CheckBox()
         new_checkbox.id = each
         new_checkbox.size_hint = (.05, 1)
         new_checkbox.group = "feature"
         new_checkbox.bind(on_press=self.change_detection)
         new_box.add_widget(new_checkbox)
         new_label = SLabel()
         new_label.id = each
         new_label.text = each
         new_label.bind(on_press=self.change_detection)
         new_label.size_hint = (.95, 1)
         new_box.add_widget(new_label)
         self.ids.holder.add_widget(new_box)
         if each == KivyCamera.feature_detect:
             new_box.background_color = (0.5, 0.5, 0.5, 1)
             new_checkbox.active = True
         count+=1
     rh = (10-count)/10
     space_box = BoxLayout()
     space_box.size_hint = (1, rh)
     self.ids.holder.add_widget(space_box)
     file.close()
Exemplo n.º 9
0
    def checkboxPrompt(self, question, answer=False, cb=None):
        "As a text box based question, with optional  default answer.  If user confirm, call cb."

        t = CheckBox(active=True)

        def cbr_yes(*a):
            cb(t.active)
            self.dialog.dismiss()

        def cbr_no(*a):
            cb(None)
            self.dialog.dismiss()

        self.dialog = MDDialog(
            type="custom",
            title=question,
            content_cls=t,
            buttons=[
                Button(text="Accept", on_press=cbr_yes),
                Button(text="Cancel", on_press=cbr_no),
            ],
        )
        self.dialog.height = (0.8, 0.8)
        t.active = answer
        self.dialog.open()
Exemplo n.º 10
0
    def _bind_radio_menu(self, layout):
        button_pool = layout.ids[LayoutIds.radio_labels]

        radio_select_buttons = dict()
        radios = radio_types.radio_choices()

        for radio in radios:
            radio_layout = BoxLayout(orientation='horizontal',
                                     size_hint=(1, 0.1))

            radio_label = Label(text=radio_types.pretty_name(radio),
                                size_hint=(0.9, 1),
                                font_size=dp(11),
                                halign='left')
            radio_checkbox = CheckBox(size_hint=(0.1, 1))
            radio_checkbox.active = radio == radio_types.DEFAULT
            radio_label.bind(size=radio_label.setter('text_size'))

            radio_layout.add_widget(radio_label)
            radio_layout.add_widget(radio_checkbox)

            radio_select_buttons[radio] = radio_checkbox

            button_pool.add_widget(radio_layout)

        self._async_wrapper.radio_buttons = radio_select_buttons

        create_button = layout.ids[LayoutIds.create_radio_plugs]
        create_button.bind(on_press=self._async_wrapper.radio_generator)
Exemplo n.º 11
0
 def _get_checklist_widget_yes_no(self, question, i):
     yes_no_widget = BoxLayout(orientation='vertical',
                               id='Response ' + i,
                               size_hint_y=None)
     yes_response = BoxLayout(orientation='horizontal',
                              id='sub Response' + i)
     yes_response.add_widget(Label(text='Yes', id='Response ' + i))
     yes_checkbox = CheckBox(id='Yes Response ' + i, group='yes_no' + i)
     yes_response.add_widget(yes_checkbox)
     no_response = BoxLayout(orientation='horizontal',
                             id='sub Response' + i)
     no_response.add_widget(Label(text='No', id='Response ' + i))
     no_checkbox = CheckBox(id='No Response ' + i, group='yes_no' + i)
     no_response.add_widget(no_checkbox)
     if question.answer:
         yes_checkbox.active = True
     else:
         no_checkbox.active = True
     yes_no_widget.add_widget(yes_response)
     yes_no_widget.add_widget(no_response)
     return yes_no_widget
 def show_plugins(self, plugins_list):
     def on_checkbox_active(cb, value):
         self.plugins.toggle_enabled(self.electrum_config, cb.name)
     for item in self.plugins.descriptions:
         if 'kivy' not in item.get('available_for', []):
             continue
         name = item.get('name')
         label = Label(text=item.get('fullname'))
         plugins_list.add_widget(label)
         cb = CheckBox()
         cb.name = name
         p = self.plugins.get(name)
         cb.active = (p is not None) and p.is_enabled()
         cb.bind(active=on_checkbox_active)
         plugins_list.add_widget(cb)
Exemplo n.º 13
0
 def show_plugins(self, plugins_list):
     def on_checkbox_active(cb, value):
         self.plugins.toggle_enabled(self.electrum_config, cb.name)
     for item in self.plugins.descriptions:
         if 'kivy' not in item.get('available_for', []):
             continue
         name = item.get('name')
         label = Label(text=item.get('fullname'))
         plugins_list.add_widget(label)
         cb = CheckBox()
         cb.name = name
         p = self.plugins.get(name)
         cb.active = (p is not None) and p.is_enabled()
         cb.bind(active=on_checkbox_active)
         plugins_list.add_widget(cb)
Exemplo n.º 14
0
 def getCellChk(self,fila,columna,Activo,Disabled = False,Size=200,Tipo="chk"):
     """Funcion que devuelve una celda completa para manejo de checkbox"""
     cell = GridRow()
     cell.id = "row{0}_col{1}".format(fila,columna)
     cell.size = [Size,40]
     cchk=CheckBox()
     cchk.id=Tipo
     cchk.active=Activo
     cchk.disabled=Disabled
     cchk.background_checkbox_disabled_down='atlas://data/images/defaulttheme/checkbox_on'
     cchk.text_size=cell.size
     if Tipo == "borrar":
         cchk.bind(active=self.borradoCkick)
     cell.add_widget(cchk)
     return cell
Exemplo n.º 15
0
    def __init__(self, settings, dashboard_factory, **kwargs):
        super(DashboardScreenPreferences, self).__init__(**kwargs)
        self._settings = settings

        current_screens = self._settings.userPrefs.get_dashboard_screens()
        screen_keys = dashboard_factory.available_dashboards
        for key in screen_keys:
            [name, image] = dashboard_factory.get_dashboard_preview_image_path(key)
            checkbox = CheckBox()
            checkbox.active = True if key in current_screens else False
            checkbox.bind(active=lambda i, v, k=key:self._screen_selected(k, v))
            screen_item = DashboardScreenItem()
            screen_item.add_widget(checkbox)
            screen_item.add_widget(FieldLabel(text=name))
            screen_item.add_widget(Image(source=image))
            self.ids.grid.add_widget(screen_item)
        self._current_screens = current_screens
Exemplo n.º 16
0
 def __init__(self, title, choices, key, callback):
     Factory.Popup.__init__(self)
     for k, v in choices.items():
         l = Label(text=v)
         l.height = '48dp'
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         self.ids.choices.add_widget(l)
         self.ids.choices.add_widget(cb)
     self.ids.choices.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
Exemplo n.º 17
0
    def __init__(self, settings, dashboard_factory, **kwargs):
        super(DashboardScreenPreferences, self).__init__(**kwargs)
        self._settings = settings

        current_screens = self._settings.userPrefs.get_dashboard_screens()
        screen_keys = dashboard_factory.available_dashboards
        for key in screen_keys:
            [name,
             image] = dashboard_factory.get_dashboard_preview_image_path(key)
            checkbox = CheckBox()
            checkbox.active = True if key in current_screens else False
            checkbox.bind(
                active=lambda i, v, k=key: self._screen_selected(k, v))
            screen_item = DashboardScreenItem()
            screen_item.add_widget(checkbox)
            screen_item.add_widget(FieldLabel(text=name))
            screen_item.add_widget(Image(source=image))
            self.ids.grid.add_widget(screen_item)
        self._current_screens = current_screens
Exemplo n.º 18
0
    def __init__(self, title, choices, key, callback):
        Factory.Popup.__init__(self)
        for k, v in choices.items():
            l = Label(text=v)
            l.height = '48dp'
            cb = CheckBox(group='choices')
            cb.value = k
            cb.height = '48dp'

            def f(cb, x):
                if x: self.value = cb.value

            cb.bind(active=f)
            if k == key:
                cb.active = True
            self.ids.choices.add_widget(l)
            self.ids.choices.add_widget(cb)
        self.ids.choices.add_widget(Widget(size_hint_y=1))
        self.callback = callback
        self.title = title
        self.value = key
Exemplo n.º 19
0
    def build(self):

        chord_list = [
            'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B',
            'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am',
            'Bbm', 'Bm'
        ]

        #box layout, root of all layouts
        root = BoxLayout(orientation='vertical')

        #grid layout for top half of the screen
        top_grid = GridLayout(cols=3)

        #grid_layout for buttons on side
        button_group = GridLayout(rows=4)

        #start button to start playing playlist
        start = Button(text='START')
        start.bind(on_press=self.play_playlist)
        start.background_color = (1, 2.55, 1, 1)
        button_group.add_widget(start)

        #clear button to clear the playlist
        clear = Button(text='CLEAR')
        clear.bind(on_press=self.clear_playlist)
        clear.background_color = (2.55, 1, 1, 1)
        button_group.add_widget(clear)

        #text box saying "demo mode"
        text = Label(text="Demo \nMode")

        #check box to determine whether or not the app is in 'demo' mode
        checkbox = CheckBox()
        checkbox.active = self.is_demo
        checkbox.bind(active=self.in_demo_mode)
        checkbox.size_hint = (.5, .5)
        checkbox.color = (2.55, 2.55, 2.55, 1)
        button_group.add_widget(text)
        button_group.add_widget(checkbox)
        button_group.size_hint = (.2, .2)

        #grid layout for chord suggestions
        suggestions_layout = GridLayout(rows=2, cols=2)

        for i in range(0, 4):
            temp = Button()
            self.suggestions.append(temp)
            suggestions_layout.add_widget(temp)
            temp.bind(on_press=self.select_chord)

        #grid layout for playlist
        playlist_layout = GridLayout(rows=1)

        #setting up playlist buttons
        for i in range(0, 8):
            temp = Button()
            self.playlist_buttons.append(temp)
            playlist_layout.add_widget(temp)

        #grid defining chord keyboard
        bottom_grid = GridLayout(cols=12)

        #list of all buttons in chord keyboard
        buttons = []
        for chord in chord_list:
            temp = Button(text=chord)
            buttons.append(temp)
            temp.background_color = (self.chord_color_map[chord])
            bottom_grid.add_widget(temp)
            temp.bind(on_release=self.select_chord)

        top_grid.add_widget(button_group)
        top_grid.add_widget(playlist_layout)
        top_grid.add_widget(suggestions_layout)
        root.add_widget(top_grid)
        root.add_widget(bottom_grid)
        bottom_grid.size_hint = (1, .70)

        return root
Exemplo n.º 20
0
    def fillOptions(self, box):

        if box.id == 'Window':
            boxes = self.getOptionsLayout(2, 0.8)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Spectrogram width'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        textbox = TextInput()
                        textbox.text = '0'
                        textbox.multiline = False
                        textbox.size_hint = (1.0, 0.25)
                        self.input_fields['swidth'] = textbox
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.35)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.35)
                        child.add_widget(spacer_top)
                        child.add_widget(textbox)
                        child.add_widget(spacer_bot)
                    if child.id == 'text' and lines.id == '1':
                        label = Label()
                        label.text = 'Spectrogram height'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '1':
                        textbox = TextInput()
                        textbox.text = '1'
                        textbox.multiline = False
                        textbox.size_hint = (1.0, 0.25)
                        self.input_fields['sheight'] = textbox
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.35)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.35)
                        child.add_widget(spacer_top)
                        child.add_widget(textbox)
                        child.add_widget(spacer_bot)
                box.add_widget(lines)

        if box.id == 'Spectrogram':
            boxes = self.getOptionsLayout(2, 0.8)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Window width'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        textbox = TextInput()
                        textbox.text = '0'
                        textbox.multiline = False
                        textbox.size_hint = (1.0, 0.25)
                        self.input_fields['wwidth'] = textbox
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.35)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.35)
                        child.add_widget(spacer_top)
                        child.add_widget(textbox)
                        child.add_widget(spacer_bot)
                    if child.id == 'text' and lines.id == '1':
                        label = Label()
                        label.text = 'Window height'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '1':
                        textbox = TextInput()
                        textbox.text = '1'
                        textbox.multiline = False
                        textbox.size_hint = (1.0, 0.25)
                        self.input_fields['wheight'] = textbox
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.35)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.35)
                        child.add_widget(spacer_top)
                        child.add_widget(textbox)
                        child.add_widget(spacer_bot)
                box.add_widget(lines)

        if box.id == 'Lines':
            boxes = self.getOptionsLayout(1, 0.8)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Line width'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        textbox = TextInput()
                        textbox.text = '0'
                        textbox.multiline = False
                        textbox.size_hint = (1.0, 0.125)
                        self.input_fields['sline'] = textbox
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.35)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.35)
                        child.add_widget(spacer_top)
                        child.add_widget(textbox)
                        child.add_widget(spacer_bot)
                box.add_widget(lines)
        if box.id == 'Scales':
            boxes = self.getOptionsLayout(2, 0.5)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Y axis scale'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        box_labels = BoxLayout()
                        box_labels.orientation = 'horizontal'
                        box_labels.size_hint = (1.0, 0.2)

                        label_lin = Label()
                        label_lin.text = 'Linear'
                        label_lin.font_size = 12
                        label_log = Label()
                        label_log.text = 'Logarithmic'
                        label_log.font_size = 12

                        box_labels.add_widget(label_lin)
                        box_labels.add_widget(label_log)

                        box_radio = BoxLayout()
                        box_radio.orientation = 'horizontal'
                        box_radio.size_hint = (1.0, 0.2)

                        radio_lin = CheckBox()
                        radio_lin.group = '0'
                        radio_lin.active = True
                        radio_log = CheckBox()
                        radio_log.group = '0'
                        radio_log.active = False

                        self.input_fields['yaxis'] = (radio_lin, radio_log)

                        box_radio.add_widget(radio_lin)
                        box_radio.add_widget(radio_log)

                        child.add_widget(box_labels)
                        child.add_widget(box_radio)
                    if child.id == 'text' and lines.id == '1':
                        label = Label()
                        label.text = '\"Z\" axis scale'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '1':
                        box_labels = BoxLayout()
                        box_labels.orientation = 'horizontal'
                        box_labels.size_hint = (1.0, 0.2)

                        label_lin = Label()
                        label_lin.text = 'Linear'
                        label_lin.font_size = 12
                        label_log = Label()
                        label_log.text = 'Decibels'
                        label_log.font_size = 12

                        box_labels.add_widget(label_lin)
                        box_labels.add_widget(label_log)

                        box_radio = BoxLayout()
                        box_radio.orientation = 'horizontal'
                        box_radio.size_hint = (1.0, 0.2)

                        radio_lin = CheckBox()
                        radio_lin.group = '1'
                        radio_lin.active = True
                        radio_log = CheckBox()
                        radio_log.group = '1'
                        radio_log.active = False

                        self.input_fields['zaxis'] = (radio_lin, radio_log)

                        box_radio.add_widget(radio_lin)
                        box_radio.add_widget(radio_log)

                        child.add_widget(box_labels)
                        child.add_widget(box_radio)
                box.add_widget(lines)
        if box.id == 'Window function':
            boxes = self.getOptionsLayout(1, 0.8)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Blackman window'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        checkbox = CheckBox()
                        checkbox.size_hint = (1.0, 0.2)
                        spacer_top = BoxLayout()
                        spacer_top.size_hint = (1.0, 0.4)
                        spacer_bot = BoxLayout()
                        spacer_bot.size_hint = (1.0, 0.4)
                        self.input_fields['blackman'] = checkbox
                        child.add_widget(spacer_top)
                        child.add_widget(checkbox)
                        child.add_widget(spacer_bot)
                box.add_widget(lines)
        if box.id == 'Color Values':
            boxes = self.getOptionsLayout(2, 0.5)
            for lines in boxes:
                for child in lines.children:
                    if child.id == 'text' and lines.id == '0':
                        label = Label()
                        label.text = 'Maximum value'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '0':
                        box_labels = BoxLayout()
                        box_labels.orientation = 'horizontal'
                        box_labels.size_hint = (1.0, 0.3)

                        label_lin = Label()
                        label_lin.text = 'Linear'
                        label_lin.font_size = 12
                        label_log = Label()
                        label_log.text = 'Decibels'
                        label_log.font_size = 12

                        box_labels.add_widget(label_lin)
                        box_labels.add_widget(label_log)

                        box_input = BoxLayout()
                        box_input.orientation = 'horizontal'
                        box_input.size_hint = (1.0, 0.2)

                        value_lin = TextInput()
                        value_lin.text = '0'
                        value_lin.multiline = False
                        value_lin.size_hint = (0.5, 1.0)
                        value_db = TextInput()
                        value_db.text = '0'
                        value_db.multiline = False
                        value_db.size_hint = (0.5, 1.0)

                        self.input_fields['maxlin'] = value_lin
                        self.input_fields['maxdb'] = value_db

                        box_input.add_widget(value_lin)
                        box_input.add_widget(value_db)

                        box_spacer = BoxLayout()
                        box_spacer.size_hint = (1.0, 0.3)
                        child.add_widget(box_labels)
                        child.add_widget(box_input)
                        child.add_widget(box_spacer)
                    if child.id == 'text' and lines.id == '1':
                        label = Label()
                        label.text = 'Minimum value'
                        child.add_widget(label)
                    if child.id == 'values' and lines.id == '1':
                        box_labels = BoxLayout()
                        box_labels.orientation = 'horizontal'
                        box_labels.size_hint = (1.0, 0.3)

                        label_lin = Label()
                        label_lin.text = 'Linear'
                        label_lin.font_size = 12
                        label_log = Label()
                        label_log.text = 'Decibels'
                        label_log.font_size = 12

                        box_labels.add_widget(label_lin)
                        box_labels.add_widget(label_log)

                        box_input = BoxLayout()
                        box_input.orientation = 'horizontal'
                        box_input.size_hint = (1.0, 0.2)

                        value_lin = TextInput()
                        value_lin.text = '0'
                        value_lin.multiline = False
                        value_lin.size_hint = (0.5, 1.0)
                        value_db = TextInput()
                        value_db.text = '0'
                        value_db.multiline = False
                        value_db.size_hint = (0.5, 1.0)

                        self.input_fields['minlin'] = value_lin
                        self.input_fields['mindb'] = value_db

                        box_input.add_widget(value_lin)
                        box_input.add_widget(value_db)

                        box_spacer = BoxLayout()
                        box_spacer.size_hint = (1.0, 0.3)

                        child.add_widget(box_labels)
                        child.add_widget(box_input)
                        child.add_widget(box_spacer)
                box.add_widget(lines)
Exemplo n.º 21
0
    def build(self):

        self.nao_errou = True

        main_box = BoxLayout(orientation='vertical')
        main_box.padding = 50
        main_box.size_hint.y = None
        main_box.size.y = 100
        title = Label(text="Automatizador de Conversão Monetária Mensal :P")
        main_box.add_widget(title)

        input_padding = 5

        valor_inicial_box = BoxLayout(orientation='horizontal')
        valor_inicial_box.padding = input_padding
        valor_inicial_label = Label(text="Valor Original Fixo")
        valor_inicial_input = TextInput(hint_text="0.00")
        valor_inicial_box.add_widget(valor_inicial_label)
        valor_inicial_box.add_widget(valor_inicial_input)
        main_box.add_widget(valor_inicial_box)

        prazo_inicial_box = BoxLayout(orientation='horizontal')
        prazo_inicial_box.padding = input_padding
        prazo_inicial_label = Label(text="Prazo Inicial (Formato MMAAAA)")
        prazo_inicial_input = TextInput(hint_text="MMAAAA")
        prazo_inicial_box.add_widget(prazo_inicial_label)
        prazo_inicial_box.add_widget(prazo_inicial_input)
        main_box.add_widget(prazo_inicial_box)

        prazo_final_box = BoxLayout(orientation='horizontal')
        prazo_final_box.padding = input_padding
        prazo_final_label = Label(text="Prazo Final (Formato MMAAAA)")
        prazo_final_input = TextInput(hint_text="MMAAAA")
        prazo_final_box.add_widget(prazo_final_label)
        prazo_final_box.add_widget(prazo_final_input)
        main_box.add_widget(prazo_final_box)

        periodicidade_box = BoxLayout(orientation='horizontal')
        periodicidade_box.padding = input_padding
        periodicidade_label = Label(text="Periodicidade do Cálculo")
        mensal_cb = CheckBox(color=[1, 1, 1, 1])
        mensal_label = Label(text="Mês a Mês")
        mensal_cb.active = True
        mensal_cb.group = "periodo"
        mensal_cb.color = (1, 1, 1, 1)
        mensal_cb.bind(active=self.on_mensal_active)
        corrido_cb = CheckBox()
        corrido_label = Label(text="Meses Corridos")
        corrido_cb.color = (1, 1, 1, 1)
        corrido_cb.active = False
        corrido_cb.group = "periodo"
        corrido_cb.bind(active=self.on_corrido_active)
        periodicidade_box.add_widget(periodicidade_label)
        periodicidade_box.add_widget(mensal_cb)
        periodicidade_box.add_widget(mensal_label)
        periodicidade_box.add_widget(corrido_cb)
        periodicidade_box.add_widget(corrido_label)
        main_box.add_widget(periodicidade_box)

        self.inicio_input = prazo_inicial_input
        self.fim_input = prazo_final_input
        self.valor_input = valor_inicial_input
        self.main_box = main_box
        self.periodicidade = "mensal"

        botao = Button(text="Iniciar Busca",
                       on_release=self.buscar_informacoes)
        botao.margin = (80, 80)
        main_box.add_widget(botao)

        limpar_botao = Button(text="Resetar Valores",
                              on_release=self.resetar_valores)
        limpar_botao.margin = (80, 80)
        main_box.add_widget(limpar_botao)

        self.erro_label = Label(
            text="Você digitou dados em formatos errados. Confira novamente!")

        main_box.add_widget(
            Label(
                text=
                "Software ainda em desenvolvimento. Conferir informações antes de usar."
            ))
        main_box.add_widget(Label(text="Feito por Rafael :P"))

        return main_box
Exemplo n.º 22
0
    def __init__(self, source_widget, **kwargs):
        self.orientation = "vertical"
        self.script_input = TextInput(hint_text="()", multiline=True, size_hint_y=1)
        self.auto_run_scripts = True
        self.run_single_page_only = False
        self.sync_with_others = True
        self.run_script_this_button = Button(
            text="run script on this", size_hint_y=None, height=30
        )
        self.run_script_this_button.bind(
            on_press=lambda widget: self.run_script(
                self.script_input.text, widget=self.script_input
            )
        )
        self.run_script_all_button = Button(
            text="run script on all ( {} )".format(self.all_sources_key),
            size_hint_y=None,
            height=30,
        )
        self.run_script_all_button.bind(on_press=lambda widget: self.run_on_all())
        self.script_regenerate_button = Button(
            text="regenerate scripts", size_hint_y=None, height=30
        )
        self.script_regenerate_button.bind(
            on_press=lambda widget: self.source_widget.update_region_scripts()
        )

        self.source_widget = source_widget
        super(ScriptBox, self).__init__(**kwargs)
        auto_run_checkbox = CheckBox(size_hint_x=None)
        if self.auto_run_scripts:
            auto_run_checkbox.active = BooleanProperty(True)
        auto_run_checkbox.bind(
            active=lambda widget, value, self=self: setattr(
                self, "auto_run_scripts", value
            )
        )
        auto_run_row = BoxLayout(orientation="horizontal", height=30, size_hint_y=None)
        auto_run_row.add_widget(auto_run_checkbox)
        auto_run_row.add_widget(
            Label(text="auto run generated scripts", size_hint_x=None)
        )
        run_single_page_only_checkbox = CheckBox(size_hint_x=None)
        if self.run_single_page_only:
            run_single_page_only_checkbox.active = BooleanProperty(True)
        run_single_page_only_checkbox.bind(
            active=lambda widget, value, self=self: setattr(
                self, "run_single_page_only", value
            )
        )
        auto_run_row.add_widget(run_single_page_only_checkbox)
        auto_run_row.add_widget(
            Label(text="run this page region only", size_hint_x=None)
        )
        sync_checkbox = CheckBox(size_hint_x=None)
        if self.sync_with_others:
            sync_checkbox.active = BooleanProperty(True)
        sync_checkbox.bind(
            active=lambda widget, value, self=self: [
                setattr(self, "sync_with_others", value),
                self.app.use_latest_session(),
            ]
        )
        auto_run_row.add_widget(sync_checkbox)
        auto_run_row.add_widget(Label(text="sync with others", size_hint_x=None))

        self.add_widget(auto_run_row)
        self.add_widget(self.script_input)
        self.add_widget(self.run_script_this_button)
        self.add_widget(self.run_script_all_button)
        self.add_widget(self.script_regenerate_button)
Exemplo n.º 23
0
    def build(self):
        global screen
        global subpagecounter
        global subpageprev
        global subpagenext
        global channelname
        global pageinput
        global pageinput_val
        global podstrona
        global pobrana_strona
        global error_popup
        global error_label

        ch_chooser_layout = GridLayout(cols=2,
                                       row_force_default=True,
                                       row_default_height=120).__self__
        cb_tvp1 = CheckBox(group="ch").__self__
        cb_tvp1.on_press = lambda: on_checkbox_active(1, cb_tvp1.active)
        lb_tvp1 = Label(text="TVP1").__self__
        cb_tvp2 = CheckBox(group="ch").__self__
        cb_tvp2.on_press = lambda: on_checkbox_active(2, cb_tvp2.active)
        lb_tvp2 = Label(text="TVP2").__self__
        cb_tvppol = CheckBox(group="ch").__self__
        cb_tvppol.on_press = lambda: on_checkbox_active(3, cb_tvppol.active)
        lb_tvppol = Label(text="TVP Polonia").__self__
        cb_tvpkul = CheckBox(group="ch").__self__
        cb_tvpkul.on_press = lambda: on_checkbox_active(4, cb_tvpkul.active)
        lb_tvpkul = Label(text="TVP Kultura").__self__
        cb_tvpspo = CheckBox(group="ch").__self__
        cb_tvpspo.on_press = lambda: on_checkbox_active(5, cb_tvpspo.active)
        lb_tvpspo = Label(text="TVP Sport").__self__
        cb_polsat = CheckBox(group="ch").__self__
        cb_polsat.on_press = lambda: on_checkbox_active(6, cb_polsat.active)
        lb_polsat = Label(text="Polsat").__self__
        cb_tv4 = CheckBox(group="ch").__self__
        cb_tv4.on_press = lambda: on_checkbox_active(7, cb_tv4.active)
        lb_tv4 = Label(text="TV4").__self__
        ch_chooser_layout.add_widget(lb_tvp1)
        ch_chooser_layout.add_widget(cb_tvp1)
        ch_chooser_layout.add_widget(lb_tvp2)
        ch_chooser_layout.add_widget(cb_tvp2)
        ch_chooser_layout.add_widget(lb_tvppol)
        ch_chooser_layout.add_widget(cb_tvppol)
        ch_chooser_layout.add_widget(lb_tvpkul)
        ch_chooser_layout.add_widget(cb_tvpkul)
        ch_chooser_layout.add_widget(lb_tvpspo)
        ch_chooser_layout.add_widget(cb_tvpspo)
        ch_chooser_layout.add_widget(lb_polsat)
        ch_chooser_layout.add_widget(cb_polsat)
        ch_chooser_layout.add_widget(lb_tv4)
        ch_chooser_layout.add_widget(cb_tv4)

        ch_switch = Button(text="Przełącz").__self__
        ch_cancel = Button(text="Anuluj").__self__
        ch_cancel.on_press = lambda: channel_chooser.dismiss()
        ch_switch.on_press = lambda: chchannel(channel_chooser)
        ch_chooser_layout.add_widget(ch_switch)
        ch_chooser_layout.add_widget(ch_cancel)

        cb_tvp1.active = True

        channel_chooser = Popup(title="Zmień kanał",
                                content=ch_chooser_layout,
                                size_hint=(None, None),
                                size=(600, 1110)).__self__

        main_layout = BoxLayout(padding=10, orientation='vertical').__self__
        tvp_fetch(100, 1, "TG1", False)

        page_control_layout = GridLayout(cols=3,
                                         row_force_default=True,
                                         row_default_height=120).__self__
        pagelabel = Label(text="Strona:").__self__

        pageinput.bind(text=on_text)
        navigate_btn = Button(text='Idź').__self__
        navigate_btn.on_press = lambda: navigate_callback(
            int(pageinput_val), 1, True)
        page_control_layout.add_widget(pagelabel)
        page_control_layout.add_widget(pageinput)
        page_control_layout.add_widget(navigate_btn)

        subpage_control_layout = GridLayout(cols=4,
                                            row_force_default=True,
                                            row_default_height=120).__self__
        subpagelabel = Label(text="Podstrona:").__self__
        subpageprev.on_press = lambda: navigate_callback(
            pobrana_strona, podstrona - 1, True)
        subpagenext.on_press = lambda: navigate_callback(
            pobrana_strona, podstrona + 1, True)
        subpage_control_layout.add_widget(subpagelabel)
        subpage_control_layout.add_widget(subpageprev)
        subpage_control_layout.add_widget(subpagecounter)
        subpage_control_layout.add_widget(subpagenext)

        navigation_layout = GridLayout(cols=2,
                                       row_force_default=True,
                                       row_default_height=120).__self__
        prevbutton = Button(text="Wstecz").__self__
        prevbutton.on_press = lambda: prev_page()
        homebutton = Button(text="Strona główna").__self__
        homebutton.on_press = lambda: navigate_callback(100, 1, True)
        navigation_layout.add_widget(prevbutton)
        navigation_layout.add_widget(homebutton)

        channelbutton = Button(text='Zmień kanał').__self__
        channelbutton.on_press = lambda: channel_chooser.open()

        controls_layout = GridLayout(cols=1,
                                     row_force_default=True,
                                     row_default_height=120).__self__
        controls_layout.add_widget(channelname)
        controls_layout.add_widget(page_control_layout)
        controls_layout.add_widget(subpage_control_layout)
        controls_layout.add_widget(navigation_layout)
        controls_layout.add_widget(channelbutton)

        main_layout.add_widget(screen)
        main_layout.add_widget(controls_layout)
        return main_layout