1
00:00:01,400 --> 00:00:04,280
So let's create our loop.

2
00:00:05,180 --> 00:00:14,720
While true, I'll check for the event and values and we will Cranton, so I will choose.

3
00:00:16,390 --> 00:00:20,970
A full year led to this one and nothing happened.

4
00:00:22,860 --> 00:00:28,290
Let's click on ACAP, nothing will happen until we click a button.

5
00:00:28,500 --> 00:00:34,770
OK, but we can even exit now will not allow us to exit the window.

6
00:00:37,820 --> 00:00:45,320
OK, so we have the problem is we have not tell W when to quit.

7
00:00:48,000 --> 00:00:54,780
So if event equals S.G., they'll win close.

8
00:00:56,910 --> 00:01:05,670
Break, let me run this again now, when we click on this will exit correctly, and if we click on exit,

9
00:01:05,670 --> 00:01:06,920
nothing else will work.

10
00:01:07,050 --> 00:01:10,700
But I'm only showing you why this error message appears.

11
00:01:10,710 --> 00:01:13,770
Let's commend this and run it again.

12
00:01:16,150 --> 00:01:25,420
This, by default, will close the wind, but we have not exited blue yet, so Delu still trying to

13
00:01:25,420 --> 00:01:27,860
read from the window which is closed.

14
00:01:28,000 --> 00:01:34,690
This is why it's giving us this error message, trying to read a closed window.

15
00:01:35,200 --> 00:01:39,460
OK, now let's modify this.

16
00:01:42,540 --> 00:01:55,800
If event equals exit or OK, now our window will be closed properly, but I want also to trigger some

17
00:01:55,800 --> 00:02:03,720
events when we play and select this button and this button and other buttons, for instance.

18
00:02:04,200 --> 00:02:05,260
So how can we do this?

19
00:02:05,670 --> 00:02:13,950
There is a property for each element that it will allow it to create event.

20
00:02:14,250 --> 00:02:19,260
To do this, we will use something called enable event.

21
00:02:19,620 --> 00:02:28,440
So by default, the folder brass will fill in the value for this input when we select a folder.

22
00:02:28,860 --> 00:02:33,330
So here we will enable event equals to.

23
00:02:33,660 --> 00:02:35,670
Let's check what this will do.

24
00:02:36,780 --> 00:02:42,140
Now, when we choose our folders, it now had created an event.

25
00:02:42,600 --> 00:02:44,880
Let's try another one.

26
00:02:44,880 --> 00:02:46,700
We haven't put anything in here.

27
00:02:46,800 --> 00:02:49,890
I'll choose another folder and nothing happens.

28
00:02:50,280 --> 00:02:58,530
So any event will fire an event when a control or when an element is changed.

29
00:02:58,980 --> 00:03:03,810
OK, so we should do the same thing with the destination.

30
00:03:04,050 --> 00:03:07,920
OK, let's adjust the width of this.

31
00:03:07,950 --> 00:03:10,910
So it will be more readable.

32
00:03:11,220 --> 00:03:13,770
We can also give it a tool tip.

33
00:03:14,220 --> 00:03:18,130
Select this nation folder.

34
00:03:18,480 --> 00:03:27,950
Let's do the same thing in here and we will see what a tool is because this is sort of enhancement.

35
00:03:27,960 --> 00:03:28,560
It's not.

36
00:03:34,600 --> 00:03:40,740
Now, when I hoover on the button, it will play select source or destination folder.

37
00:03:41,470 --> 00:03:44,400
OK, now we have completed our interface.

38
00:03:44,680 --> 00:03:52,010
Let's put our logic in the loop first when I select a source folder.

39
00:03:52,450 --> 00:04:01,200
I want to scan the files in this folder and populate the multiline with the file names.

40
00:04:01,630 --> 00:04:03,220
So let's do this.

41
00:04:06,320 --> 00:04:17,080
I'll check if an event equals source and we are tracking the event, if it equal the kenin.

42
00:04:17,810 --> 00:04:29,400
OK, then source will equal to Earth values source and this is to get the actual content of the input

43
00:04:29,750 --> 00:04:30,220
box.

