def addToMyShows(self, index): # Restore the cursor in case we're dropping an item and a messagebox appears QApplication.changeOverrideCursor(Qt.ArrowCursor) selectedShow = self.dispSearchResults[index] # Make sure the requested show isn't already tracked # For that, check the id (which is unique) checkShow = [ item['id'] for item in self.myShows if item['id'] == selectedShow['id'] ] if selectedShow['id'] in checkShow: tools.msgDebug(u"""Show already in "My Shows". Can't add!""", __name__) QMessageBox().information( self, "Information", 'Cannot add "%s".\n' % selectedShow['name'] + 'This show is already tracked.', QMessageBox.Ok) return # Tell the user if the show is terminated if selectedShow['year_end'] != "????": yesno = QMessageBox().question( self, "Attention", '"%s" seem to be terminated.\n' % selectedShow['name'] + "Adding it to your list would be pointless.\n\n" + "Are you sure you still want to continue?", QMessageBox.Yes, QMessageBox.No) if yesno == QMessageBox().No: return # Add the show to our list self.myShows.append(selectedShow) # Sort the shows by names self.myShows = tools.sortShowsByName(self.myShows) # Need to save... self.saveRequired() ################################################# ## REMOVEME ################################################# #wct = TestConf( self.myShows ) #wct.start() ################################################# # Refresh list self.displayMyShows()
def addToMyShows(self, index): # Restore the cursor in case we're dropping an item and a messagebox appears QApplication.changeOverrideCursor( Qt.ArrowCursor ) selectedShow = self.dispSearchResults[index] # Make sure the requested show isn't already tracked # For that, check the id (which is unique) checkShow = [ item['id'] for item in self.myShows if item['id'] == selectedShow['id']] if selectedShow['id'] in checkShow: tools.msgDebug(u"""Show already in "My Shows". Can't add!""", __name__) QMessageBox().information(self, "Information", 'Cannot add "%s".\n' % selectedShow['name'] + 'This show is already tracked.', QMessageBox.Ok) return # Tell the user if the show is terminated if selectedShow['year_end'] != "????": yesno = QMessageBox().question(self, "Attention", '"%s" seem to be terminated.\n' % selectedShow['name'] + "Adding it to your list would be pointless.\n\n" + "Are you sure you still want to continue?", QMessageBox.Yes, QMessageBox.No) if yesno == QMessageBox().No: return # Add the show to our list self.myShows.append( selectedShow ) # Sort the shows by names self.myShows = tools.sortShowsByName( self.myShows ) # Need to save... self.saveRequired() ################################################# ## REMOVEME ################################################# #wct = TestConf( self.myShows ) #wct.start() ################################################# # Refresh list self.displayMyShows()
def getShows(self): pattern = re.compile(r'^show_\d+$') showOpts = [] for option in self.options("shows"): match = pattern.match(option) if match: showOpts.append(option) showList = [] for option in showOpts: show = JSON().decode(self.get("shows", option)) showList.append(show) # Sort the shows showList = tools.sortShowsByName(showList) return showList
def getShows(self): pattern = re.compile( r'^show_\d+$' ) showOpts = [] for option in self.options( "shows" ): match = pattern.match( option ) if match: showOpts.append( option ) showList = [] for option in showOpts: show = JSON().decode( self.get( "shows", option ) ) showList.append( show ) # Sort the shows showList = tools.sortShowsByName( showList ) return showList