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

        super(SwitchContainer, self).__init__(**kwargs)
        self.cols = 2

        #
        #Switch1
        #

        #switch label
        self.add_widget(Label(text="SW 1: "))

        #switch1 button
        self.sw1 = Switch(active=False)
        self.add_widget(self.sw1)
        self.sw1.disabled = True  #Make the switch unclickable on the app

        #
        #Led1
        #

        #led label
        self.add_widget(
            Label(text="LED 1: "))  #Create a label that displays "LED 1"

        #led1 button
        self.led1 = Switch(active=False)
        self.add_widget(
            self.led1)  #Create a switch that can be turned off or on

        #schedule the JSONrequest function to trigger every second to read/write database
        event = Clock.schedule_interval(partial(self.JSONrequest), 1)
예제 #2
0
    def build_overview(self):
        alarm_overview = self.ids['Alarm_Overview_Stack']
        alarm_overview.bind(minimum_height=alarm_overview.setter('height'))
        alarm_overview.clear_widgets(children=None)

        SortedAlarms = sorted(Alarms,
                              key=lambda Alarm: Alarm.MinutesAfterMidnight())
        for alarm in SortedAlarms:

            alarm_overview.add_widget(
                Label(text=alarm.to_string(),
                      font_size=25,
                      height=80,
                      size_hint=(0.4, None)))

            alarm_switch = Switch(active=alarm.IsActive,
                                  height=80,
                                  size_hint=(0.3, None))
            alarm_switch.bind(active=alarm.toggle_active)

            alarm_delete = Button(
                background_normal='images/AccordionSelected.png',
                height=64,
                size_hint=(0.2, None))
            alarm_delete.bind(on_press=partial(self.delete_alarm, alarm))

            alarm_overview.add_widget(alarm_switch)
            alarm_overview.add_widget(alarm_delete)
예제 #3
0
	def build(self):
		Config.set('graphics', 'width', 320)
		Config.set('graphics', 'height', 512)
		print(kivy.__version__)

		# -------- funciones -------------
		def sw(instance, value):
			print('the switch', instance, 'is', value)
			print(layout.size)
			if value:
				labelMensaje.text = "ACTIVADO."
				print(kivy.__version__)
			else:
				labelMensaje.text = "DESACTIVADO."

		# capas layout
		layout = BoxLayout(spacing=2, orientation="horizontal", padding=30)
		layout2 = BoxLayout(spacing=10, orientation="vertical", padding=30)
		
		# elementos widgets
		labelsw1 = Label(text="Luz del pasillo:")
		btn1 = Button(text='Entrar')
		labelMensaje = Label(text="DESACTIVADO.", font_size=30)
		switch = Switch()

		layout.add_widget(switch, index=0)
		layout.add_widget(labelsw1, index=1)
		layout2.add_widget(layout, index=2)
		layout2.add_widget(btn1, index=0)
		layout2.add_widget(labelMensaje, index=1)

		switch.bind(active=sw)

		return layout2
 def __init__(self, **kwargs):
     super(Alarm_widget, self).__init__(**kwargs)
     # Alarm_Body=FloatLayout(pos_hint={'center_x':0.5,'y':0})
     self.DataBar = DataBar  =BoxLayout(size_hint=[.5,1],pos_hint={'x':0,'center_y':0.5}, orientation='vertical')
     self.frst=frst=Label(text='Alarm1')
     self.scnd=scnd=Label(text='0:0')
     self.size_hint=(1,None)
     self.height=100
     self.sound_inst_loop=['Sound1.mp3','Sound2.mp3','Sound3.mp3','Sound4.mp3','Sound5.mp3']
     self.sound_loop=['1','2','3','4','5']
     for i in range(len(self.sound_inst_loop)):
         self.sound_loop[i] = SoundLoader.load(self.sound_inst_loop[i])
     self.touchedS=BooleanProperty(False)
     self.audiobool=BooleanProperty(False)
     DataBar.add_widget(frst)
     DataBar.add_widget(scnd)
     self.callScr=Call_Time_Screen()
     self.popupsi=Popup(title='Unexpected/uninputed value',content=self.callScr)
     self.add_widget(DataBar)
     self.ONOFF= ONOFF= Switch(size_hint=[1/2,.5],pos_hint={'x': 0, 'center_y': 0.5})
     ONOFF.bind(active=self.LetsGetActivate)
     self.Alarm_ToolBar=Alarm_ToolBar=FloatLayout(size_hint=(.5,1),pos_hint={'right':1,'center_y':0.5})
     # self.Button_Delete=Button_Delete= Alarm_manager_Lables(size_hint=[1/5,.4],pos_hint={'right': .9, 'center_y': 0.5})
     # Button_Delete.img1.source='icons8-no-96.png'
     # Button_Delete.btn1.bind(on_release=self.LetsDelete)
     Alarm_ToolBar.add_widget(ONOFF)
     # Alarm_ToolBar.add_widget(Button_Delete)
     # Button_Stop.btn1.bind(on_release=self.LetsGetDelete)
     self.add_widget(Alarm_ToolBar)
