Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super(BoxLayout, self).__init__(*args, **kwargs)
     self.textinput = TextInput(text='Enter elements separated by spaces', multiline=False,
                                size=(300, 50))
     self.rut = Label(text='', pos=(450, 250))
     self.add_widget(self.textinput)
     self.textinput.bind(on_text_validate=self.chicken)
     self.wextinput = TextInput(text='Enter given', multiline=False, size=(300, 50))
     self.wextinput.bind(on_text_validate=self.alfredo)
     self.wextinput.bind(focus=self.on_focus2)
     self.reset = TextInput(text='Type reset to reset', multiline=False, size=(300, 50))
     self.texts = [self.textinput, self.wextinput, self.reset]
     self.textinput.bind(focus=self.on_focus)
     self.reset.bind(on_text_validate=self.resets)
     self.given = 0
     self.atoms = 0
     self.but = Label(text='Given: ' + str(self.given), pos=(425, 200))
     self.tut = Label(text='' + str(self.atoms), pos=(425, 225))
     self.mmlabel = Label(pos=((self.textinput.x + 50), (self.textinput.y + 100)))
     self.atlabel = Label(pos=(350, 425))
     self.molabel = Label(pos=(350, 400))
     self.tolabel = Label(pos=(350, 450))
     self.errorlabel = Label(pos=((self.textinput.x + 100), (self.textinput.y + 100)))
     self.add_widget(self.but)
     self.add_widget(self.tut)
     self.add_widget(self.atlabel)
     self.add_widget(self.molabel)
     self.add_widget(self.tolabel)
     self.mm = []
Ejemplo n.º 2
0
	def __init__(self, **kwargs):
		super(viewDayPopup, self).__init__(**kwargs)

		box = BoxLayout(orientation='vertical', spacing=10)
		get_input_box = BoxLayout(size_hint=(1, None), height=30)
		self.day_input = TextInput(multiline=False)
		self.month_input = TextInput(multiline=False)
		self.year_input = TextInput(multiline=False)
		day_lbl = Label(text='Ngày')
		month_lbl = Label(text='Tháng')
		year_lbl = Label(text='Năm')

		submit_btn = Button(text='OK', size_hint=(.2, 1), halign='center')
		anchor_submit_layout = AnchorLayout(anchor_x='center')
		anchor_submit_layout.add_widget(submit_btn)

		get_input_box.add_widget(day_lbl)
		get_input_box.add_widget(self.day_input)
		get_input_box.add_widget(month_lbl)
		get_input_box.add_widget(self.month_input)
		get_input_box.add_widget(year_lbl)
		get_input_box.add_widget(self.year_input)

		box.add_widget(get_input_box)
		box.add_widget(anchor_submit_layout)

		self.add_widget(box)
		self.day_input.focus = True
		self.day_input.bind(on_text_validate=self.dayValidate)
		self.month_input.bind(on_text_validate=self.monthValidate)
		self.year_input.bind(on_text_validate=self.yearValidate)
		submit_btn.bind(on_release=self.update)
Ejemplo n.º 3
0
class HomePage(PageBase):
    """HomePage of the App.

    This is the first page that the user will see."""

    def __init__(self, app):
        """Constructor"""
        # Call the base.
        super(HomePage, self).__init__(app)

        # Load the backend
        self.backend = SpecialBackend(FlatfileBackend())

        # Create a body manually, overriding the default.
        self.body = AnchorLayout(anchor_x='center', anchor_y='center')
        stack_layout = StackLayout(size_hint=(0.95, 0.6))
        self.body.add_widget(stack_layout)

        text_layout =  BoxLayout(anchor_x='left', anchor_y='center', size_hint=(0.8, None))
        text_layout.height = '35px'
        stack_layout.add_widget(text_layout)

        def on_enter(sender):
            self._on_search(sender, self.query.text)
        self.query = TextInput(text='', multiline=False, hint_text='Type here...')
        self.query.bind(on_text_validate=on_enter)
        text_layout.add_widget(self.query)


        button_layout =  BoxLayout(anchor_x='right', anchor_y='center', size_hint=(0.2, None))
        button_layout.height = '35px'
        stack_layout.add_widget(button_layout)

        def on_search_press(sender):
            self._on_search(self.query, self.query.text)
        search = Button(text='Search!')
        search.width = '50px'
        search.bind(on_press=on_search_press)
        button_layout.add_widget(search)

        self.search_results = RichPage.get_page(app, [self], self.backend, 'search')

        def on_category_press(sender):
            RichPage.get_page(app, [self], self.backend, 'categories').show(self)
            self.hide()
        category = Button(text='Categories', size_hint=(None, None), height='35px')
        category.width = '100px'
        category.bind(on_press=on_category_press)        
        self.body.add_widget(category)

    def _on_search(self, sender, value):
        """Called when the user trys to search."""
        query = value
        self.query.text = ''

        self.backend.cached_search(query)
        self.search_results.reload()

        self.hide()
        self.search_results.show(self)
Ejemplo n.º 4
0
class GuessScreen(GridLayout):
    def __init__(self, **kwargs):
        super(GuessScreen, self).__init__(**kwargs)
        self.cols = 1
        self.rows = 4
        self.someone = self.get_someone()

        self.photo = AsyncImage(source=self.someone['image'])
        self.add_widget(self.photo)

        self.guess = TextInput(multiline=False, focus=True )
        self.guess.bind(on_text_validate=self.on_enter)
        self.add_widget(self.guess)

    def get_someone(self):
        n_people = random.randint(0,len(people)-1)
        return people[n_people]

    def on_enter(self, value):
        print "Now guessing: ", self.someone['first_name']
        if self.guess.text == self.someone['first_name']:
            print "Yay"
            self.someone = self.get_someone()
            self.photo.source = self.someone['image']
            self.guess.text = ""
        else:
            print 'Boooo'
Ejemplo n.º 5
0
	def download(self,instance):
		print "Download music"
		k = instance.parent.parent.parent.children[0]
		k.clear_widgets()
		h = TextInput(multiline = False)
		h.bind(on_text_validate = self.on_enter)
		k.add_widget(h)
Ejemplo n.º 6
0
def process_presence(event):
    e = event
    etype = e[u"type"]
    current_screen = app.current_screen
    if current_screen.special:
            return
    if u'displayname' in e[u'content']:
        user_id, user_ids = e[u'content'][u'displayname'], current_screen.room.user_ids
        members_list = current_screen.members_list
        if e[u'content'][u'presence'] == u'online':
            if user_id not in user_ids:
                current_screen.room.user_ids.append(user_id)
                mbr_item = TextInput(
                    text=user_id,
                    size_hint_y=None,
                    height=20,
                    background_color=choice(COLORS) if SETTINGS['ui']['flags']['enable-item-random-color'] else (1, 1, 1, 1),
                    readonly=True
                )
                mbr_item.size = members_list.size[0], mbr_item.line_height + mbr_item.line_spacing + mbr_item.padding[1] + mbr_item.padding[3]
                members_list.add_widget(mbr_item)
        elif e[u'content'][u'presence'] in (u'offline', u'unavailable'):
                app.current_screen.room.user_ids.remove(user_id)
                mbr_item = [i for i in members_list if i.text == user_id][0]
                members_list.remove_widget(mbr_item)
Ejemplo n.º 7
0
    def test_cursor_blink(self):
        ti = TextInput(cursor_blink=True)
        ti.focus = True

        # overwrite blinking event, because too long delay
        ti._do_blink_cursor_ev = Clock.create_trigger(
            ti._do_blink_cursor, 0.01, interval=True
        )

        self.render(ti)

        # from kwargs cursor_blink == True
        self.assertTrue(ti.cursor_blink)
        self.assertTrue(ti._do_blink_cursor_ev.is_triggered)

        # set whether to blink & check if resets
        ti.cursor_blink = False
        for i in range(30):
            self.advance_frames(int(0.01 * Clock._max_fps) + 1)
            self.assertFalse(ti._do_blink_cursor_ev.is_triggered)

            # no blinking, cursor visible
            self.assertFalse(ti._cursor_blink)

        ti.cursor_blink = True
        self.assertTrue(ti.cursor_blink)
        for i in range(30):
            self.advance_frames(int(0.01 * Clock._max_fps) + 1)
            self.assertTrue(ti._do_blink_cursor_ev.is_triggered)
Ejemplo n.º 8
0
    def test_selectall_copy_paste(self):
        text = 'test'
        ti = TextInput(multiline=False, text=text)
        ti.focus = True
        self.render(ti)

        from kivy.base import EventLoop
        win = EventLoop.window

        # select all
        # win.dispatch(event_name, key, scancode, kstr, modifiers)
        win.dispatch('on_key_down', 97, 4, 'a', ['capslock', 'ctrl'])
        win.dispatch('on_key_up', 97, 4)
        self.advance_frames(1)

        # copy
        win.dispatch('on_key_down', 99, 6, 'c',
                     ['capslock', 'numlock', 'ctrl'])
        win.dispatch('on_key_up', 99, 6)
        self.advance_frames(1)

        # home
        win.dispatch('on_key_down', 278, 74, None, ['capslock'])
        win.dispatch('on_key_up', 278, 74)
        self.advance_frames(1)

        # paste
        win.dispatch('on_key_down', 118, 25, 'v', ['numlock', 'ctrl'])
        win.dispatch('on_key_up', 118, 25)
        self.advance_frames(1)

        assert ti.text == 'testtest'
Ejemplo n.º 9
0
    def __init__(self):
        result = super(SettingsPopup, self).__init__(size_hint=(0.8,0.8))

        self.title = 'Settings'

        layout = BoxLayout(orientation='vertical')
        
        firstNameLayout = BoxLayout(orientation='horizontal')
        firstNameLabel = Label(text='First name')
        self._firstNameInput = TextInput(multiline=False)
        self._firstNameInput.bind(text=self.change_first_name)
        firstNameLayout.add_widget(firstNameLabel)
        firstNameLayout.add_widget(self._firstNameInput)

        lastNameLayout = BoxLayout(orientation='horizontal')
        lastNameLabel = Label(text='Last name')
        self._lastNameInput = TextInput(multiline=False)
        self._lastNameInput.bind(text=self.change_last_name)
        lastNameLayout.add_widget(lastNameLabel)
        lastNameLayout.add_widget(self._lastNameInput)

        try:
            htmlRequest = requests.get('http://www.glstn.sk/rozvrh/rozvrh_tr_menu.htm')
            htmlRequest.encoding = 'windows-1250'

            searchRegex = re.compile(ur'<option value=["]([^"]*)["]>((?:[\w\d]+[.]){0,1}\w+).*<\/option>', re.UNICODE)
            for item in searchRegex.finditer(htmlRequest.text):
                School.classes.append(item.group(2))
                School.timetables.append(item.group(1))
        except Exception, e:
            pass
Ejemplo n.º 10
0
    def build(self):
        layout_main = BoxLayout(
            orientation='vertical',

        )
        text_input = TextInput(
            font_size=150,
            height=200,
            size_hint_y=None,
            text='default',
        )

        layout = FloatLayout()
        scatter = Scatter()
        label = Label(
            text="default",
            font_size=150,
        )

        text_input.bind(text=label.setter('text'))

        layout.add_widget(scatter)
        scatter.add_widget(label)

        # Order is important - first is top/left
        layout_main.add_widget(text_input)
        layout_main.add_widget(layout)

        return layout_main
class LoginScreen(GridLayout):

    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.cols = 2
        x =Label(text='Utilizator ')
        self.add_widget(x)
        self.username = TextInput(multiline=False)
        self.add_widget(self.username)
        self.add_widget(Label(text='Parola'))
        self.password = TextInput(password=True, multiline=False)
        self.add_widget(self.password)
        self.password.bind(on_text_validate= self.verific_user_si_parola)

    def verific_user_si_parola(self,t):
        print t,"instanta" 
        text_user = self.username.text
        text_pass = self.password.text
        if (text_user == "test" and text_pass=="test"):
            self.clear_widgets()
            self.add_widget(Label(text='Bine ai venit!'))
        else:
            self.username.select_all()  
            self.username.delete_selection()      
            self.password.select_all()  
            self.password.delete_selection()
Ejemplo n.º 12
0
class TwistedClientApp(App):
    connection = None

    def build(self):
        root = self.setup_gui()
        self.connect_to_server()
        return root

    def setup_gui(self):
        self.textbox = TextInput(size_hint_y=.1, multiline=False)
        self.textbox.bind(on_text_validate=self.send_message)
        self.label = Label(text='connecting...\n')
        self.layout = BoxLayout(orientation='vertical')
        self.layout.add_widget(self.label)
        self.layout.add_widget(self.textbox)
        return self.layout

    def connect_to_server(self):
        reactor.connectTCP('localhost', 8000, EchoFactory(self))

    def on_connection(self, connection):
        self.print_message("connected succesfully!")
        self.connection = connection

    def send_message(self, *args):
        msg = self.textbox.text
        if msg and self.connection:
            self.connection.write(str(self.textbox.text))
            self.textbox.text = ""

    def print_message(self, msg):
        self.label.text += msg + "\n"
Ejemplo n.º 13
0
class AddBlockButton(Button):
	def __init__(self, *args, **kwargs):
		super(AddBlockButton, self).__init__(*args, **kwargs)
		self.bind(on_release=self.openPopup)
		box=BoxLayout(padding=10)
		self.Input=TextInput(text="New Block", multiline=False, font_size=18)
		self.Input.bind(on_text_validate=self.addBlock)
		b=Button(text="Add it")
		b.bind(on_release=self.addBlock)	
		box.add_widget(self.Input)
		box.add_widget(b)
		self.addPopup = Popup(title="Add A New Block",
					size_hint=(None,None),
					size=(400,115),
					separator_color=[.9,.4,.2,1],
					background_color=[0,0,0,.6],
					content=box
					)
	def openPopup(self,*args):
		self.addPopup.open()
	def addBlock(self,*args):
		tree = self.parentLayout.ids["blockstree"]
		b=TreeViewBlock(text=self.Input.text,is_open=True)
		b.parentTree=tree
		tree.add_node(b)
		blocks= createBlockDicts(tree.iterate_all_nodes())
		#Update Blocks
		updateConfig({"blocks":blocks})
		self.addPopup.dismiss()
