1
00:00:00,790 --> 00:00:09,130
Hi, again, what we have so far in our Cuvee AB is the first page of the app, which I chose to name

2
00:00:09,130 --> 00:00:10,480
it as a Login Screen.

3
00:00:10,500 --> 00:00:16,840
So here is where the users login and sign up and the Login button has not been implemented.

4
00:00:17,590 --> 00:00:22,030
So is "Forgot Password?" and "Sign Up" Button works.

5
00:00:22,750 --> 00:00:28,900
Now there is a few things what you might want to do next, such as, for example, you might want to

6
00:00:29,470 --> 00:00:34,500
do some design work to have some spaces between these buttons.

7
00:00:34,930 --> 00:00:44,260
This text input and this button or maybe make these two buttons like smaller and just show them as

8
00:00:44,260 --> 00:00:47,110
links instead of buttons with squares.

9
00:00:47,860 --> 00:00:48,190
But.

10
00:00:49,200 --> 00:00:50,160
You can do that.

11
00:00:50,210 --> 00:00:57,900
But what I prefer to do myself is first I want to make a minimum design, which means I want to make

12
00:00:57,900 --> 00:00:58,950
the design work.

13
00:00:59,160 --> 00:00:59,700
I just want.

14
00:00:59,760 --> 00:01:01,760
It's enough for me to see the buttons for now.

15
00:01:02,700 --> 00:01:04,680
I don't care if they are too big or too small.

16
00:01:05,100 --> 00:01:06,390
I want them to work.

17
00:01:07,140 --> 00:01:08,490
So I press the Sign Up button.

18
00:01:08,520 --> 00:01:14,430
Then I want to be able here to write a username and a password.

19
00:01:15,720 --> 00:01:21,390
And when I click submit, I want to store these data in the database.

20
00:01:21,690 --> 00:01:23,790
So I want to create a new user with those data.

21
00:01:24,750 --> 00:01:30,360
And then at the end, after I have completed all the functionalities of the program, I want to play

22
00:01:30,360 --> 00:01:33,510
around with a design to make it better looking.

23
00:01:33,810 --> 00:01:40,770
So in this lecture, let's go ahead and implement the submit button so that these data are stored in

24
00:01:40,830 --> 00:01:42,480
a Json file.

25
00:01:42,840 --> 00:01:43,300
Right.

26
00:01:43,320 --> 00:01:52,140
So let's locate the submit button, which is in here and at the on_press attribute, which is going

27
00:01:52,140 --> 00:01:54,120
to execute the root.

28
00:01:54,450 --> 00:01:57,320
So the root is a SignUpScreen class.

29
00:01:58,140 --> 00:02:02,220
This one here, we're going to execute the method of that class.

30
00:02:02,460 --> 00:02:05,420
Let's call this method add.user.

31
00:02:06,760 --> 00:02:09,100
OK, so let's go ahead and add

32
00:02:09,130 --> 00:02:09,490
that

33
00:02:10,960 --> 00:02:15,040
function, that method, add_user(self):.

34
00:02:17,620 --> 00:02:18,590
Let's pass for now.

35
00:02:19,330 --> 00:02:21,730
So this method is going to get the values.

36
00:02:21,830 --> 00:02:26,860
So the user name and the password values and send them and store them in a Json file.

37
00:02:27,280 --> 00:02:28,900
So where are the values?

38
00:02:29,470 --> 00:02:37,780
Well, we can access the user name using (root.ids.)

39
00:02:38,080 --> 00:02:43,990
and here we enter the id of the widget where the user name will be entered.

40
00:02:44,410 --> 00:02:53,050
So the text input widget, it doesn't have an ID, but we can give it an ID, id: username.

41
00:02:53,560 --> 00:02:54,790
It shouldn't be in quotes.

42
00:02:54,970 --> 00:02:56,410
So it's just a variable.

43
00:02:57,130 --> 00:02:57,820
And then here you write

44
00:02:57,830 --> 00:02:58,690
username.

45
00:03:00,130 --> 00:03:02,080
Now, if you leave it like that.