44
00:04:30,530 --> 00:04:38,780
We could have used the browse button and gave it a key, but in anyway, we have the same value in the

45
00:04:38,780 --> 00:04:39,080
input.

46
00:04:39,800 --> 00:04:41,430
Now let's grab the extension.

47
00:04:42,020 --> 00:04:55,640
This will be values of E at the end of sixty eight 16 values of equity and now files will equal open

48
00:04:56,150 --> 00:05:00,470
source that are low, for example.

49
00:05:00,920 --> 00:05:03,590
And in here we will pass the extension.

50
00:05:04,220 --> 00:05:04,570
OK.

51
00:05:05,340 --> 00:05:15,210
We have converted the values of souls to a path using the past Nebris, we have grabbed extensor if

52
00:05:15,210 --> 00:05:24,150
the user had changed it, and then we have created our globe to get the files from this path.

53
00:05:24,690 --> 00:05:29,810
And now the files will equal to list of files.

54
00:05:30,180 --> 00:05:32,510
Let's put a breakpoint in use and check.

55
00:05:32,700 --> 00:05:33,810
What will this do?

56
00:05:38,680 --> 00:05:47,300
And I will choose Loubriel select, and now it has stopped the excuse at the big point.

57
00:05:47,770 --> 00:05:52,300
Now let's check everything, let's check the values.

58
00:05:53,020 --> 00:06:03,090
Values is the trinity with all the keys that we have, the clear and all the elements that we have and

59
00:06:03,100 --> 00:06:04,960
gave them EKI also.

60
00:06:06,210 --> 00:06:16,740
So let's get the values of the key is, see, this will be the path that we have chosen, but this is

61
00:06:16,740 --> 00:06:21,030
a string, so we will create a path out of it.

62
00:06:23,160 --> 00:06:25,150
And now this is above.

63
00:06:25,690 --> 00:06:36,330
OK, now let's grab the extensions and this is again in the values, this one, we haven't modified

64
00:06:36,330 --> 00:06:36,570
them.

65
00:06:36,570 --> 00:06:37,740
So it's this one.

66
00:06:40,320 --> 00:06:49,080
Next thing is, we will use our globe, which will get a list of all the files in the US.

67
00:06:49,410 --> 00:06:51,870
So let's check the files now.

68
00:06:52,290 --> 00:06:53,750
This will be a generator.

69
00:06:53,970 --> 00:06:57,390
We will convert it to a list using less.

70
00:06:57,870 --> 00:07:04,950
And now we have a list of all files in those folders as.

71
00:07:06,450 --> 00:07:14,720
So now we can I trade over them and and update our multiline.

72
00:07:15,240 --> 00:07:29,010
So I'll check if files this mean that it's not empty for everything in files, window out to update

73
00:07:29,250 --> 00:07:30,970
an element in the window.

74
00:07:31,020 --> 00:07:35,240
We will use Windu and then we will pass in the key.

75
00:07:35,640 --> 00:07:39,180
The key for the multiline is file.

76
00:07:39,630 --> 00:07:41,010
We will pass it in your.

77
00:07:43,130 --> 00:07:49,520
Files, then we will use the method, since this is a multiline, it have a print method.

78
00:07:50,950 --> 00:07:55,000
Which will update the multi-line with the values that we want to Ockrent.

79
00:07:56,090 --> 00:07:58,970
Now, let's check this, I choose.

80
00:08:01,020 --> 00:08:03,000
The pass the library were in.

81
00:08:05,450 --> 00:08:10,460
And now it had populated the list with all the files.

82
00:08:10,810 --> 00:08:17,360
OK, this is very cool, but we can modify that first.

83
00:08:17,360 --> 00:08:19,570
Let's choose another path.

84
00:08:21,910 --> 00:08:33,970
And it had again repopulated the left, so in order to overcome this, we can clear left before putting

85
00:08:33,970 --> 00:08:35,740
anything in it.

86
00:08:35,740 --> 00:08:42,430
So we will use Windu of files, not a date.

87
00:08:42,880 --> 00:08:46,090
And this will update all the values.

88
00:08:46,330 --> 00:08:51,790
We will give it value argument and then we will pass in an empty string.

89
00:08:52,090 --> 00:08:53,640
Let's check this out.

