Esempio n. 1
0
    def calculationResultLayout(self):
        calculationResultsLayout = GridLayout()
        calculationResultsLayout.cols = 2

        dataValues = self.getDataValues()
        familyNetLabel = Label(text='Sissetulek (€)')
        familyNetResult = Label(text=str(self.getFamilySum()))
        motherNetLabel = Label(text='* ema neto (€)', color=(1,0,0,1))
        motherNetResult = Label(text=str(dataValues['mother']['netIncome']))
        fatherNetLabel = Label(text='* isa neto (€)', color=(0,1,0,1))
        fatherNetResult = Label(text=str(dataValues['father']['netIncome']))
        childSupportLabel = Label(text='* lastetoetus neto (€)', color=(1,1,0,1))
        childSupportResult = Label(text=str(dataValues['childSupport']['netIncome']))

        def doCalculation(obj):
            print('xxx')
            self.getNewValuesFromInputFields()
            self.startDrawing()

        childSupportResult.bind( on_press=doCalculation)


        calculationResultsLayout.add_widget( familyNetLabel )
        calculationResultsLayout.add_widget( familyNetResult )
        calculationResultsLayout.add_widget( motherNetLabel )
        calculationResultsLayout.add_widget( motherNetResult )
        calculationResultsLayout.add_widget( fatherNetLabel )
        calculationResultsLayout.add_widget( fatherNetResult )
        calculationResultsLayout.add_widget( childSupportLabel )
        calculationResultsLayout.add_widget( childSupportResult )

        return calculationResultsLayout
    def __init__(self,**kwargs):
        super (ScreenThree,self).__init__(**kwargs)

        box1 = GridLayout()
        box1.cols = 2
        box2 = BoxLayout(orientation='horizontal')

        my_label1 = Label(text="Enfermedades", font_size='24dp')
        box1.add_widget(my_label1)
        box1.add_widget(Label(text=" "))
        for x in range(0, len(enfermedades)):
            box1.add_widget(Label(text=enfermedades[x]))
            box1.add_widget(Button(text="Ver Mas Informacion", on_press=self.changerH))
        box1.add_widget(Label(text=" "))
        box1.add_widget(Label(text=" "))
        box1.add_widget(Label(text=" "))
        box1.add_widget(Label(text=" "))
        box1.add_widget(Label(text=" "))
        box1.add_widget(Label(text=" "))

        my_button1 = Button(text="Home",size_hint_y=None, size_y=100)
        my_button1.bind(on_press=self.changer)
        my_button4 = Button(text="Informacion \nGeneral",size_hint_y=None, size_y=100)
        my_button2 = Button(text="Ingredientes",size_hint_y=None, size_y=100)
        my_button2.bind(on_press=self.changer2)
        my_button3 = Button(text="Enfermedades",size_hint_y=None, size_y=100)
        #my_button3.bind(on_press=self.changer2)

        box2.add_widget(my_button1)
        box2.add_widget(my_button4)
        box2.add_widget(my_button2)
        box2.add_widget(my_button3)

        self.add_widget(box1)
        self.add_widget(box2)
Esempio n. 3
0
 def test_gridlayout_get_max_widgets_with_rows_cols(self):
     gl = GridLayout()
     gl.rows = 5
     gl.cols = 3
     expected = 15
     value = gl.get_max_widgets()
     self.assertEqual(expected, value)
Esempio n. 4
0
	def __init__(self, **kwargs):
		super(ProgrammerView, self).__init__(**kwargs)

		grid = GridLayout()
		grid.cols= 2
		precode = open('function_file', 'r+')
		commands = [line for line in precode]
		usercode = open('user_file', 'r+')
		
		v2 = UserCodeDisplay(usercode.read())
		
		v1 = FunctionList(commands)
		
		grid.add_widget(v1)

		grid.add_widget(v2)

		grid.add_widget(Label(text= 'CODE BLOCKS', size_hint=(1,.05)))
		grid.add_widget(Label(text= 'USER PROGRAM', size_hint=(1,.05)))

		self.add_widget(grid)

		def on_touch_down(self, touch, *args):
			super(ProgrammerView, self).on_touch_down(touch)
	

		def on_touch_move(self, touch):
			pass

		def on_touch_up(self, touch):
			pass