예제 #5
0
 def __init__(self, **kwargs):
     super(SwitchContainer, self).__init__(**kwargs)
     self.cols = 2
     self.add_widget(Label(text="Auto jump status:"))
     self.settings_sample = Switch(active=False)
     self.add_widget(self.settings_sample)
     self.settings_sample.bind(active=switch_callback)
예제 #6
0
파일: admin.py 프로젝트: twoelz/symbaduct
    def __init__(self, section, item_name, item_value):
        super(BoxLayoutItemBoolean, self).__init__(section, item_name,
                                                   item_value)

        self.item_value = Switch(active=item_value)
        self.add_widget(self.item_value)
        self.item_value.bind(active=self.item_activated)
예제 #7
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        Window.size = (640, 700)
        self.cross_img = Image(source="", size=(640, 640), pos=(0, 120))

        self.add_widget(self.cross_img)

        self.noise_slider = Slider(min=-1, max=1, value=0, pos=(290, 40))
        self.add_widget(self.noise_slider)

        self.Generate_button = Button(text="Generate",
                                      size=(320, 60),
                                      pos=(0, 0),
                                      font_size=default_font_size)
        self.Generate_button.bind(on_press=self.Generate_image)
        self.add_widget(self.Generate_button)

        self.back_button = Button(text="Back",
                                  size=(320, 60),
                                  pos=(320, 0),
                                  font_size=default_font_size)
        self.back_button.bind(on_press=self.back)
        self.add_widget(self.back_button)

        self.switch = Switch(size=(50, 60), pos=(30, 50))
        self.switch.bind(active=self.switch_training)
        self.add_widget(self.switch)
예제 #8
0
 def build(self):
     layout = GridLayout(cols=2)
     layout.add_widget(Button(text='Widget 1'))
     layout.add_widget(Switch())
     layout.add_widget(Slider())
     layout.add_widget(Button(text='Widget 4'))
     return layout
예제 #9
0
class MainApp(App):
    user_id = 1

    def build(self):
        return GUI

    def on_start(self):
        # get database data
        result = requests.get(
            "https://chainapp-1e9a9-default-rtdb.europe-west1.firebasedatabase.app/{}.json"
            .format(str(self.user_id)))
        print("ok?", result)
        data = json.loads(result.content.decode())
        print(data)

    # Root is the main widget in layout, = gridlayout
    def change_screen(self, screen_name):
        print(self.root.ids)
        screen_manager = self.root.ids['screen_manager']
        screen_manager.current = screen_name

    def callback(instance, value):
        print('the switch', instance, 'is', value)

    switch = Switch()
    switch.bind(active=callback)
예제 #10
0
    def build(self):
        if platform == "android":
            from android import AndroidService
            service = AndroidService('desire sensors service', 'running')
            service.start('service started')
            self.service = service

        status_page = StatusPage()
        accelerometer.enable()
        compass.enable()
        self.gps = gps
        self.gps.configure(on_location=self.on_gps_location,
                           on_status=self.on_gps_status)
        self.gps.start()

        notification.notify(title="Hello", message="Just Checking")
        #vibrator.vibrate(0.2)  # vibrate for 0.2 seconds
        print("Hello World")
        status_page.gps_data = self.gps_data

        #        Clock.schedule_interval(status_page.update, 1.0 / 10.0) # 10H
        Clock.schedule_interval(status_page.update, 1.0)  # 1Hz

        button = Button(text='Service', size_hint=(0.12, 0.12))
        button.bind(on_press=self.callback)
        status_page.add_widget(button)

        switch = Switch()
        switch.bind(active=self.callback)
        status_page.add_widget(switch)
        return status_page
