예제 #1
0
    def __init__(self, **kwargs):
        super(UiowaScreen, self).__init__(**kwargs)

        self.layout = FloatLayout()
        self.layout.width = Window.width
        self.layout.height = Window.height
        self.layout.x = 0
        self.layout.y = 0
        self.add_widget(self.layout)

        img = Image(source=self.uiowaImage)
        img.size = (Window.width * 1.0, Window.height * 1.0)
        img.pos = (0, 0)
        img.opacity = .8
        self.add_widget(img, 1)

        with self.layout.canvas:  #sets canvas instructions for the rightlayout and draws a blue rect. filling the entire layout
            Color(1, 1, 1, .7)  #WHITE
            Rectangle(pos=(.15 * self.layout.height, .30 * self.layout.height),
                      size=(.45 * self.layout.width, .55 * self.layout.height))

        qr = Image(source=self.qrCode)
        qr.size_hint = (.39, .39)
        qr.pos_hint = {'x': .56, 'y': .12}
        self.add_widget(qr)

        logo = Image(source=self.uiLogo)
        logo.size_hint = (.33, .33)
        logo.pos_hint = {'x': .59, 'y': .58}
        self.add_widget(logo)

        uiowaText = Label(
            text=
            'The GravBox project is the result of the hard work of students of the University of Iowa\'s Physics and Astronomy Department. To learn more about physics and astronomy at the University of Iowa, and the research work being done in these areas, please scan the QR code to the right.',
            valign='middle',
            halign='center',
            font_size='24sp',
            text_size=(.4 * self.layout.width, None),
            color=(0, 0, 0, 1))
        uiowaText.pos_hint = {'x': -.18, 'y': .075}
        self.add_widget(uiowaText)

        backBtn = MyButton(text='BACK')  # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint = {'x': .27, 'y': .16}
        backBtn.background_color = [.4, .4, .4, 1]
        backBtn.bind(
            on_release=self.backButton
        )  #when the button is released the callback function is called
        self.add_widget(backBtn)
예제 #2
0
    def display(self):
        background = Image(source="images/background2.png")
        clinic = Image(source="images/clinic.png",
                       pos_hint={
                           'x': .15,
                           'y': -0.05
                       },
                       size_hint=(.7, .7))
        sun = Image(source="images/sun.png", size_hint=(.7, .7))
        sun.pos_hint = {
            'x': .15,
            'y': 0.3
        }

        self.layout.add_widget(background)
        self.layout.add_widget(clinic)
        self.layout.add_widget(sun)

        if self.game_session.level.battery > 0:
            battery = Image(source="images/battery.png",
                            size_hint=(.3, .38),
                            pos_hint={
                                'x': .1,
                                'y': .2
                            })
            self.layout.add_widget(battery)

        self.time_label = Label(text="00:00:00",
                                font_size='24dp',
                                pos_hint={
                                    'x': .4,
                                    'y': .01
                                },
                                size_hint=(.2, .1))
        self.layout.add_widget(self.time_label)

        back_button = Button(text="<< Menu",
                             font_size='18dp',
                             pos_hint={
                                 'x': .01,
                                 'y': 0.01
                             },
                             size_hint=(.15, .075),
                             on_press=self.callpopup)
        self.layout.add_widget(back_button)

        for i, appliance in enumerate(self.game_session.level.appliances):
            appliance.pos_hint = {
                'x': self.locations[i][0],
                'y': self.locations[i][1]
            }
            appliance.size_hint = (.12, .12)
            self.layout.add_widget(appliance)

        self.layout.add_widget(self.current_load_label)
        self.add_widget(self.layout)
        Clock.schedule_interval(self.update, 1)
        Clock.schedule_interval(self.add_drop, 1 / 20)
        Clock.schedule_interval(self.move_rain, 1 / 20)