Esempio n. 5
0
    def __init__(self, event_dispatcher, **kwargs):
        """
        Initialize button and textures of MenuLevel.
        :param event_dispatcher: dispatcher
        :param kwargs: args of layout
        :rtype: void
        """
        super(MenuLevel, self).__init__(**kwargs)
        self.event_dispatcher = event_dispatcher
        self.level_service = LevelService()

        # Add fond.
        self.canvas.add(
            Rectangle(source=self.FOND_MENU_PATH, size=Window.size)
        )

        # Add button
        self.add_widget(
            Button(text="Menu", font_name=self.FONT_MENU_PATH, background_color=self.color_2,
                   pos_hint={'x': 0.82, 'y': 0}, size_hint=(0.18, 0.15),
                   on_press=self.switch_to_menu_screen)
        )

        menu_level_grid = GridLayout(size_hint=(0.7, 0.45), pos_hint={'x': 0.15, 'y': 0.3}, row=2)
        self.add_widget(menu_level_grid)

        set_list = os.listdir(self.MAPS_PATH)
        set_number = len(set_list)
        menu_level_grid.cols = set_number / 2

        for index in range(1, set_number + 1):
            if index % 2 == 0:
                button_title = "Level " + str(index)
                menu_level_grid.add_widget(
                    Button(
                        text=button_title,
                        font_name=self.FONT_MENU_PATH,
                        background_color=self.color_1,
                        on_press=self.launch_level,
                        cls=[index]
                    )
                )

            else:
                button_title = "Level " + str(index)
                menu_level_grid.add_widget(
                    Button(
                        text=button_title,
                        font_name=self.FONT_MENU_PATH,
                        background_color=self.color_2,
                        on_press=self.launch_level,
                        cls=[index]
                    )
                )
Esempio n. 6
0
 def __init__(self, **kwargs):
     super(InputsScreen, self).__init__(**kwargs)
     scroll = ScrollView()
     scroll.size_hint = (1, 1)
     self.add_widget(scroll)
     layout = GridLayout()
     layout.cols = 3
     layout.padding = '8dp'
     layout.spacing = '8dp'
     layout.size_hint_y = None
     layout.bind(minimum_height=layout.setter('height'))
     scroll.add_widget(layout)
     self.layout = layout
 def accept_credentials(self):
     main_layout= BoxLayout(padding='2sp')
     main_layout.orientation='vertical'
     layout=GridLayout(padding='2sp')
     layout.cols=2
     layout.add_widget(Label(text='Email id:'))
     email = TextInput(multiline=False)
     layout.add_widget(email)
     token = TextInput(multiline=False)
     layout.add_widget(Label(text='Submission Token:'))
     layout.add_widget(token)
     main_layout.add_widget(layout)
     submit = Button(text='Submit',size_hint=(1,0.4))
     submit.bind(on_press=partial(self.submit_assignment,email,token))
     main_layout.add_widget(submit)
     return main_layout
Esempio n. 8
0
 def exit(self):
     self.popup = ModalView(size_hint=(0.5, 0.4))
     grd = GridLayout()
     grd.cols = 2
     grd.padding = 120
     flt = FloatLayout()
     lbl = Label(pos=(320, 340), text='Are you sure to exit game????', font_size=35)
     flt.add_widget(lbl)
     btn1 = Button(text='YES', font_size=50)
     btn1.bind(on_press=self.button_pressed)
     btn2 = Button(text='NO', font_size=50)
     btn2.bind(on_press=self.popup.dismiss)
     grd.add_widget(btn1)
     grd.add_widget(btn2)
     self.popup.add_widget(flt)
     self.popup.add_widget(grd)
     self.popup.open()