90
00:08:53,860 --> 00:08:55,040
Choose the library.

91
00:08:55,510 --> 00:08:59,610
OK, let's choose this first.

92
00:09:00,370 --> 00:09:05,840
Now it have cleared the multiline first and then assign it then.

93
00:09:05,930 --> 00:09:15,700
Well this is nice, but I don't like the wrapping here, so I don't want this to be in here.

94
00:09:15,700 --> 00:09:20,080
For example, every rule should be a file by itself.

95
00:09:20,410 --> 00:09:27,790
OK, so we have a couple of options to wrap the first option.

96
00:09:27,790 --> 00:09:31,170
We can give it our parameters in here.

97
00:09:32,870 --> 00:09:44,780
And not widget, dot com, fake rap, equal to none, and which is capital letters.

98
00:09:44,810 --> 00:09:49,720
Let's check this Telek the folder now it had dropped the text.

99
00:09:50,080 --> 00:09:55,140
This is the first option, but I prefer another one.

100
00:09:55,520 --> 00:10:04,130
What I will do is I will calculate the number of characters in each file and then we will set the width

101
00:10:04,460 --> 00:10:10,830
of the multiline to the largest number of characters in a file.

102
00:10:10,850 --> 00:10:13,040
So let's check this first.

103
00:10:13,550 --> 00:10:19,100
Let's get the number of characters in the list of files first.

104
00:10:19,100 --> 00:10:20,970
Let's put a breakpoint in here.

105
00:10:20,990 --> 00:10:22,610
Let's talk about this.

106
00:10:23,160 --> 00:10:24,770
Let's take it a step by step.

107
00:10:26,040 --> 00:10:27,660
I will choose the library.

108
00:10:32,810 --> 00:10:43,430
Now we have a list of files, so we want to trade on each one of them and get the number of characters

109
00:10:43,970 --> 00:10:49,710
in each file to do this, we will use a list comprehension.

110
00:10:50,450 --> 00:10:51,050
We will.

111
00:10:53,150 --> 00:11:03,770
Get X for X in files, and this will play out of them, so we have done nothing, so we will convert

112
00:11:03,770 --> 00:11:05,130
this less to string.

113
00:11:05,600 --> 00:11:16,050
Now we have converted them to strings, and since we have changed, we can get its plans very easily.

114
00:11:16,490 --> 00:11:21,160
Now we have Delane of each file.

115
00:11:21,650 --> 00:11:27,180
I mean, the length of its name to get the max, we will use Max.

116
00:11:27,290 --> 00:11:32,220
This will get us the maximum length of file and all of this.

117
00:11:32,240 --> 00:11:33,950
So I'll copy this.

118
00:11:34,460 --> 00:11:42,650
I'll put it in here and I'll create a variable, all characters equal to what we have calculated.

119
00:11:43,970 --> 00:11:46,940
And then we will use Wendell.

120
00:11:49,720 --> 00:11:53,620
Files not set size.

121
00:11:56,110 --> 00:12:03,760
Then we'll give it parameters size, which we will give a chance, which is a number of characters,

122
00:12:04,360 --> 00:12:12,620
and we can give it none as the other parameters, so it will not change it, which is the high.

123
00:12:12,820 --> 00:12:14,200
Now, let's take this.

124
00:12:15,120 --> 00:12:16,990
Of course, all of these are often.

125
00:12:24,190 --> 00:12:32,620
I'll choose library and now the multiline, I just get to the maximum of the length of the filename.

126
00:12:33,700 --> 00:12:35,290
This is nice.

127
00:12:35,800 --> 00:12:40,720
Let's see what we will do when the destination is populated.

128
00:12:41,410 --> 00:12:49,180
We will need to alert the user if the directory contains some files.

129
00:12:49,750 --> 00:12:58,990
Previously on In the Back of the script, when the destination directory was not empty, we will normally

130
00:12:58,990 --> 00:13:07,270
prompt the user destination does exist and it will be overwritten and then we will check if the user

131
00:13:07,270 --> 00:13:09,400
selected yes or no.

132
00:13:09,850 --> 00:13:12,980
If he selected no, we will get.

133
00:13:13,000 --> 00:13:16,050
Otherwise we will proceed with the packet.