예제 #3
0
	def placeWorldItems(self):
		for each in requiredItems:
			x = Image(source=self.resource_path('artAssets/{}.png'.format(each)))
			x.allow_stretch = True
			x.keep_ratio = True
			x.size_hint = (.03,.03)
			if(allWorldItems[each] in lightWorldLocations):
				x.pos_hint = {'center_x':lightWorldLocations[allWorldItems[each]][0],'center_y':lightWorldLocations[allWorldItems[each]][1]}
				x.text = '{}:{}'.format(each, allWorldItems[each])
				x.reload()
				self.ids.lightScatter.add_widget(x,0)
			elif(allWorldItems[each] in darkWorldLocations):
				x.pos_hint = {'center_x':darkWorldLocations[allWorldItems[each]][0],'center_y':darkWorldLocations[allWorldItems[each]][1]}
				x.reload()
				self.ids.darkScatter.add_widget(x,0)
			else:
				pass
예제 #4
0
    def build(self):
        # Image
        ac_image = Image(source='static/ac1.png')
        ac_image.size_hint = (1.25, 1.5)
        ac_image.pos_hint = {'center_x': 0.5}
        self.add_widget(ac_image)

        # Details
        details_box = MDBoxLayout(orientation='horizontal', size_hint_y=0.5)
        self.temprature = MDLabel(text='18°C')
        self.temprature.color = [1] * 4
        self.fan_speed = MDLabel(text='Fan: 2')
        self.fan_speed.color = [1] * 4
        details_box.add_widget(self.temprature)
        details_box.add_widget(self.fan_speed)
        self.add_widget(details_box)
예제 #5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.size_hint_y = None
     self.height = '32dp'
     self.button = Button(text="text1",
                          pos_hint={
                              'center_x': 0.5,
                              'center_y': 0.5
                          },
                          size_hint=(1, 1))
     button_layout = RelativeLayout()
     self.add_widget(button_layout)
     button_layout.add_widget(self.button)
     icon = Image(source=str(ICON), size=(16, 16), size_hint=(None, None))
     icon.reload()
     icon.pos_hint = {'center_x': 0.95, 'center_y': 0.5}
     button_layout.add_widget(icon)
예제 #6
0
파일: main.py 프로젝트: adingeist/PopperPig
 def __init__(self, **kwargs):
     # accesses properties and methods from FloatLayout
     super().__init__(**kwargs)
     global bestPopCount, store
     # create a cloud layout layer where all the clouds will be spawned (this will be above the sky background)
     cloud_layout = CloudLayout()
     self.add_widget(cloud_layout)
     # in the json file set as store in global variables, get the best score value saved to local memory in at the
     # key 'bestScore'
     bestPopCount = store.get('bestScore')['best']
     # create a new float layout for menu items
     self.menu_layout = FloatLayout()
     # create the start button
     start_button = Button()
     # the start button width and height should both take up 30% of the screen
     start_button.size_hint = (.3, .3)
     # the start button should be located in the middle of the screen horizontally and 30% up the screen vertically
     start_button.pos_hint = {'center_x': .5, 'center_y': .3}
     # set the start button text to say "start"
     start_button.text = "Start"
     # change its font style
     start_button.font_name = "PressStart2P.ttf"
     # make the font medium sized
     start_button.font_size = "20sp"
     # upon the buttons release it will remove the layout with all menu items attached to it
     start_button.bind(on_release=self.remove_layout)
     # creates an image object for the title image
     title = Image()
     # the image should take up no more than 90% of the screen horizontally and no more than 90% of screen vertically
     title.size_hint = (.9, .9)
     # the title image is centered horizontally and located 70% up screen vertically
     title.pos_hint = {'center_x': .5, 'center_y': .7}
     # changes the title image to the title image .png file
     title.source = "Assets/popper_pig_title.png"
     # add the start button and the title to the menu layout
     self.menu_layout.add_widget(start_button)
     self.menu_layout.add_widget(title)
     # add the menu layout
     self.add_widget(self.menu_layout)
