Ejemplo n.º 1
1
 def _addButton(self, parent, name, source, size, pos, action_func, on_top=False):
     button = Image(source=source)
     button.size = size
     button.on_top = on_top
     button.pos = pos
     button.scale = 1.
     button.rotation = 0.
     button.action = action_func
     button.name = name
     self.objects.update({name: {'obj': button}})
     parent.add_widget(button)
     
     return button
Ejemplo n.º 2
0
    def __init__(self, **kwargs):
        super(AboutScreen, 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.aboutImage)
        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
            Color(1, 1, 1, .7)  #BLUE
            Rectangle(pos=(.05 * self.layout.height, .05 * self.layout.height),
                      size=(.45 * self.layout.width, .9 * self.layout.height))

        group = Image(source=self.groupPhoto)
        group.size_hint = (.5, .5)
        group.pos = (Window.width * .49, Window.height * .37)
        self.add_widget(group)

        nameLabel = Label(
            text=
            'From left to right: Jianbo Lu, Jacob Isbell, Sophie Deam, Wyatt Bettis, Ross McCurdy, Erin Maier, Sadie Moore, Zachary Luppen, Mason Reed',
            text_size=(.45 * self.layout.width, .3 * self.layout.height),
            halign='center',
            font_size='18sp',
            color=(0, 0, 0, 1))
        nameLabel.pos = (Window.width * .24, Window.height * -.10)
        self.add_widget(nameLabel)

        aboutText = Label(
            text=
            'GravBox is the interface application for the Augmented Reality (AR) Sandbox for gravitational dynamics simulations designed and built at the University of Iowa by Dr. Hai Fu\'s 2016-2017 Introduction to Astrophysics class. \n\nThe GravBox application was developed by Zachary Luppen, Erin Maier, and Mason Reed. The sandbox was designed and built by Wyatt Bettis, Ross McCurdy, and Sadie Moore. The gravitational algorithm was written by Sophie Deam, Jacob Isbell, and Jianbo Lu. Graphic design was contributed by Jeremy Swanston. \n\nThe original AR Sandbox is the result of an NSF-funded project on informal science education for freshwater lake and watershed science developed by the UC Davis\' W.M. Keck Center for Active Visualization in the Earth Sciences, together with the UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center.\n\n To learn more about the GravBox project, contact Hai Fu at [email protected], or visit our Github at https://github.com/GravBoxInterface/GravBox',
            valign='middle',
            halign='center',
            font_size='19sp',
            text_size=(.4 * self.layout.width, None),
            color=(0, 0, 0, 1))
        aboutText.pos = (-.39 * self.layout.height, 0)
        self.add_widget(aboutText)

        backBtn = MyButton(text='BACK')  # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint = {'x': .69, 'y': .12}
        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)
Ejemplo n.º 3
0
    def __init__(self, **kwargs):
        super(AboutScreen, self).__init__(**kwargs)

        layout = FloatLayout()
        layout.width = Window.width
        layout.height = Window.height
        layout.x = Window.width / 2 - layout.width / 2
        layout.y = Window.height / 2 - layout.height / 2
        self.add_widget(layout)

        img = Image(source=self.aboutImage)
        img.size = (Window.width * 1.0, Window.height * 1.0)
        img.pos = (-Window.width * 0.0, -Window.height * 0.0)
        img.opacity = 0.4
        self.add_widget(img)

        aboutText = Label(
            text=
            'GravBox is the interface application for the Augmented Reality (AR) Sandbox for gravitational dynamics simulations designed and built\nby Dr. Hai Fu\'s Introduction to Astrophysics class during the 2016-2017 academic year and beyond.\nGravBox itself was designed by Zachary Luppen, Erin Maier, and Mason Reed.\n\nAR Sandbox is the result of an NSF-funded project on informal science education for freshwater lake and watershed science developed by the\nUC Davis\' W.M. Keck Center for Active Visualization in the Earth Sciences (KeckCAVES),\ntogether with the UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center.',
            halign='center',
            valign='center')
        aboutText.pos = (.25, .25)
        self.add_widget(aboutText)

        backBtn = MyButton(text='BACK')  # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint = {'x': 0, 'y': .90}
        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)
Ejemplo n.º 4
0
    def on_labels(self, instance, value):
        self.reset()
        image_view = self.ids.image_view

        for i, label in enumerate(value):
            # Make an image for this mask
            image = Image(source="", keep_ratio=True, allow_stretch=True)
            imgIO = io.BytesIO()
            mask_img = np.zeros((*label.mask.shape, 4))
            mask_img[:, :, :3] = np.array(
                PAINTBRUSH_COLORS[i % len(PAINTBRUSH_COLORS)])
            mask_img[:, :,
                     3] = np.where(np.isnan(label.mask), 0.0, label.mask) * 0.6
            pil_img = PILImage.fromarray(
                (mask_img * 255).astype(np.uint8),
                mode='RGBA').resize(image_view.image_size)
            pil_img.save(imgIO, format='png')
            imgIO.seek(0)
            imgData = io.BytesIO(imgIO.read())
            image.texture = CoreImage(imgData, ext='png').texture
            image.reload()

            self.ids.paintbrush_parent.add_widget(image)
            self.paintbrushes.append(image)
            image.pos = self.ids.paintbrush_parent.pos
            image.size = self.ids.paintbrush_parent.size

            for center, stroke in zip(label.centers, label.strokes):
                # Label
                center = image_view.convert_point_from_image(center)
                lw = Label(pos=(int(center[0] + self.ids.label_parent.pos[0]),
                                int(center[1] + self.ids.label_parent.pos[1])),
                           text=label.label)
                self.label_widgets.append(lw)
                self.ids.label_parent.add_widget(lw)
Ejemplo n.º 5
0
	def on_touch_down(self, touch):
		userdata = touch.ud
		(w, h) = (FSW,FSH)
		sc = max(float(w)/FSW,float(h)/FSH)
		# start collecting points in touch.ud
		self.canvas.clear
		gimg = Image(source=GOAL_IMG)
		self.add_widget(gimg)
		bimg = Image(source=BALL_IMG)
		self.add_widget(bimg)
		(xpos, ypos) = (int(touch.x)-w/2, int(touch.y)-h/2)
		#bimg.size = (10,10) #(int(60.0*sc), int(60.0*sc))
		bimg.pos = (xpos, ypos)
		#print '{0} and {1}'.format(float(w)/FSW,float(h)/FSH) 2115
		#print sc
		print '{0} and {1}'.format(touch.x, touch.y)
		#print '{0} and {1}'.format(xpos, ypos)
		if touch.x > FSW/20 and touch.x < w-FSW/20 and touch.y > h*0.2 and touch.y < h*0.88:
			print "GOAL!"
			mimg = Image(source=MSG_IMG)
			self.add_widget(mimg)
		#with self.canvas:
			#Color(1, 1, 1)
			#d = 60.
			#Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
		return True
Ejemplo n.º 6
0
	def __init__(self, team, next = False, **kwargs):
		super(crestButton,self).__init__(**kwargs)

		self.team = team
		self.size_hint = (None,None)
		self.size = (90,90)

		if next == True:
			self.background_normal = './data/images/crest_'+team['name']+'.png'
			self.background_down = './data/images/crest_'+team['name']+'.png'
		else:
			self.background_normal = './data/images/crest_'+team['name']+'_no.png'
			self.background_down = './data/images/crest_'+team['name']+'_no.png'

		position_list = [(-48+180-45,150+320-45),(48+180-45,150+320-45), (-48+180-45,56+320-45), (48+180-45,56+320-45)]
		self.pos = position_list[g.save.tournament['teams'].index(team)]

		if team['result'] is not '':
			sign = Image(source='./data/images/crest-marker-'+team['result']+'.png')
			sign.size_hint = (None,None)
			sign.size = (90,90)
			sign.pos = position_list[g.save.tournament['teams'].index(team)]
			self.add_widget(sign)

		self.bind(on_release = self.crest_click)
Ejemplo n.º 7
0
    def __init__(self, **kwargs):
        super(UiowaScreen, self).__init__(**kwargs)

        layout = FloatLayout()
        layout.width = Window.width
        layout.height = Window.height
        layout.x = Window.width / 2 - layout.width / 2
        layout.y = Window.height / 2 - layout.height / 2
        self.add_widget(layout)

        img = Image(source=self.uiowaImage)
        img.size = (Window.width * 1.0, Window.height * 1.0)
        img.pos = (-Window.width * 0.0, -Window.height * 0.0)
        img.opacity = 0.4
        self.add_widget(img)

        aboutText = Label(text='UIOWA INFO HERE')
        aboutText.pos = (.25, .25)
        self.add_widget(aboutText)

        backBtn = MyButton(text='BACK')  #start button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint = {'x': 0, 'y': .9}
        backBtn.background_color = [.4, .4, .4, 1]
        backBtn.bind(
            on_release=self.backButton
        )  #when the button is released the backButton function is called
        layout.add_widget(backBtn)
