def gui_anime(self, event): # wxGlade: oadb.<event_handler> print "Starting anime search..." aname = self.aname_box.GetValue() try: aid = int(self.aid_box.GetValue()) except ValueError: aid = 0 self.anime_results.Clear() wx.BeginBusyCursor() results = db.findaid(aid, aname) wx.EndBusyCursor() if results != None: # Hit! # Formatting... for k,v in results.iteritems(): results[k] = unicode(str(v)) self.aname_box.Clear() self.aid_box.Clear() self.anime_results.AppendText("Name: " + results['aname'] + "\n") self.anime_results.AppendText("Kanji: " + results['akanji'] + "\n") self.anime_results.AppendText("Anime ID: " + results['aid'] + "\n") self.anime_results.AppendText("AniDB link: http://anidb.info/a" + results['aid'] + "\n") self.anime_results.AppendText("Year: " + results['year'] + " (" + results['type'] + ")\n") self.anime_results.AppendText("(Other languages: " + results['aother'] + ")\n") self.anime_results.AppendText("Episodes: " + results['eps'] + " (" + results['epcount'] + " normal, " + results['spcount'] + " special)\n") self.anime_results.AppendText("Rating: " + results['arating'] + " (" + results['avotes'] + " votes)\n") self.anime_results.AppendText("(Temporary rating: " + results['tmprating'] + " (" + results['tmpvotes'] + " votes))\n") else: self.anime_results.AppendText("No results, sorry.") self.derror("No results found.")
def gui_anime(self, event): # wxGlade: oadb.<event_handler> print "Starting anime search..." aname = self.aname_box.GetValue() try: aid = int(self.aid_box.GetValue()) except ValueError: aid = 0 self.anime_results.Clear() wx.BeginBusyCursor() results = db.findaid(aid, aname) wx.EndBusyCursor() if results != None: # Hit! # Formatting... for k, v in results.iteritems(): results[k] = unicode(str(v)) self.aname_box.Clear() self.aid_box.Clear() self.anime_results.AppendText("Name: " + results["aname"] + "\n") self.anime_results.AppendText("Kanji: " + results["akanji"] + "\n") self.anime_results.AppendText("Anime ID: " + results["aid"] + "\n") self.anime_results.AppendText("AniDB link: http://anidb.info/a" + results["aid"] + "\n") self.anime_results.AppendText("Year: " + results["year"] + " (" + results["type"] + ")\n") self.anime_results.AppendText("(Other languages: " + results["aother"] + ")\n") self.anime_results.AppendText( "Episodes: " + results["eps"] + " (" + results["epcount"] + " normal, " + results["spcount"] + " special)\n" ) self.anime_results.AppendText("Rating: " + results["arating"] + " (" + results["avotes"] + " votes)\n") self.anime_results.AppendText( "(Temporary rating: " + results["tmprating"] + " (" + results["tmpvotes"] + " votes))\n" ) else: self.anime_results.AppendText("No results, sorry.") self.derror("No results found.")
def gui_tree_rc(self, event): popup = wx.Menu() treeitem = event.GetItem() treedata = self.tree.GetItemPyData(treeitem) if treedata[0] == "a": # Right-click on anime idd = wx.NewId() popup.Append(idd, "Remove anime " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmaid(treedata[1]), id=idd) idd = wx.NewId() popup.Append(idd, "Refresh anime " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmaid(treedata[1]) and db.findaid(treedata[1]), id=idd) elif treedata[0] == "ue": # Right-click on unidentified episode idd = wx.NewId() popup.Append(idd, "Lookup episode") self.Bind(wx.EVT_MENU, lambda evt: db.findeid(aid=treedata[1]), id=idd) elif treedata[0] == "e": # Right-click on known episode idd = wx.NewId() popup.Append(idd, "Remove episode " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmeid(treedata[1]), id=idd) idd = wx.NewId() popup.Append(idd, "Refresh episode " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmeid(treedata[1]) and db.findeid(treedata[1]), id=idd) elif treedata[0] == "f": # Right-click on file idd = wx.NewId() popup.Append(idd, "Remove file " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmfid(treedata[1]), id=idd) idd = wx.NewId() popup.Append(idd, "Refresh file " + str(treedata[1])) self.Bind(wx.EVT_MENU, lambda evt: db.rmfid(treedata[1]) and db.findfid(treedata[1]), id=idd) idd = wx.NewId() popup.Append(idd, "Refresh") self.Bind(wx.EVT_MENU, self.gui_refresh, id=idd) self.PopupMenu(popup) event.Skip()