예제 #7
0
파일: main.py 프로젝트: arwema/EnergyGame
    def display(self):
        background = Image(source="images/background2.png")
        clinic = Image(source="images/clinic.png", pos_hint={'x': .15, 'y': -0.05}, size_hint=(.7, .7))
        sun = Image(source="images/sun.png", size_hint=(.7, .7))
        sun.pos_hint = {'x': .15, 'y': 0.3};

        self.layout.add_widget(background)
        self.layout.add_widget(clinic)
        self.layout.add_widget(sun)

        if self.game_session.level.battery > 0:
            battery = Image(source="images/battery.png", size_hint=(.3, .38), pos_hint={'x': .1, 'y': .2})
            self.layout.add_widget(battery)

        self.time_label = Label(text="00:00:00",
                           font_size='24dp',
                           pos_hint={'x': .4, 'y': .01},
                           size_hint=(.2, .1))
        self.layout.add_widget(self.time_label)

        back_button = Button(text="<< Menu",
                              font_size='18dp',
                              pos_hint={'x': .01, 'y': 0.01},
                              size_hint=(.15, .075), on_press=self.callpopup)
        self.layout.add_widget(back_button)

        for i, appliance in enumerate(self.game_session.level.appliances):
            appliance.pos_hint = {'x': self.locations[i][0], 'y': self.locations[i][1]}
            appliance.size_hint = (.12, .12)
            self.layout.add_widget(appliance)

        self.layout.add_widget(self.current_load_label)
        self.add_widget(self.layout)
        Clock.schedule_interval(self.update, 1)
        Clock.schedule_interval(self.add_drop, 1/20)
        Clock.schedule_interval(self.move_rain, 1/20)
예제 #8
0
 def on_pre_enter(self):
     interior_img = Image(source=shipimage.ship_dict[self.ship.shipclass]['prefix']+ '/ShipRooms.png',color=[0.5,0.5,0.5,1.], allow_stretch=True, size_hint= [None, None])
     interior_img.size = densFix(interior_img.texture.size)
     interior_img.pos_hint= {'center_x': .5, 'center_y': .5}
     self.ids['shiplayout'].add_widget(interior_img)
     self.ids['shiplayout'].size = (np.array(interior_img.size)+100).tolist()
     
     #add rooms
     for r in self.ship.rooms:
         #mimg = r['module'].module_image()
         rimg = RoomImage( room_entry=r )
         #butt.text = str(r['size'])
         #room_name = 'room'+str(r['size'])+'_'
         #room_name += 'empty.png' if not r['module'] else 'full.png'
         b_center = np.array(self.ids['shiplayout'].center)+np.array(r['loc'])*Metrics.density        
         #print r_center, np.array(self.ids['shiplayout'].center),np.array(r['loc'])       
         #room_img = Image(source='img/room/'+room_name, center = r_center.tolist(), size=[40,40], size_hint= [None, None])
         #rimg.center = b_center.tolist()
         rimg.go_to_loc(b_center.tolist())
         #rimg.ids['sizeimg'].pos_hint = 0.5,0.5
         self.ids['shiplayout'].add_widget(rimg)
         
     self.ids['shipscroll'].scroll_x = 0.5
     self.ids['shipscroll'].scroll_y = 0.5
예제 #9
0
파일: flappybird.py 프로젝트: anbarief/Blog
 def show_collision(self):
     image = Image(source=collision)
     self.parent.add_widget(image)
     image.pos_hint = self.pos_hint
     image.size_hint = (0.1, 0.1)
