-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.py
More file actions
73 lines (62 loc) · 2.25 KB
/
controller.py
File metadata and controls
73 lines (62 loc) · 2.25 KB
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
class Controller:
'''
Controller class: it contains the methods used by the view widgets to communicate with the model.
It is, obviously, the controller of our MVC.
Attributes:
- model (Model): the model, in order to access to the needed data.
'''
def __init__(self, model):
self.model = model
def checkImageExistance(self, imageToCheck):
'''
Check whether the image passed as argument is present in the model image list.
If so, it returns 'True'; otherwise it returns 'False'.
'''
if self.model.checkImage(imageToCheck):
return True
else:
return False
def addImage(self, imageToAdd):
'''
Add the image received as argument to the model image list.
'''
self.model.addImage(imageToAdd)
def getImageList(self):
'''
Getter for the model image list.
'''
return self.model.getImageList()
def removeImageFromIndex(self, imageIndex):
'''
Remove the image contained in the model image list at the corresponding index passed as argument.
'''
imageToRemove = self.model.getSelectedImageFromIndex(imageIndex)
self.model.removeImage(imageToRemove)
def clearImageList(self):
'''
Clear the model image list. Remove all the images.
'''
self.model.clearImageList()
def selectImageFromIndex(self, imageIndex):
'''
Set the model image to the one selected based on its index.
'''
selectedImage = self.model.getSelectedImageFromIndex(imageIndex)
self.model.setImage(selectedImage)
def getSelectedImage(self):
'''
Getter for the model selected image. It returns the current image selected.
'''
return self.model.getSelectedImage()
def getTabsData(self):
'''
Getter for the model data. Particularly it returns the general info and the EXIF data stored in the model.
'''
info = self.model.getInfo()
exifData = self.model.getEXIF()
return info, exifData
def getGeoData(self):
'''
Getter for the model geo data. It returns the localization info.
'''
return self.model.getGeoData()