Ejemplo n.º 8
0
	def __init__(self, *args, **kwargs):
		super(Goal, self).__init__(*args, **kwargs)
		print "__init__ is run"
		gimg = Image(source=GOAL_IMG)
		self.add_widget(gimg)
		gimg.pos = (0,0)
		#Window.fullscreen = True
		Window.size = (FSW, FSH)
Ejemplo n.º 9
0
    def initialize_background_image(self, width, height):
        background_image = Image(source="dashboard/serpent.png")

        background_image.size = (height, height)
        background_image.opacity = 0.1
        background_image.pos = ((width / 2) - (height / 2),
                                self.size[1] - height)

        self.add_widget(background_image)
Ejemplo n.º 10
0
 def reloadIcons(self):
     self.ids.map.clear_widgets()
     for room in self.rooms:
         if room.name != "bureau" and room.name != "boss":
             slider = ScoreSlider(size=("30dp", "30dp"), pos=(room.xMin * self.ids.map.size[0] + self.ids.map.pos[0] + 10, room.yMin * self.ids.map.size[1] + self.ids.map.pos[1]), score=room.score)
             self.ids.map.add_widget(slider)
         if(self.app.gameManager.dialogAvailableInRoom(room.id)):
             warning = Image(source=(self.app.app.APPLICATION_PATH + os.path.normpath('/Images/warning.png')), size=("60dp", "80dp"), keep_ratio = False, allow_stretch = True)
             warning.pos = (room.xMax * self.ids.map.size[0] + self.ids.map.pos[0] - warning.size[0], room.yMin * self.ids.map.size[1] + self.ids.map.pos[1] + 10)
             self.ids.map.add_widget(warning)
Ejemplo n.º 11
0
    def __init__(self, name, offset):
        super().__init__()

        player = Image(
            source=f'../../res/characters/{name}/{name}_preview.png',
            keep_ratio=False,
            allow_stretch=True)
        player.size = (200, 200)
        player.pos = (200 + offset, 45)

        self.add_widget(player)

        frame = Image(
            source=
            '../../res/uix/screens/dungeon_battle/special_background.png',
            keep_ratio=False,
            allow_stretch=True)
        frame.size = (200, 220)
        frame.pos = (200 + offset, 25)
        self.add_widget(frame)

        health = Image(
            source=
            '../../res/uix/screens/dungeon_battle/special_background.png',
            keep_ratio=False,
            allow_stretch=True)
        health.size = (200, 220)
        health.pos = (200 + offset, 25)
        self.add_widget(health)

        mana = Image(
            source=
            '../../res/uix/screens/dungeon_battle/special_foreground.png',
            keep_ratio=False,
            allow_stretch=True)
        mana.size = (200, 220)
        mana.pos = (200 + offset, 25)
        self.add_widget(mana)

        self.node = LWFNode.create('../../res/lwf/character_active.lwf')
        self.node.pos = (300 + offset, 145)
        self.node.lwf.scale_for_width(10 * 200 / 180, 10 * 200 / 180)
        self.add_widget(self.node)
Ejemplo n.º 12
0
    def on_check(self, instance, value):
        sheepimg = Image(source='images/TXT_BRAVO_MOUTONS.png', size_hint=(None, None), size=(300, 150))
        self.add_widget(sheepimg)
        sheepimg.pos = (300, 300)

        self.button = BtnOk(scenario=self)
        self.button.center = (630, 270)
        self.button.button.background_normal = 'images/BUT_OK_UNVALID.png'
        self.button.button.background_down = 'images/BUT_OK_VALID.png'
        self.add_widget(self.button)
Ejemplo n.º 13
0
    def IMAG(self):
        layout = RelativeLayout()
        widget3 = Widget()
        img2 = Image()
        img2.source = "img/text.png"
        x, y = 130, 370
        img2.pos = x + self.xo, y - 420 + self.yo
        img2.size = 300, 680

        widget3.add_widget(img2)
        self.widget1.add_widget(widget3)
Ejemplo n.º 14
0
    def question(self, que):
        self.restore_default()

        self._question = que
        if que.is_img:
            img = Image(source=que.img_path)
            img.pos = self.pos
            img.size = self.size
            self.add_widget(img)
        else:
            self.text = que.text
