def handle(self, event): #super().handle(event) if isinstance(event, Response) and isinstance(event.request, SearchRequest): log.info("-----EVENT RESPONSE AND REQUEST--------" + event.data) self.gui.emit(SearchResponse(event.request, event.data)) self.gui.emit(ShowFrame('MovieListWidget')) #self.gui.emit(ShowMovieList()) elif isinstance(event, SearchResponse): log.info("-----EVENT SHOW FRAME--------" + event.data) self.gui.emit(SearchResponse(event.request, event.data)) self.gui.emit(ShowFrame('MovieListWidget'))
def btnDeleteFileClicked(self, file=None,item=None): """ Play the movie in the MoviePlayer or in the default player of the client system :param file: the file we want to play :type film: file model """ fileDel = None if file is None: fileDel = self.film.files[0] else: fileDel = file if item is not None: response = QMessageBox.question(self, "Delete file", "Delete the file from database ? it will not delete the file from your computer", QMessageBox.Yes | QMessageBox.Cancel) if response == QMessageBox.Yes: row = self.lstFile.row(item) self.lstFile.takeItem(row) if self.lstFile.count() is 1: self.lstFile.hide() self.btnLaunchFilm.show() self.btnDeleteFile.show() self.btnShowInDir.show() fileDel.delete() else: response = QMessageBox.question(self, "Delete the last file of the movie", "Delete the file and the <b>movie</b> from database ? it will not delete the movie from your computer", QMessageBox.Yes | QMessageBox.Cancel) if response == QMessageBox.Yes: fileDel.delete() self.film.delete() self.gui.emit(ShowFrame(mawie.gui.components.QMovieListWidget.MovieListWidget.__name__, data=Movie.query()))
def handle(self, event): super().handle(event) if isinstance(event, ShowExplorer): self.emit(ShowFrame(self)) elif issubclass(event.__class__, MovieNotParsed): self.lstFileNotParse.addItem(event.file) elif issubclass(event.__class__, MovieParsed): self.lstFileNotParse.removeItem(event.file) self.lstFileParse.addItem(event.file)
def handle(self, event): #should call super() otherwise the compoenent may never appear on screen if isinstance(event, ShowFrame): log.info( "HANDLING FRAME CHANGE asking frame %s [self = %s]", event.frame.__class__.__name__ if not isinstance(event.frame, str) else event.frame, self.__class__.__name__) if event.frame == self.__class__.__name__: self.onShowFrame() self.gui.emit(ShowFrame(self))
def clickedSee(self, film): self.emit(ShowFrame(MovieWidget.__name__, film))
def btnGoBackClicked(self): self.gui.emit(ShowFrame(mawie.gui.components.QMovieListWidget.MovieListWidget.__name__))
def _forceFrameChange(self): if len(self.inputSearch.text()) > 0: self.gui.emit(SearchRequest(self.inputSearch.text().lower())) self.gui.emit(ShowFrame('MovieListWidget'))
def _displayAllMovies(self): self.gui.emit(SearchRequest("")) self.gui.emit(ShowFrame('MovieListWidget'))