예제 #11
0
    def update(self, *args):
        self.ids["Title"].text = self.title
        self.ids["Description"].text = self.description

        self._editorHolder.clear_widgets()

        if self.type == "numericSlider":
            if self.sliderMin is None or self.sliderMax is None:
                raise ValueError("'sliderMin' and / or 'sliderMax' cannot be 'None' if type is numericSlider")


            self._editorWidget = Slider(min=self.sliderMin, max=self.sliderMax,
                                        value=Config.getint(self.section, self.option), step=1)
            self._editorWidget.bind(value=self.value_changed)

            self._editorWidget2 = TextInput(multiline=False, font_size=self._editorHolder.height / 2,
                                            text=Config.get(self.section, self.option), input_filter="int")
            self._editorWidget2.bind(on_text_validate=self.text_box_int_validator)
            self._editorWidget2.bind(focus=self.text_box_int_validator)


        elif self.type == "bool":
            self._editorWidget = Switch(active=Config.getboolean(self.section, self.option))
            self._editorWidget.bind(active=self.value_changed)


        elif self.type == "string":
            self._editorWidget = TextInput(multiline=False, font_size=self._editorHolder.height / 2,
                                           text=Config.get(self.section, self.option))
            self._editorWidget.bind(on_text_validate=lambda *args: self.value_changed(None, self._editorWidget.text))
            self._editorWidget.bind(focus=lambda *args: self.value_changed(None, self._editorWidget.text))

        elif self.type == "option":
            self._editorWidget = Button(text=Config.get(self.section, self.option))

            dropDown = DropDown()

            for option in self.options:
                text = str(option)
                try:
                    text = text + " - " + str(self.extra_info[option])
                except KeyError:
                    pass

                btn = Button(text=text, size_hint_y=None, height=self.height)
                btn.tag = str(option)
                btn.bind(on_release=lambda _btn: dropDown.select(_btn.tag))
                dropDown.add_widget(btn)

            self._editorWidget.bind(on_release=dropDown.open)
            self._editorWidget.bind(on_release=lambda *args: emptyFunction(dropDown.children))
            dropDown.bind(on_select=lambda instance, x: setattr(self._editorWidget, 'text', x))
            dropDown.bind(on_select=self.value_changed)


        if self._editorWidget2 is not None:
            self._editorHolder.add_widget(self._editorWidget2)

        if self.type != "title":
            self._editorHolder.add_widget(self._editorWidget)
예제 #12
0
 def __init__(self, label="", **kwargs):
     super(SwitchButton, self).__init__(**kwargs)
     self.cols = 2
     self.rows = 1
     self.label = Label(text=label)
     self.switch = Switch(active=True)
     self.add_widget(self.label)
     self.add_widget(self.switch)
예제 #13
0
    def sw_factory(self):
        def cb(ins, val):
            self.value = val
            print(self.value)

        ti = Switch(size_hint_y=None, height=30)
        ti.bind(active=cb)
        return ti
예제 #14
0
    def __init__(self, **kwargs):
        super(SwitchContainer, self).__init__(**kwargs)

        self.inside = GridLayout()
        self.inside.cols = 4

        self.cols = 1

        self.inside.add_widget(
            Label(text="Iris Scanner: "))  #create a label for SW1
        self.sw1 = Switch(
            active=False)  #create a SwitchCompat for SW1(default to OFF)
        self.inside.add_widget(
            self.sw1)  #add the created SwitchCompat to the screen
        self.sw1.disabled = True  #make SW1unclickable on the app

        self.inside.add_widget(
            Label(text="Proximity Fab: "))  #create a label for SW2
        self.sw2 = Switch(
            active=False)  #create a SwitchCompat for SW2(default to OFF)
        self.inside.add_widget(
            self.sw2)  #add the created SwitchCompat to the screen
        self.sw2.disabled = True  #make SW2unclickable on the app

        self.inside.add_widget(Label(text="Door: "))  #create a label for LED1
        self.led1 = Switch(
            active=False)  #create a SwitchCompat for LED1(default to OFF)
        self.inside.add_widget(
            self.led1)  #add the created SwitchCompat to the screen

        self.inside.add_widget(Label(text="Alarm: "))  #create a label for LED2
        self.led2 = Switch(
            active=False)  #create a SwitchCompat for LED2(default to OFF)
        self.inside.add_widget(
            self.led2)  #add the created SwitchCompat to the screen

        self.add_widget(self.inside)

        self.add_widget(
            Label(text="Acknowldege Alarm:"))  #create a label for LED2
        self.ACK = Switch(
            active=False)  #create a SwitchCompat for LED2(default to OFF)
        self.add_widget(self.ACK)  #add the created SwitchCompat to the screen

        #schedule the JSONrequest function to trigger every 5 seconds to read/write databases
        event = Clock.schedule_interval(partial(self.JSONrequest), 3)
