Example #1
0
 def __init__(self, **kwargs):
     self._layout = MaterialBoxLayout
     self._title_layout = RelativeLayout()
     self._title_header = MaterialLabel()
     self._title_bg = Image()
     self._list = List()
     super(DetailView, self).__init__(**kwargs)
     self._layout.add_widget(self._title_layout)
     self._layout.add_widget(self.list)
Example #2
0
    def build(self):
        rl = RelativeLayout()
        cam = Camera(resolution=(640, 360),
                     size=(1000, 600),
                     pos=(0, 0),
                     play=True)
        rl.add_widget(cam)

        return rl
Example #3
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     #self.on_transform_with_touch(self.check_pos)
     self.source = 'map3.png'
     self.size = map_size
     self.pos = map_pos
     self.Rell = RelativeLayout()
     print(self.Rell.pos)
     self.add_widget(self.Rell)
Example #4
0
 def __init__(self, recepteur, **kwargs):
     super().__init__(**kwargs)
     Clock.schedule_interval(self.update_controle_tir, .1)
     self.launch_time = None
     self.date_since_launch = None
     self.recepteur = recepteur
     self.feu_reception = RelativeLayout()
     self.feu_reception.add_widget(Label(text="Reception:"))
     self.add_widget(self.feu_reception)
Example #5
0
 def __init__(self, **kwargs):
     super(ScrollableLabel, self).__init__(**kwargs)
     ######################################
     self.ParentLayout = FloatLayout()
     self.ScrollWindow = RelativeLayout()
     self.ScrollLabel = Label()
     self.text = StringProperty('')
     ######################################
     self.ScrollWindow.size_hint = (None, None)
Example #6
0
 def test_relativelayout_on_touch_move(self):
     EventLoop.ensure_window()
     rl = RelativeLayout()
     EventLoop.window.add_widget(rl)
     touch = UTMotionEvent("unittest", 1, {"x": .5, "y": .5})
     EventLoop.post_dispatch_input("begin", touch)
     touch.move({"x": .6, "y": .4})
     EventLoop.post_dispatch_input("update", touch)
     EventLoop.post_dispatch_input("end", touch)
Example #7
0
 def __init__(self, **kwargs):  # inicializace
     super(PartylineScreen, self).__init__(**kwargs)
     self.root.insertStrings.append((self, "STR_PARTYLINE"))
     self.input = TextInput(size_hint=(.8, .07),
                            pos_hint={
                                'x': .08,
                                'y': .024
                            })
     self.output = Label(markup=True,
                         font_name='font/Roboto-Regular.ttf',
                         font_size='16dp',
                         size_hint_y=None)
     self.SLayout = GridLayout(size_hint_y=None, cols=1, spacing=0)
     self.SLayout.bind(minimum_height=self.SLayout.setter('height'))
     self.scroll = ScrollView(size_hint=(1, .9),
                              pos_hint={
                                  'center_x': .58,
                                  'y': .125
                              },
                              scroll_timeout=10000)
     self.scroll.do_scroll_x = False
     self.scroll.add_widget(self.SLayout)
     self.SLayout.add_widget(self.output)
     self.layout = RelativeLayout(size_hint=(.75, .83),
                                  pos_hint={
                                      'center_x': .437,
                                      'y': .02
                                  })
     self.send = DelButton(color=(1, 1, 1, 0),
                           text='SEND',
                           size_hint=(None, .1),
                           pos_hint={
                               'x': .88,
                               'y': .022
                           },
                           background_normal='crop/icons/send.png',
                           background_down='crop/icons/send.png')
     self.send.bind(on_press=self.sendMsg)
     self.input.bind(focus=self.on_focus)
     self.layout.content.add_widget(self.scroll)
     self.layout.content.add_widget(self.input)
     self.layout.content.add_widget(self.send)
     self.add_widget(self.layout)
     if self.root.onAndroid():
         self.LayouFocusOn = Animation(size_hint_y=.5,
                                       pos_hint={
                                           'center_x': .437,
                                           'y': .38
                                       },
                                       duration=.2)
         self.LayouFocusOut = Animation(size_hint_y=.83,
                                        pos_hint={
                                            'center_x': .437,
                                            'y': .02
                                        },
                                        duration=.2)