Esempio n. 9
0
    def __init__(self, event_dispatcher, **kwargs):
        """
        Initialize button and textures of MenuLevel.

        :param event_dispatcher:
        :param kwargs: args of layout
        :rtype: void
        """
        super(MenuLevel, self).__init__(**kwargs)
        self.event_dispatcher = event_dispatcher

        # Add fond.
        self.canvas.add(
            Rectangle(source='./resources/menu/test_im7.jpeg', size=Window.size)
        )

        # Add button
        self.add_widget(
            Button(text="Back to Menu", font_name=self.FONT_MENU_LEVEL, background_color=(0.8, 0, 0, 0.85),
                   pos_hint={'x': 0.82, 'y': 0}, size_hint=(0.18, 0.15),
                   on_press=self.switch_to_menu_screen)
        )

        menu_level_grid = GridLayout(size_hint=(0.7, 0.45), pos_hint={'x': 0.15, 'y': 0.3}, row=2)
        self.add_widget(menu_level_grid)

        set_list = os.listdir('./resources/maps/')
        set_number = len(set_list)
        menu_level_grid.cols = set_number / 2

        for index in range(set_number):
            if index % 2 == 0:
                button_title = "Level " + str(index + 1)
                menu_level_grid.add_widget(
                    Button(text=button_title, font_name=self.FONT_MENU_LEVEL,
                           background_color=(0.1, 0, 0, 0.85))
                )

            else:
                button_title = "Level " + str(index + 1)
                menu_level_grid.add_widget(
                    Button(text=button_title, font_name=self.FONT_MENU_LEVEL,
                           background_color=(0.8, 0, 0, 0.85))
                )
Esempio n. 10
0
    def inputElementsLayout(self):
        inputElementsLayout = GridLayout()
        inputElementsLayout.cols = 2

        motherGrossLabel = Label(text='Ema bruto (€)')
        self.motherGrossInput = TextInput(multiline=False, text=str(self.getDataValue('mother','grossIncome')))
        fatherGrossLabel = Label(text='Isa bruto (€)')
        self.fatherGrossInput = TextInput(multiline=False, text=str(self.getDataValue('father','grossIncome')))
        numberOfChildrenLabel = Label(text='Lapsi (tk)')
        self.numberOfChildrenInput = TextInput(multiline=False, text=str(self.getDataValue('childSupport','numberOfChildren')))

        inputElementsLayout.add_widget( motherGrossLabel )
        inputElementsLayout.add_widget( self.motherGrossInput )
        inputElementsLayout.add_widget( fatherGrossLabel )
        inputElementsLayout.add_widget( self.fatherGrossInput )
        inputElementsLayout.add_widget( numberOfChildrenLabel )
        inputElementsLayout.add_widget( self.numberOfChildrenInput )

        return inputElementsLayout
    def __init__(self, height: int, backCallback: callable, homeCallback: callable, **kwargs):
        super(BottomBar, self).__init__(**kwargs)

        bottomBack = Image()
        bottomBack.color = [0, 0, 0, 1]
        bottomBack.width = Window.size[0]
        bottomBack.height = height
        self.add_widget(bottomBack)

        btnGrid = GridLayout()
        btnGrid.cols = 5
        btnGrid.rows = 1
        btnGrid.width = Window.size[0]
        btnGrid.height = height
        self.add_widget(btnGrid)

        btnBack = Button(text="Back")
        btnBack.bind(on_press=lambda instance: backCallback())
        btnGrid.add_widget(btnBack, 0)

        btnHome = Button(text="Home")
        btnHome.bind(on_press=lambda instance: homeCallback())
        btnGrid.add_widget(btnHome, 1)
Esempio n. 12
0
 def test_gridlayout_get_max_widgets_rows_None(self):
     gl = GridLayout()
     gl.cols = 1
     expected = None
     value = gl.get_max_widgets()
     self.assertEqual(expected, value)