예제 #15
0
    def __init__(self, **kwargs):
        super(SettingsLiteScreen, self).__init__(**kwargs)

        # Set up the settings in a grid
        popup = GridLayout(cols=1, size_hint_y=None)
        # Make sure the height is such that there is something to scroll.
        popup.bind(minimum_height=popup.setter('height'))

        # Set up setting buttons
        with open(join(dirname(__file__), 'camera.json')) as json_file:
            json_data = json.load(json_file)
            for setting in json_data:
                if setting['settings_lite'] == '1':

                    # Check if the setting is boolean
                    if setting['type'] == 'bool':

                        # Check if the current setting is on or off
                        if main.App.get_running_app().config.getint('Camera', setting['key']) == 1:
                            cur_state = True
                        else:
                            cur_state = False

                        # Create the widgets
                        label = Label(text=setting['title'],
                                     size_hint_y=None,
                                     height=48)
                        switch = Switch(active=cur_state,
                                    size_hint_y=None,
                                    height=48)
                        switch.bind(active=partial(self.settings_lite_switch_toggle, setting['key']))
                        # Add to main settings_lite widget
                        popup.add_widget(label)
                        popup.add_widget(switch)

                    # Else just make the setting a button
                    else:
                        btn = Button(text=setting['title'],
                                     size_hint_y=None,
                                     height=96)
                        btn.bind(on_release=self.settings_lite_button_push)
                        popup.add_widget(btn)

        # Setup the scrollable section and add to floatlayout.
        scrolly = ScrollView(size_hint=(0.2, 0.83),
                             pos_hint={'x':0.8, 'y':0.17})
        scrolly.add_widget(popup)
        floaty = FloatLayout()
        floaty.add_widget(scrolly)

        # Add the close button to the bottom
        close_button = Button(text='Close',
                              size_hint=(0.2, 0.16),
                              pos_hint={'x':0.8, 'y':0})
        close_button.bind(on_release=self.close_settings_lite)
        floaty.add_widget(close_button)
        self.add_widget(floaty)
예제 #16
0
    def dashboard_speed_tab(self):
        canvas = BoxLayout(orientation='vertical')

        # 1st layer
        setup = BoxLayout(orientation='horizontal')
        #setup.height = 20
        setup.size_hint = (1, None)
        btnPlus = Button(text='-', id="minus")
        self.w_spd_targetspeed = Label(text='10', font_size="20sp")
        btnMinus = Button(text='+', id="plus")
        btnAspd = ToggleButton(text='AirSpeed',
                               id="aspd",
                               group='speed_source',
                               state='down')
        btnGspd = ToggleButton(text='GndSpeed',
                               id="gspd",
                               group='speed_source')
        btnAspd.bind(state=self.cb_set_speed_source)
        btnGspd.bind(state=self.cb_set_speed_source)
        btnPlus.bind(state=self.cb_set_speed_source)
        btnMinus.bind(state=self.cb_set_speed_source)
        swRead = Switch(active=False)
        swRead.bind(active=self.toggle_reading)
        setup.add_widget(btnPlus)
        setup.add_widget(self.w_spd_targetspeed)
        setup.add_widget(btnMinus)
        setup.add_widget(btnAspd)
        setup.add_widget(btnGspd)
        setup.add_widget(swRead)

        # zaskrtavatko - hlas, tón, pipani
        # Ukazatel

        data = BoxLayout(orientation='horizontal')

        data_actual = BoxLayout(orientation='vertical')
        self.w_spd_release_status = Label(text="--Release--", markup=True)
        self.w_spd_speed_info = Label(text="info",
                                      markup=True,
                                      halign="center")
        data_actual.add_widget(self.w_spd_release_status)
        data_actual.add_widget(self.w_spd_speed_info)

        data_offset = BoxLayout(orientation='vertical')
        self.w_spd_offset = Label(text="Err", font_size="50sp", markup=True)
        data_offset.add_widget(self.w_spd_offset)

        self.w_spd_range = Range()

        data.add_widget(data_actual)
        data.add_widget(data_offset)
        data.add_widget(self.w_spd_range)

        canvas.add_widget(setup)
        canvas.add_widget(data)
        return canvas