예제 #10
0
    def jogar(self, btn):
        print("selecao")
        try:
            GridLayout
            TextInput
        except:
            from kivy.uix.textinput import TextInput
            from kivy.uix.gridlayout import GridLayout
        self.sel_txti = TextInput(size_hint=(0.285, 0.085), multiline=False)
        self.sel_txti.pos_hint = {
            "x": 0.5 - self.sel_txti.size_hint_x,
            "y": 0.67
        }
        self.sel_txti.text = "Nome do personagem"
        self.sel_txti.bind(focus=self.clean, text=self.change_txti)
        self.sel_btn_check = Button(id="false",
                                    text="check",
                                    size_hint=(0.1285, 0.085),
                                    pos_hint={
                                        "x": 0.5,
                                        "y": 0.67
                                    },
                                    on_press=self.check)
        sel_btn_icone = Button(size_hint=(0.155, 0.17),
                               on_press=selecao.opcoes,
                               opacity=0.3)
        sel_btn_icone.pos_hint = {
            "x": 0.5 + self.sel_btn_check.size_hint_x,
            "y": 0.67
        }
        self.sel_icone = Image(source="source/img/icone/img_vazia.jpg",
                               size_hint=sel_btn_icone.size_hint,
                               pos_hint=sel_btn_icone.pos_hint)
        self.sel_icone.allow_stretch = True
        self.sel_icone.keep_ratio = False

        sel_grid_image = Image(source="source/img/fundo_grid.jpg",
                               size_hint=(0.57, 0.5),
                               allow_stretch=True,
                               keep_ratio=False)
        sel_grid_image.pos_hint = {
            "x": 0.5 - (sel_grid_image.size_hint_x / 2),
            "y": 0.17
        }
        sel_grid = GridLayout(cols=2, size_hint=(0.57, 0.5))
        sel_grid.pos_hint = {"x": 0.5 - (sel_grid.size_hint_x / 2), "y": 0.17}
        for i in range(1, 3 + 1):
            sel_grid.add_widget(Label(text="Server" + str(i)))
            sel_grid.add_widget(
                Button(id=str(i), text="Entrar" + str(i), on_press=self.join))
        sel_image = Image(source="source/img/fundo.jpg",
                          allow_stretch=True,
                          keep_ratio=False)
        sel_layout = FloatLayout()
        sel_layout.add_widget(sel_image)
        sel_layout.add_widget(self.sel_txti)
        sel_layout.add_widget(self.sel_btn_check)
        sel_layout.add_widget(self.sel_icone)
        sel_layout.add_widget(sel_btn_icone)
        sel_layout.add_widget(sel_grid_image)
        sel_layout.add_widget(sel_grid)
        selecao.add_widget(sel_layout)
        screen_manager.current = selecao.name
예제 #11
0
            #main_layout.add_widget(main_layout_title)
            main.add_widget(main_layout)
            screen_manager.current = "main"


loading_bg_image = Image(source="source/img/loading_bg.jpg",
                         size_hint=(1, 1),
                         allow_stretch=True,
                         keep_ratio=False)
loading_image = Image(source="source/img/connection.gif",
                      size_hint=(0.2, 0.2),
                      anim_delay=0.04,
                      allow_stretch=True,
                      keep_ratio=False)
loading_image.pos_hint = {
    "x": 0.65 - (loading_image.size_hint_x / 2),
    "y": 0.5 - (loading_image.size_hint_y / 2)
}
loading_label = Label(text="trying connection: ",
                      font_size=sp(20 * Window.size[1] / 600))
loading_label.pos_hint = {
    "x": 0.45 - (loading_label.size_hint_x / 2),
    "y": 0.5 - (loading_label.size_hint_y / 2)
}
loading_layout = Loading_Layout()
loading_layout.add_widget(loading_bg_image)
loading_layout.add_widget(loading_label)
loading_layout.add_widget(loading_image)