Esempio n. 13
0
    def build(self):
        screen_manager = ScreenManager()
        self.loaded_values = [
            1, 0, 0, 0, 0, 0
        ]  # round num, cp, primary obj, 1st secondary, 2nd secondary, 3rd secondary
        self.update_values()
        self.theme_cls.primary_palette = "Gray"
        self.theme_cls.primary_hue = "800"

        # Game counters screen and backgrgound color

        self.counters = Screen(name="Counters")
        self.change_bg_color()

        screen_manager.add_widget(self.counters)

        # SCROLLVIEW

        self.scroll = ScrollView()
        self.counters.add_widget(self.scroll)

        # MENU
        self.menu_button = MDIconButton(icon='format-color-fill',
                                        on_release=self.menu_open)
        self.menu_button.pos_hint = {'center_x': .9, 'center_y': .1}
        self.menu_button.md_bg_color = (1, 1, 1, 1)
        items = [{
            "text": "Ceramic White"
        }, {
            "text": "Loyal Angels Green"
        }, {
            "text": "Space Doggos Gray"
        }, {
            "text": "Codex Blue"
        }, {
            "text": "Vampire Angels Red"
        }, {
            "text": "Gray Nights"
        }, {
            "text": "Stubborn Fists Yellow"
        }]
        self.menu = MDDropdownMenu(caller=self.menu_button,
                                   items=items,
                                   callback=self.menu_callback,
                                   width_mult=5)
        self.counters.add_widget(self.menu_button)

        # MAIN GRID
        app_grid = GridLayout(cols=1, spacing=100, size_hint_y=None)
        app_grid.padding = [
            Window.width / 40, Window.height / 20, Window.width / 40,
            Window.height / 4
        ]  # [left,top,right,bottom]
        app_grid.bind(minimum_height=app_grid.setter('height'))
        self.scroll.add_widget(app_grid)

        # ROUND COUNTER

        round_parent_grid = MDGridLayout()
        round_parent_grid.cols = 1
        round_parent_grid.rows = 2
        round_parent_grid.adaptive_height = True

        round_label = MDLabel(text='Round number:')
        round_label.halign = 'center'
        round_parent_grid.add_widget(round_label)
        app_grid.add_widget(round_parent_grid)

        grid_round = GridLayout()
        grid_round.cols = 3

        increase_round = MDIconButton(icon="arrow-right-bold",
                                      on_press=self.increase_round)
        self.round_counter = MDLabel(text=str(self.loaded_values[0]))
        self.round_counter.halign = 'center'
        self.round_counter.valign = 'middle'
        decrease_round = MDIconButton(icon="arrow-left-bold",
                                      on_press=self.decrease_round)

        grid_round.add_widget(decrease_round)
        grid_round.add_widget(self.round_counter)
        grid_round.add_widget(increase_round)
        round_parent_grid.add_widget(grid_round)

        # COMMAND POINTS

        cp_parent_grid = MDGridLayout()
        cp_parent_grid.cols = 1
        cp_parent_grid.rows = 2
        cp_parent_grid.adaptive_height = True

        cp_label = MDLabel(text='Command Points Left:')
        cp_label.halign = 'center'
        cp_parent_grid.add_widget(cp_label)
        app_grid.add_widget(cp_parent_grid)

        grid_cp = MDGridLayout()
        grid_cp.cols = 3

        increase_cp = MDIconButton(icon="arrow-right-bold",
                                   on_press=self.increase_cp)
        self.cp_counter = MDLabel(text=str(self.loaded_values[1]))
        self.cp_counter.halign = 'center'
        self.cp_counter.valign = 'middle'
        decrease_cp = MDIconButton(icon="arrow-left-bold",
                                   on_press=self.decrease_cp)

        grid_cp.add_widget(decrease_cp)
        grid_cp.add_widget(self.cp_counter)
        grid_cp.add_widget(increase_cp)
        cp_parent_grid.add_widget(grid_cp)

        # VP PRIMARY

        prim_parent_grid = MDGridLayout()
        prim_parent_grid.cols = 1
        prim_parent_grid.rows = 2
        prim_parent_grid.adaptive_height = True

        prim_label = MDLabel(text='Primary Objective Points:')
        prim_label.halign = 'center'
        prim_parent_grid.add_widget(prim_label)
        app_grid.add_widget(prim_parent_grid)

        grid_prim = MDGridLayout()
        grid_prim.cols = 3

        increase_prim = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_prim)
        self.prim_counter = MDLabel(text=str(self.loaded_values[2]))
        self.prim_counter.halign = 'center'
        self.prim_counter.valign = 'middle'
        decrease_prim = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_prim)

        grid_prim.add_widget(decrease_prim)
        grid_prim.add_widget(self.prim_counter)
        grid_prim.add_widget(increase_prim)
        prim_parent_grid.add_widget(grid_prim)

        # VP SECONDARY 1

        sec1_parent_grid = MDGridLayout()
        sec1_parent_grid.cols = 1
        sec1_parent_grid.rows = 2
        sec1_parent_grid.adaptive_height = True

        sec1_label = MDTextField()
        sec1_label.hint_text = '1st Secondary Objective Points:'
        sec1_label.multiline = False
        #sec1_label = MDLabel(text='1st Secondary Objective Points:')
        sec1_label.halign = 'center'
        sec1_parent_grid.add_widget(sec1_label)
        app_grid.add_widget(sec1_parent_grid)

        grid_sec1 = MDGridLayout()
        grid_sec1.cols = 3

        increase_sec1 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec1)
        self.sec1_counter = MDLabel(text=str(self.loaded_values[3]))
        self.sec1_counter.halign = 'center'
        self.sec1_counter.valign = 'middle'
        decrease_sec1 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec1)

        grid_sec1.add_widget(decrease_sec1)
        grid_sec1.add_widget(self.sec1_counter)
        grid_sec1.add_widget(increase_sec1)
        sec1_parent_grid.add_widget(grid_sec1)

        # VP SECONDARY 2

        sec2_parent_grid = MDGridLayout()
        sec2_parent_grid.cols = 1
        sec2_parent_grid.rows = 2
        sec2_parent_grid.adaptive_height = True

        sec2_label = MDTextField()
        sec2_label.hint_text = '2nd Secondary Objective Points:'
        sec2_label.multiline = False
        #sec2_label = MDLabel(text='2nd Secondary Objective Points:')
        sec2_label.halign = 'center'
        sec2_parent_grid.add_widget(sec2_label)
        app_grid.add_widget(sec2_parent_grid)

        grid_sec2 = MDGridLayout()
        grid_sec2.cols = 3

        increase_sec2 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec2)
        self.sec2_counter = MDLabel(text=str(self.loaded_values[4]))
        self.sec2_counter.halign = 'center'
        self.sec2_counter.valign = 'middle'
        decrease_sec2 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec2)

        grid_sec2.add_widget(decrease_sec2)
        grid_sec2.add_widget(self.sec2_counter)
        grid_sec2.add_widget(increase_sec2)
        sec2_parent_grid.add_widget(grid_sec2)

        # VP SECONDARY 3

        sec3_parent_grid = MDGridLayout()
        sec3_parent_grid.cols = 1
        sec3_parent_grid.rows = 2
        sec3_parent_grid.adaptive_height = True

        sec3_label = MDTextField()
        sec3_label.hint_text = '3rd Secondary Objective Points:'
        sec3_label.multiline = False
        #sec3_label = MDLabel(text='3rd Secondary Objective Points:')
        sec3_label.halign = 'center'
        sec3_parent_grid.add_widget(sec3_label)
        app_grid.add_widget(sec3_parent_grid)

        grid_sec3 = MDGridLayout()
        grid_sec3.cols = 3

        increase_sec3 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec3)
        self.sec3_counter = MDLabel(text=str(self.loaded_values[5]))
        self.sec3_counter.halign = 'center'
        self.sec3_counter.valign = 'middle'
        decrease_sec3 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec3)

        grid_sec3.add_widget(decrease_sec3)
        grid_sec3.add_widget(self.sec3_counter)
        grid_sec3.add_widget(increase_sec3)
        sec3_parent_grid.add_widget(grid_sec3)

        # Empty grid to create space

        empty_grid = MDGridLayout()
        app_grid.add_widget(empty_grid)

        # Bottom grid for Score and Reset buttons

        bottom_grid = MDGridLayout()
        bottom_grid.cols = 2
        app_grid.add_widget(bottom_grid)

        # SCORE TOAST

        score_button = MDFillRoundFlatIconButton(icon='flag-plus-outline',
                                                 text="Show score",
                                                 on_press=self.sum_up)
        button_anchor = AnchorLayout()
        button_anchor.anchor_y = 'bottom'
        button_anchor.add_widget(score_button)
        bottom_grid.add_widget(button_anchor)

        # RESET

        reset_button = MDFillRoundFlatIconButton(icon='backup-restore',
                                                 text="Reset",
                                                 on_press=self.reset_values)
        reset_button_anchor = AnchorLayout()
        reset_button_anchor.anchor_y = 'bottom'
        reset_button_anchor.add_widget(reset_button)
        bottom_grid.add_widget(reset_button_anchor)

        return screen_manager