예제 #17
0
 def __init__(self, **kwargs):
     super(Automatic, self).__init__(**kwargs)
     self.orientation = 'horizontal'
     self.file = FileChooserIconView()
     self.add_widget(self.file)
     self.ip = TextInput(text="IP", multiline=False)
     self.add_widget(self.ip)
     self.add_widget(Label(text="aggressive:"))
     self.aggressive = Switch(active=True)
     self.add_widget(self.aggressive)
예제 #18
0
    def __init__(self, text, color, bold=False, **kwargs):
        super(SwitchLayout, self).__init__(**kwargs)
        self.cols = 2
        label = Label(text=text, bold=bold)
        self.add_widget(label)
        self.add_widget(Switch())

        self.bind(size=self.update_rect, pos=self.update_rect)

        with self.canvas.before:
            Color(color[0], color[1], color[2], color[3])
            self.rect = Rectangle(size=self.size, pos=self.pos)
예제 #19
0
    def __init__(self, **kwargs):
        super(SettingsField, self).__init__()
        self.cols = 4
        self.rows = 1
        self.titleInput = TextInput()
        self.pneumatic = Switch()
        self.highValue = TextInput()
        self.lowValue = TextInput()

        self.add_widget(self.titleInput)
        self.add_widget(self.pneumatic)
        self.add_widget(self.highValue)
        self.add_widget(self.lowValue)
예제 #20
0
 def __init__(self, **kwargs):
     services = ("redis", "cassandraDB", "rethinkDB", "mongoDB",
                 "elasticsearch", "couchDB")
     super(Specific, self).__init__(**kwargs)
     self.orientation = 'horizontal'
     self.service = Spinner(text='Service', values=services)
     self.add_widget(self.service)
     self.IP = TextInput(text="IP", multiline=False)
     self.port = TextInput(text="port", multiline=False)
     self.add_widget(self.IP)
     self.add_widget(self.port)
     self.aggressive = Switch(active=True)
     self.add_widget(self.aggressive)
예제 #21
0
    def __init__(self, **kwargs):
        self.rows = 1
        self.cols = 1
        GridLayout.__init__(self, **kwargs)
        topLayout = BoxLayout(orientation="vertical")
        midLayout = BoxLayout(orientation="horizontal", size_hint=(1.0, 0.8))
        swLayout = BoxLayout(orientation="vertical", size_hint=(0.2, 1.0))
        swLayout.add_widget(Label(text="Zoom"))
        self.zs = Switch()
        self.zs.bind(active=self.zoomSwitchLogic)
        swLayout.add_widget(self.zs)
        swLayout.add_widget(Label(text="Pan"))
        self.ps = Switch()
        self.ps.bind(active=self.panSwitchLogic)
        swLayout.add_widget(self.ps)
        midLayout.add_widget(Renderer(self.zs, self.ps, size_hint=(0.8, 1.0)))
        midLayout.add_widget(swLayout)

        topLayout.add_widget(Button(text="first", size_hint=(1.0, 0.1)))
        #topLayout.add_widget(Renderer(size_hint=(1.0, 0.8)))
        topLayout.add_widget(midLayout)
        topLayout.add_widget(Button(text="second", size_hint=(1.0, 0.1)))
        self.add_widget(topLayout)
    def __init__(self, **kwargs):
        super(RVViewClass, self).__init__(**kwargs)

        self.label_user_info = Label(text='', bold=True, italic=True)
        self.add_widget(self.label_user_info)
        self.label_estimator_info = Label(text='', bold=True, italic=True)
        self.add_widget(self.label_estimator_info)
        self.switch_is_accessible = Switch(active=True)
        self.add_widget(self.switch_is_accessible)

        self.bind(user_id=self.represent_info)
        self.bind(estimator_id=self.represent_info)
        self.bind(db=self.represent_info)
        self.switch_is_accessible.bind(active=self.switch_is_accessible_bind)