Ejemplo n.º 15
0
    def update_text(self, i):
        self.y = self.height * i

        ans = self.answer
        if ans.is_img:
            img = Image(source=ans.img_path)
            img.pos = self.pos
            img.size = self.size
            self.add_widget(img)
        else:
            self.text = ans.text
Ejemplo n.º 16
0
    def IMAG2(self):
        layout = RelativeLayout()
        widget4 = Widget()
        img2 = Image()
        img2.source = "img/text.png"
        x, y = 140, -250
        img2.pos = x, y
        img2.size = 300, 680

        widget4.add_widget(img2)
        layout.add_widget(widget4)
        self.widget1.add_widget(layout)
Ejemplo n.º 17
0
    def my_callback(screen, dt):
         global timeCountdown
         global pictureCounter
         timeCountdown = timeCountdown-1
         screen.ids.hsCountdown.text = str(timeCountdown)
         screen.ids.hsLabel.color = [1, 1, 0, 0] # black it out
         screen.ids.hsButton.color = [1, 1, 0, 0] # black it out
         screen.ids.hsButton.background_color = [1, 1, 0, 0] # black it out
         Logger.info(str(timeCountdown)) #screen.ids.hsDebug1.text = screen.ids.hsDebug1.text + str(timeCountdown)
         if (timeCountdown == 0):
              # start a new thread with the actual capturing process
             Thread(target=screen.captureImageThread, args=(screen.camera,screen.inspectImage,)).start()
             screen.ids.hsCountdown.text = ""
             timeCountdown = 5
#             screen.run_command('gphoto2 --camera "Canon EOS 60D" --capture-and-download --filename "hallo.jpg"')
              #screen.ids.hsDebug1.text = screen.ids.hsDebug1.text + str(cmd)	
             if (pictureCounter == 4):
                 preview04 = Image(source='preview04.jpg')
                 preview04.size = (400,240)
                 preview04.pos = (0,240)
                 screen.add_widget(preview04, 100)
                 Clock.unschedule(screen.my_callback)
             if (pictureCounter == 3): 
                 preview03 = Image(source='preview03.jpg')
                 preview03.size = (400,240)
                 preview03.pos = (400,0)
                 screen.add_widget(preview03, 100) # TODO move to layer 100
                 pictureCounter = 4
             if (pictureCounter == 2):
                 preview02 = Image(source='preview02.jpg')
                 preview02.size = (400,240)
                 preview02.pos = (0,0)
                 screen.add_widget(preview02, 100) # TODO move to layer 100
                 pictureCounter = 3
             if (pictureCounter == 1):
                 preview01 = Image(source='preview01.jpg')
                 preview01.size = (400,240)
                 preview01.pos = (400,240)
                 screen.add_widget(preview01, 100)
                 pictureCounter = 2
Ejemplo n.º 18
0
 def Label2(self):
     widget3 = Widget()
     img2 = Image()
     img2.source = "img/text.png"
     x, y = 130, 370
     img2.pos = x + self.xo, y - 160 + self.yo
     img2.size = 300, 500
     lbl2 = Label()
     lbl2.pos = x + 90 + self.xo, y + 40 + self.yo
     lbl2.text = "            " + 'HACK-VISION DEMO\n                 Recibe GPS \n' + "          " + '      Blueetooth '
     widget3.add_widget(img2)
     widget3.add_widget(lbl2)
     self.widget1.add_widget(widget3)
Ejemplo n.º 19
0
 def Label2(self):
     widget3 = Widget()
     img2 = Image()
     img2.source = "img/text.png"
     x, y = 130, 370
     img2.pos = x + self.xo, y - 160 + self.yo
     img2.size = 300, 500
     lbl2 = Label()
     lbl2.pos = x + 90 + self.xo, y + 40 + self.yo
     lbl2.text = "            " + 'HACK-VISION DEMO\n CLIENTE BLUETOOTH  ENVIO\n' + "          " + '            GPS'
     widget3.add_widget(img2)
     widget3.add_widget(lbl2)
     self.widget1.add_widget(widget3)
Ejemplo n.º 20
0
 def Label2(self):
     widget3 = Widget()
     img2 = Image()
     img2.source = "img/text.png"
     x, y = 50, 330
     img2.pos = x, y - 160
     img2.size = 300, 500
     lbl2 = Label()
     lbl2.pos = x + 90, y + 40
     lbl2.font_size = '18dp'
     lbl2.text = "   " + 'FReePS DEMO\n        Diego Alberto Parra  \n' + "          " + '             Bogota D.C.'
     widget3.add_widget(img2)
     widget3.add_widget(lbl2)
     Mprincipal.add_widget(widget3)