Esempio n. 14
0
 def test_gridlayout_get_max_widgets_rows_None(self):
     gl = GridLayout()
     gl.cols = 1
     expected = None
     value = gl.get_max_widgets()
     self.assertEqual(expected, value)
Esempio n. 15
0
    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)

        self.modifier = 0
        self.number_of_dices = 1
        self.type_dice = 0
        self.registro = 0
        self.orientation = "vertical"
        self.calculo_resultado = 0
        self.mod_is_negative = 1
        self.cb_list = []
        self.critical = ""

        Window.bind(on_key_up=self.read_key)

        # Añadiendo Widgets

        cuadricula_inicial = GridLayout()
        cuadricula_inicial.cols = 9
        cuadricula_inicial.rows = 2
        self.add_widget(cuadricula_inicial)

        # añadiendo primera cara textos y checkboxes

        for i in DICES:
            cuadricula_inicial.add_widget(Label(text="1d{0}".format(i), size_hint=(1, None), font_size=14, height=20))

        for i in DICES:
            cb = CheckBox(group=True, color=(255, 0, 0, 3), id=str(i))
            cb.bind(active=self.update_type_dice)
            cuadricula_inicial.add_widget(cb)
            self.cb_list.append(cb)

        # Segunda Caja:

        caja_de_modificadores = BoxLayout(orientation="horizontal")
        self.add_widget(caja_de_modificadores)

        # 2.1
        caja_num = StackLayout()
        caja_de_modificadores.add_widget(caja_num)
        caja_num.add_widget(Label(text="Dice Number", size_hint=(0.5, 0.5)))
        caja_num.add_widget(change_num)
        change_num.bind(text=self.input_number)
        caja_num.add_widget(lista_num)
        lista_num.bind(text=self.cuantas_lanzadas)

        # 2.2
        caja_mod = StackLayout()
        caja_de_modificadores.add_widget(caja_mod)
        caja_mod.add_widget(Label(text="Modifier", size_hint=(0.5, 0.4)))
        caja_mod.add_widget(change_mod)
        change_mod.bind(text=self.input_modifier)
        caja_mod.add_widget(Label(text="Negativo", size_hint=(0.5, 0.3)))
        self.cb_negative = CheckBox(size_hint=(0.5, 0.3))
        caja_mod.add_widget(self.cb_negative)
        self.cb_negative.bind(active=self.negative_modifier)
        caja_mod.add_widget(lista_mod)
        lista_mod.bind(text=self.cuanto_es_modificador)

        # 2.3
        self.btn = Button(text="Lanzar", font_size=18, )
        self.btn.bind(on_press=self.lanzar_dados)
        caja_de_modificadores.add_widget(self.btn)

        # Tercera caja

        self.resultado = Label(text="Esperando Lanzamiento de dados", color=(1, 0, 0, 0.8))
        self.add_widget(self.resultado)

        # Cuarta caja

        self.lista_registro = RV()
        self.add_widget(self.lista_registro)