Ejemplo n.º 14
0
    def build(self):

        self.widget = Widget()

        self.notesscroller = ScrollView(size_hint=(1,1-0), size=(800,800))

        self.notesscroller.do_scroll_x=True
        self.notesscroller.do_scroll_y=True

        #
        #self.layout.bind(minimum_height=layout.setter('height'))


        #self.layout = RelativeLayout(size=(10000,10000), size_hint=(None,None))
        self.layout = TreeLayout(size=(800,800), size_hint=(None,None))

        #objWidget.add_obj({1: 'Hallo'})

        self.song = MySong()
        song= self.song
        #self.song.fromXml2file("Output.xml")


        adict ={"1":"hallo", "2":"Welt"}

        song.fromXml2file("/home/test/PycharmProjects/olga/Songs/OlgaXml/Chopin284.xml")



        #self.widget.add_widget(self.layout)


        self.graphwidget = self.layout
        self.graphwidget.debug = True
        self.graphwidget.build(self.notesscroller)

        obj=a()
        self.layout.add_obj(obj,deeplevel=1)

        self.notesscroller.add_widget(self.graphwidget)


        #self.layout.bind(minimum_size=self.layout.setter('size'))
        #self.layout.bind(minimum_width=self.layout.setter('width'))

        self.widget.add_widget(self.notesscroller)




        return self.widget

        ti = TextInput(text='Hallo')
        #ti._refresh_text()
        ti._update_graphics()
        return ti
        #return TreeViewButton(text='Hallo')


        """
Ejemplo n.º 15
0
    def __init__(self, **kwargs):
        super (InfoPage, self).__init__(**kwargs)
        root = FloatLayout()
        self.toggle = ToggleButton(text='Server', font_size=14, pos_hint={'center_x': .5, 'center_y': .90},size_hint=(None, None))
        self.toggle.bind(on_press=toggle_pressed)

        ip_label = Label(text='IP Address', pos_hint={'center_x': .5, 'center_y': .80}, size_hint=(None, None),
                         width=500, height=40)
        self.ip = TextInput(text=address, multiline=False, pos_hint={'center_x': .5, 'center_y': .75}, size_hint=(None, None),width=500, height=40)
        self.ip.bind(text=set_ip)

        port_label = Label(text='Port', pos_hint={'center_x': .5, 'center_y': .7}, size_hint=(None, None), width=500,
                           height=40)
        self.port = TextInput(text=port, multiline=False, pos_hint={'center_x': .5, 'center_y': .65}, size_hint=(None, None), width=500, height=40)
        self.port.bind(text=set_port)

        secret_label = Label(text='Secret', pos_hint={'center_x': .5, 'center_y': .6}, size_hint=(None, None),
                             width=500, height=40)
        self.secret = TextInput(multiline=False, pos_hint={'center_x': .5, 'center_y': .55}, size_hint=(None, None),
                           width=500, height=40)

        self.secret.bind(text=set_secret)

        connect_button = Button(text="Connect", pos_hint={'center_x': .5, 'center_y': .45}, size_hint=(None, None),
                                width=250, height=40)
        connect_button.bind(on_press=self.connect)
        root.add_widget(self.toggle)
        root.add_widget(self.ip)
        root.add_widget(ip_label)
        root.add_widget(self.port)
        root.add_widget(port_label)
        root.add_widget(secret_label)
        root.add_widget(self.secret)
        root.add_widget(connect_button)
        self.add_widget(root)
Ejemplo n.º 16
0
    def redraw(self, *args):
        self.clear_widgets()
        if self.child_name and self.child_name in self.parent_o.partner_data:
            self.add_widget(Label(text="Name:", halign='right'))
            self.add_widget(Label(text=self.child_name, height=25))
            for attribute in partner_attributes:
                self.add_widget(Label(text="{0}:".format(attribute),
                                      halign='right'))
                #print "REDRAW", self.child_name, attribute, self.parent_o.partner_data
                if attribute in self.parent_o.partner_data[self.child_name]:
                    pdata = self.parent_o.partner_data[self.child_name]
                    if pdata[attribute]:
                        value = pdata[attribute].encode('utf-8')
                    else:
                        value = ''
                else:
                    value = ''
                c = TextInput(text=value, height='29px',size_hint_y=None, multiline=False)
                c.attribute = attribute
                c.bind(text = self.update_textinput)
                self.add_widget(c)

                #c.size_hint_y = 0.1

                c.set_height = '25px'
Ejemplo n.º 17
0
class FArgument(Widget):
	"""
	the argument section of an fBlock
	"""
	def __init__(self, text="__", **kwargs):
		self.name = text
		super(self.__class__,self).__init__(**kwargs)
		with self.canvas:
			Color(0.6,0.4,0.4)
			self.bg = Rectangle(size=self.size, pos=self.pos)
		self.layout = BoxLayout(padding=[10,10,10,10])
		self.textbox = TextInput(text=self.name)
		self.layout.add_widget(self.textbox)
		self.add_widget(self.layout)
		self.bind(size=self.redoLayout, pos=self.redoLayout)
		self.textbox.bind(text=self.updateText)
		
	def redoLayout(self, instance, value):
		self.bg.size = self.size
		self.bg.pos = self.pos
		self.layout.size = self.size
		self.layout.pos = self.pos
		
	def updateText(self, instance, value):
		self.name = self.textbox.text
		
	def __repr__(self):
		return self.name
Ejemplo n.º 18
0
# A simple kivy App, with a textbox to enter messages, and
# a large label to display all the messages received from
# the server
class TwistedClientApp(App):
    #connection = None

    def build(self):
        root = self.setup_gui()
        self.connect_to_server()
        return root

    def setup_gui(self):
        self.textbox = TextInput(size_hint_y=.1, multiline=False)
        self.textbox.bind(on_text_validate=self.send_message)
        self.label = Label(text='server started\n')
        self.layout = BoxLayout(orientation='vertical')
        self.layout.add_widget(self.label)
        self.layout.add_widget(self.textbox)
        return self.layout

    def connect_to_server(self):
        reactor.listenTCP(8000, EchoFactory(self))

    def on_connection(self, connection, clients):
        self.print_message("connected succesfully!")
        self.connection = connection
        self.clients = clients
    def send_message(self, *args):
        msg = self.textbox.text
        #if msg and self.connection:
class ConnectionScreen(Screen):
    def __init__(self, **kwargs):
        super(ConnectionScreen, self).__init__(**kwargs)

        self.root = Accordion()
        roleItem = AccordionItem(title='Role')
        self.root.add_widget(roleItem)
        serverItem = AccordionItem(title='Server')
        self.root.add_widget(serverItem)
        self.dmBtn = ToggleButton(text="DM", group="role")
        self.pcBtn = ToggleButton(text="Player", group="role", state="down")
        self.textinput = TextInput(text='John-LAPTOP', multiline=False)
        self.textinput.bind(on_text_validate=self.on_confirm)
        roleItem.add_widget(self.dmBtn)
        roleItem.add_widget(self.pcBtn)
        serverItem.add_widget(self.textinput)
        self.add_widget(self.root)

    def on_confirm(self, instance):
        global Combatants
        if self.dmBtn.state == "down":
            Combatants = Roster()
            t = threading.Thread(target = self.startServer)
            t.start()
            global isDM
            isDM = True
        elif self.pcBtn.state == "down":
            nameserver = Pyro4.locateNS(host=self.textinput.text)
            Combatants = Pyro4.Proxy("PYRONAME:Combatants")
        SS = SelectionScreen(name="Selection Screen")
        sm.add_widget(SS)
        self.manager.current = 'Selection Screen'

    def startServer(self):
        Pyro4.Daemon.serveSimple({Combatants: "Combatants"}, host=socket.gethostname(), ns=True)
 def build(self):
     
     topic = 'Python'
     
     layout = GridLayout(cols=2, size_hint_y=None, spacing=10, padding=(10,10,10,10))
     layout.bind(minimum_height=layout.setter('height'))
     message = fetch(topic)
     for data in message:
         l = Button(text=data, text_size=(300, None), size_hint_y=None, padding=(5, 5), bold=True)
         # calculating height here 
         before = l._label.render()
         l.text_size=(300, None)
         after = l._label.render()
         l.height = 60 + (after[1]/before[1])*before[1] # ammount of rows * single row height
         # end
         layout.add_widget(l)
         
     sub = ScrollView()
     sub.add_widget(layout)
     
     root = GridLayout(cols=1)
     
     title = Label(text='Facebook Mining Topic: ' + topic, font_size=30, size_hint_y=None, height=100)
     root.add_widget(title)
     
     textinput = TextInput(hint_text='Search ...', multiline=False, size_hint_y=None, height=40)
     textinput.bind(on_text_validate=on_enter)
     root.add_widget(textinput)
     
     root.add_widget(sub)
     return root
Ejemplo n.º 21
0
class TwistedClientApp(App):
    connection = None

    def build(self):
        root = self.setup_gui()
        self.connect_to_server()
        return root

    def setup_gui(self):
        self.textbox = TextInput(size_hint_y=.1, multiline=False)
        self.textbox.bind(on_text_validate=self.send_message)
        self.label = Label(text='connecting...\n')
        self.comm = BoxLayout(orientation='vertical')
        self.comm.add_widget(self.label)
        self.comm.add_widget(self.textbox)

        self.indicator = Label(text='System State\n')

        self.layout = BoxLayout(orientation='horizontal')
        self.layout.add_widget(self.indicator)
        self.layout.add_widget(self.comm)
        return self.layout

    def connect_to_server(self):
        reactor.connectTCP('localhost', 8000, EchoFactory(self))

    def on_connection(self, connection, send_function):
        self.print_message("connected succesfully!")
        self.connection = connection
        self.send = send_function

    def send_message(self, *args):
        msg = self.textbox.text
        if msg and self.connection:
            self.send(str(self.textbox.text))
            self.textbox.text = ""
        if not self.connection:
            self.connect_to_server()
            self.label.text += "Please try again." + "\n"

    def handle_message(self, msg):
        self.label.text += msg + "\n"
        print "handle_message called"
        if 'SET' in msg:
            response = self.handle_command(msg)
            return response

    def handle_command(self, msg):
        if 'SET' in msg:
            print "handling command"
            try:
                self.indicator.text = "SYSTEM:" + msg.split()[2]
                return "200"
            except:
                self.label.text += "Malformed message received." + "\n"
                return "Error 400"

    def print_message(self, msg):
        self.label.text += msg + "\n"
Ejemplo n.º 22
0
 def btn_filter_state(self, instance, value):
     print "btn", instance, value
     if value == 'down':
         txt = TextInput(multiline=False, focus=True, size_hint=(1, 0.1))
         txt.bind(on_text_validate=self.btn_filter_state_enter)
         self.mainw.add_widget(txt, 0)
     elif value == 'normal':
         self.mainw.remove_widget(self.mainw.children[0])
Ejemplo n.º 23
0
 def build(self):
     box = BoxLayout(orientation='horizontal')
     t = TextInput(text="You can try and enter a text, maybe i'll help you", multiline=False,
                               size_hint = (.3,.1 ))
     f = t._get_text()
     c = ListItemLabel()
     box.add_widget(t)
     return box
Ejemplo n.º 24
0
 def on_widget(self, *args):
     for name in sorted(self.widget._Widget__properties):
         title = Label(text=name+":", size_hint=(None,1), width=150, halign='left')
         textval = TextInput(text=str(getattr(self.widget, name)))
         validate = functools.partial(self.set_value, name, textval)
         textval.bind(text=validate)
         self.add_widget(title)
         self.add_widget(textval)
Ejemplo n.º 25
0
class TwistedClientApp(App):
    connection = None

    def build(self):
        root = self.setup_gui()
        self.connect_to_server()
        return root

    def setup_gui(self):
        self.textbox = TextInput(size_hint_y=.1, multiline=False)
        self.textbox.bind(on_text_validate=self.send_message)
        self.label = Label(text='connecting...\n')
        self.layout = BoxLayout(padding=5, orientation='vertical')
        self.away_layout = BoxLayout(padding=5, orientation='horizontal')
        self.home_layout = BoxLayout(padding=5, orientation='horizontal')
        self.hand_layout = BoxLayout(padding=5, orientation='horizontal')
        self.hand_layout.add_widget(Button(text='haaai'))
        self.play_button = Button(text='Play a Card')
        self.play_button.bind(on_press=self.send_card)
        self.layout.add_widget(self.label)
        self.layout.add_widget(self.textbox)
        self.hand_layout.add_widget(self.play_button)
        self.layout.add_widget(self.away_layout)
        self.layout.add_widget(self.home_layout)
        self.layout.add_widget(self.hand_layout)
        self.away_layout.add_widget(Button(text='enemy cards'))
        self.home_layout.add_widget(Button(text='friendly cards'))
        self.hand_layout.add_widget(Button(text='your hand'))
        self.hand_1 = Button(text='Plaaaay')
        self.hand_1.bind(on_press=self.enemy_playcard)
        self.hand_layout.add_widget(self.hand_1)
        
#        self.
        
        return self.layout

    def connect_to_server(self):
        reactor.connectTCP('localhost', 8000, EchoFactory(self))
    def on_connection(self, connection):
        self.print_message("connected succesfully!")
        self.connection = connection
    def send_card(self, *args):
        msg = "client1 playing_card 120 3"
        if msg and self.connection:
            self.connection.write(str(msg))
    def send_message(self, *args):
        msg = self.textbox.text
        if msg and self.connection:
            self.connection.write(str(self.textbox.text))
            self.textbox.text = ""
    def print_message(self, msg):
        self.label.text += msg + "\n"
    
    def enemy_playcard(self, *args):
        self.away_layout.add_widget(Button(text='Heheheheeeehe'))
    def update_checker(self, data, *args):
        if type data is dict:
            hand = data['hand']
	def updateJob(self,instance):
		#print self.dataCarousel.children[0].children
		if self.job_popup is None:
			self.job_popup = Popup(attach_to=self, title='Survey Name',title_align = 'center',size_hint=(0.5,None),padding=10)
			job = TextInput(multiline= False)
			job.bind(on_text_validate = lambda t: self.updateJobName(t.text))
			self.job_popup.content = job
		if self.app.config.get('locks','lockSurvey') == 'False':
			self.job_popup.open()
Ejemplo n.º 27
0
 def __init__(self, **kwargs):
     super(FullDisplay, self).__init__(**kwargs)
     self.ser = serial.Serial("/dev/ttyUSB0", 19200)
     self.display = DataDisplay(self.ser, size_hint=(1, 0.9), pos_hint={"y": 0.1})
     self.add_widget(self.display)
     term = TextInput(multiline=False, size_hint=(1, 0.1))
     term.bind(on_text_validate=self.on_enter)
     self.add_widget(term)
     Clock.schedule_interval(self.display.updateSerial, 1 / 25.0)
Ejemplo n.º 28
0
    def _get_body(self):
        txt = TextInput(id='filename', text=self.filename, multiline=False,
                        size_hint_y=None, height=metrics.dp(30))
        txt.bind(text=self.setter('filename'))
        self.bind(filename=txt.setter('text'))

        layout = super(XFileSave, self)._get_body()
        layout.add_widget(txt)
        return layout
Ejemplo n.º 29
0
	def get_message_text(instance):
		text = TextInput(text=' ', multiline=False)
		def send_message(instance):
			print 'Text input text is: %s' % instance.text
			print 'Sending to number: %s' % number
			send(number, instance.text)
			add_entry_to_sent(number, instance.text)
		text.bind(on_text_validate=send_message)
		holder.add_widget(text)
Ejemplo n.º 30
0
	def comment_pop(instance):
		""" Creates a Popup to Log Task into timesheet  """

		con=lite.connect('TimeTracker.db')
		with con:
		    cur=con.cursor()
		    cur.execute("SELECT DISTINCT TASK FROM Timesheet ORDER BY TASK ")
		    rows = cur.fetchall()
		    task_list=['OTHER']
		    for row in rows:
				task_list.append(row[0])
		if con:
		    con.close()
		f=FloatLayout()
		global popup1
		popup1 = Popup(title='Task Desciption',
		content=f,
		size_hint=(1.0, 0.6), size=(400, 400))
		g=GridLayout(cols=2,row_force_default=True, row_default_height=40,
					 padding=(1,0,1,0))
		g.add_widget(Label(text="SELECT TASK ",pos=(400,800)))
		global task
		task=TextInput(size_hint=(1,0.75),write_tab=False,text_size=(2,None))
		dropdown = DropDown()
		for index in range(len(rows)+1):
		    btn = Button(text=task_list[index], size_hint_y=None, height=44)
		    btn.bind(on_release=lambda btn: dropdown.select(btn.text))
		    dropdown.add_widget(btn)
		global mainbutton
		mainbutton = Button(text='TASK', size_hint=(None, None),size=(100, 44),
							pos_hint={'center_x': .5, 'center_y': .5})
		mainbutton.bind(on_release=dropdown.open)
		dropdown.bind(on_select=MyApp.select_task)
		g.add_widget(mainbutton)
		g.add_widget(Label(text="ADD TASK",pos=(400,600)))
		g.add_widget(task)
		g.add_widget(Label(text="COMMENTS",pos=(400,400)))
		global comment
		comment=TextInput(size_hint=(1,0.75),write_tab=False)
		g.add_widget(comment)
		global msg
		msg=Label(text="Please enter the task and comment to save the task \n",
				  pos=(popup1.width-350,popup1.height-200))
		comment.bind(on_text=
					 msg.setter("Please enter the task and comment to save the task \n"))
		btn1=Button(text='SAVE',size_hint=(0.2,0.1),pos=(popup1.width-350,
					popup1.height-250))
		btn1.bind(on_press=MyApp.update_timesheet)
		btn2=Button(text='CANCEL',size_hint=(0.2,0.1),
					pos=(popup1.width-50,popup1.height-250))
		f.add_widget(msg)
		f.add_widget(btn1)
		f.add_widget(btn2)
		f.add_widget(g)
		popup1.open()
		btn2.bind(on_press=popup1.dismiss)
Ejemplo n.º 31
0
    def __init__(self, **kwargs):
        super(CropperLayout, self).__init__(**kwargs)
        self.orientation = 'horizontal'
        # Window.clearcolor = (0.5, 0.5, 0.5, 1)

        left_side_panel = BoxLayout(orientation="vertical")
        self.add_widget(left_side_panel)
        info_panel = GridLayout(cols=2, size_hint_y=0.1)
        left_side_panel.add_widget(info_panel)
        self.image_widget = Image(size_hint_y=1)
        left_side_panel.add_widget(self.image_widget)

        info_panel.add_widget(Label(text='Cropped image width:'))
        self.final_img_width = Label(text='100')
        info_panel.add_widget(self.final_img_width)

        info_panel.add_widget(Label(text='Cropped image height:'))
        self.final_img_height = Label(text='100')
        info_panel.add_widget(self.final_img_height)

        side_panel = BoxLayout(orientation="vertical", size_hint_y=0.8)
        side_panel.spacing = 20
        self.add_widget(side_panel)

        final_image_size_box = BoxLayout(orientation="vertical",
                                         padding=(0.30),
                                         size_hint_y=2)
        side_panel.add_widget(final_image_size_box)
        final_image_size_box.add_widget(
            Label(text="Select size of cropped image", size_hint_y=0.2))

        final_image_size_grid = GridLayout(cols=2)
        final_image_size_box.add_widget(final_image_size_grid)
        final_image_size_grid.add_widget(Label(text='Width:'))
        self.final_width = SizeTextInput(text='100', dimension='width')
        final_image_size_grid.add_widget(self.final_width)
        final_image_size_grid.add_widget(Label(text='Height:'))
        self.final_height = SizeTextInput(text='100', dimension='height')
        final_image_size_grid.add_widget(self.final_height)

        aspect_ratio_panel = GridLayout(cols=2)
        side_panel.add_widget(aspect_ratio_panel)

        aspect_ratio_panel.add_widget(
            Label(text='Select aspect ratio:', size_hint_y=2))
        self.aspect_ratio_field = TextInput(text='', multiline=False)
        aspect_ratio_panel.add_widget(self.aspect_ratio_field)
        aspect_ratio_panel.add_widget(Label(text='Lock aspect ratio:'))
        self.mylab = MyCheckBox()
        self.mylab.rgba = [1, 1, 1, 1]
        self.locked_aspect_ratio_checkbox = self.mylab
        aspect_ratio_panel.add_widget(self.locked_aspect_ratio_checkbox)

        width_panel = BoxLayout(orientation="vertical", size_hint_y=2)
        side_panel.add_widget(width_panel)

        width_info = BoxLayout(orientation="horizontal")
        width_panel.add_widget(width_info)
        # width_info.size_hint = 1, 0.15

        curr_width = Label(text="Crop area width (pixels):")
        width_info.add_widget(curr_width)
        self.width_field = SizeTextInput(text="100", dimension='width')
        width_info.add_widget(self.width_field)

        self.width_buttons = GridLayout(cols=3)
        width_panel.add_widget(self.width_buttons)
        w_plus_one = CropAreaButton(text='+1', dimension='width', value=1)
        w_plus_ten = CropAreaButton(text='+10', dimension='width', value=10)
        w_plus_hundred = CropAreaButton(text='+100',
                                        dimension='width',
                                        value=100)
        w_minus_one = CropAreaButton(text='-1', dimension='width', value=-1)
        w_minus_ten = CropAreaButton(text='-10', dimension='width', value=-10)
        w_minus_hundred = CropAreaButton(text='-100',
                                         dimension='width',
                                         value=-100)
        [
            self.width_buttons.add_widget(widget)
            for widget in (w_plus_one, w_plus_ten, w_plus_hundred, w_minus_one,
                           w_minus_ten, w_minus_hundred)
        ]

        height_panel = BoxLayout(orientation="vertical", size_hint_y=2)
        side_panel.add_widget(height_panel)

        height_info = BoxLayout(orientation="horizontal")
        height_panel.add_widget(height_info)

        curr_height = Label(text="Crop area height (pixels):")
        height_info.add_widget(curr_height)
        self.height_field = SizeTextInput(text="100", dimension='height')
        height_info.add_widget(self.height_field)

        self.height_buttons = GridLayout(cols=3)
        height_panel.add_widget(self.height_buttons)
        h_plus_one = CropAreaButton(text='+1', dimension='height', value=1)
        h_plus_ten = CropAreaButton(text='+10', dimension='height', value=10)
        h_plus_hundred = CropAreaButton(text='+100',
                                        dimension='height',
                                        value=100)
        h_minus_one = CropAreaButton(text='-1', dimension='height', value=-1)
        h_minus_ten = CropAreaButton(text='-10', dimension='height', value=-10)
        h_minus_hundred = CropAreaButton(text='-100',
                                         dimension='height',
                                         value=-100)
        [
            self.height_buttons.add_widget(widget)
            for widget in (h_plus_one, h_plus_ten, h_plus_hundred, h_minus_one,
                           h_minus_ten, h_minus_hundred)
        ]

        self.nxt = Button(text='Crop and save')
        # nxt.bind(on_press=self.next_image)
        # nxt.size_hint = 1, 1
        side_panel.add_widget(self.nxt)
Ejemplo n.º 32
0
    def showFoodInList(self, *args):

        if os.path.isfile('foodDatabase.txt') == False:
            #define Gridlayout for buttons
            buttonWithoutDatabaseGrid = GridLayout(cols=1,
                                                   row_force_default=True,
                                                   row_default_height=200,
                                                   spacing=15)

            backButton = Button(text='go back',
                                size_hint_y=None,
                                font_size=35,
                                background_normal='',
                                background_color=(0, 1, 1, 0.5),
                                on_release=self.changer)

            buttonWithoutDatabaseGrid.add_widget(backButton)
            self.add_widget(buttonWithoutDatabaseGrid)

        #if foodDatabase.txt exists read it and make it into dictionary
        elif os.path.isfile('foodDatabase.txt') or \
        len(eval(open('foodDatabase.txt', 'r').read())) >1:

            data = eval(open('foodDatabase.txt',
                             'r').read())  #evaluate data into dictionary
            nameList = list(data.keys(
            ))  #extract keys of nested dict to list -> names of foods

            buttonGrid = GridLayout(cols=1,
                                    id='btnGrid',
                                    size_hint_y=None,
                                    row_force_default=True,
                                    row_default_height=200,
                                    rows_minimum={
                                        0: 100,
                                        1: 100
                                    },
                                    spacing=15)

            # when we add children to the grid layout, its size doesn't change at
            # all. we need to ensure that the height will be the minimum required
            # to contain all the childs. (otherwise, we'll child outside the
            # bounding box of the childs)
            buttonGrid.bind(minimum_height=buttonGrid.setter('height'))

            backButton = Button(text='go back',
                                size_hint_y=None,
                                font_size=35,
                                background_normal='',
                                background_color=(0, 1, 1, 0.8),
                                on_release=self.changer)

            removeTextInput = TextInput(text='',
                                        font_size=45,
                                        multiline=False,
                                        on_text_validate=self.rmFoodInstant)

            buttonGrid.add_widget(backButton)
            buttonGrid.add_widget(removeTextInput)

            # add buttons into above defined grid
            for foodName in nameList:
                #buttons loop to create as many buttons as food dictionary/foodDatabase.txt has foods
                #in it
                btn = ObjectProperty(None)

                btn = Button(
                    text=str(foodName),  #text of buttons is name of food
                    size=self.size,
                    font_size=45,
                    valign='center',
                    on_release=self.buttonPressIdentification)
                # on button release buttonPressIdentification function is called
                # which returnes the button instances text (buttontext)
                buttonGrid.add_widget(btn)  #add buttons to the gridlayout
                btn.bind(on_release=(self.changer))
                #bind button to an on_release event -> here screenchanger
                btn.bind(on_release=(self.on_enter))
                #bind buttons to the on_enter event which will input the saved food properties
                #into the main input window

            # create a scroll view, with a size < size of the grid
            scrollingPanel = ScrollView(do_scroll_x=False)
            #defining scrolling screen
            scrollingPanel.add_widget(buttonGrid)
            #add child to the ScreenView -> GridLayout
            self.add_widget(scrollingPanel)
            #add widget back to ScrollView? dont no exactly
        else:
            pass
Ejemplo n.º 33
0
    def __init__(self, client, dto, **kwargs):
        """
        Widget contenant la page de profil d'un utilisateur

        :param client: Socket permettant de communiquer avec le serveur
        :type client: Client
        :param kwargs: Arguments clé/valeur de la classe parente
        """
        self.register_event_type("on_sign_out")
        super(CustomScreen, self).__init__(**kwargs)

        self.client = client
        self.dto = dto

        self.searchResultsDisplayed = False
        self.InboxViewIsOpen = False
        self.conversationViewIsOpen = False
        self.notificationsViewIsOpen = False
        self.personalInfosAreHidden = False
        self.isUserProfile = True
        self.user = None
        self.otherUser = None

        # ===================== Attributs graphiques ====================== #

        # ------------------------- Barre de menu ------------------------- #
        # Contient les boutons:
        #     - Boite de messagerie
        #     - Retour/Déconnexion
        #     - Notifications
        self.menuBarWidget = MenuBarWidget(size_hint=(1, .05),
                                           pos_hint={
                                               'x': 0,
                                               'y': .95
                                           })
        self.menuBarWidget.bind(on_home=self.handleHomeButton)
        self.menuBarWidget.bind(on_open_conversations=self.openInboxView)
        self.menuBarWidget.bind(
            on_open_notifications=self.openNotificationsView)

        # ---------------------- Barre de recherche ----------------------- #
        self.searchBar = TextInput(hint_text="Type to search for someone...",
                                   size_hint=(1, .05),
                                   pos_hint={
                                       'x': 0,
                                       'y': 1 - .05 - .05
                                   })
        self.searchBar.bind(text=self.search)

        # ------------------- Résultat d'une recherche -------------------- #
        self.searchResultsWidget = SearchResultsWidget(size_hint=(1, .35 -
                                                                  .05 - .05),
                                                       pos_hint={
                                                           'x': 0,
                                                           'y': .65
                                                       })
        self.searchResultsWidget.bind(
            on_search_result_selected=self.handleSearchResultSelected)

        # ---------------------------- Profil ----------------------------- #
        # Contient les boutons:
        #     - Préférence de privacité
        #     - Envoi de message
        #     - Envoi de demande d'ami
        self.userInteractionWidget = UserInteractionWidget(
            size_hint=(1, .35 - .05 - .05), pos_hint={
                'x': 0,
                'y': .65
            })
        self.userInteractionWidget.bind(
            on_send_friend_request=self.sendFriendRequest)
        self.userInteractionWidget.bind(
            on_open_conversation=self.openConversationView)
        self.userInteractionWidget.bind(
            on_open_privacy_setting=self.openPrivacySettingView)

        # -------------------- Préférences de privacité -------------------- #
        self.privacySettingWidget = PrivacySettingWidget(size_hint=(1, .35 -
                                                                    .05 - .05),
                                                         pos_hint={
                                                             'x': 0,
                                                             'y': .65
                                                         })
        self.privacySettingWidget.bind(
            on_submit_privacy_setting=self.handlePrivacySettingChange)

        # -------------------------- Conversations ------------------------- #
        self.inboxWidget = InboxWidget(size_hint=(1, .95))
        self.inboxWidget.bind(on_close=self.closeInboxView)
        self.inboxWidget.bind(on_open_conversation=self.openConversationView)

        # -------------------------- Conversation -------------------------- #
        self.conversationView = ConversationWidget()
        self.conversationView.bind(on_close=self.closeConversationView)
        self.conversationView.bind(on_send_message=self.sendMessage)

        # ------------------------- Notifications -------------------------- #
        self.notificationsWidget = NotificationsWidget(size_hint=(1, .95))
        self.notificationsWidget.bind(on_close=self.closeNotificationsView)

        # --------------------- Espace de publication ---------------------- #
        self.publicationsWidget = PublicationsWidget()
        self.publicationsWidget.bind(on_publish=self.sendPublication)

        # ---------------------- Amis/Demandes d'ami ----------------------- #
        self.friendsWidget = FriendsWidget()
        self.friendsWidget.bind(
            on_friend_request_response=self.sendFriendRequestResponse)

        # ------------------- Informations personnelles -------------------- #
        self.aboutWidget = AboutWidget()

        # ------------------------ Fil d'actualité ------------------------- #
        self.activityFeedWidget = ActivityFeedWidget()
        self.activityFeedWidget.bind(on_add_comment=self.sendComment)

        # -----------------  Message de manque de permission --------------- #
        self.infosNotDisplayableLabel = AboutLabel(
            color=(0, 0, 0, 1),
            text="You don't have permissions to view this user infos",
            size_hint=(1, .65),
            pos_hint={
                'x': 0,
                'y': 0
            })

        # ----------------------- Paneau d'onglets ------------------------- #
        # Les onglets contiennent:
        #     - L'espace de publication
        #     - Les amis/demandes d'ami
        #     - Les informations personnelles
        #     - Le fil d'actualité
        self.tabbedPanel = ProfileTabbedPanel(self.publicationsWidget,
                                              self.friendsWidget,
                                              self.aboutWidget,
                                              self.activityFeedWidget,
                                              size_hint=(1, .65),
                                              pos_hint={
                                                  'x': 0,
                                                  'y': 0
                                              })

        self.add_widget(self.menuBarWidget)
        self.add_widget(self.searchBar)
        self.add_widget(self.userInteractionWidget)
        self.add_widget(self.tabbedPanel)
Ejemplo n.º 34
0
    def build(self):

        #self.text_input = FloatInputRight(font_size=20, size_hint_y=.05)
        b = BoxLayout(orientation='vertical')
        self.text_input = TextInput(
            size_hint_y=.4,
            font_size=20,
            foreground_color=[1, 0, 0, 1],
            #hint_text = 'Your name',
            hint_text_color=[0.5, 0.5, 0.5, 1.0],
            input_filter='int')

        gridlayout = GridLayout(cols=4,
                                row_force_default=True,
                                row_default_height=40)
        clear = Button(text='C',
                       size_hint_x=None,
                       width=100,
                       background_color=(1, 0, 1, 1))
        divide = Button(text='/', size_hint_x=None, width=100)
        multiply = Button(text='*', size_hint_x=None, width=100)
        delete = Button(text='Del', size_hint_x=None, width=100)
        seven = Button(text='7', size_hint_x=None, width=100)
        eight = Button(text='8', size_hint_x=None, width=100)
        nine = Button(text='9', size_hint_x=None, width=100)
        minus = Button(text='-', size_hint_x=None, width=100)
        four = Button(text='4', size_hint_x=None, width=100)
        five = Button(text='5', size_hint_x=None, width=100)
        six = Button(text='6', size_hint_x=None, width=100)
        plus = Button(text='+', size_hint_x=None, width=100)
        one = Button(text='1', size_hint_x=None, width=100)
        two = Button(text='2', size_hint_x=None, width=100)
        three = Button(text='3', size_hint_x=None, width=100)
        curl_brace = Button(text='()', size_hint_x=None, width=100)
        zero = Button(text='0', size_hint_x=None, width=100)
        dot = Button(text='.', size_hint_x=None, width=100)
        plus_divide_minus = Button(text='+/-', size_hint_x=None, width=100)
        equal_to = Button(text='=', size_hint_x=None, width=100)

        gridlayout.add_widget(clear)
        clear.bind(on_press=self.clear_memory)
        gridlayout.add_widget(divide)
        divide.bind(on_press=self._divide)
        gridlayout.add_widget(multiply)
        multiply.bind(on_press=self._multiply)
        gridlayout.add_widget(delete)
        delete.bind(on_press=self.delete_)
        gridlayout.add_widget(seven)
        seven.bind(on_press=self._seven)
        gridlayout.add_widget(eight)
        eight.bind(on_press=self._eight)
        gridlayout.add_widget(nine)
        nine.bind(on_press=self._nine)
        gridlayout.add_widget(minus)
        minus.bind(on_press=self._minus)
        gridlayout.add_widget(four)
        four.bind(on_press=self._four)
        gridlayout.add_widget(five)
        five.bind(on_press=self._five)
        gridlayout.add_widget(six)
        six.bind(on_press=self._six)
        gridlayout.add_widget(plus)
        plus.bind(on_press=self._add)
        gridlayout.add_widget(one)
        one.bind(on_press=self._one)
        gridlayout.add_widget(two)
        two.bind(on_press=self._two)
        gridlayout.add_widget(three)
        three.bind(on_press=self._three)
        gridlayout.add_widget(curl_brace)
        curl_brace.bind(on_press=self._curl_brace)
        gridlayout.add_widget(zero)
        zero.bind(on_press=self._zero)
        gridlayout.add_widget(dot)
        dot.bind(on_press=self._dot)
        gridlayout.add_widget(plus_divide_minus)
        plus_divide_minus.bind(on_press=self._plus_slash_minus)
        gridlayout.add_widget(equal_to)
        equal_to.bind(on_press=self._equal_to)

        b.add_widget(self.text_input)
        # self.text_input.bind(text=self.print_txt_to_console)
        # self.text_input.bind(focus=self.on_focus)

        b.add_widget(gridlayout)

        return b
Ejemplo n.º 35
0
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.screenmanager import Screen
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
import youtube_dl


def idk(instance):
    ydl_opts = {}
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([text.text])


text = TextInput(
    text=
    "paste your link and wait for about 10 seconds and then search .mp4 in your computer and you should have it and also dont forget to delete this text before pasting"
)
btn = Button(text="convert to MP4")
btn.bind(on_press=idk)


class youtump4(App):
    def build(self):
        box = BoxLayout(orientation='vertical')
        screen = Screen()
        screen.add_widget(box)
        box.add_widget(text)
        box.add_widget(btn)
        return screen

Ejemplo n.º 36
0
    def __init__(self, **kwargs):
        super(MyGrid, self).__init__(**kwargs)
        self.cols = 2

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

        '''Text Input Widget from kivy'''

        self.inside.add_widget(Label(text="Webcam No: "))
        self.Webcam_no = TextInput(multiline=False)
        self.inside.add_widget(self.Webcam_no)

        self.inside.add_widget(Label(text="Distance for each eye: "))
        self.lastName = TextInput(multiline=False)
        self.inside.add_widget(self.lastName)

        self.inside.add_widget(Label(text="Distance for Both eyes: "))
        self.email = TextInput(multiline=False)
        self.inside.add_widget(self.email)

        self.inside.add_widget(Label(text="Max X Resolution: "))
        self.xres = TextInput(multiline=False)
        self.inside.add_widget(self.xres)
        
        self.Webcam_no.text = "1"
        self.lastName.text = "50"
        self.email.text = "100"
        self.xres.text = "1280"

        self.pb = ProgressBar()
        self.inside.add_widget(self.pb)

        self.inside.add_widget(Label(text=" "))

        '''Buttons Widget from kivy'''
        
        self.submit = Button(text="RUN FOR RIGHT EYE", font_size=30)
        self.submit.bind(on_press=self.pressedrunright)
        self.inside.add_widget(self.submit)

        self.submit = Button(text="RUN FOR LEFT EYE", font_size=30)
        self.submit.bind(on_press=self.pressedrunleft)
        self.inside.add_widget(self.submit)

        self.submit = Button(text="RUN FOR BOTH EYE", font_size=30)
        self.submit.bind(on_press=self.pressedrune)
        self.inside.add_widget(self.submit)
        
        self.inside.add_widget(Label(text=" "))
        
        self.add_widget(self.inside)
##########################################################
        self.inside2 = GridLayout()
        self.inside2.cols = 3
        
        self.submit = Button(text="Right eye: --<.>--", font_size=20)
        self.submit.bind(on_press=self.pressedrtw)
        self.inside2.add_widget(self.submit)
        
        self.submit = Button(text="Right eye: ----->", font_size=20)
        self.submit.bind(on_press=self.pressedrtq)
        self.inside2.add_widget(self.submit)

        self.submit = Button(text="Right eye: <-----", font_size=20)
        self.submit.bind(on_press=self.pressedrte)
        self.inside2.add_widget(self.submit)

        self.image1 = Image(source='./one/right/rightmid.jpg')
        self.image1.allow_stretch= True
        #self.image.height=5000
        self.inside2.add_widget(self.image1)

        self.image2 = Image(source='./one/right/right1.jpg')
        self.image2.allow_stretch= True
        self.inside2.add_widget(self.image2)

        self.image3 = Image(source='./one/right/right2.jpg')
        self.image3.allow_stretch= True
        self.inside2.add_widget(self.image3)

        self.inside2.add_widget(Label(text=" "))
        self.inside2.add_widget(Label(text=" "))
        self.inside2.add_widget(Label(text=" "))

        Clock.schedule_interval(self.update_pic,1)

        self.submit = Button(text="Left eye: --<.>--", font_size=20)
        self.submit.bind(on_press=self.pressedlfw)
        self.inside2.add_widget(self.submit)
        
        self.submit = Button(text="Left eye: ----->", font_size=20)
        self.submit.bind(on_press=self.pressedlfq)
        self.inside2.add_widget(self.submit)

        self.submit = Button(text="Left eye: <-----", font_size=20)
        self.submit.bind(on_press=self.pressedlfe)
        self.inside2.add_widget(self.submit)


        '''Disply Real Time Images taken'''
        self.image4 = Image(source='./one/left/leftmid.jpg')
        self.inside2.add_widget(self.image4)

        self.image5 = Image(source='./one/left/left1.jpg')
        self.inside2.add_widget(self.image5)

        self.image6 = Image(source='./one/left/left2.jpg')
        self.inside2.add_widget(self.image6)

        self.inside2.add_widget(Label(text=" "))
        self.inside2.add_widget(Label(text=" "))
        self.inside2.add_widget(Label(text=" "))

        Clock.schedule_interval(self.update_pic,1)

        self.submit = Button(text="Both eyes: --<.>--", font_size=20)
        self.submit.bind(on_press=self.pressedbmd)
        self.inside2.add_widget(self.submit)
        
        self.submit = Button(text="Both eye: ----->", font_size=20)
        self.submit.bind(on_press=self.pressedbrt)
        self.inside2.add_widget(self.submit)

        self.submit = Button(text="Both eye: <-----", font_size=20)
        self.submit.bind(on_press=self.pressedblf)
        self.inside2.add_widget(self.submit)

        self.image7 = Image(source='./both/bmd.jpg')
        self.inside2.add_widget(self.image7)

        self.image8 = Image(source='./both/brt.jpg')
        self.inside2.add_widget(self.image8)

        self.image9 = Image(source='./both/blf.jpg')
        self.inside2.add_widget(self.image9)

        Clock.schedule_interval(self.update_pic,1)
        
        self.add_widget(self.inside2)   
Ejemplo n.º 37
0
class Archy(HBase):
    """Copy class. See module documentation for more information.
    """
    size_hint_x = NumericProperty(.9, allownone=True)
    size_hint_y = NumericProperty(.9, allownone=True)
    '''Default size properties for the popup
    '''
    title = StringProperty('Copy files ...')
    '''Default title for class
    '''
    path = StringProperty(u'/')
    '''Directory selcted
    '''
    BUTTON_SEARCH = 'Search'
    buttons = ListProperty([HBase.BUTTON_CANCEL, HBase.BUTTON_OK])
    '''Default button set for class
    '''
    files = ListProperty()
    '''This property represents the files on the popup.

    :attr:`files` is a :class:`~kivy.properties.ListProperty` and defaults to
    ''[]
    '''
    def __init__(self, **kwargs):
        self._pnl_files = None
        super(Archy, self).__init__(**kwargs)

    def _get_body(self):
        pnl = BoxLayout(orientation='vertical', padding=10, spacing=10)
        self._pnl_files = BoxLayout(orientation='vertical',
                                    padding=10)  #, size_hint_y=None)
        self.property('files').dispatch(self)
        scroll = ScrollView(size_hint_y=self.size_hint_y, height=300)
        scroll.add_widget(self._pnl_files)
        pnl.add_widget(scroll)
        #pnl.add_widget(self._pnl_files)
        self._pnl_path = BoxLayout(padding=10,
                                   spacing=10,
                                   size_hint_y=None,
                                   height=30)
        self.direction = TextInput(text=self.path,
                                   multiline=False,
                                   size_hint_y=None,
                                   height=30)
        self.bind(path=self.direction.setter('text'))
        # self.fbind(pnl, self.direction)
        self._pnl_path.add_widget(self.direction)
        self.btn_search = Button(text='...',
                                 size_hint_x=0.3,
                                 size_hint_y=None,
                                 height=30,
                                 on_release=self.search)
        # self.fbind(pnl, self.btn_search)
        self._pnl_path.add_widget(self.btn_search)
        pnl.add_widget(self._pnl_path)
        return pnl

    def on_files(self, instance, files):
        if self._pnl_files is None:
            return

        self._pnl_files.clear_widgets()
        if len(files) == 0:
            self._pnl_files.height = 0
            return
        self._pnl_files.size_hint_y = self.size_hint_y
        self._pnl_files.height = self._pnl_files.minimum_height
        for item in files:
            if isinstance(item, Box):
                name = os.path.basename(item.movie)
                image = os.path.basename(item.picture)
                label_v = Label(text=name,
                                font_size=20,
                                size_hint_y=None,
                                height=30)
                # label_i = Label(text=image, font_size=20, size_hint_y=None, height=30)
                self._pnl_files.add_widget(label_v)
                # self._pnl_files.add_widget(label_i)
            else:
                name = os.path.basename(item)
                label = Label(text=name,
                              font_size=20,
                              size_hint_y=None,
                              height=30)
                self._pnl_files.add_widget(label)

    def search(self, *args):
        Logger.warning(msg='procesando ...')
        Folder(on_dismiss=self.path_callback,
               path=self.path)  # expanduser(u'~'))

    def path_callback(self, instance):
        Logger.warning(msg=instance.path)
        self.path = instance.path
Ejemplo n.º 38
0
class AppBody(FloatLayout):
    def __init__(self, **kwargs):
        '''
        Inherit Float Layout information and draw page 1
        '''
        super(AppBody, self).__init__(**kwargs)
        self.drawPage1()

    def drawPage1(self):
        '''
        Calls draw meathods for the initial GUI page. Additionally, this includes
        clears the widgets, defines a window that is 300 by 300 and draws button
        to push to get to the file browser, draws the text box input for URL
        and draws all of the buttons for selecting mat size.
        '''
        self.clear_widgets()
        self.size = (300, 300)
        self.drawInputImage()
        self.drawInputURL()
        self.drawSize()

    def drawInputImage(self):
        '''
        Adds button widget and binds it to callback with its instance set to
        'Your Files' with a label widget next to the button as instructions.
        '''
        self.add_widget(
            Label(text='[b]Brick it![/b]',
                  markup=True,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .45,
                      'y': .83
                  },
                  font_size='60sp'))
        self.add_widget(
            Label(text='[b]Input Your Image:[/b]',
                  markup=True,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .24,
                      'y': .3
                  },
                  font_size='20sp'))
        self.button = Button(text='Your Files',
                             size_hint=(.5, .1),
                             pos_hint={
                                 'x': .45,
                                 'y': .3
                             })
        self.add_widget(self.button)
        self.button.bind(on_press=self.callback)

    def drawInputURL(self):
        '''
        Add text input that has a label next to it with instructions. Binds this
        to on_focus such that it calls on_focus when the box is either clicked on
        or clicked off of.
        '''
        self.add_widget(
            Label(text='[b]Or Input URL to an image:[/b]',
                  markup=True,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .2,
                      'y': .475
                  },
                  font_size='20sp'))
        self.add_widget(
            Label(text='(Paste URL and click outside of textbox)',
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .18,
                      'y': .425
                  }))
        self.urlIn = TextInput(multiline=False,
                               size_hint=(.5, .1),
                               pos_hint={
                                   'x': .45,
                                   'y': .45
                               })
        self.urlIn.bind(focus=self.on_focus)
        self.add_widget(self.urlIn)

    def drawSize(self):
        '''
        Buttons for each size of LEGO mat with instances as the sizes of the buttons
        bound to callbacks.
        '''
        self.add_widget(
            Label(text='[b]Baseplate Size:[/b]',
                  markup=True,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .45,
                      'y': .7
                  },
                  font_size='20sp'))
        self.drop1 = Button(text='[b]5"x5"[/b]',
                            markup=True,
                            size_hint=(.15, .1),
                            pos_hint={
                                'x': 0.025,
                                'y': .61
                            })
        self.add_widget(self.drop1)
        self.drop2 = Button(text='[b]6"x6"[/b]',
                            markup=True,
                            size_hint=(.15, .1),
                            pos_hint={
                                'x': .225,
                                'y': .61
                            })
        self.add_widget(self.drop2)
        self.drop3 = Button(text='[b]5"x10"[/b]',
                            markup=True,
                            size_hint=(.15, .1),
                            pos_hint={
                                'x': .425,
                                'y': .61
                            })
        self.add_widget(self.drop3)
        self.drop4 = Button(text='[b]10"x10"[/b]',
                            markup=True,
                            size_hint=(.15, .1),
                            pos_hint={
                                'x': .625,
                                'y': .61
                            })
        self.add_widget(self.drop4)
        self.drop5 = Button(text='[b]15"x15"[/b]',
                            markup=True,
                            size_hint=(.15, .1),
                            pos_hint={
                                'x': .825,
                                'y': .61
                            })
        self.add_widget(self.drop5)

        self.drop1.bind(on_press=self.callback)
        self.drop2.bind(on_press=self.callback)
        self.drop3.bind(on_press=self.callback)
        self.drop4.bind(on_press=self.callback)
        self.drop5.bind(on_press=self.callback)

    def callback(self, instance):
        '''
        Actions for when any button on the initial page is clicked. Actions include
        changing global variable for mat size used for pixelation and opening
        the file browser.
        '''
        if instance.text == '[b]5"x5"[/b]':
            global input_mat_size
            input_mat_size = 16
            print(input_mat_size)
        if instance.text == '[b]6"x6"[/b]':
            global input_mat_size
            input_mat_size = 19
            print(input_mat_size)
        if instance.text == '[b]5"x10"[/b]':
            global input_mat_size
            input_mat_size = 16
            print(input_mat_size)
        if instance.text == '[b]10"x10"[/b]':
            global input_mat_size
            input_mat_size = 32
            print(input_mat_size)
        if instance.text == '[b]15"x15"[/b]':
            global input_mat_size
            input_mat_size = 48
            print(input_mat_size)
        if instance.text == 'Your Files':
            self.clear_widgets()
            SelectFile().run()

    def on_focus(self, instance, value):
        '''
        Called when the text box is selected or deselected. Depending on action,
        pulls image from the URL inputted by the user on deselect.
        '''
        if value:
            pass
        else:
            self.inputURL = instance.text
            n = len(self.inputURL)
            if self.inputURL[n - 4:n] == ".png":
                cwd = os.getcwd()
                urllib.request.urlretrieve(instance.text, "teamLEGGO.png")
                self.clear_widgets()
                self.drawLabelImage()
                self.drawImage2()
            else:
                pngpls = PngPls()
                return pngpls.popup()

    def drawLabelImage(self):
        '''
        Displays label for selected image.
        '''
        self.add_widget(
            Label(text='[b]Here is your image!:[/b]',
                  markup=True,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .1,
                      'y': .9
                  },
                  font_size='20sp'))

    def drawImage2(self):
        '''
        Displays the pixelated image.
        '''
        pixelationProgram = vectorStuff()
        pixelationProgram.input_mat_size = input_mat_size
        pixelationProgram.runPixel()
        self.wimg = Image(source='teamLEGGO_pix.png',
                          size_hint=(.6, .6),
                          pos_hint={
                              'x': .2,
                              'y': .3
                          })
        self.add_widget(self.wimg)
        bricksUsed, cost = pixelationProgram.get_price(
            pixelationProgram.lego_nums, pixelationProgram.input_mat_size)
        self.add_widget(
            Label(text=bricksUsed,
                  size_hint=(.1, .1),
                  pos_hint={
                      'x': .45,
                      'y': .1
                  }))
        self.add_widget(
            Label(text=cost, size_hint=(.1, .1), pos_hint={
                'x': .45,
                'y': .15
            }))
        self.button1 = Button(text='LEGOs Needed',
                              size_hint=(.2, .05),
                              pos_hint={
                                  'x': .4,
                                  'y': .05
                              })
        self.add_widget(self.button1)
        self.button1.bind(on_press=self.call)

    def call(self, instance):
        '''
        Outputs LEGOs needed popup
        '''
        if instance.text == 'LEGOs Needed':
            numlego = NumLego()
            numlego.popup()
Ejemplo n.º 39
0
    def __init__(self, **kwargs):
        super(SignInScreen, self).__init__(**kwargs)

        title_label = Label(text="Argus Vision", markup=True)
        title_label.pos = (492, 600)
        title_label.size_hint = (None, None)
        title_label.font_size = (40)
        title_label.color = (0, 0, 0, 1)


        email_input = TextInput(hint_text='Email Address')
        email_input.focus = True
        email_input.write_tab = False
        email_input.multiline = False
        email_input.pos = (410, 450)
        email_input.size_hint = (None, None)
        email_input.size = (280, 30)
        self.email_input = email_input

        password_input = TextInput(hint_text='Password')
        password_input.password = True
        password_input.write_tab = False
        password_input.multiline = False
        password_input.pos = (410, 390)
        password_input.size_hint = (None, None)
        password_input.size = (280, 30)
        self.password_input = password_input

        login_button = Button(text="Login")
        login_button.background_color = (0.4, 0.5, 0.6, 1)
        login_button.pos =(450, 250)
        login_button.size_hint = (None, None)
        login_button.size = (200, 50)

        signup_button = Button(text="Sign Up")
        signup_button.background_color = (0.4, 0.5, 0.6, 1)
        signup_button.pos = (450, 180)
        signup_button.size_hint = (None, None)
        signup_button.size = (200, 50)

        forgot_pw = Label(text="[ref=][color=0000ff]Forgot your password?[/color][/ref]", markup=True)
        forgot_pw.pos = (500, 100)
        forgot_pw.size_hint = (None, None)
        forgot_pw.font_size = (16)
        forgot_pw.color = (0, 0, 0, 1)
        self.forgot_pw_text = ""

        signup_button.bind(on_release=self.go_signup)
        forgot_pw.bind(on_ref_press=self.forgot_pw)
        login_button.bind(on_release=self.login ) # partial(self.login,email_input.text,password_input.text))
        Window.bind(on_key_down=self.key_press)

        self.add_widget(title_label)
        self.add_widget(email_input)
        self.add_widget(password_input)
        self.add_widget(login_button)
        self.add_widget(forgot_pw)
        self.add_widget(signup_button)
Ejemplo n.º 40
0
 def declare_inputs(self):
     self.hearing_class_input = TextInput(text="Class?")
     self.hearing_class_input.size_hint = (None, None)
     self.hearing_class_input.width = 100
     self.hearing_class_input.height = 35
     self.hearing_class_input.font_size = 18
Ejemplo n.º 41
0
def makefocus():
    textInput = TextInput(focus=True)
Ejemplo n.º 42
0
 def declare_inputs(self):
     self.hearing_class_input = TextInput(text="Class?")
     self.hearing_class_input.size_hint = (None, None)
     self.hearing_class_input.height = 25
Ejemplo n.º 43
0
    def chat_panel(self, user, event):
        """
		Creates the actual chat screen where the messages are displayed and where the user can respond.

		:param str user: The username of whomever the user is chatting with.
		"""

        full_name = self.users[user]
        self.chatting = user
        self.clear_widgets()
        self.master_layout.clear_widgets()
        self.message_layout.clear_widgets()
        self.sub_layout.clear_widgets()

        if full_name in self.messages:
            self.new = False
            temp = self.messages[full_name]
            for msg in temp:
                if not msg.sender:
                    lab = Label(text=msg.body,
                                color=(1, 1, 1, 1),
                                size_hint_y=None,
                                markup=True,
                                halign='right')

                    with lab.canvas.before:
                        Color(.67, .82, 1, mode='hsv')
                        lab.bg_rect = Rectangle(pos=self.pos, size=self.size)

                else:
                    lab = Label(text=msg.sender + ": " + msg.body,
                                color=(0, 0, 0, 1),
                                size_hint_y=None,
                                markup=True,
                                halign='left')
                    lab.color = colorsys.hsv_to_rgb(
                        self.name_to_txt(msg.sender), 1, 1)

                    with lab.canvas.before:
                        Color(name_to_bg(msg.sender), 1, 1, mode='hsv')
                        lab.bg_rect = Rectangle(pos=self.pos, size=self.size)

                lab.bind(
                    width=lambda s, w: s.setter('text_size')(s, (w, None)))
                lab.bind(texture_size=lab.setter('size'))
                lab.bind(pos=self.redraw, size=self.redraw)
                self.sub_layout.add_widget(lab)

        else:
            self.new_lab = Label(text="Start a new conversation with " + user +
                                 "!",
                                 color=(0, 0, 0, 1))
            self.new = True
            self.sub_layout.add_widget(self.new_lab)

        bottom = BoxLayout(size_hint_y=None, height=130)
        self.reply = TextInput(hint_text="Write a message...")
        title = Label(text=user, halign='left', color=(0, 0, 0, 1))

        send = Button(text="Send",
                      size_hint_x=.25,
                      on_release=functools.partial(self.send_message,
                                                   full_name))
        bottom.add_widget(self.reply)
        bottom.add_widget(send)
        header = BoxLayout(size_hint_y=None, height=130)
        back_btn = Button(text='< Recent',
                          size_hint_x=.5,
                          on_release=lambda x: self.gen_menu())
        presence = Label(size_hint_x=.3)
        header.add_widget(back_btn)
        header.add_widget(title)
        header.add_widget(presence)
        self.message_layout.add_widget(self.sub_layout)
        self.master_layout.add_widget(self.message_layout)
        self.add_widget(header)
        self.add_widget(self.master_layout)
        self.add_widget(bottom)
Ejemplo n.º 44
0
 def set(self):
     self.L = Label(text="Orders-->(Order ID, Item Name, Qtn)",
                    pos_hint={
                        "right": .35,
                        "y": 0.9
                    },
                    size_hint=(.4, .05),
                    font_size=25,
                    color=(0, 0, 0, .2))
     self.add_widget(self.L)
     self.L1 = Label(text="Payment-->(OrderID,Paid,Received,Amt.)",
                     pos_hint={
                         "right": .37,
                         "y": 0.95
                     },
                     size_hint=(.4, .05),
                     font_size=25,
                     color=(0, 0, 0, .2))
     self.add_widget(self.L1)
     self.displaydata = TextInput(text="",
                                  cursor=True,
                                  size_hint=(.17, .7),
                                  font_size=20,
                                  pos_hint={
                                      "x": 0.08,
                                      "y": 0.1
                                  })
     self.add_widget(self.displaydata)
     self.btn1 = Button(text="Show Orders",
                        font_name="candara",
                        size_hint=(.4, .1),
                        font_size=22,
                        pos_hint={
                            "x": 0.46,
                            "y": 0.88
                        },
                        background_color=(0, 0, 1, .7),
                        bold=True,
                        on_press=self.showOrders)
     self.add_widget(self.btn1)
     self.btn2 = Button(text="Show Payment",
                        font_name="candara",
                        size_hint=(.4, .1),
                        pos_hint={
                            "x": 0.46,
                            "y": 0.75
                        },
                        background_color=(0, 0, 1, .7),
                        bold=True,
                        font_size=25,
                        on_press=self.showPayments)
     self.add_widget(self.btn2)
     self.tb1p = TextInput(hint_text="Order ID",
                           size_hint=(.16, .1),
                           pos_hint={
                               "x": 0.37,
                               "y": 0.54
                           },
                           font_size=28,
                           multiline=False)
     self.add_widget(self.tb1p)
     self.label1 = Label(text="Check Payment Details",
                         font_name="candara",
                         color=(0, 0, 0, 1),
                         size_hint=(.3, .1),
                         pos_hint={
                             "x": .53,
                             "y": .64
                         },
                         bold=True,
                         font_size=30)
     self.add_widget(self.label1)
     self.label2 = Label(text="Check Order Details",
                         font_name="candara",
                         color=(0, 0, 0, 1),
                         size_hint=(.3, .1),
                         pos_hint={
                             "x": .53,
                             "y": .34
                         },
                         bold=True,
                         font_size=30)
     self.add_widget(self.label2)
     self.btn3p = Button(text='Check',
                         font_name="candara",
                         size_hint=(.16, .1),
                         pos_hint={
                             "x": 0.6,
                             "y": 0.54
                         },
                         background_color=(0, 0, 1, .7),
                         bold=True,
                         font_size=25,
                         on_press=self.checkp)
     self.add_widget(self.btn3p)
     self.tb3p = TextInput(readonly=True,
                           size_hint=(.1, .1),
                           pos_hint={
                               "x": 0.83,
                               "y": 0.54
                           },
                           font_size=35)
     self.add_widget(self.tb3p)
     self.btn3r = Button(text='Received',
                         font_name="candara",
                         size_hint=(.3, .1),
                         pos_hint={
                             "x": 0.535,
                             "y": 0.14
                         },
                         background_color=(0, 0, 1, .7),
                         bold=True,
                         font_size=25,
                         on_press=self.receive)
     self.add_widget(self.btn3r)
     self.tb2r = TextInput(hint_text="Order ID",
                           size_hint=(.16, .1),
                           pos_hint={
                               "x": 0.37,
                               "y": 0.25
                           },
                           font_size=25,
                           multiline=False)
     self.add_widget(self.tb2r)
     self.btn4p = Button(text='Paid',
                         font_name="candara",
                         background_color=(0, 0, 1, .7),
                         bold=True,
                         size_hint=(.3, .08),
                         pos_hint={
                             "x": 0.535,
                             "y": 0.44
                         },
                         font_size=25,
                         on_press=self.paid)
     self.add_widget(self.btn4p)
     self.btn4r = Button(text='Check',
                         font_name="candara",
                         background_color=(0, 0, 1, .7),
                         bold=True,
                         size_hint=(.16, .1),
                         pos_hint={
                             "x": 0.6,
                             "y": 0.25
                         },
                         font_size=25,
                         on_press=self.checkr)
     self.add_widget(self.btn4r)
     self.tb4r = TextInput(readonly=True,
                           size_hint=(.1, .1),
                           pos_hint={
                               "x": 0.83,
                               "y": 0.25
                           },
                           font_size=35)
     self.add_widget(self.tb4r)
     self.btn = Button(text='Click Here To Make changes in Menu',
                       font_name="candara",
                       background_color=(0, 0, 1, .7),
                       bold=True,
                       size_hint=(.3, .1),
                       pos_hint={
                           "x": 0.555,
                           "y": 0.02
                       },
                       font_size=25,
                       on_press=self.create)
     self.add_widget(self.btn)
     self.next = False
Ejemplo n.º 45
0
    def on_enter(self, *args):
        '''When the user press enter and wants to run a command
        '''
        self.unbind(on_subprocess_done=self.on_enter)
        # if there is a command running, it's necessary to stop it first
        if self.command_status == 'started':
            self.kill_process()
            # restart this call after killing the running process
            self.bind(on_subprocess_done=self.on_enter)
            return

        txtinput_command_line = self.txtinput_command_line
        add_to_cache = self.add_to_cache
        command_history = self.command_history

        def remove_command_interaction_widgets(*args):
            '''command finished: remove widget responsible for interaction
            '''
            parent.remove_widget(self.interact_layout)
            self.interact_layout = None
            # enable running a new command
            try:
                parent.add_widget(self.txtinput_command_line)
            except:
                self._initialize(0)

            self._focus(txtinput_command_line, True)
            self.command_status = 'closed'
            self.dispatch('on_subprocess_done')

        def run_cmd(*args):
            '''Run the command
            '''
            # this is run inside a thread so take care, avoid gui ops
            try:
                _posix = True
                if sys.platform[0] == 'w':
                    _posix = False
                cmd = shlex.split(str(command), posix=_posix)\
                    if not self.shell else command
            except Exception as err:
                cmd = ''
                self.add_to_cache(''.join((str(err), ' <', command, ' >\n')))
            if len(cmd) > 0:
                prev_stdout = sys.stdout
                sys.stdout = self.stdout
                try:
                    # execute command
                    self.popen_obj = popen = subprocess.Popen(
                        cmd,
                        bufsize=0,
                        stdout=subprocess.PIPE,
                        stdin=subprocess.PIPE,
                        stderr=subprocess.STDOUT,
                        preexec_fn=None,
                        close_fds=False,
                        shell=self.shell,
                        cwd=self.cur_dir,
                        env=self.environment,
                        universal_newlines=False,
                        startupinfo=None,
                        creationflags=0)
                    popen_stdout_r = popen.stdout.readline
                    popen_stdout_flush = popen.stdout.flush
                    txt = popen_stdout_r()
                    plat = platform()
                    while txt:
                        # skip flush on android
                        if plat[0] != 'a':
                            popen_stdout_flush()

                        encoding = getattr(sys.stdin, "encoding", None)
                        if encoding and isinstance(txt, bytes):
                            txt = txt.decode(encoding)
                        add_to_cache(txt)
                        txt = popen_stdout_r()
                except (OSError, ValueError) as err:
                    add_to_cache(''.join(
                        (str(err.strerror), ' < ', command, ' >\n')))
                    self.command_status = 'closed'
                    self.dispatch('on_subprocess_done')
                sys.stdout = prev_stdout
            self.popen_obj = None
            Clock.schedule_once(remove_command_interaction_widgets, 0)

        # append text to textcache
        add_to_cache(self.txtinput_command_line.text + '\n')
        command = txtinput_command_line.text[len(self.prompt()):]

        if command == '':
            self.txtinput_command_line_refocus = True
            return

        # store command in command_history
        if self.command_history_pos > 0:
            self.command_history_pos = len(command_history)
            if command_history[self.command_history_pos - 1] != command:
                command_history.append(command)
        else:
            command_history.append(command)

        len_command_history = len(command_history)
        self.command_history_pos = len(command_history)

        # on reaching limit(cached_lines) pop first command
        if len_command_history >= self.cached_commands:
            self.command_history = command_history[1:]

        # replace $PATH with
        command = os.path.expandvars(command)

        if command == 'clear' or command == 'cls':
            self.clear()
            txtinput_command_line.text = self.prompt()
            self.txtinput_command_line_refocus = True
            self.command_status = 'closed'
            self.dispatch('on_subprocess_done')
            return
        # if command = cd change directory
        if command.startswith('cd ') or command.startswith('export '):
            if command[0] == 'e':
                e_q = command[7:].find('=')
                _exprt = command[7:]
                if e_q:
                    os.environ[_exprt[:e_q]] = _exprt[e_q + 1:]
                    self.environment = os.environ.copy()
            else:
                try:
                    command = re.sub('[ ]+', ' ', command)
                    if command[3] == os.sep:
                        os.chdir(command[3:])
                    else:
                        os.chdir(self.cur_dir + os.sep + command[3:])
                    if sys.version_info >= (3, 0):
                        self.cur_dir = os.getcwd()
                    else:
                        self.cur_dir = os.getcwdu()
                except OSError as err:
                    Logger.debug('Shell Console: err:' + err.strerror +
                                 ' directory:' + command[3:])
                    add_to_cache(''.join((err.strerror, '\n')))
            txtinput_command_line.text = self.prompt()
            self.txtinput_command_line_refocus = True
            self.command_status = 'closed'
            self.dispatch('on_subprocess_done')
            return

        txtinput_command_line.text = self.prompt()
        # store output in textcache
        parent = txtinput_command_line.parent
        # disable running a new command while and old one is running
        parent.remove_widget(txtinput_command_line)
        # add widget for interaction with the running command
        txtinput_run_command = TextInput(multiline=False,
                                         font_size=self.font_size)

        def interact_with_command(*l):
            '''Text input to interact with the running command
            '''
            popen_obj = self.popen_obj
            if not popen_obj:
                return
            txt = l[0].text + '\n'
            popen_obj_stdin = popen_obj.stdin
            popen_obj_stdin.write(txt)
            popen_obj_stdin.flush()
            self.txtinput_run_command_refocus = True

        self.txtinput_run_command_refocus = False
        txtinput_run_command.bind(on_text_validate=interact_with_command)
        txtinput_run_command.bind(focus=self.on_focus)
        btn_kill = Button(text="Stop", width=60, size_hint=(None, 1))

        self.interact_layout = il = GridLayout(rows=1,
                                               cols=2,
                                               height=27,
                                               size_hint=(1, None))
        btn_kill.bind(on_press=self.kill_process)
        il.add_widget(txtinput_run_command)
        il.add_widget(btn_kill)
        parent.add_widget(il)

        txtinput_run_command.focus = True
        self.command_status = 'started'
        thread.start_new_thread(run_cmd, ())
Ejemplo n.º 46
0
    def __init__(self, **kwargs):
        super(SignUpScreen, self).__init__(**kwargs)

        title_label = Label(text="Create Account", markup=True)
        title_label.pos = (492, 700)
        title_label.size_hint = (None, None)
        title_label.font_size = (40)
        title_label.color = (0, 0, 0, 1)

        email_input = TextInput(hint_text='Email Address')
        email_input.focus = True
        email_input.write_tab = False
        email_input.multiline = False
        email_input.pos = (410, 650)
        email_input.size_hint = (None, None)
        email_input.size = (280, 30)
        self.email_input = email_input

        password_input = TextInput(hint_text='Password')
        password_input.password = True
        password_input.write_tab = False
        password_input.multiline = False
        password_input.pos = (410, 590)
        password_input.size_hint = (None, None)
        password_input.size = (280, 30)
        self.password_input = password_input

        re_password_input = TextInput(hint_text='Re-Enter Password')
        re_password_input.password = True
        re_password_input.write_tab = False
        re_password_input.multiline = False
        re_password_input.pos = (410, 530)
        re_password_input.size_hint = (None, None)
        re_password_input.size = (280, 30)
        self.re_password_input = re_password_input

        name_input = TextInput(hint_text='Name')
        name_input.write_tab = False
        name_input.multiline = False
        name_input.pos = (410, 470)
        name_input.size_hint = (None, None)
        name_input.size = (280, 30)
        self.name_input = name_input

        surname_input = TextInput(hint_text='Surname')
        surname_input.write_tab = False
        surname_input.multiline = False
        surname_input.pos = (410, 410)
        surname_input.size_hint = (None, None)
        surname_input.size = (280, 30)
        self.surname_input = surname_input

        phone_input = TextInput(hint_text='Phone number')
        phone_input.write_tab = False
        phone_input.multiline = False
        phone_input.pos = (410, 350)
        phone_input.size_hint = (None, None)
        phone_input.size = (280, 30)
        self.phone_input = phone_input

        birthdate_input = TextInput(hint_text='Birthday, DD/MM/YYYY')
        birthdate_input.write_tab = False
        birthdate_input.multiline = False
        birthdate_input.pos = (410, 290)
        birthdate_input.size_hint = (None, None)
        birthdate_input.size = (280, 30)
        self.birthdate_input = birthdate_input

        create_account_button = Button(text="Create Account")
        create_account_button.background_color = (0.4, 0.5, 0.6, 1)
        create_account_button.pos = (450, 200)
        create_account_button.size_hint = (None, None)
        create_account_button.size = (200, 50)
        create_account_button.bind(on_release=self.create_account)

        return_to_login_button = Button(text="Return to Login page")
        return_to_login_button.background_color = (0.4, 0.5, 0.6, 1)
        return_to_login_button.pos = (450, 120)
        return_to_login_button.size_hint = (None, None)
        return_to_login_button.size = (200, 50)
        return_to_login_button.bind(on_release=self.return_to_login)

        self.alert_label = Label()

        self.add_widget(title_label)
        self.add_widget(self.email_input)
        self.add_widget(self.password_input)
        self.add_widget(self.re_password_input)
        self.add_widget(self.name_input)
        self.add_widget(self.surname_input)
        self.add_widget(self.phone_input)
        self.add_widget(self.birthdate_input)
        self.add_widget(create_account_button)
        self.add_widget(return_to_login_button)
Ejemplo n.º 47
0
    def SeriePop(self, title, option):
        self.box = FloatLayout()

        self.labni = (Label(text="Digite o número quântico N Inicial:",
                            font_size=15,
                            size_hint=(None, None),
                            pos_hint={
                                'x': .4,
                                'y': .72
                            }))
        self.box.add_widget(self.labni)

        self.inpni = (TextInput(hint_text="Enter (ni)",
                                multiline=False,
                                pos_hint={
                                    "x": 0.35,
                                    "y": 0.67
                                },
                                size_hint=(0.3, 0.07)))
        self.box.add_widget(self.inpni)

        if option == 2:
            self.labnf = (Label(text="Digite o número quântico N Final:",
                                font_size=15,
                                size_hint=(None, None),
                                pos_hint={
                                    'x': .4,
                                    'y': .43
                                }))
            self.box.add_widget(self.labnf)

            self.inpnf = (TextInput(hint_text="Enter (nf)",
                                    multiline=False,
                                    pos_hint={
                                        "x": 0.35,
                                        "y": 0.39
                                    },
                                    size_hint=(0.3, 0.07)))
            self.box.add_widget(self.inpnf)

        self.but = (Button(text="Confirmar",
                           size_hint=(None, None),
                           width=200,
                           height=50,
                           pos_hint={
                               'x': 0.33,
                               'y': 0.2
                           }))
        self.box.add_widget(self.but)

        self.butExit = (Button(text="Close",
                               size_hint=(None, None),
                               width=200,
                               height=50,
                               pos_hint={
                                   'x': 0.33,
                                   'y': 0
                               }))
        self.box.add_widget(self.butExit)

        self.main_pop = Popup(title=title,
                              content=self.box,
                              size_hint=(None, None),
                              size=(600, 600),
                              auto_dismiss=False,
                              title_size=15)

        if option == 2:
            self.but.bind(on_press=lambda x: self.trataSerie(
                self.inpni.text, self.inpnf.text, title))
        else:
            self.but.bind(on_press=lambda x: self.trataSerie(
                self.inpni.text, None, title))

        self.butExit.bind(on_press=self.main_pop.dismiss)

        self.main_pop.open()
Ejemplo n.º 48
0
class HohenGame(Widget):
    def __init__(self):
        super(HohenGame, self).__init__()
        self.textinput = TextInput(hint_text='Your commands here..',
                                   x=metrics.dp(10),
                                   y=metrics.dp(48),
                                   multiline=False,
                                   width=metrics.dp(470),
                                   height=metrics.dp(38))
        self.cmd = Label(text="Welcome to Hohenheim!",
                         x=metrics.dp(196),
                         y=metrics.dp(130),
                         text_size=(metrics.dp(460), metrics.dp(160)),
                         markup=True)
        self.textinput.bind(on_text_validate=self.on_enter)
        self.giant = Sprite(source='images/giant.png',
                            x=metrics.dp(620),
                            y=metrics.dp(330))
        self.depo = Sprite(source='images/deposit.png',
                           x=metrics.dp(220),
                           y=metrics.dp(470))
        self.axe = Sprite(source='images/axe.png',
                          x=metrics.dp(1220),
                          y=metrics.dp(470))
        self.invaxe = Image(source='images/axe.png',
                            x=metrics.dp(self.invx('axe')),
                            y=metrics.dp(self.invy('axe')),
                            width=metrics.dp(30))
        self.invdepo = Image(source='images/deposit.png',
                             x=metrics.dp(self.invx('depo')),
                             y=metrics.dp(self.invy('depo')),
                             width=metrics.dp(30))
        self.background = Sprite(source='images/background_nobridge.jpg')
        self.bridge = Sprite(source='images/bridge.jpg',
                             x=metrics.dp(500),
                             y=metrics.dp(260))
        self.bridge_active = Sprite(source='images/bridge_active.jpg',
                                    x=metrics.dp(500),
                                    y=metrics.dp(260))
        self.takehelp = {'axe': self.axe, 'depo': self.depo}
        self.gmhelp = {
            'giant': self.giant,
            'bridge': self.bridge,
            'bridge_active': self.bridge_active
        }
        self.invhelp = {'axe': self.invaxe, 'depo': self.invdepo}
        self.add_widget(self.background)
        self.add_widget(self.textinput)
        self.add_widget(self.cmd)
        self.addobjects()

    def use(self, user, usee):
        pass
        print self.gm['takeables'][user]['use']
        if self.gm['takeables'][user]['use'] == 'break':
            self.gm['bridge'] = False
            self.gm['takeables'][user]['state'] = ''
            self.cmdb('You use %s on %s and it breaks' % (user, usee), 'bold')
            print("this will remove the bridge and kill the troll")

    def cmdb(self, statement, switch):
        if switch == 'bold':
            self.cmd.text += "[b][i]\n" + statement + '[/i][/b]'
        else:
            self.cmd.text += statement

    def take(self, item):
        self.switch = False
        for key in self.gm['takeables']:
            if key == item:
                if self.gm['takeables'][item]['state'] == 'game':
                    self.switch = True
                elif self.gm['takeables'][item]['state'] == 'inv':
                    self.cmdb("You already have " + item, 'bold')
        if self.switch == True:
            self.gm['takeables'][item]['state'] = 'inv'
            #self.cmd.text += "[b][i]\nYou took " + item + '[/i][/b]'
            self.cmdb("You took " + item, 'bold')

    def invx(self, xhelp):
        self.xval = 1150
        try:
            self.xval = self.sizehelphelp['%s' % xhelp]['x']
        except:
            pass
        return self.xval

    def invy(self, yhelp):
        self.yval = 70
        try:
            self.yval = self.sizehelphelp['%s' % yhelp]['y']
        except:
            pass
        return self.yval

    def refinv(self):
        self.invaxe.pos = (self.invx('axe'), self.invy('axe'))
        self.invdepo.pos = (self.invx('depo'), self.invy('depo'))
        #self.invdepo.pos = (1300,70)

    def addobjects(self):
        for key in self.gm:
            if self.gm['%s' % key] == True:
                self.add_widget(self.gmhelp['%s' % key])
            elif self.gm['%s' % key] == 'active':
                self.add_widget(self.gmhelp['%s_active' % key])
        for key in self.gm['takeables']:
            if self.gm['takeables']['%s' % key]['state'] == 'game':
                self.add_widget(self.takehelp['%s' % key])
            if self.gm['takeables']['%s' % key]['state'] == 'inv':
                self.add_widget(self.invhelp['%s' % key])

    def on_enter(self, value):
        #print self.gm
        #print self.inv
        if self.textinput.text != '':
            self.cmd.text += '\n' + self.textinput.text
        if re.search('^take', value.text) != None:
            if value.text[5:] == '':
                pass
            else:
                self.take(value.text[5:])
        elif value.text == 'commands' or value.text == 'cmd':
            self.cmdb(commands, 'bold')
        elif re.search('^take', value.text) != '':
            if value.text[5:] == '':
                pass
            else:
                self.use('axe', 'bridge')
        self.refgame()
        value.text = ''

#    def _refocus_txtinp(self,*args):
#        self.cmd.focus = True
#        print "hi"

    def checkgiant(self):
        if self.gm['giant'] == True and self.gm['bridge'] == False:
            self.cmdb('The giant has no footing, it falls into the chasm',
                      'bold')
            self.gm['giant'] = False

    def refgame(self):
        self.checkgiant()
        self.sizehelp = []
        self.sizehelphelp = {}  ##FIX THIS FOR NEW SYNTAX OF INV
        xval = 1150
        yval = 70
        for key in self.gm['takeables']:
            if self.gm['takeables'][key]['state'] == 'inv':
                self.sizehelp.append(key)
        self.sizehelp.reverse()
        #print self.sizehelp
        for x in range(len(self.sizehelp)):
            self.sizehelphelp['%s' % self.sizehelp[x]] = {'x': xval, 'y': yval}
            xval += 50
            if xval == 1300:
                xval = 1150
            if x > 4:
                yval = 20
        self.refinv()
        try:
            pass
        except:
            pass
        self.clear_widgets()
        self.add_widget(self.background)
        #        if self.gm['takeables']['axe']['state'] == 'inv':
        #            self.gm['bridge'] == 'active'
        #        elif self.gm['takeables']['axe']['state'] == 'game':
        #            self.gm['bridge'] == True
        self.addobjects()
        self.add_widget(self.textinput)
        self.add_widget(self.cmd)
Ejemplo n.º 49
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.cols = 2

        if os.path.isfile('prev_details.txt'):
            with open('prev_details.txt', 'r') as f:
                d = f.read().split(',')

                prev_baudrate = d[0]
                prev_port = d[1]
                prev_parity = d[2]
                prev_data_bits = d[3]
                # prev_motor = d[4]
                # prev_direction = d[5]
                # prev_steps = d[6]

        else:

            prev_baudrate = ""
            prev_port = ""
            prev_parity = ""
            prev_data_bits = ""
            # prev_motor = ""
            # prev_direction = ""
            # prev_steps = ""

        self.add_widget(Label(text="Baudrate : "))
        self.baudrate = TextInput(text=prev_baudrate, multiline=False)
        self.add_widget(self.baudrate)

        self.add_widget(Label(text="Port : "))
        self.port = TextInput(text=prev_port, multiline=False)
        self.add_widget(self.port)

        self.add_widget(Label(text="Data bits : "))
        self.data_bits = TextInput(text=prev_data_bits, multiline=False)
        self.add_widget(self.data_bits)

        self.add_widget(Label(text="Parity : "))
        self.parity = TextInput(text=prev_parity, multiline=False)
        self.add_widget(self.parity)

        self.connect = Button(text="Connect")
        self.connect.bind(on_press=self.connect_button)
        self.add_widget(Label())
        self.add_widget(self.connect)

        self.add_widget(Label(text="motor : "))
        self.motor = TextInput(multiline=False)
        self.add_widget(self.motor)

        self.add_widget(Label(text="Direction : "))
        self.direction = TextInput(multiline=False)
        self.add_widget(self.direction)

        self.add_widget(Label(text="Steps : "))
        self.steps = TextInput(multiline=False)
        self.add_widget(self.steps)

        self.send_button = Button(text="Send")
        self.send_button.bind(on_press=self.send)
        self.add_widget(Label(text="SERCOM"))
        self.add_widget(self.send_button)
Ejemplo n.º 50
0
    def build(self):
        Button.color = [0, 0, 0, 1]

        self.gapFiller = Button(background_normal="", background_color=blackColor, size_hint_x=None, width=300,
                                size_hint_y=None, height=300)
        self.gapFiller_right = Button(background_normal="", background_color=blackColor, size_hint_x=None, width=300,
                                      size_hint_y=None, height=300)
        self.hilfe_gesucht_button_right = Button(text="hilfe gesucht", on_press=self.plate02hilfeGesuchtAction,
                                                 background_normal="", size_hint_x=None, width=300, size_hint_y=None,
                                                 height=300)
        self.hilfe_gesucht_button = Button(text="hilfe gesucht", on_press=self.plate01hilfeGesuchtAction,
                                           background_normal="", size_hint_x=None, width=300, size_hint_y=None,
                                           height=300)
        self.reverseButton = Button(text="Rückgängig", on_press=self.plate01reverseAction, background_normal="",
                                    size_hint_x=None, width=300, size_hint_y=None, height=300, center=(0.5,0.5))

        ## LINKE SEITE
        self.bemerkt_button = Button(on_press=self.plate01BemerktAction, background_normal="img/bemerkt.png",
                                     size_hint_x=None, width=300, size_hint_y=None, height=300)
        self.angeschaut_button = Button(on_press=self.plate01angeschautAction, background_normal="img/angeschaut.png",
                                        size_hint_x=None, width=300, size_hint_y=None, height=300)
        self.aktiv_beschaeftigt_button = Button(on_press=self.plate01aktivBeschaeftigtAction,
                                                background_normal="img/aktivBeschaeftigt.png", size_hint_x=None,
                                                width=300, size_hint_y=None, height=300)
        self.haendisch_angefasst_button = Button(on_press=self.plate01haendischAngefasstAction,
                                                 background_normal="img/haendischAngefasst.png", size_hint_x=None,
                                                 width=300, size_hint_y=None, height=300)
        self.fuss_gedrueckt_erfolg_button = Button(on_press=self.plate01fussErfolgAction,
                                                   background_normal="img/fussGedruecktErfolg.png", size_hint_x=None,
                                                   width=300, size_hint_y=None, height=300)
        self.fuss_gedrueckt_misserfolg_button = Button(on_press=self.plate01fussMisserfolgAction,
                                                       background_normal="img/fussGedruecktMisserfolg.png",
                                                       size_hint_x=None, width=300, size_hint_y=None, height=300)

        self.spiel_verstanden_button = Button(on_press=self.plate01spielVerstandenAction,
                                              background_normal="img/spielVerstanden.png", size_hint_x=None, width=300,
                                              size_hint_y=None, height=300)
        self.spiel_nicht_verstanden_button = Button(on_press=self.plate01spielNichtVerstandenAction,
                                                    background_normal="img/spielNichtVerstanden.png", size_hint_x=None,
                                                    width=300, size_hint_y=None, height=300)
        self.spiel_gestartet_button = Button(on_press=self.plate01spielGestartetAction,
                                             background_normal="img/spielGestartet.png", size_hint_x=None, width=300,
                                             size_hint_y=None, height=300)
        self.spiel_beendet_button = Button(on_press=self.plate01spielBeendetAction,
                                           background_normal="img/spielBeendet.png", size_hint_x=None, width=300,
                                           size_hint_y=None, height=300)
        self.wildcard_text_button = TextInput(text='', width=300, height=300, on_double_tap=self.plate01SaveWildcardText, size_hint=(None, None))



        ## RECHTE SEITE
        self.bemerkt_button_right = Button(on_press=self.plate02BemerktAction, background_normal="img/bemerkt.png",
                                           size_hint_x=None, width=300, size_hint_y=None, height=300)
        self.angeschaut_button_right = Button(on_press=self.plate02angeschautAction,
                                              background_normal="img/angeschaut.png", size_hint_x=None, width=300,
                                              size_hint_y=None, height=300)
        self.aktiv_beschaeftigt_button_right = Button(on_press=self.plate02aktivBeschaeftigtAction,
                                                      background_normal="img/aktivBeschaeftigt.png", size_hint_x=None,
                                                      width=300, size_hint_y=None, height=300)
        self.haendisch_angefasst_button_right = Button(on_press=self.plate02haendischAngefasstAction,
                                                       background_normal="img/haendischAngefasst.png", size_hint_x=None,
                                                       width=300, size_hint_y=None, height=300)
        self.fuss_gedrueckt_erfolg_button_right = Button(on_press=self.plate02fussErfolgAction,
                                                         background_normal="img/fussGedruecktErfolg.png",
                                                         size_hint_x=None, width=300, size_hint_y=None, height=300)
        self.fuss_gedrueckt_misserfolg_button_right = Button(on_press=self.plate02fussMisserfolgAction,
                                                             background_normal="img/fussGedruecktMisserfolg.png",
                                                             size_hint_x=None, width=300, size_hint_y=None, height=300)

        self.spiel_verstanden_button_right = Button(on_press=self.plate02spielVerstandenAction,
                                                    background_normal="img/spielVerstanden.png", size_hint_x=None,
                                                    width=300, size_hint_y=None, height=300)
        self.spiel_nicht_verstanden_button_right = Button(on_press=self.plate02spielNichtVerstandenAction,
                                                          background_normal="img/spielNichtVerstanden.png",
                                                          size_hint_x=None, width=300, size_hint_y=None, height=300)
        self.spiel_gestartet_button_right = Button(on_press=self.plate02spielGestartetAction,
                                                   background_normal="img/spielGestartet.png", size_hint_x=None,
                                                   width=300, size_hint_y=None, height=300)
        self.spiel_beendet_button_right = Button(on_press=self.plate02spielBeendetAction,
                                                 background_normal="img/spielBeendet.png", size_hint_x=None, width=300,
                                                 size_hint_y=None, height=300)
        self.wildcard_text_button_right = TextInput(text='', width=300, height=300, on_double_tap=self.plate02SaveWildcardText, size_hint=(None, None))

        ## LAYOUT : LEFT SIDE
        self.leftRow1 = BoxLayout()
        self.leftRow1.add_widget(self.bemerkt_button)
        self.leftRow1.add_widget(self.angeschaut_button)
        self.leftRow1.add_widget(self.aktiv_beschaeftigt_button)

        self.leftRow2 = BoxLayout()
        self.leftRow2.add_widget(self.haendisch_angefasst_button)
        self.leftRow2.add_widget(self.fuss_gedrueckt_erfolg_button)
        self.leftRow2.add_widget(self.fuss_gedrueckt_misserfolg_button)

        self.leftRow3 = BoxLayout()
        self.leftRow3.add_widget(self.hilfe_gesucht_button)
        self.leftRow3.add_widget(self.spiel_verstanden_button)
        self.leftRow3.add_widget(self.spiel_nicht_verstanden_button)

        self.leftRow4 = BoxLayout()
        self.leftRow4.add_widget(self.wildcard_text_button)
        self.leftRow4.add_widget(self.spiel_gestartet_button)
        self.leftRow4.add_widget(self.spiel_beendet_button)

        self.leftSide = BoxLayout(orientation="vertical")
        self.leftSide.add_widget(self.leftRow1)
        self.leftSide.add_widget(self.leftRow2)
        self.leftSide.add_widget(self.leftRow3)
        self.leftSide.add_widget(self.leftRow4)

        ## LAYOUT : RIGHT SIDE
        self.rightRow1 = BoxLayout()
        self.rightRow1.add_widget(self.bemerkt_button_right)
        self.rightRow1.add_widget(self.angeschaut_button_right)
        self.rightRow1.add_widget(self.aktiv_beschaeftigt_button_right)

        self.rightRow2 = BoxLayout()
        self.rightRow2.add_widget(self.haendisch_angefasst_button_right)
        self.rightRow2.add_widget(self.fuss_gedrueckt_erfolg_button_right)
        self.rightRow2.add_widget(self.fuss_gedrueckt_misserfolg_button_right)

        self.rightRow3 = BoxLayout()
        self.rightRow3.add_widget(self.hilfe_gesucht_button_right)
        self.rightRow3.add_widget(self.spiel_verstanden_button_right)
        self.rightRow3.add_widget(self.spiel_nicht_verstanden_button_right)

        self.rightRow4 = BoxLayout()
        self.rightRow4.add_widget(self.wildcard_text_button_right)
        self.rightRow4.add_widget(self.spiel_gestartet_button_right)
        self.rightRow4.add_widget(self.spiel_beendet_button_right)

        self.rightSide = BoxLayout(orientation="vertical")
        self.rightSide.add_widget(self.rightRow1)
        self.rightSide.add_widget(self.rightRow2)
        self.rightSide.add_widget(self.rightRow3)
        self.rightSide.add_widget(self.rightRow4)

        ## LAYOUT TOGETHER
        self.layout = GridLayout(cols=3, padding=[30])
        self.layout.add_widget(self.leftSide)
        self.layout.add_widget(self.reverseButton)
        self.layout.add_widget(self.rightSide)

        return self.layout
Ejemplo n.º 51
0
    def build(self):
        self.txt = "0"
        bl = BoxLayout(orientation='vertical', padding=[30, 30, 30, 30])
        gl1 = GridLayout(rows=1, spacing=40, size_hint=(.25, .25))
        gl2 = GridLayout(rows=1, spacing=40, size_hint=(.25, .25))
        gl3 = GridLayout(rows=1, spacing=40, size_hint=(.25, .25))
        gl4 = GridLayout(rows=1, spacing=40, size_hint=(.25, .25))

        self.txtkzt = TextInput(text="1",
                                font_size=30,
                                size_hint=(None, None),
                                size=(180, 70))
        self.lblkzt = Label(text='KZT',
                            font_size=30,
                            halign='justify',
                            size_hint=(.3, .3))
        self.btnkzt = Button(text='convert',
                             size_hint=(None, None),
                             size=(80, 50),
                             pos=(480 * .25, 640 * .25 - 100),
                             on_press=self.update_text)
        self.btnclear = Button(text='clear',
                               size_hint=(None, None),
                               size=(80, 50),
                               pos=(480 * .25, 640 * .25),
                               on_release=self.clear_txt)

        self.txteur = TextInput(multiline=False,
                                text="0",
                                font_size=30,
                                size_hint=(None, None),
                                size=(180, 75))
        self.lbleur = Label(text="EUR",
                            font_size=30,
                            halign="right",
                            size_hint=(.3, .3))

        self.txtusd = TextInput(text="0",
                                font_size=30,
                                size_hint=(None, None),
                                size=(180, 75))
        self.lblusd = Label(text="USD",
                            font_size=30,
                            valign="center",
                            halign="right",
                            size_hint=(1, .2))

        self.txtrub = TextInput(text="0",
                                font_size=30,
                                size_hint=(None, None),
                                size=(180, 75))
        self.lblrub = Label(text="RUB",
                            font_size=30,
                            valign="center",
                            halign="center",
                            size_hint=(1, .2))

        gl1.add_widget(self.lblkzt)
        gl1.add_widget(self.txtkzt)
        gl1.add_widget(self.btnkzt)
        gl1.add_widget(self.btnclear)

        gl2.add_widget(self.lbleur)
        gl2.add_widget(self.txteur)

        gl3.add_widget(self.lblusd)
        gl3.add_widget(self.txtusd)

        gl4.add_widget(self.lblrub)
        gl4.add_widget(self.txtrub)

        bl.add_widget(gl1)
        bl.add_widget(gl2)
        bl.add_widget(gl3)
        bl.add_widget(gl4)

        return bl
Ejemplo n.º 52
0
        def build(self):                
                """ This function is used to make application """
                layout = FloatLayout()
                Window.size = (800, 1000)
                with layout.canvas:
                        Rectangle(size=(800, 1000), pos=(0, 0), source='/home/msd/Desktop/l.jpg')

                self.l1 = Label(text='[b][color=#600968][size=40]Registeration![/size][/color][/b]',
                                pos=(200, 900),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)		
                self.l2 = Label(text='[b][color=#600968][size=40]Name:[/size][/color][/b]',
                                pos=(80, 800),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)	
                self.name1 = TextInput(multiline=False,
                                      pos=(400, 800),
                                      size_hint=(None,None),
			              size=(300, 50),
                                      hint_text='Enter your name',
                                      hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l3 = Label(text='[b][color=#600968][size=40]Family Name:[/size][/color][/b]',
                                pos=(80, 700),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.familyname = TextInput(multiline=False,
                                            pos=(400, 700),
                                            size_hint=(None, None),
                                            size=(300, 50),
                                            hint_text='Enter your family name',
                                            hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l4 = Label(text='[b][color=#600968][size=40]User Name:[/size][/color][/b]',
                                pos=(80, 600),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.username = TextInput(multiline=False,
                                          pos=(400, 600),
                                          size_hint=(None, None),
                                          size=(300, 50),
                                          hint_text='Enter a username',
                                          hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l5 = Label(text='[b][color=#600968][size=40]PassWord:[/size][/color][/b]',
                                pos=(80, 500),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.password = TextInput(multiline=False,
                                          pos=(400, 500),
                                          size_hint=(None, None),
			                  size=(300, 50),
                                          password=True)
                self.l6 = Label(text='[b][color=#600968][size=40]Confirm PassWord:[/size][/color][/b]',
                                pos=(80, 400),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.confirmpassword = TextInput(multiline=False,
                                                pos=(400, 400),
                                                size_hint=(None, None),
			                        size=(300, 50),
                                                password=True)
                self.l7 = Label(text='[b][color=#600968][size=40]E-mail:[/size][/color][/b]',
                                pos=(80, 300),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.email = TextInput(multiline=False,
                                       pos=(400, 300),
                                       size_hint=(None, None),
		                       size=(300, 50),
                                       hint_text='Enter your E-mail adress',
                                       hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l8 = Label(text='[b][color=#600968][size=40]Gender:[/size][/color][/b]',
                                pos=(80, 200),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.gender = TextInput(multiline=False,
                                        pos=(400, 200),
                                        size_hint=(None, None),
			                size=(300, 50),
                                        hint_text='Male or Female',
                                        hint_text_color=(213/250, 175/250, 214/250, 1))
                layout.add_widget(self.l1)
                layout.add_widget(self.l2)
                layout.add_widget(self.name1)
                layout.add_widget(self.l3)
                layout.add_widget(self.familyname)
                layout.add_widget(self.l4)
                layout.add_widget(self.username)
                layout.add_widget(self.l5)
                layout.add_widget(self.password)
                layout.add_widget(self.l6)
                layout.add_widget(self.confirmpassword)
                layout.add_widget(self.l7)
                layout.add_widget(self.email)
                layout.add_widget(self.l8)
                layout.add_widget(self.gender)
                self.b1 = Button(text='[color=#0c0c0c][size=40]Submit[/size][/color]',
			        pos=(300, 100),
		       	        size_hint=(None, None),
		                size=(200, 50),
		                background_color=(100/250, 50/250, 125/250, 1),
                                markup=True)
                self.b2 = Button(text='[color=#0c0c0c][size=40]Back[/size][/color]',
			        pos=(300, 50),
		       	        size_hint=(None, None),
		                size=(200, 50),
		                background_color=(100/250, 50/250, 125/250, 1),
                                markup=True)
                layout.add_widget(self.b1)
                layout.add_widget(self.b2)
                self.b1.bind(on_press=self.callback1)
                self.b2.bind(on_press=self.callback2)
                return layout
Ejemplo n.º 53
0
    def add_input(self, container, passw=False):
        text_input = TextInput(password=passw)
	text_input.write_tab = False
	text_input.multiline = False
        container.add_widget(text_input)
        return text_input
    def __init__(self, **kwargs):
        super(MyGridLayout, self).__init__(**kwargs)

        self.cols = 1

        self.top_grid = GridLayout()
        self.top_grid.cols = 5

        self.w1 = TextInput(multiline=False)
        self.top_grid.add_widget(self.w1)

        self.x1 = TextInput(multiline=False)
        self.top_grid.add_widget(self.x1)

        self.y1 = TextInput(multiline=False)
        self.top_grid.add_widget(self.y1)

        self.z1 = TextInput(multiline=False)
        self.top_grid.add_widget(self.z1)

        self.r1 = TextInput(multiline=False)
        self.top_grid.add_widget(self.r1)

        self.w2 = TextInput(multiline=False)
        self.top_grid.add_widget(self.w2)

        self.x2 = TextInput(multiline=False)
        self.top_grid.add_widget(self.x2)

        self.y2 = TextInput(multiline=False)
        self.top_grid.add_widget(self.y2)

        self.z2 = TextInput(multiline=False)
        self.top_grid.add_widget(self.z2)

        self.r2 = TextInput(multiline=False)
        self.top_grid.add_widget(self.r2)

        self.w3 = TextInput(multiline=False)
        self.top_grid.add_widget(self.w3)

        self.x3 = TextInput(multiline=False)
        self.top_grid.add_widget(self.x3)

        self.y3 = TextInput(multiline=False)
        self.top_grid.add_widget(self.y3)

        self.z3 = TextInput(multiline=False)
        self.top_grid.add_widget(self.z3)

        self.r3 = TextInput(multiline=False)
        self.top_grid.add_widget(self.r3)

        self.w4 = TextInput(multiline=False)
        self.top_grid.add_widget(self.w4)

        self.x4 = TextInput(multiline=False)
        self.top_grid.add_widget(self.x4)

        self.y4 = TextInput(multiline=False)
        self.top_grid.add_widget(self.y4)

        self.z4 = TextInput(multiline=False)
        self.top_grid.add_widget(self.z4)

        self.r4 = TextInput(multiline=False)
        self.top_grid.add_widget(self.r4)

        self.add_widget(self.top_grid)
        self.submit = Button(text="Submit", font_size=32)
        self.submit.bind(on_press=self.press)
        self.add_widget(self.submit)
Ejemplo n.º 55
0
class ProfileScreen(CustomScreen):
    def __init__(self, client, dto, **kwargs):
        """
        Widget contenant la page de profil d'un utilisateur

        :param client: Socket permettant de communiquer avec le serveur
        :type client: Client
        :param kwargs: Arguments clé/valeur de la classe parente
        """
        self.register_event_type("on_sign_out")
        super(CustomScreen, self).__init__(**kwargs)

        self.client = client
        self.dto = dto

        self.searchResultsDisplayed = False
        self.InboxViewIsOpen = False
        self.conversationViewIsOpen = False
        self.notificationsViewIsOpen = False
        self.personalInfosAreHidden = False
        self.isUserProfile = True
        self.user = None
        self.otherUser = None

        # ===================== Attributs graphiques ====================== #

        # ------------------------- Barre de menu ------------------------- #
        # Contient les boutons:
        #     - Boite de messagerie
        #     - Retour/Déconnexion
        #     - Notifications
        self.menuBarWidget = MenuBarWidget(size_hint=(1, .05),
                                           pos_hint={
                                               'x': 0,
                                               'y': .95
                                           })
        self.menuBarWidget.bind(on_home=self.handleHomeButton)
        self.menuBarWidget.bind(on_open_conversations=self.openInboxView)
        self.menuBarWidget.bind(
            on_open_notifications=self.openNotificationsView)

        # ---------------------- Barre de recherche ----------------------- #
        self.searchBar = TextInput(hint_text="Type to search for someone...",
                                   size_hint=(1, .05),
                                   pos_hint={
                                       'x': 0,
                                       'y': 1 - .05 - .05
                                   })
        self.searchBar.bind(text=self.search)

        # ------------------- Résultat d'une recherche -------------------- #
        self.searchResultsWidget = SearchResultsWidget(size_hint=(1, .35 -
                                                                  .05 - .05),
                                                       pos_hint={
                                                           'x': 0,
                                                           'y': .65
                                                       })
        self.searchResultsWidget.bind(
            on_search_result_selected=self.handleSearchResultSelected)

        # ---------------------------- Profil ----------------------------- #
        # Contient les boutons:
        #     - Préférence de privacité
        #     - Envoi de message
        #     - Envoi de demande d'ami
        self.userInteractionWidget = UserInteractionWidget(
            size_hint=(1, .35 - .05 - .05), pos_hint={
                'x': 0,
                'y': .65
            })
        self.userInteractionWidget.bind(
            on_send_friend_request=self.sendFriendRequest)
        self.userInteractionWidget.bind(
            on_open_conversation=self.openConversationView)
        self.userInteractionWidget.bind(
            on_open_privacy_setting=self.openPrivacySettingView)

        # -------------------- Préférences de privacité -------------------- #
        self.privacySettingWidget = PrivacySettingWidget(size_hint=(1, .35 -
                                                                    .05 - .05),
                                                         pos_hint={
                                                             'x': 0,
                                                             'y': .65
                                                         })
        self.privacySettingWidget.bind(
            on_submit_privacy_setting=self.handlePrivacySettingChange)

        # -------------------------- Conversations ------------------------- #
        self.inboxWidget = InboxWidget(size_hint=(1, .95))
        self.inboxWidget.bind(on_close=self.closeInboxView)
        self.inboxWidget.bind(on_open_conversation=self.openConversationView)

        # -------------------------- Conversation -------------------------- #
        self.conversationView = ConversationWidget()
        self.conversationView.bind(on_close=self.closeConversationView)
        self.conversationView.bind(on_send_message=self.sendMessage)

        # ------------------------- Notifications -------------------------- #
        self.notificationsWidget = NotificationsWidget(size_hint=(1, .95))
        self.notificationsWidget.bind(on_close=self.closeNotificationsView)

        # --------------------- Espace de publication ---------------------- #
        self.publicationsWidget = PublicationsWidget()
        self.publicationsWidget.bind(on_publish=self.sendPublication)

        # ---------------------- Amis/Demandes d'ami ----------------------- #
        self.friendsWidget = FriendsWidget()
        self.friendsWidget.bind(
            on_friend_request_response=self.sendFriendRequestResponse)

        # ------------------- Informations personnelles -------------------- #
        self.aboutWidget = AboutWidget()

        # ------------------------ Fil d'actualité ------------------------- #
        self.activityFeedWidget = ActivityFeedWidget()
        self.activityFeedWidget.bind(on_add_comment=self.sendComment)

        # -----------------  Message de manque de permission --------------- #
        self.infosNotDisplayableLabel = AboutLabel(
            color=(0, 0, 0, 1),
            text="You don't have permissions to view this user infos",
            size_hint=(1, .65),
            pos_hint={
                'x': 0,
                'y': 0
            })

        # ----------------------- Paneau d'onglets ------------------------- #
        # Les onglets contiennent:
        #     - L'espace de publication
        #     - Les amis/demandes d'ami
        #     - Les informations personnelles
        #     - Le fil d'actualité
        self.tabbedPanel = ProfileTabbedPanel(self.publicationsWidget,
                                              self.friendsWidget,
                                              self.aboutWidget,
                                              self.activityFeedWidget,
                                              size_hint=(1, .65),
                                              pos_hint={
                                                  'x': 0,
                                                  'y': 0
                                              })

        self.add_widget(self.menuBarWidget)
        self.add_widget(self.searchBar)
        self.add_widget(self.userInteractionWidget)
        self.add_widget(self.tabbedPanel)

    def displayUserProfile(self, user=None):
        """
        Affiche la page de profil de l'utilisateur

        :param user: L'utilisateur
        :type user: LoggedInUser
        :return:
        :rtype: None
        """
        self.isUserProfile = True

        if user:
            # Enregistrement de l'utilisateur (lorsqu'il se connecte)
            self.user = user
            username = user.getUsername()
            self.menuBarWidget.updateNotificationButtonIcon(
                self.user.viewedNotifications())
            self.publicationsWidget.setUsername(username)
            self.activityFeedWidget.setUsername(username)
            self.inboxWidget.update(self.user.getConversations())

        # Si l'utilisateur revient du profil d'un autre utilisateur
        if self.otherUser:
            self.otherUser = None
            # transforme le bouton <Retour> en <Déconnexion>
            self.menuBarWidget.toggleHomeButtonIcon()

        # Mise à jour de la page de profil
        self.tabbedPanel.addActivityFeedTab()
        self.updateUserProfile()

    def displayOtherUserProfile(self, otherUser):
        """
        Affiche la page de profil d'un autre utilisateur

        :param otherUser: L'autre utilisateur
        :type otherUser: User
        :return:
        :rtype: None
        """
        otherUsername = otherUser.getUsername()

        # Si l'utilisateur vient de sa propre page de profil
        if not self.otherUser:
            # transforme le bouton <Déconnexion> en <Retour>
            self.menuBarWidget.toggleHomeButtonIcon()
            self.tabbedPanel.removeFeedTab()
            self.isUserProfile = False

        # Enregistrement de l'autre utilisateur
        self.otherUser = otherUser

        # Mise à jour de la page de profil
        isFriend = (otherUsername in self.user.getFriends())
        friendRequestSent = \
            (otherUsername in self.user.getReveivedFriendRequests()) or \
            (otherUsername in self.user.getSentFriendRequests())
        self.updateOtherUserProfile(isFriend, friendRequestSent)

    def updateUserProfile(self):
        """
        Permet de mettre à jour la pag de profil de l'utilisateur

        :return:
        :rtype: None
        """
        username = self.user.getUsername()
        firstName = self.user.getFirstName()
        lastName = self.user.getLastName()

        # Mise à jour
        self.userInteractionWidget.update(username, firstName, lastName, True,
                                          False, False)
        self.publicationsWidget.update(self.user.getPublications(), True)
        self.friendsWidget.update(True, self.user.getFriends(),
                                  self.user.getReveivedFriendRequests())
        self.aboutWidget.update(firstName, lastName, self.user.getEmail())
        self.activityFeedWidget.update(self.user.getActivityFeed())

        # Ré-affiche les informations personelles si elle ont été cachées
        if self.personalInfosAreHidden:
            self.remove_widget(self.infosNotDisplayableLabel)
            self.add_widget(self.tabbedPanel)
            self.personalInfosAreHidden = False

    def updateOtherUserProfile(self, isFriend, friendRequestSent):
        """
        Permet de mettre à jour la page de profil d'un autre utilisateur
        lorsque l'utilisateur la visite

        :param isFriend: Indique si l'autre utilisateur est un ami
        :type isFriend: bool
        :param friendRequestSent: Indique s'il existe une demande d'ami
        :type friendRequestSent: bool
        :return:
        :rtype: None
        """
        username = self.user.getUsername()
        otherUsername = self.otherUser.getUsername()
        firstName = self.otherUser.getFirstName()
        lastName = self.otherUser.getLastName()
        privacySetting = self.otherUser.getPrivacySetting()

        # Indique si les information personnelles peuvent être affichées
        infosCanBeDisplayed = True
        if (privacySetting == "nobody") or \
                (privacySetting == "friendsOnly" and
                 (username not in self.otherUser.getFriends())):
            infosCanBeDisplayed = False

        # Mise à jour des informations minimales sur l'autre utilisateur
        self.userInteractionWidget.update(otherUsername, firstName, lastName,
                                          False, isFriend, friendRequestSent)

        if infosCanBeDisplayed:
            # Suppression du message <manque de permissions>
            if self.personalInfosAreHidden:
                self.remove_widget(self.infosNotDisplayableLabel)
                self.add_widget(self.tabbedPanel)
                self.personalInfosAreHidden = False

            # Mise à jour des informations personnelles de l'autre utilisateur
            self.publicationsWidget.update(self.otherUser.getPublications(),
                                           False)
            self.friendsWidget.update(False, self.otherUser.getFriends())
            self.aboutWidget.update(firstName, lastName,
                                    self.otherUser.getEmail())

        # Ajout du message <manque de permissions>
        elif not self.personalInfosAreHidden:
            self.add_widget(self.infosNotDisplayableLabel)
            self.remove_widget(self.tabbedPanel)
            self.personalInfosAreHidden = True

    def search(self, instance, searchInput):
        """
        Permet d'effectuer la recherche d'un autre utilisateur

        :param instance: Le TextInput représentant la barre de recherche
        :type instance: TextInput
        :param searchInput: La recherche
        :type searchInput: str
        :return:
        :rtype: None
        """
        # Si la barre de recherche est vidée, suppression de l'affichage
        # des résultats
        if (len(searchInput) == 0) and self.searchResultsDisplayed:
            self.remove_widget(self.searchResultsWidget)
            self.searchResultsDisplayed = False

        # Ajout de l'affichage des résultats lorsque la barre de recherche
        # contient au moins un caractère
        elif (len(searchInput) == 1) and (not self.searchResultsDisplayed):
            self.add_widget(self.searchResultsWidget)
            self.searchResultsDisplayed = True

        searchInput = searchInput.split()

        # Si la barre de recherche contient plus de 2 mots, la recherche
        # n'est pas effectuée
        if len(searchInput) > 2:
            self.searchResultsWidget.clear()

        # Envoi des données de recherche au serveur (deux mots maximum)
        elif len(searchInput) == 1 or len(searchInput) == 2:
            data = {
                "request": "search",
                "username": self.user.getUsername(),
                "searchInput": searchInput
            }
            self.client.send(data)

    def displaySearchResults(self, searchResults):
        """
        Affichage des résultats d'une recherche d'un autre utilisateur

        :param searchResults: Les résultats de la recherche
        :type searchResults: list
        :return:
        :rtype: None
        """
        self.searchResultsWidget.clear()
        for searchResult in searchResults:
            self.searchResultsWidget.addSearchResult(searchResult["firstName"],
                                                     searchResult["lastName"],
                                                     searchResult["username"])

    def handleSearchResultSelected(self, instance, otherUsername):
        """
        Gère le cas où l'utilisateur à sélectionné un résultat d'une
        recherche d'un autre utilisateur

        :param instance: Le widget contenant les résultats de la recherche
        :type instance: SearchResultsWidget
        :param otherUsername: Le nom d'utilisateur sélectionné
        :type otherUsername: str
        :return:
        :rtype: None
        """
        self.searchBar.text = ""
        self.searchResultsDisplayed = False
        self.remove_widget(self.searchResultsWidget)

        # Envoi de la requête correspondante au serveur
        username = self.user.getUsername()
        if username != otherUsername:
            data = {
                "request": "displayOtherUserProfile",
                "username": self.user.getUsername(),
                "otherUsername": otherUsername
            }
            self.client.send(data)

    def openPrivacySettingView(self, instance):
        """
        Affiche le widget contenant le choix de la préférence de privacité

        :param instance: Le widget UserInteractionView
        :type instance: UserInteractionWidget
        :return:
        :rtype: None
        """
        self.add_widget(self.privacySettingWidget)

    def handlePrivacySettingChange(self, instance, setting):
        """
        Envoie une requête de changement la préférence de privacité au serveur

        :param instance: Le widget PrivacySettingView
        :type instance: PrivacySettingWidget
        :param setting:  La nouvelle préférence de privacité
        :type setting: str
        :return:
        :rtype: None
        """
        # Envoi de la requête si la préférence à été changée
        if setting != self.user.getPrivacySetting():
            self.user.setPrivacySetting(setting)
            data = {
                "request": "changePrivacySetting",
                "username": self.user.getUsername(),
                "setting": setting
            }
            self.client.send(data)

        # Suppression du widget contenant le choix de la préférence
        self.remove_widget(self.privacySettingWidget)

    def openNotificationsView(self, instance):
        """
        Affiche le widget contenant les notifications

        :param instance: La barre de manu
        :type instance: MenuBarWidget
        :return:
        :rtype: None
        """
        if not self.notificationsViewIsOpen:

            # Fermeture de la boite de messagerie si elle est ouverte
            if self.InboxViewIsOpen:
                self.closeInboxView()

            # Mise à jour de l'icone des notifications
            if not self.user.viewedNotifications():
                self.menuBarWidget.toggleNotificationButtonIcon()
                self.user.toggleViewedNotifications()

            self.notificationsViewIsOpen = True
            self.add_widget(self.notificationsWidget)

            # Envoi le fait que l'utilisateur a vu ses notifications au serveur
            data = {
                "request": "notificationsRead",
                "username": self.user.getUsername()
            }
            self.client.send(data)

    def closeNotificationsView(self, instance=None):
        """
        Supprime le widget contenant les notifications

        :param instance: Le widget contenant les notifications
        :type instance: NotificationsWidget
        :return:
        :rtype: None
        """
        self.notificationsViewIsOpen = False
        self.remove_widget(self.notificationsWidget)

    def addNotification(self, notification):
        """
        Permet d'ajouter une notification

        :param notification: La notification à ajouter
        :type notification: str
        :return:
        :rtype: None
        """
        self.notificationsWidget.addNotification(notification)
        self.user.addNotification(notification)

        # Mise à jour de l'icone des notifications
        if (not self.notificationsViewIsOpen) and \
                (self.user.viewedNotifications()):
            self.menuBarWidget.toggleNotificationButtonIcon()
            self.user.toggleViewedNotifications()

    def openInboxView(self, instance):
        """
        Permet d'ouvrir le widget contenant la boite de messagerie

        :param instance: L'instance ayant appelé la méthode
        :type instance: MenuBarWidget
        :return:
        :rtype: None
        """
        if not self.InboxViewIsOpen:
            # Ferme le widget contenant les notifications s'il est ouvert
            if self.notificationsViewIsOpen:
                self.closeNotificationsView()
            self.InboxViewIsOpen = True
            self.add_widget(self.inboxWidget)

    def closeInboxView(self, instance=None):
        """
        Permet de fermer le widget contenant la boite de messagerie

        :param instance: L'instance ayant appelé la méthode
        :type instance: InboxWidget
        :return:
        :rtype: None
        """
        self.InboxViewIsOpen = False
        self.remove_widget(self.inboxWidget)

    def openConversationView(self, instance, username=None):
        """
        Affiche le widget contenant une conversation entre l'utilisateur
        et un correspondant

        :param instance: Le widget ayant appelé la méthode
        :param username: Le nom d'utilisateur du correspondant
        :type username: str
        :return:
        :rtype: None
        """
        # Si la conversation est ouverte depuis la boite de messagerie
        # le nom d'utilisateur du correspondant est passé en paramètre
        otherUsername = username if username else self.otherUser.getUsername()
        conversation = self.user.getConversationByUsername(otherUsername)

        # Création de la conversation si elle n'existe pas encore
        if not conversation:
            conversation = Conversation(self.user.getUsername(), otherUsername)
            self.user.addConversation(conversation)
            self.inboxWidget.addConversationButton(otherUsername)

        # Mise à jour de l'affichage ded la conversation
        self.conversationView.update(otherUsername, conversation.getMessages())

        self.conversationViewIsOpen = True
        self.add_widget(self.conversationView)

    def closeConversationView(self, instance):
        """
        Ferme le widget contenant la conversation

        :param instance: Le widget contenant la conversation
        :type instance: ConversationWidget
        :return:
        :rtype: None
        """
        self.conversationViewIsOpen = False
        self.remove_widget(self.conversationView)

    def sendFriendRequest(self, instance, otherUsername):
        """
        Permet d'envoyer une demande d'ami à un autre utilisateur

        :param instance: La widget contenant le bouton d'envoi de demande
        :type instance: UserInteractionWidget
        :param otherUsername: Le nom d'utilisateur du récepteur de la demande
        :type otherUsername: str
        :return:
        :rtype: None
        """
        # Mise à jour
        self.user.addSentFriendRequest(otherUsername)
        self.userInteractionWidget.removeSendFriendRequestButton()

        # Envoi de la requête au serveur
        data = {
            "request": "friendRequest",
            "username": self.user.getUsername(),
            "otherUsername": otherUsername
        }
        self.client.send(data)

    def receiveFriendRequest(self, otherUsername):
        """
        Gère le cas où l'utilisateur reçoit une demande d'ami

        :param otherUsername: Le nom d'utilisateur de l'émetteur de la demande
        :type otherUsername: str
        :return:
        :rtype: None
        """
        # Mise à jour
        self.user.addReceivedFriendRequest(otherUsername)
        if self.isUserProfile:
            self.friendsWidget.addFriendRequest(otherUsername)
        elif self.otherUser.getUsername() == otherUsername:
            self.userInteractionWidget.removeSendFriendRequestButton()

        notification = "{:s} sent you a friend request!".format(otherUsername)
        self.addNotification(notification)

    def sendFriendRequestResponse(self, instance, accepted, otherUsername):
        """
        Permet d'envoyer une réponse à une demande d'ami

        :param instance: Le widget contenant les demandes d'ami
        :type instance: FriendsWidget
        :param accepted: Indique si la demande est acceptée
        :type accepted: bool
        :param otherUsername: Le nom d'utilisateur de l'émetteur de la demande
        :type otherUsername: str
        :return:
        :rtype: None
        """
        # Mise à jour
        self.user.removeReceivedFriendRequest(otherUsername)
        if accepted:
            self.user.addFriend(otherUsername)
            self.friendsWidget.addFriend(otherUsername)

        # Envoi de la reqête correspondante au serveur
        data = {
            "request": "friendRequestResponse",
            "username": self.user.getUsername(),
            "otherUsername": otherUsername,
            "accepted": accepted
        }
        self.client.send(data)

    def receiveFriendRequestResponse(self, otherUsername, accepted):
        """
        Gère le cas où l'utilisateur à reçu une réponse à une de ses
        demandes d'ami

        :param otherUsername: Le nom d'utilisateur de l'émetteur de la réponse
        :type otherUsername: str
        :param accepted: Indique si la demande à été acceptée
        :type accepted: bool
        :return:
        :rtype: None
        """
        username = self.user.getUsername()
        # Mise à jour
        self.user.removeSentFriendRequest(otherUsername)

        if accepted:
            notification = "{:s} accepted your friend request!".format(
                otherUsername)

            # Mise à jour spécifique au cas où la demande à été acceptée
            self.user.addFriend(otherUsername)
            if self.isUserProfile:
                self.friendsWidget.addFriend(otherUsername)
            elif self.otherUser.getUsername() == otherUsername:
                self.friendsWidget.addFriend(username)

        else:
            notification = "{:s} refused your friend request!".format(
                otherUsername)

            # Mise à jour spécifique au cas où le demande à été refusée
            if self.isUserProfile or \
                    (self.otherUser.getUsername() == otherUsername):
                self.userInteractionWidget.addSendFriendRequestButton()

        self.addNotification(notification)

    def sendMessage(self, instance, otherUsername, message):
        """
        Permet d'envoyer un message à un autre utilisateur

        :param instance: Le widget contenant la conversation
        :type instance: ConversationWidget
        :param otherUsername: Le nom d'utilisateur du correspondant
        :type otherUsername: str
        :param message: Le message à envoyer
        :type message: str
        :return:
        :rtype: None
        """
        # Ajout du message à la conversation correspondante de l'utilisateur
        conversation = self.user.getConversationByUsername(otherUsername)
        conversation.addSentMessage(message)

        # Envoi de la requếte correspondante au serveur
        data = {
            "request": "sendMessage",
            "username": self.user.getUsername(),
            "otherUsername": otherUsername,
            "message": message
        }
        self.client.send(data)

    def receiveMessage(self, otherUsername, message):
        """
        Gère le cas où l'utilisateur à reçu un message

        :param otherUsername: Le nom d'utilisateur de l'émetteur du message
        :type otherUsername: str
        :param message: Le message
        :type message: str
        :return:
        :rtype: None
        """
        # Ajout du message à la conversation correspondante
        conversation = self.user.getConversationByUsername(otherUsername)
        # Création de la conversation si elle n'existe pas encore
        if not conversation:
            conversation = Conversation(self.user.getUsername(), otherUsername)
            self.user.addConversation(conversation)
            self.inboxWidget.addConversationButton(otherUsername)
        conversation.addReceivedMessage(message)

        # Mise à jour
        if self.conversationViewIsOpen and \
                self.conversationView.getAddresseeUsername() == otherUsername:
            self.conversationView.displayReceivedMessage(message)

        notification = "You received a message from {:s}!"\
            .format(otherUsername)
        self.addNotification(notification)

    def sendPublication(self, instance, publication):
        """
        Permet d'émettre une publication

        :param instance: Le widget contenant les publications
        :type instance: PublicationsWidget
        :param publication: La publication
        :type publication: Publication
        :return:
        :rtype: None
        """
        # Mise à jour
        self.user.addPublication(publication)

        # Envoi de la requete correspondante au serveur
        data = {
            "request": "publication",
            "publication": self.dto.serializePublication(publication)
        }
        self.client.send(data)

    def receiveFeed(self, feed):
        """
        Gère le cas ou l'utilisateur reçoit une publication sur son
        fil d'actualité

        :param feed: La publication
        :type feed: Publication
        :return:
        :rtype: None
        """
        otherUsername = feed.getUsername()

        # mise à jour
        self.user.addFeed(feed)
        if self.isUserProfile:
            self.activityFeedWidget.addFeed(feed)

        notification = "{:s} published something!".format(otherUsername)
        self.addNotification(notification)

    def sendComment(self, instance, comment):
        """
        Permet de commenter une publication

        :param instance: Le widget contenant le fil d'actualité
        :type instance: ActivityFeedWidget
        :param comment: Le commentaire
        :type comment: Comment
        :return:
        :rtype: None
        """
        # Mise à jour
        feed = self.user.getFeedByNameAndID(comment.getPublicationUsername(),
                                            comment.getPublicationID())
        feed.addComment(comment)

        # Envoi de la requete correspondante au serveur
        data = {
            "request": "comment",
            "username": self.user.getUsername(),
            "otherUsername": feed.getUsername(),
            "comment": self.dto.serializeComment(comment)
        }
        self.client.send(data)

    def receivePublicationComment(self, comment):
        """
        Gère le cas où l'utilisateur reçoit un commentaire sur un de
        ses publications

        :param comment: Le commentaire
        :type comment: Comment
        :return:
        :rtype: None
        """
        publicationID = comment.getPublicationID()
        # Mise à jour
        self.user.getPublicationByID(publicationID).addComment(comment)
        if self.isUserProfile:
            self.publicationsWidget.addComment(comment)

        notification = "{:s} commented one of your publications!"\
            .format(comment.getUsername())
        self.addNotification(notification)

    def receiveActivityFeedComment(self, comment):
        """
        Gère le cas où l'utilisateur reçoit un commentaire sur une publication
        de son fil d'actualité

        :param comment: Le commentaire
        :type comment: Comment
        :return:
        :rtype: None
        """
        # Mise à jour
        self.user.getFeedByNameAndID(
            comment.getPublicationUsername(),
            comment.getPublicationID()).addComment(comment)
        if self.isUserProfile:
            self.activityFeedWidget.addComment(comment)

    def handleHomeButton(self, instance):
        """
        Gère le cas où l'utilisateur revient sur son profil ou à l'écran
        de bienvenue de l'application (déclenche l'événement <on_sign_out>
        dans ce cas)

        :param instance: Le wigdet contenant le bouton retour/déconnexion
        :type instance: MenuBarWidget
        :return:
        :rtype: None
        """
        # Fermeture de la boite de messagerie et des notifications
        if self.InboxViewIsOpen:
            self.closeInboxView()
        if self.notificationsViewIsOpen:
            self.closeNotificationsView()

        # Retour
        if not self.isUserProfile:
            self.displayUserProfile()
        # Déconnexion
        else:
            self.user = None
            self.publicationsWidget.clear()
            self.dispatch("on_sign_out")

    def on_sign_out(self):
        """
        Événement <on_sign_out>

        :return:
        :rtype: None
        """
        pass
Ejemplo n.º 56
0
    def set_content(self, instance_content_dialog):
        def _events_callback(result_press):
            self.dismiss()
            if result_press:
                self.events_callback(result_press, self)

        if self.device_ios:  # create buttons for iOS
            self.background = self._background

            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = TextInput(
                    size_hint=(1, None), multiline=False, height=dp(33),
                    cursor_color=self.theme_cls.primary_color,
                    hint_text=instance_content_dialog.hint_text,
                    background_normal='{}ios_entr_ti.png'.format(images_path),
                    background_active='{}ios_entr_ti.png'.format(images_path))
                instance_content_dialog.ids.box_input.height = dp(33)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)

            if self.text_button_cancel != '':
                anchor = 'left'
            else:
                anchor = 'center'
            box_button_ok = AnchorLayout(anchor_x=anchor)
            box_button_ok.add_widget(
                MDTextButton(
                    text=self.text_button_ok, font_size='18sp',
                    on_release=lambda x: _events_callback(
                        self.text_button_ok)))
            instance_content_dialog.ids.box_buttons.add_widget(box_button_ok)

            if self.text_button_cancel != '':
                box_button_ok.anchor_x = 'left'
                box_button_cancel = AnchorLayout(anchor_x='right')
                box_button_cancel.add_widget(
                    MDTextButton(
                        text=self.text_button_cancel, font_size='18sp',
                        on_release=lambda x: _events_callback(
                            self.text_button_cancel)))
                instance_content_dialog.ids.box_buttons.add_widget(
                    box_button_cancel)

        else:  # create buttons for Android
            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextField(
                    size_hint=(1, None), height=dp(48),
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(48)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)
                instance_content_dialog.ids.box_buttons.remove_widget(
                    instance_content_dialog.ids.sep)

            box_buttons = AnchorLayout(
                anchor_x='right', size_hint_y=None, height=dp(30))
            box = BoxLayout(size_hint_x=None, spacing=dp(5))
            box.bind(minimum_width=box.setter('width'))
            button_ok = MDRaisedButton(
                text=self.text_button_ok,
                on_release=lambda x: _events_callback(self.text_button_ok))
            box.add_widget(button_ok)

            if self.text_button_cancel != '':
                button_cancel = MDFlatButton(
                    text=self.text_button_cancel,
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    on_release=lambda x: _events_callback(
                        self.text_button_cancel))
                box.add_widget(button_cancel)

            box_buttons.add_widget(box)
            instance_content_dialog.ids.box_buttons.add_widget(box_buttons)
            instance_content_dialog.ids.box_buttons.height = button_ok.height
            instance_content_dialog.remove_widget(
                instance_content_dialog.ids.sep)
Ejemplo n.º 57
0
            def __init__(self):
                super(LoginScreen, self).__init__()
                EventLoop.ensure_window()
                Window.clearcolor = (1, 1, 1, 1)
                Window.size = (1280, 700)
                EventLoop.window.title = self.title = 'ball_detection'
                lbl1 = Label(text="Input Path : ",
                             italic=True,
                             bold=True,
                             size_hint=(.08, .05),
                             pos=(70, 650),
                             color=(0, 0, 0, 0))
                lbl2 = Label(text="visualization :",
                             bold=True,
                             size_hint=(.08, .05),
                             pos=(720, 650),
                             font_size='20sp',
                             color=(0, 0, 0, 0))
                txt1 = TextInput(multiline=False,
                                 font_size=20,
                                 size_hint=(.2, .05),
                                 pos=(180, 650))
                ok = Button(text="OK",
                            italic=True,
                            size_hint=(.08, .05),
                            pos=(450, 650))
                stop = Button(text="Stop",
                              italic=True,
                              size_hint=(.08, .05),
                              pos=(560, 650))
                temp = cv2.imread('gui_images/img_original.jpg')
                temp = cv2.resize(temp, (450, 450))
                cv2.imwrite('gui_images/temp.jpg', temp)
                img_graph = 'gui_images/temp.jpg'
                self.im_graph = Image(source=img_graph,
                                      pos_hint={
                                          'center_x': 0.70,
                                          'center_y': 0.58
                                      })
                in_px = Label(
                    text=
                    "Results in CM/Pixels\n  Toss Height : \n  Toss Distance : \n  Toss Speed : \n  Ball Speed : ",
                    bold=True,
                    font_size=20,
                    size_hint=(.2, .2),
                    pos=(645, 40),
                    color=(0, 0, 0, 0))
                in_cm = Label(text="\n|\n|\n|\n|",
                              bold=True,
                              font_size=20,
                              size_hint=(.2, .2),
                              pos=(850, 40),
                              color=(0, 0, 0, 0))
                str1 = str('\n') + str(0.0) + " px\n" + str(
                    0.0) + " px\n" + str(0.0) + " px/sec\n" + str(
                        0.0) + ' px/sec'
                self.in_px_ans = Label(text=str1,
                                       italic=True,
                                       bold=True,
                                       font_size=20,
                                       size_hint=(.2, .2),
                                       pos=(780, 40),
                                       color=(0, 0, 0, 0))
                str2 = str('\n') + str(0.0) + " cm\n" + str(
                    0.0) + " cm\n" + str(0.0) + " cm/sec\n" + str(
                        0.0) + ' cm/sec'
                self.in_cm_ans = Label(text=str2,
                                       italic=True,
                                       bold=True,
                                       font_size=20,
                                       size_hint=(.2, .2),
                                       pos=(930, 40),
                                       color=(0, 0, 0, 0))
                img_src = 'gui_images/bg.png'
                self.im = Image(source=img_src,
                                pos_hint={
                                    'center_x': 0.28,
                                    'center_y': 0.475
                                })

                dropdown = DropDown()
                for index in range(1, 15):
                    btn = Button(text='Plot %d' % index,
                                 size_hint_y=None,
                                 height=42)
                    btn.bind(on_release=lambda btn: dropdown.select(btn.text))
                    dropdown.add_widget(btn)
                mainbutton = Button(text='Show Plots',
                                    size_hint=(.1, .05),
                                    pos=(1140, 605))
                mainbutton.bind(on_release=dropdown.open)
                dropdown.bind(on_select=lambda instance, x: save_plot(x))

                self.add_widget(mainbutton)
                self.add_widget(self.im)
                self.add_widget(lbl1)
                self.add_widget(lbl2)
                self.add_widget(txt1)
                self.add_widget(ok)
                self.add_widget(stop)
                self.add_widget(in_px)
                self.add_widget(in_cm)
                self.add_widget(self.in_cm_ans)
                self.add_widget(self.in_px_ans)
                self.add_widget(self.im_graph)
                ok.bind(on_press=lambda *a: storage_for_file_name(txt1.text))
                stop.bind(on_press=lambda *a: storage_for_file_name('stop'))
                Clock.schedule_interval(self.update, 1.0 / 1000.0)
Ejemplo n.º 58
0
    def para(self,var,select):
        global font_size
        self.filetodic(var,select)#write file values in dici
        self.clear_widgets()
        self.AddButtons(select)
        self.cols = 3
        self.add_widget(Label(text="Lower Rate Limit"))# these blocks show the specific parameters for the mode...
        self.name1 = TextInput(multiline=False) # ...and gives the user the chance to change them
        self.add_widget(self.name1)
        self.submit1 = Button(text = "Change",font_size = font_size)

        self.submit1.bind(on_press = partial(self.pressed,self.name1,var,select,'Lower Rate Limit'))
        self.add_widget(self.submit1)

        self.add_widget(Label(text="Upper Rate Limit"))
        self.name2 = TextInput(multiline=False)
        self.add_widget(self.name2)
        self.submit2 = Button(text = "Change",font_size = font_size)
        self.submit2.bind(on_press = partial(self.pressed,self.name2,var,select,'Upper Rate Limit'))
        self.add_widget(self.submit2)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Maximum Sensor Rate"))
            self.name16 = TextInput(multiline=False)
            self.add_widget(self.name16)
            self.submit16 = Button(text = "Change",font_size = font_size)
            self.submit16.bind(on_press = partial(self.pressed,self.name16,var,select,'Maximum Sensor Rate'))
            self.add_widget(self.submit16)

        if(select == 5 or select == 10):
            self.add_widget(Label(text="Fixed AV Delay"))
            self.name14 = TextInput(multiline=False)
            self.add_widget(self.name14)
            self.submit14 = Button(text = "Change",font_size = font_size)
            self.submit14.bind(on_press = partial(self.pressed,self.name14,var,select,'Fixed AV Delay'))
            self.add_widget(self.submit14)

        if(select == None):
            self.add_widget(Label(text="Dynamic AV Delay"))
            self.name15 = TextInput(multiline=False)
            self.add_widget(self.name15)
            self.submit15 = Button(text = "Change",font_size = font_size)
            self.submit15.bind(on_press = partial(self.pressed,self.name15,var,select,'Dynamic AV Delay'))
            self.add_widget(self.submit15)


        if(select == 1 or select == 3 or select == 6 or select ==5 or select == 8 or select == 10):
            self.add_widget(Label(text="Atrial Amplitude"))
            self.name3 = TextInput(multiline=False)
            self.add_widget(self.name3)
            self.submit3 = Button(text = "Change",font_size = font_size)
            self.submit3.bind(on_press = partial(self.pressed,self.name3,var,select,'Atrial Amplitude'))
            self.add_widget(self.submit3)
        if(select == 1 or select == 3  or select == 5 or select == 6  or select == 8 or select == 10):
            self.add_widget(Label(text="Atrial Pulse Width"))
            self.name4 = TextInput(multiline=False)
            self.add_widget(self.name4)
            self.submit4 = Button(text = "Change",font_size = font_size)
            self.submit4.bind(on_press = partial(self.pressed,self.name4,var,select,'Atrial Pulse Width'))
            self.add_widget(self.submit4)

        if(select == 2 or select == 4  or select == 5 or select == 7  or select == 9 or select == 10):
            self.add_widget(Label(text="Ventricular Amplitude"))
            self.name5 = TextInput(multiline=False)
            self.add_widget(self.name5)
            self.submit5 = Button(text = "Change",font_size = font_size)
            self.submit5.bind(on_press = partial(self.pressed,self.name5,var,select,'Ventricular Amplitude'))
            self.add_widget(self.submit5)

        if(select == 2 or select == 4  or select == 5 or select == 7 or select == 9 or select == 10):
            self.add_widget(Label(text="Ventricular Pulse Width"))
            self.name6 = TextInput(multiline=False)
            self.add_widget(self.name6)
            self.submit6 = Button(text = "Change",font_size = font_size)
            self.submit6.bind(on_press = partial(self.pressed,self.name6,var,select,'Ventricular Pulse Width'))
            self.add_widget(self.submit6)


        if(select == 3  or select == 8):
            self.add_widget(Label(text="Atrial Sensitivity"))
            self.name8 = TextInput(multiline=False)
            self.add_widget(self.name8)
            self.submit8 = Button(text = "Change",font_size = font_size)
            self.submit8.bind(on_press = partial(self.pressed,self.name8,var,select,'Atrial Sensitivity'))
            self.add_widget(self.submit8)

        if(select == 9):
            self.add_widget(Label(text="VRP"))
            self.name21 = TextInput(multiline=False)
            self.add_widget(self.name21)
            self.submit21 = Button(text = "Change",font_size = font_size)
            self.submit21.bind(on_press = partial(self.pressed,self.name21,var,select,'VRP'))
            self.add_widget(self.submit21)

        if(select == 3  or select == 8 or select == 9):
            self.add_widget(Label(text="ARP"))
            self.name9 = TextInput(multiline=False)
            self.add_widget(self.name9)
            self.submit9 = Button(text = "Change",font_size = font_size)
            self.submit9.bind(on_press = partial(self.pressed,self.name9,var,select,'ARP'))
            self.add_widget(self.submit9)

        if(select == 3  or select == 8):
            self.add_widget(Label(text="PVARP"))
            self.name10 = TextInput(multiline=False)
            self.add_widget(self.name10)
            self.submit10 = Button(text = "Change",font_size = font_size)
            self.submit10.bind(on_press = partial(self.pressed,self.name10,var,select,'PVARP'))
            self.add_widget(self.submit10)

        # if(select == 3 or select == 4 or select == 8  or select == 9):
        #     self.add_widget(Label(text="Hysteresis"))
        #     self.name11 = TextInput(multiline=False)
        #     self.add_widget(self.name11)
        #     self.submit11 = Button(text = "Change",font_size = font_size)
        #     self.submit11.bind(on_press = partial(self.pressed,self.name11,var,select,'Hysteresis'))
        #     self.add_widget(self.submit11)

        if(select == 3 or select == 4  or select == 8  or select == 9):
            self.add_widget(Label(text="Rate Smoothing"))
            self.name12 = TextInput(multiline=False)
            self.add_widget(self.name12)
            self.submit12 = Button(text = "Change",font_size = font_size)
            self.submit12.bind(on_press = partial(self.pressed,self.name12,var,select,'Rate Smoothing'))
            self.add_widget(self.submit12)

        if(select == 4 or select == 9):
            self.add_widget(Label(text="Ventricular Sensitivity"))
            self.name13 = TextInput(multiline=False)
            self.add_widget(self.name13)
            self.submit13 = Button(text = "Change",font_size = font_size)
            self.submit13.bind(on_press = partial(self.pressed,self.name13,var,select,'Ventricular Sensitivity'))
            self.add_widget(self.submit13)


        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Activity Threshold"))
            self.name17 = TextInput(multiline=False)
            self.add_widget(self.name17)
            self.submit17 = Button(text = "Change",font_size = font_size)
            self.submit17.bind(on_press = partial(self.pressed,self.name17,var,select,'Activity Threshold'))
            self.add_widget(self.submit17)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Reaction Time"))
            self.name18 = TextInput(multiline=False)
            self.add_widget(self.name18)
            self.submit18 = Button(text = "Change",font_size = font_size)
            self.submit18.bind(on_press = partial(self.pressed,self.name18,var,select,'Reaction Time'))
            self.add_widget(self.submit18)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Response Factor"))
            self.name19 = TextInput(multiline=False)
            self.add_widget(self.name19)
            self.submit19 = Button(text = "Change",font_size = font_size)
            self.submit19.bind(on_press = partial(self.pressed,self.name19,var,select,'Response Factor'))
            self.add_widget(self.submit19)


        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Recovery Time"))
            self.name20 = TextInput(multiline=False)
            self.add_widget(self.name20)
            self.submit20 = Button(text = "Change",font_size = font_size)
            self.submit20.bind(on_press = partial(self.pressed,self.name20,var,select,'Recovery Time'))
            self.add_widget(self.submit20)



        Connect()

        self.add_widget(Label(text="Show "+var+" Parameters Values"))
        self.submitend = Button(text = "Values",font_size = font_size)
        self.submitend.bind(on_press = partial(self.Popup,var))
        self.add_widget(self.submitend)

        self.graphv = Button(text = "Ventricle E-GRAM",font_size = font_size)
        self.graphv.bind(on_press = startthreadV)
        self.add_widget(self.graphv)
        self.add_widget(Label(text=""+connection))
        self.add_widget(Label(text="NAME: "+name))
        self.grapha = Button(text = "Atrium E-GRAM",font_size = font_size)
        self.grapha.bind(on_press = startthreadA)
        self.add_widget(self.grapha)
Ejemplo n.º 59
0
def build():
    return TextInput(text="Componente TextInput")
Ejemplo n.º 60
0
from command import Commands
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput

CH = Commands()


def getdir():
    return os.getcwd()


introlabel = Label(text=getdir(), size_hint=(1, 0.1))
textInput = TextInput(multiline=False, size_hint=(1, 0.1))
resultLabel = Label(text="Output", size_hint=(1, 1))


def makefocus():
    textInput = TextInput(focus=True)


def on_enter(*kw):
    # Get results.
    out = CH.run_command(textInput.text)
    # Put result into the below label.
    resultLabel.text = out
    # Clear the TextView.
    textInput.text = ""
    introlabel.text = getdir()