Example #8
0
 def add_widget(self, widget, index=0):
     if self._container is None:
         self._container = widget
         super(VelocityCarousel, self).add_widget(self._container)
         return
     rl = RelativeLayout(size=self.size, size_hint=(None, None))
     rl.add_widget(widget)
     self.slides.append(widget)
     self._container.add_widget(rl)
     self._relayout()
 def add_widget(self, widget, index=0, canvas=None):
     slide = RelativeLayout(size=(dp(275), dp(200)),
                            x=self.x - dp(275),
                            y=self.y)
     slide.add_widget(widget)
     super(CustomCarousel, self).add_widget(slide, index, canvas)
     if index != 0:
         self.slides.insert(index - len(self.slides), widget)
     else:
         self.slides.append(widget)
Example #10
0
 def BotonCamara(self):
     Layout = RelativeLayout()
     wid2 = Widget()
     Btn5 = Button()
     Btn5.background_normal = 'img/observa.png'
     Btn5.pos = 750, 30
     Btn5.bind(on_press=self.TomarFoto)
     wid2.add_widget(Btn5)
     Layout.add_widget(wid2)
     self.RelativaDispo.add_widget(Layout)
Example #11
0
    def __init__(self, **kwargs):
        super(RootWidget, self).__init__(**kwargs)
        root = RelativeLayout()
        self.add_widget(Label(text='User Name'))
        # self.username = TextInput(multiline=False)
        # self.add_widget(self.username)
        self.add_widget(Label(text='password'))
#         self.password = TextInput(password=True, multiline=False)
#         self.add_widget(self.password)
        self.add_widget(AsyncImage(source='images/clo.jpg'))
Example #12
0
 def add_widget(self, widget, index=0, canvas=None):
     container = RelativeLayout(size=self.size,
                                x=self.x - self.width,
                                y=self.y)
     container.add_widget(widget)
     super(Carousel, self).add_widget(container, index, canvas)
     if index != 0:
         self.slides.insert(index - len(self.slides), widget)
     else:
         self.slides.append(widget)
Example #13
0
    def __init__(self, width, height, foldername, mainlayout):
        
        super(FilePane, self).__init__()
    
        # Add Option bar to top of right panel -----
        #topOptionBar =  RelativeLayout(size = (width, resY *.04), size_hint_y = None)

        self.size = (width, height)
        self.size_hint = (None,None)
        self.startPath = foldername
        self.auto_bring_to_front = False
        self.mainlayout = mainlayout


        self.orientation = 'horizontal'

        self.tiles = StackLayout(size = (width*.9, height), size_hint_x = None, padding=10, spacing=10)
        #print self.tiles.size    
        #print self.tiles.minimum_height


        self.tiles.bind(minimum_height = self.tiles.setter('height'))



        self.add_widget(self.tiles)


        r = RelativeLayout(height = self.height)
        scrollbar = Slider(orientation = 'vertical')
        

        r.add_widget(scrollbar)
        self.add_widget(r)



        print self.tiles.height

        try:
            dirs = os.listdir( foldername )

            # This would print all the files and directories
            for file in dirs:
                if(self.isImage(file)):
                    self.addFile(self.startPath+ "\\" + file, file)
        except OSError:
            print OSError
            print "FilePane: no files found"

        print self.tiles.height


        scrollbar.range = (0, self.tiles.height)
        scrollbar.bind(value = self.updatePos)