loading = Loading(name="loading")
loading.add_widget(loading_layout)
예제 #12
0
        def __init__(self, ms, **kwargs):
            super(MasterClient.Home, self).__init__(**kwargs)

            self.ms = ms

            # Float Layout Top Bar
            self.float_layout = FloatLayout()
            self.float_layout.size_hint = (None, None)
            # self.float_layout.pos_hint = (None, None) # Não pode definir no FloatLayout
            self.float_layout.size = (402, 85)
            self.float_layout.y = 630

            # Top Bar image
            self.top_bar = Image()
            self.float_layout.add_widget(self.top_bar)
            self.top_bar.source = ("interface/Home/top_bar1.png")
            self.top_bar.y = 630

            # AddContact button
            self.add_contact_btn = Button()
            self.float_layout.add_widget(self.add_contact_btn)
            self.add_contact_btn.size_hint = (None, None)
            self.add_contact_btn.size = (40, 40)
            self.add_contact_btn.pos = (345, 643)
            self.add_contact_btn.background_color = (1.0, 1.0, 1.0, 0)
            self.add_contact_btn.on_press = self.press_add_contact_button

            # Switch status button
            self.switch_status = Button()
            self.float_layout.add_widget(self.switch_status)
            self.switch_status.size_hint = (None, None)
            self.switch_status.size = (43, 24)
            self.switch_status.pos = (20, 651)
            self.switch_status.background_color = (1.0, 1.0, 1.0, 0)
            self.switch_status.on_press = self.press_switch_status

            # Switch status image
            self.switch_img = Image()
            self.add_widget(self.float_layout)
            self.switch_status.add_widget(self.switch_img)
            self.switch_img.source = ("interface/Home/switch_on.png")
            self.switch_img.size = (43, 24)
            self.switch_img.pos = (20, 651)

            # Scroll View
            self.scroll_view = ScrollView()
            self.add_widget(self.scroll_view)
            self.scroll_view.size_hint = (None, None)
            self.scroll_view.size = (402, 630)
            self.scroll_view.y = self.scroll_view.parent.x
            self.scroll_view.orientation = "vertical"
            self.scroll_view.background_color = (255, 0, 0, 1)

            # Box View chats
            self.box = BoxLayout()
            self.scroll_view.add_widget(self.box)
            self.box.id = "box"
            self.box.orientation = "vertical"
            self.box.size_hint_y = None
            self.box.bind(minimum_height=self.box.setter("height"))
            self.box.y = self.box.parent.y

            print(len(contacts))
            for contact in contacts:
                print("entrei aqui no coisa do bicho do negoço")
                print(contact)
                ###
                # Box button
                box_button = Button()
                self.box.add_widget(box_button)

                box_button.size_hint = (None, None)
                box_button.width = 402
                box_button.height = 80
                #box_button.background_color = (255, 255, 255, 1)

                # Contact photo image
                contact_photo = Image()
                box_button.add_widget(contact_photo)
                contact_photo.source = ("interface/Home/contact.png")
                contact_photo.size_hint = (None, None)
                contact_photo.pos_hint = (None, None)
                contact_photo.size = (80, 80)
                contact_photo.pos = (0, 0)

                # Contact status img
                contact_img_status = Image()
                box_button.add_widget(contact_img_status)
                contact_img_status.source = ("interface/online.png")
                contact_img_status.size_hint = (None, None)
                contact_img_status.pos_hint = (None, None)
                contact_img_status.size = (80, 80)
                contact_img_status.pos = (330, contact_img_status.parent.y)

                # Contact name label
                lbl_name = Label()
                box_button.add_widget(lbl_name)
                lbl_name.text = contact_name
                lbl_name.size = (15, 120)
                lbl_name.pos = (90, contact_img_status.parent.y)
예제 #13
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.orientation = 'vertical'

        # Main screen layout
        screen_layout = MDGridLayout()
        screen_layout.cols = 2
        screen_layout.md_bg_color = [0, 1, 1, 1]

        # AC region
        self.timer = 0
        new_layout = MDFloatLayout()
        self.new_card = MDCard(
            orientation='vertical',
            padding='10dp',
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
            size_hint=(0.75, 0.75),
        )
        self.new_card.md_bg_color = app.off_red
        ac_image = Image(source='static/ac1.png', )
        ac_image.size_hint_y = 0.9

        ac_image.pos_hint = {'top': 1.0, 'center_x': 0.5}
        self.new_card.radius = [4] * 4

        # ac_button.bind(active=callback)
        self.new_card.add_widget(ac_image)
        self.new_card.on_press = self.ac_touch_down
        self.new_card.on_release = self.ac_touch_up
        temp = MDLabel(text='18ºC')
        temp.font_size = 10
        temp.size = (0.25, 1)
        temp.color = [1, 1, 1, 1]
        new_layout.add_widget(self.new_card)
        screen_layout.add_widget(new_layout)

        self.ac_popup = Popup(title='AC settings',
                              content=AcFeatures(),
                              size_hint=(0.75, 0.75))
        self.ac_popup.background_color = [i / 255
                                          for i in [137, 205, 211]] + [1]
        #self.ac_popup.on_open = self.faltu

        #--------------------------------------------------------------#

        # Light setup
        new_layout = MDFloatLayout()
        self.light_card = MDCard(
            orientation='horizontal',
            padding='10dp',
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
            size_hint=(0.75, 0.75),
        )
        self.light_card.md_bg_color = app.dark_color
        light_image = Image(
            source='static/light1.png',
            size_hint=(1, 1),
        )
        self.light_card.on_press = self.light_change
        self.light_card.add_widget(light_image)
        new_layout.add_widget(self.light_card)
        screen_layout.add_widget(new_layout)

        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        self.add_widget(screen_layout)