예제 #23
0
    def __init__(self, json_device, *args, **kwargs):
        super(DeviceBox, self).__init__(*args, **kwargs)

        self.app = App.get_running_app()

        print 'building device box'
        print json_device
        print '\n'

        self.maj_id = json_device['id']
        self.model = json_device['device_key']
        self.name = json_device['name']

        self.orientation = 'vertical'
        self.add_widget(
            Label(text=self.name, text_size=(self.width - dp(10), 35)))

        if self.model in self.nexa_controllers:
            self.switches = []
            for switch in json_device['switches']:
                if switch['state'] != None: state = switch['state']
                else: state = False
                new_switch = Switch(id=switch['id'],
                                    active=state,
                                    disabled=True)
                self.switches.append(new_switch)
                self.add_widget(new_switch)
        elif self.model in self.nexa_sensors:
            self.last_activated = Label(text=json_device['last_activated'],
                                        size_hint=(None, 1),
                                        text_size=(self.width - dp(10), 100),
                                        pos_hint={'center_x': 0.5})
            self.add_widget(self.last_activated)
        elif self.model in self.nexa_devices:
            self.switch = Switch(id=json_device['id'])
            self.switch.bind(active=self.user_action)
            self.add_widget(self.switch)
예제 #24
0
 def __init__(self, **kwargs):
     super(Switch_implementare, self).__init__(**kwargs)
     self.cols = 1
     self.padding = 150
     self.switch1 = Switch()
     self.switch1.active = True
     self.add_widget(self.switch1)
     self.arata_volum = Label(text="volum: 10")
     self.add_widget(self.arata_volum)
     self.slide_muzica = Slider(min=0, max=100, value=10)
     self.slide_muzica.step = 5
     self.slide_muzica.orientation = "horizontal"  # alte optiuni 'vertical'
     self.add_widget(self.slide_muzica)
     self.switch1.bind(active=self.dezactiveaza_volum)
     self.slide_muzica.bind(value=self.valoare_volum)
예제 #25
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.cols = 2

        self.pref = Prefences()

        # App will speak pref
        ch = Switch(active=self.getSettingValue('speak'))
        ch.bind(active=self.callback)
        self.add_widget(Label(text='app will speak words'))
        self.add_widget(ch)

        chMakeCaps = Switch(active=self.getSettingValue('makeCaps'))
        chMakeCaps.bind(active=self.callbackMakeCaps)
        self.add_widget(Label(text='app will show all words in Caps'))
        self.add_widget(chMakeCaps)

        self.add_widget(
            Label(text="URL importing")
        )

        self.urlLayout = UrlLayout()
        self.add_widget(self.urlLayout)
예제 #26
0
def BrowserPop(self):
    layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700)
    layout.bind(minimum_height=layout.setter('height'))
    panel = SettingsPanel(title="Browser Mods", settings=self)   
    main = BoxLayout(orientation = 'vertical')
    root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False)
    root.size = (600, 400)
    root.add_widget(layout)
    main.add_widget(root)
    done = Button(text ='Done Choosing Options')
    main.add_widget(done)
    if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
        fp = open("%s/BrowserSettings.smali" % (Browser), "r")
        lines = fp.readlines()
        fp.close()
        tabs = SettingItem(panel = panel, title = "Unlimited Browser Tabs",disabled=False, desc = "Allows Unlimited number of browser tabs to be open")
        for i in range(len(lines)):
            if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
                tabs_switch = Switch(active=False)
                continue
            if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
                tabs_switch = Switch(active=True)
        tabs.add_widget(tabs_switch)
        layout.add_widget(tabs)
    
        def callback(instance, value):
            tabs_state(instance, value)
        tabs_switch.bind(active=callback)
    
    popup = Popup(background='atlas://images/eds/pop', title='Browser Mods', content=main, auto_dismiss=False, size_hint=(None, None), size=(630, 500))
    popup.open()

    def finish(self):
        finish_browser(self)
        popup.dismiss()
    done.bind(on_release=finish)
예제 #27
0
    def __init__(self, **kwargs):
        super(WhiteNoise, self).__init__(**kwargs)
        pos_hint = {"x": .5, "y": .1}

        def callback(instance, value):
            if (value is True):
                noise1.play()
            elif (value is False):
                noise1.stop()

        self.text = "white noise"
        noise1 = SoundLoader.load('sounds/noise1.wav')
        noise1.loop = True
        switch = Switch()
        switch.bind(active=callback)
        self.add_widget(switch)