Ejemplo n.º 21
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)
Ejemplo n.º 22
0
 def Label1(self):
     global lbl1
     img2 = Image()
     img2.source = "img/text.png"
     #        img2.pos = 215, 140
     img2.pos = 400, 160
     img2.size = 400, 500
     lbl1 = Label()
     lbl1.text = "Esperando instrucciones:"
     #   lbl1.pos = 200,140
     lbl1.pos = 530, 380
     lbl1.font_size = "14dp"
     Mprincipal.add_widget(img2)
     Mprincipal.add_widget(lbl1)
     print "Esperando instrucciones:"
Ejemplo n.º 23
0
    def __init__(self, **kwargs):
        super(WelcomeScreen, self).__init__(**kwargs)

        layout = FloatLayout(
        )  #Float Layout for positioning buttons and image anywhere on the screen
        layout.width = Window.width  #the float layout is the size of the window
        layout.height = Window.height
        layout.x = Window.width / 2 - layout.width / 2  #sets the x position of the layout to 0
        layout.y = Window.height / 2 - layout.height / 2  #sets the y position of the layout to 0
        self.add_widget(layout)  #adds the layout to the screen

        img = Image(source=self.welcomeImage)  #BACKGROUND IMAGE
        img.size = (Window.width * 1.0, Window.height * 1.0)
        img.pos = (-Window.width * 0.0, -Window.height * 0.0)
        img.opacity = 1.0  #alpha value between 0.0 - 1.0
        self.add_widget(img)  #adds the image to the screen

        startBtn = MyButton(text='')  #start button
        startBtn.size_hint = (.21, .09)
        startBtn.pos_hint = {'x': .395, 'y': .24}
        startBtn.background_color = [
            .306, .325, .4196, .4
        ]  #backgroundcolor of the button (this is grayish)
        startBtn.bind(
            on_release=self.changer
        )  #when the button is released the changer function is called
        self.add_widget(
            startBtn)  #adds the button called startButton to the floatlayout

        aboutBtn = MyButton(text='')  #about button
        aboutBtn.size_hint = (.08, .095)
        aboutBtn.pos_hint = {'x': .618, 'y': 0}
        aboutBtn.background_color = [.4, .4, .4, .4]
        aboutBtn.bind(
            on_release=self.about
        )  #when the button is released the about function is called
        self.add_widget(
            aboutBtn)  #adds the button called aboutBtn to the floatlayout

        uiowaBtn = MyButton(text='')  #uiowa button
        uiowaBtn.size_hint = (.08, .095)
        uiowaBtn.pos_hint = {'x': .7, 'y': 0}
        uiowaBtn.background_color = [.4, .4, .4, .4]
        uiowaBtn.bind(
            on_release=self.uiowa
        )  #when the button is released the uiowa function is called
        self.add_widget(
            uiowaBtn)  #adds the button called uiowaBtn to the floatlayout
Ejemplo n.º 24
0
    def move_piece(self, from_row, from_col, to_row, to_col, moved_piece_color):
        """
        To be called when the client receives a "piece_moved" command
        :return:
        """
        app = App.get_running_app()
        # Clear the image that showed where the last piece moved from
        self.clear_just_moved_indicator()

        # Need to mirror the rows and columns if the player isn't the client
        if moved_piece_color == "red" and app.player.is_red or moved_piece_color == 'black' and not app.player.is_red:
            pass
        else:
            # Mirror the movements
            from_row = self.mirror_row(from_row)
            from_col = self.mirror_col(from_col)
            to_row = self.mirror_row(to_row)
            to_col = self.mirror_col(to_col)

        # Get the widget being moved
        moving_piece = app.board_helper.get_widget_at(from_row, from_col)
        piece_being_entered = app.board_helper.get_widget_at(to_row, to_col)
        #print("Moving piece", moving_piece.id())



        # Animate the motion
        animation_widget = Image(source=moving_piece.source,
                                 color=moving_piece.color,
                                 keep_ratio=False, allow_stretch=True)
        animation_widget.size_hint = (None, None)
        animation_widget.size = moving_piece.size
        animation_widget.pos = self.to_window(*moving_piece.pos)
        Window.add_widget(animation_widget)
        new_pos = piece_being_entered.pos
        moving_piece.opacity = 0
        app.is_animating = True
        anim = Animation(pos=new_pos, transition='out_expo')#, duration=0)
        anim.bind(on_complete=partial(self.finish_piece_movement, piece_being_entered, moving_piece))
        anim.start(animation_widget)

        # Move the turn indicator
        self.move_turn_indicator()