Esempio n. 16
0
    def GetAudioConversionUI(self):
        self.AudioFls_toconvert = FilesHolder(None)
        self.AudioTarget_Dir = TargetDirectoryHolder(None)

        gl = StackLayout(spacing=(0, 5))

        lab_title = Label(text='Audio Format Converter', size_hint=(1, 0.1))
        lab_title.outline_color = (1, 1, 1, 1)
        lab_title.color = (0, 0, 0, 1)
        lab_title.outline_width = 2

        sub_gl = GridLayout(cols_minimum={
            0: 20,
            5: 80
        }, size_hint=(1, 0.1))
        sub_gl.cols = 6
        sub_gl.add_widget(Label(size_hint=(1, 0.8)))
        sub_gl.add_widget(Label(text='From', size_hint=(1, 0.8)))

        self.input_ext_dd = DropDown()
        for out in AUDIO_FORMATS:
            btn = Button(text=out, size_hint_y=None, height=44)

            def fnc(e):
                self.input_ext_dd.select(e.text)
                self.input_format = e.text
                self.AudioFls_toconvert.set_format(e.text)

            btn.bind(on_press=fnc)
            self.input_ext_dd.add_widget(btn)
        mainbutton_in = Button(text='Input file format', size_hint=(1, 0.8))
        mainbutton_in.bind(on_release=self.input_ext_dd.open)
        self.input_ext_dd.bind(
            on_select=lambda instance, x: setattr(mainbutton_in, 'text', x))

        sub_gl.add_widget(mainbutton_in)
        sub_gl.add_widget(Label(text='To', size_hint=(1, 0.8)))
        self.output_ext_dd = DropDown()
        for out in AUDIO_FORMATS:
            btn = Button(text=out, size_hint_y=None, height=44)

            def fnc(e):
                self.output_ext_dd.select(e.text)
                self.output_format = e.text

            btn.bind(on_press=fnc)
            self.output_ext_dd.add_widget(btn)
        mainbutton_out = Button(text='Output file format', size_hint=(1, 0.8))
        mainbutton_out.bind(on_release=self.output_ext_dd.open)
        self.output_ext_dd.bind(
            on_select=lambda instance, x: setattr(mainbutton_out, 'text', x))

        sub_gl.add_widget(mainbutton_out)
        sub_gl.add_widget(Label(size_hint=(1, 0.8)))
        sub_gl.add_widget(Label())
        sub_gl.add_widget(Label())
        sub_gl.add_widget(Label())
        sub_gl.add_widget(Label())
        sub_gl.add_widget(Label())
        sub_gl.add_widget(Label())

        sub_gl_1 = GridLayout(cols_minimum={
            0: 350,
            1: 50,
            2: 50
        },
                              size_hint=(1, 0.1))
        sub_gl_1.cols = 3

        sub_gl_1.add_widget(Label(text='Filename'))
        sub_gl_1.add_widget(Label(text='format'))
        sub_gl_1.add_widget(Label(text='state'))

        scroll = ScrollView(do_scroll_y=True,
                            size_hint=(1, None),
                            size=(Window.width, 200))
        sub_gl_1_1 = CustomGridLayout(cols_minimum={
            0: 350,
            1: 50,
            2: 50
        },
                                      size_hint=(1, None),
                                      height=200)
        sub_gl_1_1.cols = 3
        sub_gl_1_1.bind(minimum_height=sub_gl_1_1.setter('height'))
        self.AudioFls_toconvert.GrList = sub_gl_1_1
        scroll.add_widget(sub_gl_1_1)

        sub_gl_2 = StackLayout(orientation='rl-tb', size_hint=(1, 0.02))
        sub_gl_2.add_widget(
            Label(text='', width=50, height=30, size_hint=(None, None)))
        sub_gl_2.add_widget(
            Button(text='Remove File',
                   width=100,
                   height=30,
                   size_hint=(None, None)))

        def show_load(e):
            content = LoadDialogMul(
                load=self.to_path_wrapper(self.AudioFls_toconvert),
                cancel=self.dismiss_popup,
            )
            self._popup = Popup(title="Load file(s)",
                                content=content,
                                size_hint=(0.9, 0.9))
            self._popup.open()

        btn = Button(text='Add File(s)',
                     width=100,
                     height=30,
                     size_hint=(None, None))
        btn.bind(on_release=show_load)
        sub_gl_2.add_widget(btn)

        sub_gl_3 = GridLayout(cols_minimum={
            1: 120,
            2: 500,
            3: 50
        },
                              size_hint=(1, 0.05))
        sub_gl_3.cols = 4
        sub_gl_3.add_widget(
            Label(text='', width=50, height=30, size_hint=(None, None)))
        sub_gl_3.add_widget(
            Label(text='Dest. Directory: ',
                  width=120,
                  height=30,
                  size_hint=(None, None)))
        self.AudioTarget_Dir.TItarget = TextInput(multiline=False,
                                                  width=500,
                                                  height=30,
                                                  size_hint=(None, None))
        sub_gl_3.add_widget(self.AudioTarget_Dir.TItarget)

        def show_load2(e):
            content = LoadDialogDir(
                load=self.to_path_wrapper(self.AudioTarget_Dir),
                cancel=self.dismiss_popup,
            )
            self._popup = Popup(title="Choose Directory",
                                content=content,
                                size_hint=(0.9, 0.9))
            self._popup.open()

        btn2 = Button(text='parcourir',
                      width=100,
                      height=30,
                      size_hint=(None, None))
        btn2.bind(on_release=show_load2)
        sub_gl_3.add_widget(btn2)

        sub_gl_4 = StackLayout(orientation='rl-tb',
                               size_hint=(1, 0.04),
                               spacing=(0, 10))
        sub_gl_4.add_widget(
            Label(text='', width=50, height=30, size_hint=(None, None)))

        btn4 = Button(text='Stop',
                      width=100,
                      height=30,
                      size_hint=(None, None))
        btn4.bind(on_release=self.Stop_Converting)
        sub_gl_4.add_widget(btn4)

        btn3 = Button(text='Start',
                      width=100,
                      height=30,
                      size_hint=(None, None))
        btn3.bind(on_release=self.Start_Converting)
        sub_gl_4.add_widget(btn3)

        gl.add_widget(lab_title)
        gl.add_widget(sub_gl)
        header = Label(text='Files to convert:(0 pending, 0 done)',
                       size_hint=(1, 0.05))

        def changeHeader(e, filelist):
            header.text = 'Files to convert:({} pending, {} done)'.format(
                len([f for f in filelist if f['state'] == 'pending']),
                len([f for f in filelist if f['state'] == 'done']),
            )

        self.changeHeader = changeHeader
        sub_gl_1_1.bind(FlList=changeHeader)
        gl.add_widget(header)
        gl.add_widget(sub_gl_1)
        gl.add_widget(scroll)
        gl.add_widget(sub_gl_2)
        gl.add_widget(Label(text='', height=40, size_hint=(None, 0.04)))
        gl.add_widget(sub_gl_3)
        gl.add_widget(Label(text='', height=40, size_hint=(None, 0.03)))
        gl.add_widget(sub_gl_4)

        return gl
