0
1
00:00:04,810 --> 00:00:06,700
<v Lecturer>Hello again in previous lecture what we did</v>
1

2
00:00:06,700 --> 00:00:09,630
we created our function for file and save.
2

3
00:00:09,630 --> 00:00:13,050
Now, it's time to create function for save as.
3

4
00:00:13,050 --> 00:00:16,180
To that I need to do, and actually it will be very simple,
4

5
00:00:16,180 --> 00:00:19,890
and like before I need to go to find this guy, right?
5

6
00:00:19,890 --> 00:00:23,580
And save as is here and I will create here
6

7
00:00:23,580 --> 00:00:28,370
Command property command equals self dot parent
7

8
00:00:32,520 --> 00:00:37,520
parent dot save as file, okay.
8

9
00:00:37,860 --> 00:00:39,740
This is our function name.
9

10
00:00:39,740 --> 00:00:40,920
And after that, here, what I need to do,
10

11
00:00:40,920 --> 00:00:44,450
I need to copy this guy and come to here.
11

12
00:00:44,450 --> 00:00:46,260
Create this definition, right.
12

13
00:00:46,260 --> 00:00:48,640
Before save file, file, I will say
13

14
00:00:48,640 --> 00:00:52,603
def save as file and here,
14

15
00:00:54,750 --> 00:00:57,740
asterisk, arguments, right, and here,
15

16
00:00:57,740 --> 00:00:59,910
it's very simple, actually.
16

17
00:00:59,910 --> 00:01:02,266
So, for save as, what we need to do,
17

18
00:01:02,266 --> 00:01:05,070
for save as, actually, we don't need to,
18

19
00:01:05,070 --> 00:01:08,370
we need to only create a new URL, okay.
19

20
00:01:08,370 --> 00:01:10,760
It doesn't mean, we don't need to use here URL
20

21
00:01:12,060 --> 00:01:14,500
if URL, if a file has URL,
21

22
00:01:14,500 --> 00:01:18,910
because we are, saving as means you are like,
22

23
00:01:18,910 --> 00:01:21,520
you are creating a new file, okay.
23

24
00:01:21,520 --> 00:01:24,600
Doesn't matter if this file already has a URL
24

25
00:01:24,600 --> 00:01:26,400
or it doesn't have a URL.
25

26
00:01:26,400 --> 00:01:28,380
That's why here, what I need to do,
26

27
00:01:28,380 --> 00:01:30,490
actually, this guy, I need,
27

28
00:01:30,490 --> 00:01:32,450
I can copy and paste this guy
28

29
00:01:32,450 --> 00:01:34,310
but I will do something else also.
29

30
00:01:34,310 --> 00:01:36,980
So, here, I will say, simply,
30

31
00:01:36,980 --> 00:01:41,283
try and also, except.
31

32
00:01:42,958 --> 00:01:45,830
For except also, let's say return, okay.
32

33
00:01:45,830 --> 00:01:47,940
Let's return here.
33

34
00:01:47,940 --> 00:01:50,540
I want to say content
34

35
00:01:52,460 --> 00:01:57,460
equals str self dot text editor get
35

36
00:02:02,470 --> 00:02:05,340
from first one until end, right.
36

37
00:02:05,340 --> 00:02:07,193
And after that, what I need to do here,
37

38
00:02:08,030 --> 00:02:11,510
I will say, URL equals, I need to open here
38

39
00:02:11,510 --> 00:02:13,270
file dialogue, okay.
39

40
00:02:13,270 --> 00:02:15,297
And file, for file dialogue,
40

41
00:02:15,297 --> 00:02:17,700
I need to say, file dialogue window,
41

42
00:02:17,700 --> 00:02:20,340
ask save as file, okay.
42

43
00:02:20,340 --> 00:02:25,340
And again, mode is equals W, right.
43

44
00:02:25,810 --> 00:02:27,450
And default extension.
44

45
00:02:27,450 --> 00:02:31,450
Actually, we can copy this, guys, okay,
45

46
00:02:31,450 --> 00:02:32,820
this, guys...
46

47
00:02:34,470 --> 00:02:36,160
until here right.
47

48
00:02:36,160 --> 00:02:37,823
Copy and paste it here.
48

49
00:02:39,720 --> 00:02:41,350
And it's fine.
49

50
00:02:41,350 --> 00:02:42,760
After that, what I need to do here,
50

51
00:02:42,760 --> 00:02:47,760
I will say URL dot right content, okay.
51

52
00:02:48,190 --> 00:02:52,816
And also we can say here, URL dot close.
52

53
00:02:52,816 --> 00:02:54,620
And also, what I want to do,
53

54
00:02:54,620 --> 00:02:57,090
I want to change my title, okay.
54

55
00:02:57,090 --> 00:03:02,090
Title of my window, self dot parent dot title.
55

56
00:03:03,570 --> 00:03:06,837
And here, what I need to do, already create this title actually
56

57
00:03:08,111 --> 00:03:10,670
So,let me find it, it's here, right.
57

58
00:03:10,670 --> 00:03:15,261
And I will say, copy this guy and paste it here.
58

59
00:03:15,261 --> 00:03:16,094
Okay.
59

60
00:03:19,700 --> 00:03:21,853
And now if I run my application,
60

61
00:03:24,240 --> 00:03:25,073
it is ready.
61

62
00:03:26,610 --> 00:03:29,240
And, for example, let's open a new,
62

63
00:03:29,240 --> 00:03:32,840
open a file from our computer, existing file.
63

64
00:03:32,840 --> 00:03:35,210
And let's use this one, okay.
64

65
00:03:35,210 --> 00:03:39,500
And now, I want to save as this right file.
65

66
00:03:39,500 --> 00:03:42,660
Save as, you see now, we need to use here,
66

67
00:03:42,660 --> 00:03:45,370
dialogue, a new dialogue window.
67

68
00:03:45,370 --> 00:03:50,357
And here, let's name it something like, abdcf, okay.
68

69
00:03:52,820 --> 00:03:56,703
And save and if I open it, open.
69

70
00:03:57,686 --> 00:04:02,550
Abcdf is here right, our content is,
70

71
00:04:02,550 --> 00:04:06,440
will be hello python, how are you and so on.
71

72
00:04:06,440 --> 00:04:09,190
And here, you see our content is here.
72

73
00:04:09,190 --> 00:04:12,720
And also we are changing our title here.
73

74
00:04:12,720 --> 00:04:17,040
This is how we can use save as function for our files.
74

75
00:04:17,040 --> 00:04:17,970
For now, that's all.
75

76
00:04:17,970 --> 00:04:18,970
See you in the next.
