-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interface.py
276 lines (220 loc) · 8.12 KB
/
Interface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
""""
Final Project Title: Top3
Objective: This file is the interface of the project which displays a small pop which will contain
the recommended movies provided by the algorithm.
By: Ansh Malhotra, Armaan Mann, Leya Abubaker
This file is Copyright (c) 2021 Ansh Malhotra, Armaan Mann, Leya Abubaker
"""
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.uix.popup import Popup
import extracting_reviews
from extracting_reviews import trailers, fetch_movie_reviews
from kivy.config import Config
import main
import pprint
portions = input("Enter Portion File: ")
movies = main.get_recs(portions)
get_dict = extracting_reviews.filtering(movies)
keys = list(get_dict.keys())
class MyGrid(Widget):
"""
Contains all of the properties within the GUI: buttons, texts, images, etc.
"""
def button(self) -> None:
"""
Represents the first button for Movie1 contains the popup once movie1 button is pressed
"""
show_popup()
def button2(self) -> None:
"""
Represents the first button for Movie2 contains the popup once movie1 button is pressed
"""
show_popup2()
def button3(self) -> None:
"""
Represents the first button for Movie3 contains the popup once movie1 button is pressed
"""
show_popup3()
def image_appear(self) -> None:
"""
Once the "Top Recommendations" Button is pressed, it changes the images for movie1,
movie2 and movie3 to their respective movie poster.
"""
self.ids.my_image3.source = get_dict[keys[0]]
self.ids.my_image2.source = get_dict[keys[1]]
self.ids.my_image1.source = get_dict[keys[2]]
class P(FloatLayout):
"""
Class represents all of the items functions within popout for movie1, which is
displayed once movie1 button is pressed
"""
def ytube(self) -> None:
"""
Function launches the show_trailer function, which refers to the "Click to See Trailer"
button. Once clicked the button launches Youtube Trailer for movie1
"""
show_trailer()
def text1(self) -> None:
"""
Function launches the description function which shows the description of movie1, only
when the "Click for Description" button is clicked
"""
description()
def review1(self) -> None:
"""
Function launches the reviews_1 function, which displays the reviews for movie1, once
"Click for Reviews" is pressed.
"""
reviews_1()
class P2(FloatLayout):
"""
Class represents all of the items functions within popout for movie2, which is
displayed once movie1 button is pressed
"""
def ytube2(self) -> None:
"""
Function launches the show_trailer2 function, which refers to the "Click to See Trailer"
button. Once clicked the button launches Youtube Trailer for movie2
"""
show_trailer2()
def text2(self) -> None:
"""
Function launches the description2 function which shows the description of movie2, only
when the "Click for Description" button is clicked
"""
description2()
def review2(self) -> None:
"""
Function launches the reviews_2 function, which displays the reviews for movie2, once
"Click for Reviews" is pressed.
"""
reviews_2()
class P3(FloatLayout):
"""
Class represents all of the items functions within popout for movie3, which is
displayed once movie1 button is pressed
"""
def ytube3(self) -> None:
"""
Function launches the show_trailer2 function, which refers to the "Click to See Trailer"
button. Once clicked the button launches Youtube Trailer for movie3
"""
show_trailer3()
def text3(self) -> None:
"""
Function launches the description3 function which shows the description of movie3, only
when the "Click for Description" button is clicked
"""
description3()
def review3(self) -> None:
"""
Function launches the reviews_3 function, which displays the reviews for movie3, once
"Click for Reviews" is pressed.
"""
reviews_3()
class Top3(App):
"""
Class that inherits from App, and allows us to build the app
"""
def build(self) -> object:
"""
Returns the MyGrid Widget, the function that builds the the Top3 App
"""
Window.size = (700, 600)
Config.set('graphics', 'resizable', '1')
return MyGrid()
def show_popup() -> None:
"""
Includes the properties for the pop up window once movie1 is clicked
"""
visual1 = P()
popup_movie1 = Popup(title=keys[0], content=visual1, size_hint=(None, None), size=(550, 600),
background_color='#696969')
popup_movie1.open()
def show_popup2() -> None:
"""
Includes the properties for the pop up window once movie2 is clicked
"""
visual2 = P2()
popup_movie2 = Popup(title=keys[1], content=visual2, size_hint=(None, None), size=(550, 600),
background_color='#696969')
popup_movie2.open()
def show_popup3() -> None:
"""
Includes the properties for the pop up window once movie3 is clicked
"""
visual3 = P3()
popup_movie3 = Popup(title=keys[2], content=visual3, size_hint=(None, None), size=(550, 600),
background_color='#696969')
popup_movie3.open()
def show_trailer() -> None:
"""
The function responsible for opening the Trailer once "Click for the Trailer" is pressed
within the popup for movie1
"""
trailers(keys[0])
def show_trailer2() -> None:
"""
The function responsible for opening the Trailer once "Click for the Trailer" is pressed
within the popup for movie2
"""
trailers(keys[1])
def show_trailer3() -> None:
"""
The function responsible for opening the Trailer once "Click for the Trailer" is pressed
within the popup for movie1
"""
trailers(keys[2])
def description() -> None:
"""
Shows the description for movie1 once, "Click for the Description" is clicked within the
popup for movie1
"""
g = main.loading_graph(portions)
info = g.movie_info(portions, [keys[0]])
print(info.get(keys[0])[5])
def description2() -> None:
"""Shows the description for movie1 once, "Click for the Description" is clicked within the
popup for movie2"""
g = main.loading_graph(portions)
info = g.movie_info(portions, [keys[1]])
print(info.get(keys[1])[5])
def description3() -> None:
"""
Shows the description for movie1 once, "Click for the Description" is clicked within the
popup for movie3"""
g = main.loading_graph(portions)
info = g.movie_info(portions, [keys[2]])
print(info.get(keys[2])[5])
def reviews_1() -> None:
"""
Shows the top 4 reviews for movie1 once, "Click for the Reviews" is clicked within the
popup for movie1
"""
all_reviews = fetch_movie_reviews(movies[0])
for i in range(0, 4):
pprint.pprint(all_reviews.get("Review Description")[i])
print(end='\n')
def reviews_2() -> None:
"""
Shows the top 4 reviews for movie1 once, "Click for the Reviews" is clicked within the
popup for movie2
"""
all_reviews = fetch_movie_reviews(movies[1])
for i in range(0, 4):
pprint.pprint(all_reviews.get("Review Description")[i])
print(end='\n')
def reviews_3() -> None:
"""
Shows the top 4 reviews for movie1 once, "Click for the Reviews" is clicked within the
popup for movie3
"""
all_reviews = fetch_movie_reviews(movies[1])
for i in range(0, 4):
pprint.pprint(all_reviews.get("Review Description")[i])
print(end='\n')
if __name__ == '__main__':
Top3().run()