Example #14
0
	def __init__(self,**kwargs):
		super(confirmExit,self).__init__(**kwargs)
		
		self.size_hint = (None, None)
		self.size = (290*g.scale, 290*g.scale)
		self.border = (0.2,0.4,0.2,0)
		
		self.auto_dismiss = False
		
		self.background_color = (0,0,0,0.2)
		self.background = g.IMG_CONFIRM_BG
		
		textlabel = Label(text = g.xml_root[6][5].text)
		textlabel.font_name = g.FONT_CR
		textlabel.font_size = 26*g.scale
		textlabel.color = g.COLOR_BLUE
		
		self.rl = RelativeLayout()
		self.add_widget(self.rl)
		
		self.rl.add_widget( confirmationButton('yes') )
		self.rl.add_widget( confirmationButton('no') )
		self.rl.add_widget( textlabel )
		
		# If we're in the main screen, add option to return to title
		if g.manager.current_screen.name == 'main_screen':
			self.title_btn = confSmallButton('title',self) #The btn will addd itself to parent
			show_undo = False
			if len(g.moves_history['player_1'])>0:
				show_undo = True
			if g.players == 1 and g.player == 'player_2':
				show_undo = False
			if show_undo:
				pass
			self.undo_btn = confSmallButton('undo',self) #The btn will addd itself to parent
		
		# Create volume button
		self.volume_btn = ToggleButton()
		self.volume_btn.size_hint = (None,None)
		self.volume_btn.size = (130*g.scale, 130*g.scale)
			
		self.volume_btn.border = (0,0,0,0)
		self.volume_btn.background_normal = g.IMG_CONFIRM_VOLUMEBTN_NORMAL
		self.volume_btn.background_down = g.IMG_CONFIRM_VOLUMEBTN_PRESS
		posx = self.size[0]/2 - self.volume_btn.size[0]/2
		posy = self.size[1]/2 - self.volume_btn.size[1]/2 + 235*g.scale
		self.volume_btn.pos = (posx, posy)
		self.volume_btn.bind( on_press = self.confirm_volume )
		
		if g.sound:
			self.volume_btn.state = 'normal'
		else:
			self.volume_btn.state = 'down'
			
		self.rl.add_widget(self.volume_btn)
Example #15
0
 def _menu_layout(self):
     menu_layout = RelativeLayout(
         size_hint=(None, None),
         size=(300, 100),
         pos_hint={
             'left': 1,
             'top': 1
         },
     )
     menu_layout.add_widget(self._filter_layout())
     return menu_layout
Example #16
0
 def build(self):
     self.opcion1 = 0
     self.opcion2 = 0
     self.opcion3 = 0
     self.xo = 0
     self.yo = -40
     self.RelativaDispo = RelativeLayout()
     self.widget1 = Widget()
     self.RelativaDispo.add_widget(self.widget1)
     self.PROCESOS()
     return self.RelativaDispo
Example #17
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)
Example #18
0
 def __init__(self, **kwargs):
     super(LoadDialog, self).__init__(**kwargs)
     self.Win_To_Draw = RelativeLayout()
     self.BoxLay1 = BoxLayout()
     self.FCL = FileChooserListView()
     self.BoxLay2 = BoxLayout()
     self.BCancel = Button()
     self.BLoad = Button()
     self.Bind_Cancel = None
     self.Bind_Load = None
     return
Example #19
0
    def build(self):
        rl = RelativeLayout(size=(300, 300))
        currencies = ["Dollar", "Euro", "Robux", "Dong"]

        results = Label(text="Results", pos=(352, 135), size_hint=(.2, .1))

        #self.hide_widget(results)
        b5 = Button(text="Convert", pos=(352, 235), size_hint=(.2, .1))

        b2 = DropDown()
        for i in currencies:
            btn = Button(text=i, size_hint_y=None, height=44)
            btn.bind(on_release=lambda btn: b2.select(btn.text))
            b2.add_widget(btn)
            # create a big main button
        mainbutton = Button(text='Currency 1',
                            size_hint=(.2, .2),
                            pos_hint={
                                'center_x': .27,
                                'center_y': .6
                            })
        mainbutton.bind(on_release=b2.open)
        b2.bind(on_select=lambda instance, x: setattr(mainbutton, 'text', x))
        b3 = DropDown()
        for z in currencies:
            btn1 = Button(text=z, size_hint_y=None, height=44)
            btn1.bind(on_release=lambda btn1: b3.select(btn1.text))
            b3.add_widget(btn1)
            # create a big main button
        mainbutton2 = Button(text='Currency 2',
                             size_hint=(.2, .2),
                             pos_hint={
                                 'center_x': .81,
                                 'center_y': .6
                             })
        mainbutton2.bind(on_release=b3.open)
        b3.bind(on_select=lambda instance, x: setattr(mainbutton2, 'text', x))
        b4 = TextInput(size_hint=(.2, .1),
                       pos=(352, 335),
                       text="Enter Value",
                       multiline=False)

        def callback(instance):
            value = float(b4.text) * 2.5
            results.text = str(value)

        b5.bind(on_press=callback)
        rl.add_widget(mainbutton)
        rl.add_widget(mainbutton2)
        rl.add_widget(b4)
        rl.add_widget(results)
        rl.add_widget(b5)

        return rl
Example #20
0
    def __init__(self,app,player_count,game_length,**kwargs):

        super().__init__(**kwargs)
        self.app=app
        self._keyboard=Window.request_keyboard(self._keyboard_closed, self)
        self._keyboard.bind(on_key_up=self._on_keyboard_up,on_key_down=self._on_keyboard_down)

        self.player_count=player_count
        self.game_length=game_length*5
        self.game=Game(self)

        self.video=self.game.video
        self.vid_sm=ScreenManager()
        self.vid_sm.transition=FadeTransition()
        self.vid_screen=Screen()
        self.vid_screen.add_widget(self.video)
        self.vid_sm.add_widget(self.vid_screen)

        self.top_label= Label(text=f"Round {self.game.round} of {self.game_length}.{' '*400} {self.player_count} players playing the game",
                              pos_hint={"y":.48},
                              outline_width=1
                              )

        self.title=Label(text="[size=80][b]THE [color=FF581A]GREAT[/color] DRINKING GAME[/b][/size]",
                         y=1080//2-250,
                         text_size=(1800, 400),
                         valign="top",
                         halign="center",
                         markup=True,
                         outline_width=1
                         )

        self.desc = Label(text="",
                          markup=True,
                          text_size= (1800,600),
                          y=-50,
                          outline_width=1,
                          halign="center",
                          valign="bottom"
                          )


        self.rules= FloatLayout()

        mg = self.minigame = RelativeLayout(size=(1600, 600))


        self.add_widget(self.vid_sm)
        self.add_widget(mg)
        self.add_widget(self.top_label)
        self.add_widget(self.rules)
        self.add_widget(self.title)
        self.add_widget(self.desc)
        self.bind(size=self.center_things)
Example #21
0
 def BotonSalir(self):
     Mascara = RelativeLayout()
     wid = Widget()
     Btn = Button()
     Btn.pos = 720, 210
     Btn.size = 80, 50
     Btn.text = "Salir"
     Btn.bind(on_press=self.Salir)
     wid.add_widget(Btn)
     Mascara.add_widget(wid)
     Mprincipal.add_widget(Mascara)
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.orientation = 'vertical'

        with self.canvas:
            Color(.2, .3, .5, 1)
            self.bg = Rectangle(source=os.path.join(DATA_DIR, 'bg.jpg'),
                                pos=self.pos,
                                size=self.size)
            self.bind(pos=self.update_bg, size=self.update_bg)

        self.current_mainbox = None
        self.cl_mainbox = CL_MainBox()
        self.rs_mainbox = RS_MainBox()
        self.ps_mainbox = PS_MainBox()

        self.bth_to_menu = Button(text='Меню',
                                  on_press=self.open_menu,
                                  size_hint=(.1, .05),
                                  background_color=(.6, .9, 1, 1),
                                  disabled=True)
        ''' ============== Menu of main boxes ============== '''
        self.list_submainboxes = RelativeLayout()
        bth_classifier_mainbox = Button(text="Классификатор",
                                        on_press=self.open_submain,
                                        size_hint=(.2, .05),
                                        pos_hint={
                                            "center_x": .5,
                                            "center_y": .65
                                        },
                                        background_color=(.6, .9, 1, 1))
        bth_research_mainbox = Button(text="Исследования",
                                      on_press=self.open_submain,
                                      size_hint=(.2, .05),
                                      pos_hint={
                                          "center_x": .5,
                                          "center_y": .55
                                      },
                                      background_color=(.6, .9, 1, 1))
        bth_parallel_system_mainbox = Button(text="Параллельная система",
                                             on_press=self.open_submain,
                                             size_hint=(.2, .05),
                                             pos_hint={
                                                 "center_x": .5,
                                                 "center_y": .45
                                             },
                                             background_color=(.6, .9, 1, 1))
        self.list_submainboxes.add_widget(bth_classifier_mainbox)
        self.list_submainboxes.add_widget(bth_research_mainbox)
        self.list_submainboxes.add_widget(bth_parallel_system_mainbox)

        self.add_widget(self.bth_to_menu)
        self.add_widget(self.list_submainboxes)