예제 #28
0
    def popup2(self):
        mainPop = GridLayout(spacing=2.5, padding=50)
        mainPop.cols = 1

        pop = GridLayout(padding=15)
        pop.cols = 2

        switches = []
        switch_lab = [
            'Spatial1 & ES1', 'qT1', 'Spatial2 & ES2', 'T2*',
            'Semantic1 & ES3', 'DWI', 'Semantic2 & ES4', 'RS & ES5'
        ]

        addFile = open('tmp.txt', 'a')
        for s in range(len(switch_lab)):
            pop.add_widget(Label(text=switch_lab[s]))
            switches.append(Switch(active=True))
            addFile.write('\nBlock' + str(s + 1) + ': True')
            pop.add_widget(switches[s])
        addFile.close()

        switches[0].bind(active=self.switchBlock1)
        switches[1].bind(active=self.switchBlock2)
        switches[2].bind(active=self.switchBlock3)
        switches[3].bind(active=self.switchBlock4)
        switches[4].bind(active=self.switchBlock5)
        switches[5].bind(active=self.switchBlock6)
        switches[6].bind(active=self.switchBlock7)
        switches[7].bind(active=self.switchBlock8)

        bgCol = (37 / 255, 121 / 255, 203 / 255, 1)
        mainPop.start = Button(text='S T A R T',
                               font_size=18,
                               bold=True,
                               color='yellow',
                               background_color=bgCol,
                               background_normal='',
                               size_hint=(.1, .15))
        mainPop.start.bind(on_release=self.start_tasks)
        mainPop.add_widget(pop)
        mainPop.add_widget(mainPop.start)

        newWin = Popup(title='English: protocol II',
                       content=mainPop,
                       size_hint=(.82, .8))
        newWin.open()
예제 #29
0
    def after_init(self, *args):
        self.label = Label(text=self.inputName)
        self.add_widget(self.label)

        if self.callback is not None and self.callback != '':
            self.toCall = lambda *args: self.callback()
        else:
            self.toCall = lambda: print("no callback")

        if self.inputType == 0:
            self.input = TextInput(text=self.default_text,
                                   multiline=False,
                                   input_filter=self.input_filter)
        elif self.inputType == 1:
            self.input = Switch(active=self.default_text == "True")
        elif self.inputType == 2:
            self.input = Button(text=self.default_text)
        self.bindThis()
        self.add_widget(self.input)
예제 #30
0
파일: Kivy.py 프로젝트: caojc/kivy
    def Optiuni(self, Buton):
        self.layout0.clear_widgets()

        # Cream un widget Switch si atributele sale
        self.switch1 = Switch(text="muzica")
        self.switch1.active = True
        self.switch1.size_hint = (0.3, 0.2)
        self.switch1.pos = (300, 360)
        self.layout0.add_widget(self.switch1)
        # leaga Switch-ul de metoda dezactiveaza_volum
        self.switch1.bind(active=self.dezactiveaza_volum)

        # cream un widget Label si atributele sale
        # textul de pe acesta urmand sa se schimbe odata cu volumul
        self.arata_volum = Label(text="volum: 50")
        self.arata_volum.size_hint = (0.3, 0.1)
        self.arata_volum.pos = (300, 260)
        self.layout0.add_widget(self.arata_volum)

        # cream un widget Slider si atributele sale
        # nu am urmat exact indicatiile din cerinta pt. a crea atributele
        # am incercercat sa fac fereastra sa semene cu poza
        self.slide_muzica = Slider(min=0, max=100, value=50)
        self.slide_muzica.step = 5
        self.slide_muzica.pos = (300, 100)
        self.slide_muzica.size_hint = (0.3, 0.5)
        self.slide_muzica.orientation = "horizontal"
        self.layout0.add_widget(self.slide_muzica)
        # leaga Slider-ul de metoda valoare_volum
        self.slide_muzica.bind(value=self.valoare_volum)

        # crearea widgetu-lui inapoiButon si atributelor sale
        self.inapoiButon = Button(text="Inapoi",
                                  bold=True,
                                  background_color=(0, 0, 1, 1))
        self.inapoiButon.pos = (300, 120)
        self.inapoiButon.size_hint = (0.3, 0.1)
        self.inapoiButon.opacity = 0.7
        self.layout0.add_widget(self.inapoiButon)
        # legam apasarea butonului de intoarcerea la meniul principal
        self.inapoiButon.bind(on_press=self.Menu)