Esempio n. 17
0
    def initPopup(self, instance):
        #Structuring the interface and adding the labels and text fields
        content = GridLayout()
        content.cols = 1

        inside = GridLayout()
        content.add_widget(inside)
        inside.cols = 2

        labelIP = BoxLayout()
        labelIP.width = 70
        labelIP.size_hint_x = None
        labelIP.add_widget(Label(text="IP:"))
        inside.add_widget(labelIP)

        ipGrid = BoxLayout()
        inside.add_widget(ipGrid)

        for ipGrid.i in self.ip:
            tmp = AnchorLayout(anchor_x='center', anchor_y='center')
            ipGrid.add_widget(tmp)
            ipGrid.i.size_hint = (1, 0.45)

            tmp.add_widget(ipGrid.i)

        labelPort = BoxLayout()
        labelPort.width = 70
        labelPort.size_hint_x = None
        labelPort.add_widget(Label(text="Port:"))
        inside.add_widget(labelPort)

        tmp = AnchorLayout(anchor_x='center', anchor_y='center')
        inside.add_widget(tmp)
        self.port.size_hint = (0.5, 0.45)
        tmp.add_widget(self.port)

        labelPass = BoxLayout()
        labelPass.width = 70
        labelPass.size_hint_x = None
        labelPass.add_widget(Label(text="Password"))
        inside.add_widget(labelPass)

        tmp = AnchorLayout(anchor_x='center', anchor_y='center')
        inside.add_widget(tmp)
        self.password.size_hint = (1, 0.45)
        tmp.add_widget(self.password)

        #Adding submit button at the bottom of the popup window
        btnLay = AnchorLayout(anchor_x='center', anchor_y='center')
        btnLay.size_hint = (1, 0.2)
        content.add_widget(btnLay)
        btnLay.submitIPBtn = Button(text="Submit",
                                    font_size=0.025 * 720,
                                    size_hint=(0.4, 0.9))
        btnLay.submitIPBtn.bind(on_release=self.submitIP)
        btnLay.add_widget(btnLay.submitIPBtn)

        self.popupWindow = Popup(
            title="Enter ip, port and password to access.",
            content=content,
            size_hint=(0.8, 0.6))