Example #23
0
 def __init__(self, **kwargs):
     super(SaveDialog, self).__init__(**kwargs)
     self.Win_To_Draw = RelativeLayout()
     self.BoxLay1 = BoxLayout()
     self.FCL = FileChooserListView()
     self.TIinput = TextInput()
     self.BoxLay2 = BoxLayout()
     self.BCancel = Button()
     self.BSave = Button()
     self.Bind_Cancel = None
     self.Bind_Save = None
     return
Example #24
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.__wrapper = RelativeLayout()

        self.add_widget(self.__wrapper)

        self.__revealTop = RevealTop()
        self.__revealBottom = RevealBottom()

        self.__wrapper.add_widget(self.__revealBottom)
        self.__wrapper.add_widget(self.__revealTop)
Example #25
0
    def build(self):
        root = RelativeLayout()
        l_label = Label(text="Hello World")
        root.add_widget(l_label)

        #l_label.to_parent(5, 5);

        print(l_label.get_parent_window())

        #l_label.center_x = -200
        #l_label.center_y = 250
        return root
Example #26
0
 def build(self):
     self.xo = 0
     self.yo = -40
     self.RelativaDispo = RelativeLayout()
     self.Camara()
     self.BotonCamara()
     self.widget1 = Widget()
     self.widget2 = Widget()
     self.RelativaDispo.add_widget(self.widget1)
     self.RelativaDispo.add_widget(self.widget2)
     self.PROCESOS()
     return self.RelativaDispo
Example #27
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)
Example #28
0
    def __init__(self, **kwargs):
        super(GameBoard, self).__init__(**kwargs)

        self.columns = [None] * 7
        for i in range(7):
            container = Widget()
            layout = RelativeLayout(size=(77, 460), pos=(248 + 78 * i, 20))
            self.columns[i] = Column()
            self.columns[i].col_no = i
            layout.add_widget(self.columns[i])
            container.add_widget(layout)
            self.add_widget(container)
Example #29
0
 def BotonCamara(self):
     Mascara = RelativeLayout()
     wid = Widget()
     Btn = Button()
     #    Btn.background_normal =  'img/observa.png'
     Btn.text = "Foto"
     Btn.pos = 720, 60
     Btn.size = 80, 50
     Btn.bind(on_press=self.TomarFoto)
     wid.add_widget(Btn)
     Mascara.add_widget(wid)
     Mprincipal.add_widget(Mascara)
    def __init__(self, **kwargs):
        self.type = "custom"
        if hasattr(self, "overlay_color"):
            self.overlay_color = (0, 0, 0, 0)
        else:
            self.background_color = (0, 0, 0, 0)
        # A box in which text, buttons and icons will be placed of window.
        self.content_cls = MDBoxLayout(
            adaptive_height=True,
            orientation="vertical",
            padding=("24dp", "68dp", "24dp", "24dp"),
            spacing="24dp",
        )
        self.opacity = 0
        self.bind(
            on_open={"pulse":
                     self.anim_open_dialog_pulse}.get(self.animation_type),
            on_dismiss={"pulse":
                        self.anim_close_dialog_pulse}.get(self.animation_type),
        )
        self._scale_x = 0
        self._scale_y = 0
        super().__init__(**kwargs)

        # Creating and adding control buttons (close/collapse/expand)
        # in the window header.
        if self.window_control_buttons:
            button_box = RelativeLayout()
            self.add_widget(button_box)
            if self.window_control_buttons == "close":
                button = MDIconButton(
                    icon="close",
                    pos_hint={"top": 1},
                    x=self.width - self.content_cls.padding[0] - dp(32),
                )
                if self.window_control_callback:
                    button.bind(on_release=self.window_control_callback)
                button_box.add_widget(button)
            elif self.window_control_buttons == "mac-style":
                # Color and padding of buttons.
                data = {"#eb5b53": 8, "#f5bc48": 28, "#64ca43": 48}
                for color in data:
                    button = MacOSWindowHeaderButton(
                        text_color=get_color_from_hex(color),
                        x=data[color],
                    )
                    if self.window_control_callback:
                        button.bind(on_release=lambda x=button: self.
                                    window_control_callback(x))
                    button_box.add_widget(button)

        Window.bind(on_resize=lambda *args: self.dismiss())