Ejemplo n.º 25
0
    def update_test_image(self, *_):
        """Regenerate the watermark preview image."""

        if self.watermark_settings:
            test_image = self.watermark_settings.ids['testImage']
            test_image.clear_widgets()
            if os.path.isfile(self.watermark_image):
                image = KivyImage(source=self.watermark_image)
                size_x = test_image.size[0] * (self.watermark_size / 100)
                size_y = test_image.size[1] * (self.watermark_size / 100)
                image.size = (size_x, size_y)
                image.size_hint = (None, None)
                image.opacity = self.watermark_opacity / 100
                x_pos = test_image.pos[0] + ((test_image.size[0] - size_x) *
                                             (self.watermark_horizontal / 100))
                y_pos = test_image.pos[1] + ((test_image.size[1] - size_y) *
                                             (self.watermark_vertical / 100))
                image.pos = (x_pos, y_pos)
                test_image.add_widget(image)
Ejemplo n.º 26
0
    def killWolf(self, widget):
        self.remove_widget(self.wolf)
        self.remove_widget(self.info)
        sheemimg = ObjectProperty(None)
        if self.collardog:
            sheepimg = Image(source='images/TXT_BRAVO_MOUT_2.png', size_hint=(None, None), size=(300, 150))
        else:
            sheepimg = Image(source='images/TXT_FAIL.png', size_hint=(None, None), size=(300, 150))        
        sheepimg.pos = (300, 300)
        self.add_widget(sheepimg)
        self.button = BtnOk(scenario=self)
        self.button.center = (630, 270)
        self.button.button.background_normal = 'images/BUT_OK_UNVALID.png'
        self.button.button.background_down = 'images/BUT_OK_VALID.png'

        self.add_widget(self.button)
        tmp = Retry(wa=self)
        self.retry = BtnOk(scenario=tmp)
        self.retry.center = (470, 270)
        self.retry.button.background_normal = 'images/BUT_BACK_UNVALID.png'
        self.retry.button.background_down = 'images/BUT_BACK_VALID.png'
        self.add_widget(self.retry)
    def __init__(self, **kwargs):
        super(MainWindow, self).__init__(**kwargs)

        ImageViewer = Image(source="")  # the interactive writing window
        ImageViewer.size_hint = (None, None)
        ImageViewer.size = (1021, 576)
        ImageViewer.pos = (0, 240 - 152)
        self.add_widget(ImageViewer)

        # The reason to put the interactive texts and the TextField in the MainWindow is that MainWindow is updated immediately
        # workpanel is static

        LabelReminder = Label(font_size="15sp",
                              text="",
                              color=(1, .3, .3, 1),
                              halign='left',
                              text_size=(300, 150))
        LabelReminder.size_hint = (
            None, None)  # the interactive text, which is initially set to red
        LabelReminder.size = (300, 150)
        LabelReminder.valign = 'top'
        LabelReminder.text = ""
        LabelReminder.pos = (1050, 210 - 152)
        self.add_widget(LabelReminder)

        textinput = TextInput(multiline=False)  #the TextField
        textinput.size_hint = (None, None)
        textinput.size = (300, 40)
        textinput.pos = (1040, 250 - 152)
        self.add_widget(textinput)

        self.uievents = UIEvents(ImageViewer, LabelReminder, textinput)

        WorkingPanel = WorkPanel(self.uievents)
        WorkingPanel.pos = (0, 240)
        self.add_widget(WorkingPanel)
Ejemplo n.º 28
0
	def __init__(self, *args, **kwargs):
		super(Goal, self).__init__(*args, **kwargs)
		print "__init__ is run"
		gimg = Image(source=GOAL_IMG)
		self.add_widget(gimg)
		gimg.pos = (0,0)
Ejemplo n.º 29
0
	def reload_image(self):
		new_image = Image(source='./data/images/player-'+self.status_game+'-'+self.status_health+'.png')
		new_image.pos = (0,0)
		new_image.size = (36,36)
		self.add_widget(new_image)
Ejemplo n.º 30
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)