46
00:03:04,140 --> 00:03:07,350
And also get: (root.ids.

47
00:03:08,600 --> 00:03:09,390
password).

48
00:03:09,660 --> 00:03:12,620
So let's give an id to password as well.

49
00:03:13,390 --> 00:03:14,480
Id, a colon,

50
00:03:16,280 --> 00:03:16,810
password.

51
00:03:17,550 --> 00:03:18,360
Just like that.

52
00:03:19,580 --> 00:03:23,720
Then in the ad_user function create some parameters.

53
00:03:26,570 --> 00:03:28,460
It can be using a password.

54
00:03:29,660 --> 00:03:33,530
So just like this ids, but it's not related.

55
00:03:33,680 --> 00:03:36,590
You can have whatever parameter names as you like here.

56
00:03:37,160 --> 00:03:43,050
And for that reason, I would like to actually write uname pword.

57
00:03:43,340 --> 00:03:45,560
So not to be confused with these ids.

58
00:03:46,010 --> 00:03:48,410
And for now, let me just

59
00:03:51,360 --> 00:03:58,310
print out uname and pword just to see what we have so far.

60
00:04:00,360 --> 00:04:00,820
All right.

61
00:04:01,010 --> 00:04:01,790
Sign up.

62
00:04:03,150 --> 00:04:07,650
Let's say u1, p1. Some username and password.

63
00:04:07,710 --> 00:04:10,230
Why not? Submit.

64
00:04:12,790 --> 00:04:14,320
And if you don't get anything.

65
00:04:15,040 --> 00:04:18,040
Maybe we didn't save the Kivy file.

66
00:04:18,500 --> 00:04:20,470
The Python file is saved automatically.

67
00:04:21,340 --> 00:04:22,110
Sign up again.

68
00:04:22,960 --> 00:04:24,600
U1, p1.

69
00:04:25,060 --> 00:04:25,600
Submit.

70
00:04:25,930 --> 00:04:27,100
Yes, submit.

71
00:04:27,100 --> 00:04:27,460
Submit.

72
00:04:27,670 --> 00:04:34,570
So what you are getting in return is this which

73
00:04:35,620 --> 00:04:36,920
corresponds to

74
00:04:38,600 --> 00:04:43,270
uname and this is pword.

75
00:04:43,690 --> 00:04:47,290
So these are the text input objects.

76
00:04:49,120 --> 00:04:49,360
Now.

77
00:04:50,780 --> 00:04:57,530
If you want the text that the user enters in these text input boxes, then you need to access the text

78
00:04:57,650 --> 00:04:58,370
property.

79
00:04:59,360 --> 00:05:03,050
Same for password save, execute.

80
00:05:04,320 --> 00:05:14,700
And I'll close this previous window to get the new one, u1, p1 submit.

81
00:05:15,690 --> 00:05:18,600
And now we get the actual text that the user entered.

82
00:05:19,140 --> 00:05:26,970
So that is how we get values from the text input boxes and send them to Python for further processing.

83
00:05:27,570 --> 00:05:30,390
So root refers to a sign up screen.

84
00:05:31,810 --> 00:05:36,820
Add.user is the method in the sign up screen, root again is a sign of screen.

85
00:05:37,960 --> 00:05:46,120
Class ids is a property of the sign up screen object, which actually comes from the screen.

86
00:05:46,150 --> 00:05:55,090
So screen inherited to sign screen and sign up screen has this I.D., which actually gives a sort of

87
00:05:55,090 --> 00:06:00,960
dictionary with all the ids contained in the sign up screen rule.

88
00:06:01,450 --> 00:06:08,220
So in this case, it gives you access to username, to password. Roots.ids.password gives

89
00:06:08,220 --> 00:06:08,960
text to the

90
00:06:09,160 --> 00:06:14,500
text input object that has an id, a password, and than with text

91
00:06:14,500 --> 00:06:17,710
you access the actual value of that object.

92
00:06:18,880 --> 00:06:19,630
In next lecture

93
00:06:19,690 --> 00:06:25,210
let's go ahead and work with the Json file to store this data in the Json file.

