Exemple #1
0
    def __init__(self, **kwargs):
        '''
        Initial the show layout with a default picture and an empty input box.
        '''

        super(ShowLayout, self).__init__(**kwargs)
        self.cols = 2
        self.col_force_default = True
        self.col_default_width = 550
        self.row_force_default = True
        self.row_default_height = 550

        data = []
        urlData = "https://raw.githubusercontent.com/plotly/datasets/master/miserables.json"
        webURL = urllib.request.urlopen(urlData)
        readData = webURL.read()
        encoding = webURL.info().get_content_charset('utf-8')
        data = json.loads(readData.decode(encoding))
        N = len(data['nodes'])
        L = len(data['links'])
        Edges = [(data['links'][k]['source'], data['links'][k]['target'])
                 for k in range(L)]

        G = igraph.Graph(Edges, directed=False)
        labels = []
        group = []
        for node in data['nodes']:
            labels.append(node['name'])
            group.append(node['group'])

        layt = G.layout('kk', dim=3)
        Xn = [layt[k][0] for k in range(N)]  # x-coordinates of nodes
        Yn = [layt[k][1] for k in range(N)]  # y-coordinates
        Zn = [layt[k][2] for k in range(N)]  # z-coordinates
        Xe = []
        Ye = []
        Ze = []
        for e in Edges:
            Xe += [layt[e[0]][0], layt[e[1]][0],
                   None]  # x-coordinates of edge ends
            Ye += [layt[e[0]][1], layt[e[1]][1], None]
            Ze += [layt[e[0]][2], layt[e[1]][2], None]
        trace1 = go.Scatter3d(x=Xe,
                              y=Ye,
                              z=Ze,
                              mode='lines',
                              line=dict(color='rgb(125,125,125)', width=1),
                              hoverinfo='none')

        trace2 = go.Scatter3d(x=Xn,
                              y=Yn,
                              z=Zn,
                              mode='markers',
                              name='actors',
                              marker=dict(symbol='circle',
                                          size=6,
                                          color=group,
                                          colorscale='Viridis',
                                          line=dict(color='rgb(50,50,50)',
                                                    width=0.5)),
                              text=labels,
                              hoverinfo='text')

        axis = dict(showbackground=False,
                    showline=False,
                    zeroline=False,
                    showgrid=False,
                    showticklabels=False,
                    title='')

        layout = go.Layout(
            title=
            "Network of coappearances of characters in Victor Hugo's novel<br> Les Miserables (3D visualization)",
            width=1000,
            height=1000,
            showlegend=False,
            scene=dict(
                xaxis=dict(axis),
                yaxis=dict(axis),
                zaxis=dict(axis),
            ),
            margin=dict(t=100),
            hovermode='closest',
            annotations=[
                dict(
                    showarrow=False,
                    text=
                    "Data source: <a href='http://bost.ocks.org/mike/miserables/miserables.json'>[1] miserables.json</a>",
                    xref='paper',
                    yref='paper',
                    x=0,
                    y=0.1,
                    xanchor='left',
                    yanchor='bottom',
                    font=dict(size=14))
            ],
        )
        data = [trace1, trace2]
        fig = go.Figure(data=data, layout=layout)
        htmlFile = plot(fig, filename='my-graph.html', output_type='div')
        self.picture = RstDocument(text=htmlFile)
        self.add_widget(self.picture)

        self.frequency_text = ''
        self.frequency = TextInput(text=self.frequency_text)

        self.add_widget(self.frequency)
 def add_common_fields(self):
     for field in self.elements['common_fields']:
         self.ids.common_fields.add_widget(
             Label(text=field))
         self.ids.common_fields.add_widget(
             TextInput(multiline=False))
Exemple #3
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)
Exemple #4
0
 def build(self):
     box = BoxLayout()
     box.add_widget(TextInput(text=text_error, size_hint_x=0.9, multiline=True))
     return box
    def build(self):
        self.title = 'Convert To Text'

        parent = RelativeLayout()

        self.draw = DrawWidget(size_hint=(0.5, 0.8),
                               pos_hint={
                                   'x': 0,
                                   'y': 0.2
                               })

        clear_btn = Button(size_hint=(0.5, 0.1),
                           text="Clear",
                           pos_hint={
                               'x': 0,
                               'y': 0.1
                           })
        clear_btn.bind(on_release=self.clear_canvas)

        convert_btn = Button(size_hint=(0.5, 0.1),
                             text="Convert to text",
                             pos_hint={
                                 'x': 0.5,
                                 'y': 0.1
                             })
        convert_btn.bind(on_release=self.convert)

        self.label = Label(size_hint=(0.5, 0.9), pos_hint={'x': 0.5, 'y': 0.2})

        label1 = Label(
            size_hint=(0.3, 0.1),
            pos_hint={
                "x": 0,
                "y": 0
            },
            text=
            "Wrong conversion? Type in correct capital letters comma separated and train"
        )
        label1.bind(width=lambda *x: label1.setter('text_size')
                    (label1, (label1.width, None)),
                    texture_size=lambda *x: label1.setter('height')
                    (label1, label1.texture_size[1]))

        self.inp_txt = TextInput(size_hint=(0.4, 0.1),
                                 pos_hint={
                                     "x": 0.3,
                                     "y": 0
                                 })
        self.train_btn = Button(size_hint=(0.3, 0.1),
                                pos_hint={
                                    "x": 0.7,
                                    "y": 0
                                },
                                text="Train",
                                disabled=True)
        self.train_btn.bind(on_release=self.train)

        parent.add_widget(self.draw)
        parent.add_widget(self.label)
        parent.add_widget(clear_btn)
        parent.add_widget(convert_btn)
        parent.add_widget(label1)
        parent.add_widget(self.inp_txt)
        parent.add_widget(self.train_btn)

        return parent
