[qcineoob] protection against same-person movies in common and same-movie persons in common
This commit is contained in:
parent
4c54ef017e
commit
9f2961c9a3
2 changed files with 26 additions and 8 deletions
|
|
@ -20,7 +20,7 @@
|
|||
import urllib
|
||||
|
||||
from PyQt4.QtCore import Qt, SIGNAL
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap, QMessageBox
|
||||
|
||||
from weboob.applications.qcineoob.ui.movie_ui import Ui_Movie
|
||||
from weboob.capabilities.base import empty
|
||||
|
|
@ -129,6 +129,15 @@ class Movie(QFrame):
|
|||
my_title = self.movie.original_title
|
||||
other_id = unicode(self.ui.personsInCommonEdit.text()).split('@')[0]
|
||||
other_movie = self.backend.get_movie(other_id)
|
||||
if other_id == self.movie.id:
|
||||
QMessageBox.critical(None, self.tr('"Persons in common" error'),
|
||||
unicode(self.tr('Nice try\nThe movies must be different')),
|
||||
QMessageBox.Ok)
|
||||
elif not other_movie:
|
||||
QMessageBox.critical(None, self.tr('"Persons in common" error'),
|
||||
unicode(self.tr('Movie not found: %s' % other_id)),
|
||||
QMessageBox.Ok)
|
||||
else:
|
||||
other_title = other_movie.original_title
|
||||
desc = 'Persons in common %s, %s'%(my_title, other_title)
|
||||
self.parent.doAction(desc, self.parent.personsInCommonAction, [self.backend.name, my_id, other_id])
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
import urllib
|
||||
|
||||
from PyQt4.QtCore import SIGNAL, Qt
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap, QApplication
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap, QApplication, QMessageBox
|
||||
|
||||
from weboob.applications.qcineoob.ui.person_ui import Ui_Person
|
||||
from weboob.capabilities.base import empty
|
||||
|
|
@ -94,6 +94,15 @@ class Person(QFrame):
|
|||
my_name = self.person.name
|
||||
other_id = unicode(self.ui.moviesInCommonEdit.text()).split('@')[0]
|
||||
other_person = self.backend.get_person(other_id)
|
||||
if other_id == self.person.id:
|
||||
QMessageBox.critical(None, self.tr('"Moviess in common" error'),
|
||||
unicode(self.tr('Nice try\nThe persons must be different')),
|
||||
QMessageBox.Ok)
|
||||
elif not other_person:
|
||||
QMessageBox.critical(None, self.tr('"Movies in common" error'),
|
||||
unicode(self.tr('Person not found: %s' % other_id)),
|
||||
QMessageBox.Ok)
|
||||
else:
|
||||
other_name = other_person.name
|
||||
desc = 'Movies in common %s, %s'%(my_name, other_name)
|
||||
self.parent.doAction(desc, self.parent.moviesInCommonAction, [self.backend.name, my_id, other_id])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue