Beispiel #1
0
box_bt.size_hint = 1, 0.37

# Label título ========================================

label = Label()
label.size_hint = 0.5, 1.5
label.text = 'Gerenciador de clientes e pedidos'

# Label resumo ========================================

lb_resumo = Label()
""" Armazenar os valores no Spinner"""

spin = Spinner()
spin.size_hint = 0.2, 0.5
spin.pos_hint = {'top': 0.5}
spin.text = 'Clientes'

lb_cidade = Label()
lb_nuped = Label()
lb_data = Label()
lb_valor = Label()
""" --------------------------------------------------------------------------"""

# Botãos ====================================

size_bt = [0.5, 1]

bt_ok = Button()
bt_ok.size_hint = size_bt
bt_ok.text = 'Confirmar'
Beispiel #2
0
    def __init__(self, **kwargs):
        super(InteractionScreen, self).__init__(**kwargs)

        ### CREATE LAYOUTS

        self.layout = FloatLayout(
        )  #creates a Float Layout called self.layout  (self. allows reference for entire class?)
        self.layout.width = Window.width
        self.layout.height = Window.height
        self.layout.x = 0
        self.layout.y = 0

        self.rightlayout = FloatLayout(
        )  #creates Float Layout for object selector, speed and angle labels, go button
        self.rightlayout.width = self.layout.width * (1. / 6.)
        self.rightlayout.height = self.layout.height
        self.rightlayout.x = Window.width - self.rightlayout.width
        self.rightlayout.y = Window.height / 2 - self.rightlayout.height / 2

        self.leftlayout = FloatLayout(
        )  # float layout for drawing area and background images
        self.leftlayout.width = self.layout.width * (5. / 6.)
        self.leftlayout.height = self.layout.height
        self.leftlayout.x = 0  #Window.width - self.centerlayout.width
        self.leftlayout.y = 0  #Window.width/2 - self.centerlayout.height/2

        with self.rightlayout.canvas:  #sets canvas instructions for the rightlayout and draws a blue rect. filling the entire layout
            Color(0, 0, .5, 1)  #BLUE
            Rectangle(pos=(self.rightlayout.x, self.rightlayout.y),
                      size=(self.rightlayout.width, self.rightlayout.height))

        ### LEFT LAYOUT CONTENT

        # DRAWING FUNCTIONALITY
        global drawUtility
        drawUtility = DrawingApp()
        drawUtility.size_hint = (5. / 6., 1)
        self.leftlayout.add_widget(drawUtility, 0)
        self.layout.add_widget(self.leftlayout, 2)
        self.layout.add_widget(self.rightlayout)
        self.add_widget(self.layout)

        # DEFAULT BACKGROUND IMAGE
        self.bg_image_default = Image(source=assetsdirectory +
                                      str('starfield.jpg'))
        self.bg_image_default.allow_stretch = True
        self.bg_image_default.keep_ratio = False
        self.bg_image_default.size_hint = ((5. / 6.), 1)
        self.bg_image_default.pos = (0, 0)
        self.bg_image_default.opacity = 1.0
        self.leftlayout.add_widget(self.bg_image_default,
                                   1)  #ADDS DEFAULT BACKGROUND IMAGE

        # BACKGROUND IMAGE UPDATE FUNCTION
        self.imageNumber = 1  #default image number
        self.event = Clock.schedule_interval(
            self.imageUpdate,
            1.0 / 5.0)  #SCHEDULES THE IMAGE UPDATING TO OCCUR

        # HOME BUTTON AND IMAGE
        homeBtn = Button(text='',
                         size_hint=((1. / 24.), (.06)),
                         pos_hint={
                             'x': 0,
                             'y': .94
                         },
                         opacity=.5)  #back button to the interaction screen
        homeBtn.bind(
            on_press=self.changer
        )  #binds this button to change the screen back to the welcome screen
        self.layout.add_widget(homeBtn,
                               0)  #adds the button to the float layout

        self.homeImage = Image(
            source=assetsdirectory + str('explosion1.png')
        )  # adds slightly transparent home icon over the back button
        self.homeImage.size_hint = ((1. / 24.), .06)
        self.homeImage.pos_hint = {'x': 0, 'y': .94}
        self.homeImage.opacity = .5
        self.layout.add_widget(self.homeImage)

        ### RIGHT LAYOUT CONTENT

        # OBJECT BUTTON (Must be in same order for correct layout)
        objButton = Spinner(text='PLEASE SELECT\nAN OBJECT',
                            halign='center',
                            font_size='18',
                            values=('Particle', 'Planet', 'Comet', 'Star',
                                    'Black Hole',
                                    'Elephant'))  # object spinner
        objButton.pos_hint = {'x': 0, 'y': .8}
        objButton.size_hint = ((1. / 6.), .2)
        objButton.background_color = [.4, .4, .4, 1]
        self.rightlayout.add_widget(objButton, 0)

        # TOPOGRAPHY TOGGLE SWITCH
        self.topoSwitch = Switch(
            active=True
        )  # switch to toggle between updating topography and static star field
        self.topoSwitch.pos_hint = {'x': 0, 'y': .6}
        self.topoSwitch.size_hint = ((1. / 6.), .15)
        self.topoSwitch.background_color = [.4, .4, .4, 1]
        self.rightlayout.add_widget(self.topoSwitch)

        self.topoSwitch.bind(
            active=self.topoChange)  # bind switch to topoChange function

        # SPEED LABEL
        self.spdLabel = Label(text='Speed:\n' + str(drawUtility.speed),
                              font_size='20',
                              halign='center')  # label showing current speed
        self.spdLabel.pos_hint = {'x': 0, 'y': .4}
        self.spdLabel.size_hint = ((1. / 6.), .2)
        self.spdLabel.background_color = [.4, .4, .4, 1]
        self.rightlayout.add_widget(self.spdLabel)

        def update_speed(
                value, instance):  # callback function to bind speed to vector
            self.spdLabel.text = 'Speed:\n' + str(drawUtility.speed)

        drawUtility.bind(speed=update_speed)  # bind speed to vector length

        # ANGLE LABEL
        self.angLabel = Label(text='Angle:\n' + str(drawUtility.angle),
                              font_size='20',
                              halign='center')  # label showing current angle
        self.angLabel.pos_hint = {'x': 0, 'y': .2}
        self.angLabel.size_hint = ((1. / 6.), .2)
        self.angLabel.background_color = [.4, .4, .4, 1]
        self.rightlayout.add_widget(self.angLabel)

        def update_angle(
                value, instance):  # callback function to bind angle to vector
            self.angLabel.text = 'Angle:\n' + str(drawUtility.angle)

        drawUtility.bind(angle=update_angle)  # bind angle to vector

        # GO BUTTON
        self.goButton = MyButton(
            text='Go!')  # go button to send user input to algorithm
        self.goButton.pos_hint = {'x': 0, 'y': 0}
        self.goButton.size_hint = ((1. / 6.), .2)
        self.goButton.background_color = [.4, .4, .4, 1]
        self.goButton.bind(
            on_release=self.userInput
        )  # when the button is released the USERINPUT function is called
        self.rightlayout.add_widget(self.goButton)