134
00:13:16,330 --> 00:13:23,160
We will do something similar, but we will check if the directory is empty or not.

135
00:13:23,920 --> 00:13:24,210
OK.

136
00:13:25,210 --> 00:13:37,750
So let's first, as if event equals this nation, let's check if I will say this, the nation will equal

137
00:13:37,750 --> 00:13:42,220
to half of the values of this nation.

138
00:13:42,850 --> 00:13:50,590
OK, let's put a break point in here and excuse this and let's see how I would get if the character

139
00:13:50,590 --> 00:13:51,870
is empty or not.

140
00:13:52,740 --> 00:13:58,950
I trust this director, for example, now we they execution's up, let's.

141
00:13:59,750 --> 00:14:02,250
Get this and execute it.

142
00:14:02,930 --> 00:14:13,460
Now let's check a destination that is NASA destination letters Dyer, which will return a generous generator

143
00:14:13,460 --> 00:14:15,650
we can use next this.

144
00:14:15,650 --> 00:14:19,670
Will I trade through the content of the.

145
00:14:20,350 --> 00:14:30,280
Generated, so this means that if we have an empty directly, it will return nothing to implement.

146
00:14:30,280 --> 00:14:39,420
This will use empty will equal to the Etta's dire, then we will get next.

147
00:14:39,730 --> 00:14:44,140
But if it's empty, we will return none.

148
00:14:44,350 --> 00:14:48,670
Then we can check if empty mean.

149
00:14:48,670 --> 00:14:50,580
The directory is not empty.

150
00:14:51,160 --> 00:14:59,880
In this case, we will generate problem or cancel destination contains funds.

151
00:15:02,080 --> 00:15:05,350
If you proceed, it will be.

152
00:15:10,480 --> 00:15:19,000
This will display above a message, but we want to get what button have been pressed, so we will assign

153
00:15:19,000 --> 00:15:29,070
it to a variable and then we will check if we can equals cancel this mean that the users have pressed

154
00:15:29,290 --> 00:15:35,480
the cancel button, this mean that he will not choose this folder.

155
00:15:35,620 --> 00:15:39,370
So we should clear the content of the destination.

156
00:15:40,420 --> 00:15:44,290
To do this, we will use window of this.

157
00:15:44,300 --> 00:15:50,320
The nation, the date value equals an empty string.

158
00:15:50,800 --> 00:15:56,360
OK, now let's talk about this and check what will happen.

159
00:16:01,440 --> 00:16:04,950
I'll choose a folder that contains something, this one.

160
00:16:05,460 --> 00:16:14,870
OK, now destination equals to the folder that we have chosen, we will I trade and check if it's empty.

161
00:16:15,300 --> 00:16:16,470
Actually it's not.

162
00:16:16,950 --> 00:16:18,850
So it has value.

163
00:16:18,900 --> 00:16:23,070
This means that we will enter this statement.

164
00:16:23,340 --> 00:16:29,070
Now, an out of box will appear on the screen destination and contains file.

165
00:16:29,490 --> 00:16:31,620
If you proceed, it will be deleted.

166
00:16:32,040 --> 00:16:34,380
We will press OK, for example.

167
00:16:34,890 --> 00:16:41,110
This means that we will not enter and the program will continue.

168
00:16:41,580 --> 00:16:44,220
Let's do the same thing again.

169
00:16:44,850 --> 00:16:46,320
This time we will.

170
00:16:47,570 --> 00:16:48,870
On cancer.

171
00:16:49,250 --> 00:17:00,170
So we will enter this now, their input is populated with the Foldit, so when we execute Windu update,

172
00:17:00,170 --> 00:17:04,100
it will clear that sickness that build it.

173
00:17:04,700 --> 00:17:05,280
Very nice.

174
00:17:05,300 --> 00:17:14,160
So we have now implement what will happen when this source folder is selected.

175
00:17:14,180 --> 00:17:20,510
And what will happen when the destination folder is selected and we have implemented what will happen

176
00:17:20,510 --> 00:17:21,850
when we click on Exit.

177
00:17:22,460 --> 00:17:27,680
The remaining thing is to implement what will happen when we come back.