Exemple #6
0
    def __init__(self, goBack, **kwargs):
        super(Config, self).__init__(**kwargs)
        self.goBack = goBack
        label_size = 30
        label_hint_x = 0.5

        self.video_width = VIDEO_WIDTH
        self.video_height = VIDEO_HEIGHT
        self.camera_device = CAMERA_DEVICE

        self.detector_index = 3  # Using BRISK as default value
        self.setDetector()

        # Creating the Detector Dropdown
        detectorLabel = Label(text='Choose the detection algorithm:',
                              font_size=label_size,
                              size_hint=(label_hint_x, 0.1))
        self.detector_dropdown = DropDown(color=(1, 1, 1, 1))
        for index, algo in enumerate(ALGOS_LIST):
            btn = Button(text='%s' % algo, size_hint_y=None, height=44)
            btn.bind(on_release=self.setDetectorDropdown)
            self.detector_dropdown.add_widget(btn)

        mainbutton = Button(text=ALGOS_LIST[self.detector_index],
                            size_hint=(label_hint_x, .1))
        mainbutton.bind(on_release=self.detector_dropdown.open)
        self.detector_dropdown.bind(
            on_select=lambda instance, x: setattr(mainbutton, 'text', x))

        # Creating the min number of matches config
        matchesLabel = Label(text='Minimum number of matches:',
                             font_size=label_size,
                             size_hint=(label_hint_x, 0.1))
        self.minMatches = TextInput(text=str(MIN_MATCH_COUNT),
                                    multiline=False,
                                    input_filter='int',
                                    font_size=label_size,
                                    background_color=[.9, .9, .9, .9],
                                    padding=10,
                                    size_hint=(0.5, 0.1))

        # Creating the good match distance config
        distanceLabel = Label(text='Good match distance:',
                              font_size=label_size,
                              size_hint=(label_hint_x, 0.1))
        self.distance = TextInput(text=str(MATCH_DISTANCE),
                                  multiline=False,
                                  input_filter='float',
                                  font_size=label_size,
                                  background_color=[.9, .9, .9, .9],
                                  padding=10,
                                  size_hint=(0.5, 0.1))

        # Creating the play audio(TTS) checkbox config
        self.playAudio = False
        audioLabel = Label(text='Enable TTS (Audio):',
                           font_size=label_size,
                           size_hint=(label_hint_x, 0.1))
        checkbox_audio = CheckBox(value=self.playAudio,
                                  color=(1, 1, 1, 1),
                                  size_hint=(.5, 0.1))
        checkbox_audio.bind(active=self.setAudio)

        # Creating the show center circles config
        self.showCenterCircles = False
        circlesLabel = Label(text='Show centered circles:',
                             font_size=label_size,
                             size_hint=(label_hint_x, 0.1))
        checkbox_circles = CheckBox(value=self.showCenterCircles,
                                    color=(1, 1, 1, 1),
                                    size_hint=(.5, 0.1))
        checkbox_circles.bind(active=self.setCircles)

        # Creating the button for clearing all the objetcs (images) from the obj folder
        btn_clear = Button(text='Clear Objects',
                           font_size=30,
                           background_normal='',
                           background_color=[.8, .2, .2, 1],
                           size_hint=(1, 0.1))
        btn_clear.bind(on_press=self.btnclear)

        # Creating the go back to menu button
        btn_back = Button(text='Back to Menu',
                          font_size=30,
                          background_normal='',
                          background_color=[.5, .2, .2, 1],
                          size_hint=(1, 0.1))
        btn_back.bind(on_press=self.btnquit)

        # Adding every widget to the layout
        config_area = StackLayout(size_hint=(1, .8))
        config_area.add_widget(detectorLabel)
        config_area.add_widget(mainbutton)
        config_area.add_widget(matchesLabel)
        config_area.add_widget(self.minMatches)
        config_area.add_widget(distanceLabel)
        config_area.add_widget(self.distance)
        config_area.add_widget(audioLabel)
        config_area.add_widget(checkbox_audio)
        config_area.add_widget(circlesLabel)
        config_area.add_widget(checkbox_circles)

        self.add_widget(config_area)
        self.add_widget(btn_clear)
        self.add_widget(btn_back)

        self.orientation = 'vertical'
        with self.canvas.before:
            Color(.1, .2, .9, .3)
            Rectangle(size=Window.size)
    def rebuild_set(self, instance):
        try:
            self.clear_all()
            global do_par, di_par, ai_par, hr_par, send_info
            b2 = BoxLayout(orientation='vertical')
            b3 = BoxLayout(orientation='horizontal', size_hint=(1, 0.08))

            g1 = GridLayout(cols=2,
                            spacing=30,
                            padding=25,
                            size_hint=(1, .175))
            g2 = GridLayout(cols=2,
                            spacing=30,
                            padding=25,
                            size_hint=(1, .175))
            g3 = GridLayout(cols=2,
                            spacing=30,
                            padding=25,
                            size_hint=(1, .175))
            g4 = GridLayout(cols=2,
                            spacing=30,
                            padding=25,
                            size_hint=(1, .175))

            g1.add_widget(
                Label(text='Количество',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.do_num = (TextInput(text=do_par.split(', ')[2],
                                     multiline=False,
                                     font_size=20))
            g1.add_widget(self.do_num)
            g1.add_widget(
                Label(text='Адрес',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.do_adr = (TextInput(text=do_par.split(', ')[1],
                                     multiline=False,
                                     font_size=20))
            g1.add_widget(self.do_adr)

            g2.add_widget(
                Label(text='Количество',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.di_num = (TextInput(text=di_par.split(', ')[2],
                                     multiline=False,
                                     font_size=20))
            g2.add_widget(self.di_num)
            g2.add_widget(
                Label(text='Адрес',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.di_adr = (TextInput(text=di_par.split(', ')[1],
                                     multiline=False,
                                     font_size=20))
            g2.add_widget(self.di_adr)

            g3.add_widget(
                Label(text='Количество',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.ai_num = (TextInput(text=ai_par.split(', ')[2],
                                     multiline=False,
                                     font_size=20))
            g3.add_widget(self.ai_num)
            g3.add_widget(
                Label(text='Адрес',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.ai_adr = (TextInput(text=ai_par.split(', ')[1],
                                     multiline=False,
                                     font_size=20))
            g3.add_widget(self.ai_adr)

            g4.add_widget(
                Label(text='Количество',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.hr_num = (TextInput(text=hr_par.split(', ')[2],
                                     multiline=False,
                                     font_size=20))
            g4.add_widget(self.hr_num)
            g4.add_widget(
                Label(text='Адрес',
                      font_size=20,
                      halign='left',
                      size_hint=(.2, .1),
                      color=[0, 0, 0, 1]))
            self.hr_adr = (TextInput(text=hr_par.split(', ')[1],
                                     multiline=False,
                                     font_size=20))
            g4.add_widget(self.hr_adr)

            but_back = Button(on_release=self.save_set,
                              font_size=24,
                              background_color=[0, 0.6, 0, 1],
                              background_normal='',
                              size_hint=(0.2, 1))
            I1 = Image(source='E:\images\menu2.png')
            but_back.add_widget(I1)
            b3.add_widget(but_back)
            b3.add_widget(
                Button(text='Настройки',
                       bold=True,
                       font_size=28,
                       background_color=[0, 0.6, 0, 1],
                       background_normal='',
                       background_down=''))
            b3.add_widget(
                Button(font_size=28,
                       background_color=[0, 0.6, 0, 1],
                       background_normal='',
                       background_down='',
                       size_hint=(0.2, 1)))

            b2.add_widget(b3)
            b2.add_widget(
                Label(text='Цифровые выходы:',
                      font_size=24,
                      halign='center',
                      size_hint=(1, 0.05),
                      color=[0, 0, 0, 1]))
            b2.add_widget(g1)
            b2.add_widget(
                Label(text='Цифровые входы:',
                      font_size=24,
                      halign='center',
                      size_hint=(1, 0.05),
                      color=[0, 0, 0, 1]))
            b2.add_widget(g2)
            b2.add_widget(
                Label(text='Аналоговые входы:',
                      font_size=24,
                      halign='center',
                      size_hint=(1, 0.05),
                      color=[0, 0, 0, 1]))
            b2.add_widget(g3)
            b2.add_widget(
                Label(text='Регистры временного хранения информации:',
                      font_size=24,
                      halign='center',
                      size_hint=(1, 0.05),
                      color=[0, 0, 0, 1]))
            b2.add_widget(g4)

            I1.x = 0 - I1.width * 0.125
            I1.y = Window.height - I1.height * 0.9
            self.root.add_widget(b2)
        finally:
            pass
Exemple #8
0
 def build(self):
     return TextInput(text=text)
Exemple #9
0
    def build(self):
        self.stack = backend.Stack("SOMESTACK")
        self.active_cell = None

        self.title = "Cam Flow"

        self.left = BoxLayout(
            orientation="vertical",
            size_hint=(0.6, 1),
        )
        self.spacing = BoxLayout(
            orientation="vertical",
            size_hint=(0.1, 1),
        )

        self.stack_input = TextInput(
            text=self.stack.name,
            multiline=False,
            on_text_validate=self._new_stack,
            size_hint=(1, 0.1),
        )
        self.stack_input.cursor_color = (1, 1, 1, 1)
        self.stack_input.selection_color = (.5, .5, 1, .2)
        self.stack_input.foreground_color = (1, 1, 1, 1)
        self.stack_input.background_color = (0.2, 0.2, 0.2, 0.8)
        self.stack_input.halign = 'center'

        self.matrix = GridLayout(
            rows=12,
            cols=8,
            spacing=3,
        )

        self.left.add_widget(self.stack_input)
        self.left.add_widget(self.matrix)

        self.main = BoxLayout(spacing=0, orientation="horizontal")
        self.instructions = BoxLayout(
            orientation="vertical",
            spacing=20,
        )

        self._make_matrix()
        self._make_instructions()
        self.select_cell(CamApp.INITIAL_CELL)(
            self.cell_buttons[CamApp.INITIAL_CELL])
        self._make_paths()

        self.main.add_widget(self.left)
        self.main.add_widget(self.spacing)
        self.main.add_widget(self.instructions)

        self._keyboard = Window.request_keyboard(self._keyboard_closed,
                                                 self.matrix, "text")
        self._keyboard.bind(on_key_down=self._on_keyboard_down)

        updates_pr_second = 2
        Clock.schedule_interval(self.update, 1.0 / updates_pr_second)

        Window.size = (1000, 500)
        Window.clearcolor = (.1, .1, .1, .5)

        self.popup = loginPopup.LoginPopup()
        self.popup.bind(on_dismiss=self.popup_dissmiss)

        return self.main
    def __init__(self, **kwargs):
        """
        Widget contenant le formulaire d'enregistrement à l'application

        :param kwargs: Arguments clé/valeur de la classe parente
        """

        self.register_event_type("on_sign_up")
        self.register_event_type("on_back")
        super(SignUpFormWidget, self).__init__((0.7, 0.7, 0.7), **kwargs)

        # ===================== Attributs graphiques ====================== #

        # -------------------------- Les Labels --------------------------- #

        self.usernameLabel = Label(text="Username",
                                   size_hint=(.25, .14),
                                   pos_hint={
                                       'x': .1,
                                       'y': .84
                                   })

        self.passwordLabel = Label(text="Password",
                                   size_hint=(.25, .14),
                                   pos_hint={
                                       'x': .1,
                                       'y': .7
                                   })

        self.firstNameLabel = Label(text="First name",
                                    size_hint=(.25, .14),
                                    pos_hint={
                                        'x': .1,
                                        'y': .56
                                    })

        self.lastNameLabel = Label(text="Last name",
                                   size_hint=(.25, .14),
                                   pos_hint={
                                       'x': .1,
                                       'y': .42
                                   })

        self.emailLabel = Label(text="E-mail",
                                size_hint=(.25, .14),
                                pos_hint={
                                    'x': .1,
                                    'y': .28
                                })

        # ------------------------ Les TextInputs ------------------------- #

        self.usernameTextInput = TextInput(multiline=False,
                                           size_hint=(.55, .1),
                                           pos_hint={
                                               'x': .35,
                                               'y': .86
                                           })

        self.passwordTextInput = TextInput(multiline=False,
                                           password=True,
                                           size_hint=(.55, .1),
                                           pos_hint={
                                               'x': .35,
                                               'y': .72
                                           })

        self.firstNameTextInput = TextInput(multiline=False,
                                            size_hint=(.55, .1),
                                            pos_hint={
                                                'x': .35,
                                                'y': .58
                                            })

        self.lastNameTextInput = TextInput(multiline=False,
                                           size_hint=(.55, .1),
                                           pos_hint={
                                               'x': .35,
                                               'y': .44
                                           })

        self.emailTextInput = TextInput(multiline=False,
                                        size_hint=(.55, .1),
                                        pos_hint={
                                            'x': .35,
                                            'y': .3
                                        })

        # -------------------------- Les Buttons -------------------------- #

        self.signUpButton = Button(text="Sign up",
                                   size_hint=(.8, .1),
                                   pos_hint={
                                       'x': .1,
                                       'y': .16
                                   })
        self.signUpButton.bind(on_release=self.handleSignUpButton)

        self.backButton = Button(text="Back",
                                 size_hint=(.8, .1),
                                 pos_hint={
                                     'x': .1,
                                     'y': .04
                                 })
        self.backButton.bind(on_release=self.handleBackButton)

        self.add_widget(self.usernameLabel)
        self.add_widget(self.passwordLabel)
        self.add_widget(self.firstNameLabel)
        self.add_widget(self.lastNameLabel)
        self.add_widget(self.emailLabel)
        self.add_widget(self.usernameTextInput)
        self.add_widget(self.passwordTextInput)
        self.add_widget(self.firstNameTextInput)
        self.add_widget(self.lastNameTextInput)
        self.add_widget(self.emailTextInput)
        self.add_widget(self.signUpButton)
        self.add_widget(self.backButton)
Exemple #11
0
    def iniL(self, h1b1):
        mm = {}
        l = Label(text='ip')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['ip'] = ipIn
        self.ip = ipIn

        l = Label(text='port')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['port'] = ipIn
        self.port = ipIn

        l = Label(text='key')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['key'] = ipIn
        self.key = ipIn

        l = Label(text='Tout')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['Tout'] = ipIn
        self.Tout = ipIn

        l = Label(text='listen')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['listen'] = ipIn
        self.listen = ipIn

        l = Label(text='LGot')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)

        mm['LGot'] = ipIn
        self.LGot = ipIn

        l = Label(text='MPort')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['MPort'] = ipIn
        self.MPort = ipIn

        l = Label(text='LPort')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['LPort'] = ipIn
        self.LPort = ipIn

        l = Label(text='IDose')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['IDose'] = ipIn
        self.IDose = ipIn

        l = Label(text='DDose')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['DDose'] = ipIn
        self.DDose = ipIn

        l = Label(text='LRate')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['LRate'] = ipIn
        self.LRate = ipIn

        l = Label(text='MRate')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['MRate'] = ipIn
        self.MRate = ipIn

        l = Label(text='Ahead')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['Ahead'] = ipIn
        self.Ahead = ipIn

        l = Label(text='size')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['size'] = ipIn
        self.size = ipIn

        l = Label(text='span')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['span'] = ipIn
        self.span = ipIn

        l = Label(text='limit')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['limit'] = ipIn
        self.limit = ipIn

        l = Label(text='speed')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['speed'] = ipIn
        self.speed = ipIn

        l = Label(text='ONum')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['ONum'] = ipIn
        self.ONum = ipIn

        l = Label(text='dose2')
        ipIn = TextInput()
        lih1 = BoxLayout(orientation="horizontal")
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        mm['dose2'] = ipIn
        self.dose2 = ipIn

        l = Label(text='close')
        ipIn = TextInput()
        lih1.add_widget(l)
        lih1.add_widget(ipIn)
        h1b1.add_widget(lih1)
        mm['close'] = ipIn
        self.close = ipIn
        return mm
Exemple #12
0
    def set_content(self, instance_content_dialog):
        def _events_callback(result_press):
            self.dismiss()
            if result_press:
                self.events_callback(result_press)

        if self.device_ios:  # create buttons for iOS
            self.background = self._background

            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = TextInput(
                    size_hint=(1, None),
                    multiline=False,
                    height=dp(33),
                    cursor_color=self.theme_cls.primary_color,
                    hint_text=instance_content_dialog.hint_text,
                    background_normal='{}ios_entr_ti.png'.format(images_path),
                    background_active='{}ios_entr_ti.png'.format(images_path))
                instance_content_dialog.ids.box_input.height = dp(33)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)

            if self.text_button_cancel != '':
                anchor = 'left'
            else:
                anchor = 'center'
            box_button_ok = AnchorLayout(anchor_x=anchor)
            box_button_ok.add_widget(
                MDTextButton(text=self.text_button_ok,
                             font_size='18sp',
                             on_release=lambda x: _events_callback(
                                 self.text_button_ok)))
            instance_content_dialog.ids.box_buttons.add_widget(box_button_ok)

            if self.text_button_cancel != '':
                box_button_ok.anchor_x = 'left'
                box_button_cancel = AnchorLayout(anchor_x='right')
                box_button_cancel.add_widget(
                    MDTextButton(text=self.text_button_cancel,
                                 font_size='18sp',
                                 on_release=lambda x: _events_callback(
                                     self.text_button_cancel)))
                instance_content_dialog.ids.box_buttons.add_widget(
                    box_button_cancel)

        else:  # create buttons for Android
            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextField(
                    size_hint=(1, None),
                    height=dp(48),
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(48)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)
                instance_content_dialog.ids.box_buttons.remove_widget(
                    instance_content_dialog.ids.sep)

            box_buttons = AnchorLayout(anchor_x='right',
                                       size_hint_y=None,
                                       height=dp(30))
            box = BoxLayout(size_hint_x=None, spacing=dp(5))
            box.bind(minimum_width=box.setter('width'))
            button_ok = MDRaisedButton(
                text=self.text_button_ok,
                on_release=lambda x: _events_callback(self.text_button_ok))
            box.add_widget(button_ok)

            if self.text_button_cancel != '':
                button_cancel = MDFlatButton(
                    text=self.text_button_cancel,
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    on_release=lambda x: _events_callback(self.
                                                          text_button_cancel))
                box.add_widget(button_cancel)

            box_buttons.add_widget(box)
            instance_content_dialog.ids.box_buttons.add_widget(box_buttons)
            instance_content_dialog.ids.box_buttons.height = button_ok.height
            instance_content_dialog.remove_widget(
                instance_content_dialog.ids.sep)
Exemple #13
0
    def verificar(self, *args):
        global su, tempo, nome

        # Lista de ids dos ToggleButtons
        lista_ids = self.ids.keys()
        lista_ids2 = []
        for i in lista_ids:
            if i[0] == 'l':
                tg = cint(self.ids[i].text)
                lista_ids2.append(tg)

        # Armazenando para verificar
        lista_completa = [
            lista_ids2[0:9],
            lista_ids2[9:18],
            lista_ids2[18:27],
            lista_ids2[27:36],
            lista_ids2[36:45],
            lista_ids2[45:54],
            lista_ids2[54:63],
            lista_ids2[63:72],
            lista_ids2[72:81]]

        verificar = verificar_sudoku(lista_completa)

        if verificar == True:
            boxvv = BoxLayout(
                orientation='vertical')

            self.vv = Popup(
                title='',
                background_color=(0.133, 0.454, 0.647, 1),
                content=boxvv,
                size_hint=(None, None),
                size=('250sp', '120sp'))

            voce_venceu = Label(
                text='VOCÊ VENCEU!!!',
                color=(0.913, 0.945, 0.968, 1),
                font_size=25)

            tempo_final = Label(
                color=(0.913, 0.945, 0.968, 1),
                text=str(tempo))

            nome = TextInput(
                text='Seu Nome',
                size_hint=(3, 1.2),
                multiline=False)

            bnome = Button(
                text='Enviar',
                color=(0.913, 0.945, 0.968, 1),
                background_color=(0.133, 0.454, 0.647, 1),
                on_release=self.verificar_nome)

            boxnome = BoxLayout()

            boxnome.add_widget(nome)
            boxnome.add_widget(bnome)
            boxvv.add_widget(voce_venceu)
            boxvv.add_widget(tempo_final)
            boxvv.add_widget(boxnome)

            self.cronometro.cancel()
            self.vv.open()
        else:
            boxin = BoxLayout(
                orientation='vertical')

            vp = Popup(
                title='',
                background_color=(0.133, 0.454, 0.647, 1),
                content=boxin,
                size_hint=(None, None),
                size=('250sp', '120sp'))

            incom = Label(
                text='Sudoku Incompleto',
                color=(0.913, 0.945, 0.968, 1))

            ok = Button(
                text='Ok, continuar',
                color=(0.913, 0.945, 0.968, 1),
                background_color=(0.133, 0.454, 0.647, 1),
                on_release=vp.dismiss)

            boxin.add_widget(incom)
            boxin.add_widget(ok)
            vp.open()
Exemple #14
0
    def build(self):

        self.mainFrame = PageLayout()
        self.page1BL = BoxLayout()
        self.page2BL = BoxLayout()

        #################### PAGE 1 ################################
        self.mainFramePG1 = FloatLayout(
        )  # Elemanların hepsini tutan ana pencere düzenimiz

        self.login = BoxLayout()
        self.quit = BoxLayout()

        self.login_buton = Button(background_color=(.6, .4, .8, 1),
                                  text="Login",
                                  size_hint=(.2, .1),
                                  pos_hint={
                                      'x': .2,
                                      'y': .44
                                  })
        self.quit_buton = Button(background_color=(.6, .4, .8, 1),
                                 text="Quit",
                                 size_hint=(.2, .1),
                                 pos_hint={
                                     'x': .2,
                                     'y': .56
                                 })

        # Şimdi hepsini ana düzene yerleştiriyoruz

        self.mainFramePG1.add_widget(self.login)
        self.mainFramePG1.add_widget(self.quit)
        self.mainFramePG1.add_widget(self.login_buton)
        self.mainFramePG1.add_widget(self.quit_buton)

        ################## PAGE 2 ##############################

        self.mainFramePG2 = BoxLayout(
            orientation="vertical",
            size_hint=(.5, .25),
            pos_hint={
                'x': .15,
                'y': .4
            })  # Elemanların hepsini tutan ana pencere düzenimiz

        self.user = BoxLayout()
        self.password = BoxLayout()
        self.login = BoxLayout()

        self.userLabel = Label(text="Username", size_hint=(.4, .95))
        self.userInput = TextInput(size_hint=(.6, .95))

        self.user.add_widget(self.userLabel)
        self.user.add_widget(self.userInput)

        self.passwordLabel = Label(text="Password", size_hint=(.4, .95))
        self.passwordInput = TextInput(size_hint=(.6, .95))

        self.password.add_widget(self.passwordLabel)
        self.password.add_widget(self.passwordInput)

        self.loginLabel = Label(size_hint=(.4, .9))
        self.login_buton = Button(background_color=(.6, .4, .8, 1),
                                  text="Login",
                                  size_hint=(.6, .9))
        self.login.add_widget(self.loginLabel)
        self.login.add_widget(self.login_buton)

        # Şimdi hepsini ana düzene yerleştiriyoruz

        self.mainFramePG2.add_widget(self.user)
        self.mainFramePG2.add_widget(self.password)
        self.mainFramePG2.add_widget(self.login)

        self.page1BL.add_widget(self.mainFramePG1)
        self.page2BL.add_widget(self.mainFramePG2)
        self.mainFrame.add_widget(self.page1BL)
        self.mainFrame.add_widget(self.page2BL)

        return self.mainFrame
Exemple #15
0
 def test_focusable_when_disabled(self):
     ti = TextInput()
     ti.disabled = True
     ti.focused = True
     ti.bind(focus=self.on_focused)
 def __init__(self, **kwargs):
     super(LoginScreen, self).__init__(**kwargs)
     self.cols = 2
     self.add_widget(Label(text="Username:"))
     self.username = TextInput(multiline=False)
     self.add_widget(self.username)
Exemple #17
0
if __name__ == '__main__':

    root = FloatLayout()

    # create a button to release everything
    def release_all_keyboard(*l):
        Window.release_all_keyboards()

    btn = Button(text='Release\nall\nkeyboards',
                 size_hint=(None, None),
                 halign='center')
    btn.bind(on_release=release_all_keyboard)
    root.add_widget(btn)

    # show current configuration
    lbl = 'Configuration keyboard_mode is %r, keyboard_layout is %r' % (
        Config.get('kivy',
                   'keyboard_mode'), Config.get('kivy', 'keyboard_layout'))
    label = Label(text=lbl, size_hint_y=None, height=50, pos_hint={'top': 1})
    root.add_widget(label)

    s = Scatter(size_hint=(None, None), pos=(300, 300))
    s.add_widget(TextInput(size_hint=(None, None), size=(100, 50)))
    root.add_widget(s)

    s = Scatter(size_hint=(None, None), pos=(400, 300), rotation=45)
    s.add_widget(TextInput(size_hint=(None, None), size=(100, 50)))
    root.add_widget(s)

runTouchApp(root)
Exemple #18
0
 def build(self):
     return TextInput()
    def __init__(self, *args):
        super().__init__(*args)
        self.t = TextInput(font_size=60,
                           hint_text="Enter the values here",
                           text="",
                           size_hint=(1, 0.1),
                           pos_hint={
                               'x': 0,
                               'y': 0.9
                           })
        self.add_widget(self.t)

        self.b2 = Button(font_size=60,
                         text="Del",
                         size_hint=(0.25, 0.2),
                         pos_hint={
                             'x': 0.75,
                             'y': 0.7
                         },
                         background_color=(0, 0, 0, 1))
        self.add_widget(self.b2)
        self.b2.bind(on_press=self.s)

        b1list = [
            "sin", "cos", "tan", "pow", "%", "(", ")", "log", "pi", "sqrt"
        ]
        p = 0
        q = 0.8
        m = 0

        for i in range(len(b1list)):
            self.b = Button(font_size=60,
                            text=b1list[i],
                            background_color=(0, 0, 0, 1),
                            size_hint=(0.15, 0.10),
                            pos_hint={
                                'x': p,
                                'y': q
                            })
            self.add_widget(self.b)
            p = p + 0.15
            if p == 0.75:
                q = q - 0.10
                p = 0

            self.b.bind(on_press=self.s)

        blist = [
            "7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "+", ".",
            "0", ",", "-"
        ]
        x = 0
        y = 0.55
        n = 0

        for i in range(len(blist)):
            self.b = Button(color=(1, 1, 1, 1),
                            font_size=80,
                            text=blist[i],
                            background_color=(0, 0, 0, 1),
                            size_hint=(0.25, 0.15),
                            pos_hint={
                                'x': x,
                                'y': y
                            })
            self.add_widget(self.b)
            x = x + 0.25
            if x == 1:
                y = y - 0.15
                x = 0

            self.b.bind(on_press=self.s)

        self.equal = Button(font_size=60,
                            text="Equal",
                            background_color=(0, 0, 0, 1),
                            size_hint=(0.75, 0.1),
                            pos_hint={
                                'x': 0.25,
                                'y': 0
                            })
        self.add_widget(self.equal)
        self.equal.bind(on_press=self.s)

        self.clear = Button(font_size=60,
                            text="Clear",
                            background_color=(0, 0, 0, 1),
                            size_hint=(0.25, 0.1),
                            pos_hint={
                                'x': 0,
                                'y': 0
                            })
        self.add_widget(self.clear)
        self.clear.bind(on_press=self.s)
def build():
    return TextInput(text="textinput test")
Exemple #21
0
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput

from kivy.core.window import Window

text_input = TextInput(text='Teste')
button = Button(text='Click aqui')


def click():
    print(text_input.text)


def build():
    layout = FloatLayout()

    text_input.size_hint = None, None
    text_input.height = 300
    text_input.width = 400
    text_input.x = 60
    text_input.y = 250
    layout.add_widget(text_input)

    button.size_hint = None, None
    button.height = 50
    button.width = 200
    button.x = 150
    button.y = 170
    button.on_press = click
 def build(self):
     self.log_text = TextInput(multiline=True, text="Starting\n")
     self.log_text.insert_text("Hello World!")
     return self.log_text
Exemple #23
0
    def __init__(self, mainwi, data_id, **kwars):
        super(inscribirequipo, self).__init__()
        self.mainwi = mainwi
        self.data_id = data_id
        conn = mysql.connector.connect(host="167.250.49.138",
                                       user="******",
                                       passwd="civ6525639",
                                       port="3306",
                                       database="laliga")
        cursor = conn.cursor()
        q = "SELECT Nombre FROM torneos WHERE ID="
        cursor.execute(q + self.data_id)
        for x in cursor:
            titulo = Label(text="Torneo: [b][color=000000]%s" % x[0],
                           markup=True)
            self.ids.container4.add_widget(titulo)
        conn.close()
        caja = BoxLayout(orientation="horizontal")
        regis = Label(text="[color=000000][b]EQUIPOS REGISTRADOS", markup=True)
        self.ids.container4.add_widget(regis)
        equipol = Label(text="Nombre del equipo")
        self.equipoti = TextInput(
            hint_text="Indique el nombre del equipo a inscribir")
        caja.add_widget(equipol)
        caja.add_widget(self.equipoti)
        self.ids.container4.add_widget(caja)
        #self.ids.container4.add_widget(equipol)
        #self.ids.container4.add_widget(equipoti)
        caja1 = BoxLayout(orientation="horizontal")
        equipo1l = Label(text="Preferencia Horaria")
        equipo1ti = TextInput(hint_text="¿En qué horario prefieren jugar?")
        self.breg = Button(text="Inscribirse")
        #self.ids.container4.add_widget(equipo1l)
        #self.ids.container4.add_widget(equipo1ti)
        caja1.add_widget(equipo1l)
        caja1.add_widget(equipo1ti)
        self.ids.container4.add_widget(caja1)
        self.ids.container4.add_widget(self.breg)
        self.breg.bind(on_press=lambda x: self.inscripcion_torneo())
        sepa = Label(text="")
        self.ids.container4.add_widget(sepa)

        equipon = Label(text="[color=000000][b]EQUIPOS NO REGISTRADOS",
                        markup=True)

        caja2 = BoxLayout(orientation="horizontal")
        self.ids.container4.add_widget(equipon)
        equipon1 = Label(text="Nombre del equipo")
        self.equipon1ti = TextInput(
            hint_text="Indique el nombre del equipo a registrar")
        caja2.add_widget(equipon1)
        caja2.add_widget(self.equipon1ti)
        self.ids.container4.add_widget(caja2)
        #self.ids.container4.add_widget(equipon1)
        #self.ids.container4.add_widget(self.equipon1ti)
        caja3 = BoxLayout(orientation="horizontal")
        equipon2 = Label(text="Nombre de DT\n   Capitana")
        self.equipon2ti = TextInput(
            hint_text="Indique director tecnico ó capitana")
        caja3.add_widget(equipon2)
        caja3.add_widget(self.equipon2ti)
        self.ids.container4.add_widget(caja3)
        #self.ids.container4.add_widget(equipon2)
        #self.ids.container4.add_widget(self.equipon2ti)
        caja4 = BoxLayout(orientation="horizontal")
        equipon3 = Label(text="Teléfono de contacto")
        self.equipon3ti = TextInput(
            hint_text="Indique incluyendo el código de area ejemplo: 1512345678"
        )
        caja4.add_widget(equipon3)
        caja4.add_widget(self.equipon3ti)
        self.ids.container4.add_widget(caja4)
        #self.ids.container4.add_widget(equipon3)
        #self.ids.container4.add_widget(self.equipon3ti)
        caja5 = BoxLayout(orientation="horizontal")
        equipon4 = Label(text="Zona de juego")
        self.equipon4ti = TextInput(
            hint_text="En que lugar practican (No obligatorio)")
        caja5.add_widget(equipon4)
        caja5.add_widget(self.equipon4ti)
        self.ids.container4.add_widget(caja5)
        #self.ids.container4.add_widget(equipon4)
        #self.ids.container4.add_widget(equipon4ti)
        equipon5 = Label(text="Preferencia Horaria")
        self.ids.container4.add_widget(equipon5)
        botonera = BoxLayout(orientation="horizontal")
        b1 = ToggleButton(text="9:00\n a \n12:00")
        botonera.add_widget(b1)
        b2 = ToggleButton(text="13:00\n a \n16:00")
        botonera.add_widget(b2)
        b3 = ToggleButton(text="16:00\n a \n17:00")
        botonera.add_widget(b3)
        b4 = ToggleButton(text="18:00\n a \n21:00")
        botonera.add_widget(b4)
        b5 = ToggleButton(text="22:00\n a \n00:00")
        botonera.add_widget(b5)
        self.b6 = Button(text="Registrar e inscribir")
        self.ids.container4.add_widget(botonera)
        self.ids.container4.add_widget(self.b6)
        self.b6.bind(on_release=lambda x: self.confirma_equipo_nuevo())
Exemple #24
0
class CategoryGrid(GridLayout):
    pass


sm = ScreenManager()
sm.add_widget(HomeScreen(name='home'))

### cart popup code ###
cartcontent = BoxLayout(orientation='vertical')
cartitems = GridLayout(cols=5)
cartcontent.add_widget(cartitems)

editpricebox = BoxLayout(size_hint_y=None, height=30)
cartcontent.add_widget(editpricebox)
priceinput = TextInput(text='0', multiline=False)
editpricebox.add_widget(priceinput)
plusbtn = Button(text='+')
plusbtn.bind(on_release=editprice)
editpricebox.add_widget(plusbtn)
minusbtn = Button(text='-')
minusbtn.bind(on_release=editprice)
editpricebox.add_widget(minusbtn)
editpricebox.add_widget(Label(text='Price Adjust:'))
discountlabel = Label(text='0')
editpricebox.add_widget(discountlabel)

cartbuttons = BoxLayout(size_hint_y=None, height=80)
cartcontent.add_widget(cartbuttons)
closecart = Button(text='Close Cart')
cartbuttons.add_widget(closecart)
Exemple #25
0
    def build(self):
        self.random_word = getRandomWord()
        self.count_attempts = 0
        self.count_corrects = 0
        self.max_attempts = 6

        b = BoxLayout(orientation='vertical')
        t = TextInput(text='',
                      font_size=150,
                      size_hint_y=None,
                      height=200,
                      multiline=False)
        f = FloatLayout()
        s = Scatter()
        l = Label(text='', font_size=70)
        l.color = (1, 0, 0, 1)

        b.add_widget(t)
        b.add_widget(l)

        b2 = BoxLayout(orientation='vertical')
        l2 = Label(text='What word?', font_size=100)
        b2.add_widget(l2)

        b.add_widget(b2)

        self.found_letters = []
        for i in range(0, len(self.random_word)):
            self.found_letters.append('_')

        self.found_str = "".join(self.found_letters)

        l.text = self.found_str

        def callback(instance, value):
            self.random_word = getRandomWord()
            self.count_attempts = 0
            self.count_corrects = 0
            self.found_letters = []
            for i in range(0, len(self.random_word)):
                self.found_letters.append('_')

            self.found_str = "".join(self.found_letters)
            l.text = self.found_str
            t.text = ''

        restart_button = Button(text='Restart?')
        restart_button.bind(state=callback)
        b.add_widget(restart_button)

        def on_text(instance, value):
            if (len(t.text) > 0):
                letter = t.text[-1]
                if letter not in self.random_word:
                    self.count_attempts += 1
                    l2.text = str(self.count_attempts)

                else:
                    for i in range(0, len(self.random_word)):
                        if self.random_word[i] == letter:
                            self.found_letters[i] = letter
                            self.count_corrects += 1

                    self.found_str = "".join(self.found_letters)
                    l.text = self.found_str

                if (self.count_corrects == len(self.random_word)):
                    l.font_size = 20
                    l.text = f"Congratulation you won! The word is {self.random_word}"

                if (self.count_attempts == self.max_attempts):
                    l2.font_size = 20
                    l2.text = f"Game Over the correct answer was {self.random_word}"

        t.bind(text=on_text)
        return b
Exemple #26
0
    def __init__(self, **kwargs):
        super(Form, self).__init__(**kwargs)
        self.ools = 2

        self.username = TextInput(multiline=False)
        self.add_widget(self.username)
Exemple #27
0
    def show_property(self, instance, value, key=None, index=-1, *l):
        # normal call: (tree node, focus, )
        # nested call: (widget, prop value, prop key, index in dict/list)
        if value is False:
            return

        content = None
        if key is None:
            # normal call
            nested = False
            widget = instance.widget
            key = instance.key
            prop = widget.property(key)
            value = getattr(widget, key)
        else:
            # nested call, we might edit subvalue
            nested = True
            widget = instance
            prop = None

        dtype = None

        if isinstance(prop, AliasProperty) or nested:
            # trying to resolve type dynamicly
            if type(value) in (str, str):
                dtype = 'string'
            elif type(value) in (int, float):
                dtype = 'numeric'
            elif type(value) in (tuple, list):
                dtype = 'list'

        if isinstance(prop, NumericProperty) or dtype == 'numeric':
            content = TextInput(text=str(value) or '', multiline=False)
            content.bind(
                text=partial(self.save_property_numeric, widget, key, index))
        elif isinstance(prop, StringProperty) or dtype == 'string':
            content = TextInput(text=value or '', multiline=True)
            content.bind(
                text=partial(self.save_property_text, widget, key, index))
        elif (isinstance(prop, ListProperty)
              or isinstance(prop, ReferenceListProperty)
              or isinstance(prop, VariableListProperty) or dtype == 'list'):
            content = GridLayout(cols=1, size_hint_y=None)
            content.bind(minimum_height=content.setter('height'))
            for i, item in enumerate(value):
                button = Button(text=repr(item), size_hint_y=None, height=44)
                if isinstance(item, Widget):
                    button.bind(
                        on_release=partial(self.highlight_widget, item, False))
                else:
                    button.bind(on_release=partial(self.show_property, widget,
                                                   item, key, i))
                content.add_widget(button)
        elif isinstance(prop, OptionProperty):
            content = GridLayout(cols=1, size_hint_y=None)
            content.bind(minimum_height=content.setter('height'))
            for option in prop.options:
                button = ToggleButton(
                    text=option,
                    state='down' if option == value else 'normal',
                    group=repr(content.uid),
                    size_hint_y=None,
                    height=44)
                button.bind(
                    on_press=partial(self.save_property_option, widget, key))
                content.add_widget(button)
        elif isinstance(prop, ObjectProperty):
            if isinstance(value, Widget):
                content = Button(text=repr(value))
                content.bind(on_release=partial(self.highlight_widget, value))
            elif isinstance(value, Texture):
                content = Image(texture=value)
            else:
                content = Label(text=repr(value))

        elif isinstance(prop, BooleanProperty):
            state = 'down' if value else 'normal'
            content = ToggleButton(text=key, state=state)
            content.bind(on_release=partial(self.save_property_boolean, widget,
                                            key, index))

        self.content.clear_widgets()
        if content:
            self.content.add_widget(content)
Exemple #28
0
                    Logger.debug('Shell Console: err:' + err.strerror +
                                 ' directory:' + command[3:])
                    add_to_cache(u''.join((err.strerror, '\n')))
            add_to_cache(u''.join((txtinput_command_line.text, '\n')))
            txtinput_command_line.text = self.prompt()
            self.txtinput_command_line_refocus = True
            return

        txtinput_command_line.text = self.prompt()
        # store output in textcache
        parent = txtinput_command_line.parent
        # disable running a new command while and old one is running
        parent.remove_widget(txtinput_command_line)
        # add widget for interaction with the running command
        txtinput_run_command = TextInput(multiline=False,
                                         font_size=self.font_size,
                                         font_name=self.font_name)

        def interact_with_command(*l):
            popen_obj = self.popen_obj
            if not popen_obj:
                return
            txt = l[0].text + u'\n'
            popen_obj_stdin = popen_obj.stdin
            popen_obj_stdin.write(txt.encode('utf-8'))
            popen_obj_stdin.flush()
            self.txtinput_run_command_refocus = True

        self.txtinput_run_command_refocus = False
        txtinput_run_command.bind(on_text_validate=interact_with_command)
        txtinput_run_command.bind(focus=self.on_focus)
    def __init__(self, *args, **kwargs):
        super(LayoutSettingsScreen, self).__init__(*args, **kwargs)

        self.rows = 11
        self.cols = 2

        #switches
        self.SaveDetectedPlasticImageSwitchLabel = Label(text = 'Save image with detected plastic for each picture: ')
        self.SaveDetectedPlasticImageSwitch = Switch(active = True)
        self.SaveDetectedPlasticImageSwitch.bind(active = self.TurnSaveDetectedPlasticImageOn)

        self.SaveBilateralfilterImageSwitchLabel = Label(text = 'Save image with bilateral filter for each picture: ')
        self.SaveBilateralfilterImageSwitch = Switch(active = True)
        self.SaveBilateralfilterImageSwitch.bind(active = self.TurnSaveBilateralfilterImageOn)

        self.WriteDataToTXTfileSwitchLabel = Label(text = 'Write data to .txt file: ')
        self.WriteDatatoTXTfileSwitch = Switch(active = True)
        self.WriteDatatoTXTfileSwitch.bind(active = self.WriteDataToTXTfile)

        #integer textinput
        self.InputBeltValueLabel = Label(text = 'Set the value of the belt in \n"value/brightness" from HSV: ')
        self.InputBeltValue = TextInput(text = '{}'.format(detection.BeltValue), multiline = False, input_filter = 'float')
        self.InputBeltValue.bind(text = self.SetBeltValue)

        self.InputBlackValueLabel = Label(text = 'Set the value of the color black in "\nvalue/brightness" from HSV: ')
        self.InputBlackValue = TextInput(text = '{}'.format(detection.BlackValue), multiline = False, input_filter = 'float')
        self.InputBlackValue.bind(text = self.SetBlackValue)

        self.InputWhiteValueLabel = Label(text = 'Set the value of the color white in \n"value/brightness" from HSV: ')
        self.InputWhiteValue = TextInput(text = '{}'.format(detection.WhiteValue), multiline = False, input_filter = 'float')
        self.InputWhiteValue.bind(text = self.SetWhiteValue)
        
        self.InputMaxSaturationValueLabel = Label(text = 'The maximal saturation of "S" in HSV for a color\nthe to be defined as white/grey/black: ')
        self.InputMaxSaturationValue = TextInput(text = '{}'.format(detection.MaxSaturation), multiline = False, input_filter = 'float')
        self.InputMaxSaturationValue.bind(text = self.SetMaxSaturation)

        self.InputBeltSettingLabel = Label(text = 'Input the speed setting of the belt')
        self.InputBeltSetting = TextInput(text = '{}'.format(wait.BeltSetting), multiline = False, input_filter = 'int')
        self.InputBeltSetting.bind(text = self.SetBeltSpeedSetting)

        self.InputPictureWidthLabel = Label(text = 'Input the width of the pictures in meters')
        self.InputPictureWidth = TextInput(text = '{}'.format(wait.PictureWidth), multiline = False, input_filter = 'float')
        self.InputPictureWidth.bind(text = self.SetPictureWidth)
        
        #buttons
        self.ReturnToStartScreenButton = Button(text = 'To Startscreen')
        self.ReturnToStartScreenButton.bind(on_press = self.GoToStartScreen)

        self.add_widget(self.SaveDetectedPlasticImageSwitchLabel)
        self.add_widget(self.SaveDetectedPlasticImageSwitch)

        self.add_widget(self.SaveBilateralfilterImageSwitchLabel)
        self.add_widget(self.SaveBilateralfilterImageSwitch)

        self.add_widget(self.WriteDataToTXTfileSwitchLabel)
        self.add_widget(self.WriteDatatoTXTfileSwitch)

        self.add_widget(self.InputBeltValueLabel)
        self.add_widget(self.InputBeltValue)

        self.add_widget(self.InputBlackValueLabel)
        self.add_widget(self.InputBlackValue)

        self.add_widget(self.InputWhiteValueLabel)
        self.add_widget(self.InputWhiteValue)

        self.add_widget(self.InputMaxSaturationValueLabel)
        self.add_widget(self.InputMaxSaturationValue)

        self.add_widget(self.InputBeltSettingLabel)
        self.add_widget(self.InputBeltSetting)

        self.add_widget(self.InputPictureWidthLabel)
        self.add_widget(self.InputPictureWidth)
       
        self.add_widget(self.ReturnToStartScreenButton)
Exemple #30
0
    def build(self):
        root = BoxLayout(orientation="horizontal", padding=5)

        left = BoxLayout(orientation="vertical")

        buttonRun = Button(text="Run in the terminal",
                           size_hint=[1, .07],
                           on_press=self.runParse)
        left.add_widget(buttonRun)

        self.textSite = TextInput(text="http://",
                                  foreground_color=[0, 0, 0, 1],
                                  font_size=17,
                                  size_hint=[1, .07],
                                  background_color=[1, 1, 1, .7])
        left.add_widget(self.textSite)

        gridLeft = GridLayout(size_hint=[1, .07], cols=2)

        self.nameFile = TextInput(text="result.txt", font_size=17)
        gridLeft.add_widget(self.nameFile)

        buttonSave = Button(text="Save in the file", on_press=self.saveParse)
        gridLeft.add_widget(buttonSave)

        left.add_widget(gridLeft)

        self.textResult = TextInput(readonly=True)
        left.add_widget(self.textResult)

        right = BoxLayout(orientation="vertical", size_hint=[.5, 1])

        gridRight = GridLayout(size_hint=[1, .22], cols=2)

        userAgentL = Label(text=": : User-agent : :", font_size=16)
        torProxieL = Label(text=": : Tor-proxies : :", font_size=16)

        self.userAgentC = Switch(size_hint=[1, .33], active=True)
        self.torProxieC = Switch(size_hint=[1, .33], active=True)

        gridRight.add_widget(userAgentL)
        gridRight.add_widget(self.userAgentC)

        gridRight.add_widget(torProxieL)
        gridRight.add_widget(self.torProxieC)

        self.textTag = TextInput(text="", hint_text="Tag", font_size=17)

        self.textAttribute = TextInput(text="",
                                       hint_text="Attribute",
                                       font_size=17)

        gridRight.add_widget(self.textTag)
        gridRight.add_widget(self.textAttribute)

        right.add_widget(gridRight)

        self.textInfo = TextInput(readonly=True,
                                  background_color=[1, 1, 1, .7])
        right.add_widget(self.textInfo)

        right.add_widget(
            Button(text="Clear", size_hint=[1, .055], on_press=self.clear))

        root.add_widget(left)
        root.add_widget(right)

        return root