コード例 #1
0
 def onAction(self, action):
     buttonId = action.getButtonCode()
     actionId = action.getId()
     Log('onAction: {}'.format(action.getId()))
     if buttonId != 0:
         Log('onAction : {} keyboard call on {}'.format(actionId, buttonId))
     if actionId in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         focused = self.getFocusId()
         if focused in [self.KEYBOARD_KEYS, self.KEYBOARD_TOP_ROW]:
             self.QueryString(self.getControl(focused).getSelectedItem())
             self.DisplayQuery()
             self.DisplayQueryResults()
             self.DisplayPredictive()
         elif focused == self.QUERY_RESULTS_LIST:
             listitem = self.getControl(focused).getSelectedItem()
             if listitem.getProperty('media_type') == 'movie':
                 from . import window_item_movie
                 d = window_item_movie.WindowItemMovie(
                     self.dbconn, listitem)
                 d.doModal()
                 del d
             elif listitem.getProperty('media_type') == 'tv':
                 from . import window_item_tv
                 d = window_item_tv.WindowItemTv(self.dbconn, listitem)
                 d.doModal()
                 del d
         elif focused == self.PREDICT_QUERY_LIST:
             listitem = self.getControl(focused).getSelectedItem()
             self.ShowPredicResults(listitem)
コード例 #2
0
	def onInit(self):
		labelH = self.getControl(self.TEXT).getHeight()+10
		Log(labelH)
		listH  = len(self.listitems)*50
		Log(listH)
		totalH = labelH+listH
		top_pos = (720-totalH)/2
		self.getControl(self.DIALOG).setPosition(440,top_pos)
		self.getControl(self.BACKGROUND).setHeight(totalH)
		self.ctrllist = self.getControl(self.LIST)
		self.ctrllist.setPosition(5,labelH+5)
		self.ctrllist.addItems(self.listitems)
		self.setFocusId(self.LIST)
コード例 #3
0
 def onAction(self, action):
     actionId = action.getId()
     focusId = self.getFocusId()
     buttonId = action.getButtonCode()
     Log('onAction: {}'.format(actionId))
     if buttonId != 0:
         Log('onAction : {} keyboard call on {}'.format(actionId, buttonId))
     if actionId in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.LoadMenuSelect()
     elif actionId in [ACTION_UP]:
         if focusId == self.MAINWINDOW_1_LIST:
             if self.viewitem == 'home':
                 v = (self.homelistpos - 1)
                 if v >= 0:
                     self.LoadHomeMenu(v)
             elif self.viewitem == 'movie':
                 v = (self.movielistpos - 1)
                 if v >= 0:
                     self.LoadMovieMenu(v)
             elif self.viewitem == 'tv':
                 v = (self.tvlistpos - 1)
                 if v >= 0:
                     self.LoadTvMenu(v)
     elif actionId in [ACTION_DOWN]:
         if focusId == self.MAINWINDOW_1_LIST:
             if self.viewitem == 'home':
                 v = (self.homelistpos + 1)
                 if v <= (len(self.homeContent) - 1):
                     self.LoadHomeMenu(v)
             elif self.viewitem == 'movie':
                 v = (self.movielistpos + 1)
                 if v <= (len(self.movieCats) - 1):
                     self.LoadMovieMenu(v)
             elif self.viewitem == 'tv':
                 v = (self.tvlistpos + 1)
                 if v <= (len(self.tvCats) - 1):
                     self.LoadTvMenu(v)
     elif actionId in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         if focusId == self.MAINWINDOW_1_LIST:
             listitem = self.getControl(focusId).getSelectedItem()
             if listitem.getProperty('mediatype') == 'movie':
                 from . import window_item_movie
                 d = window_item_movie.WindowItemMovie(
                     self.dbconn, listitem)
                 d.doModal()
                 del d
             elif listitem.getProperty('mediatype') == 'tvshow':
                 from . import window_item_tv
                 d = window_item_tv.WindowItemTv(self.dbconn, listitem)
                 d.doModal()
                 del d
コード例 #4
0
 def ShowPredicResults(self, listitem):
     queryresultlist = self.getControl(self.QUERY_RESULTS_LIST)
     queryresultlist.reset()
     mediatype = listitem.getProperty('media_type')
     tmdbid = int(listitem.getUniqueID('tmdb'))
     Log(mediatype)
     for title, poster_path, tmdb_id, media_type, backdrop_path, overview, release_date, age_rating, vote_avg, votes, genres in self.allcontent:
         if tmdb_id == tmdbid and mediatype == media_type:
             queryresultlist.addItem(
                 self.ListItemBuilder(title, poster_path, backdrop_path,
                                      'tmdb', vote_avg, votes, tmdb_id,
                                      overview, genres,
                                      DateTimeStrf(release_date, '%Y'),
                                      media_type, age_rating))
     if mediatype == 'movie':
         results = self.tmDB.movie(tmdbid, 'Similar').get('results')
     elif mediatype == 'tvshow':
         results = self.tmDB.tv(tmdbid, 'Similar').get('results')
     else:
         results = []
     for title, poster_path, tmdb_id, media_type, backdrop_path, overview, release_date, age_rating, vote_avg, votes, genres in self.allcontent:
         for i in results:
             if tmdb_id == int(i.get('id')) and media_type == mediatype:
                 queryresultlist.addItem(
                     self.ListItemBuilder(title, poster_path, backdrop_path,
                                          'tmdb', vote_avg, votes, tmdb_id,
                                          overview, genres,
                                          DateTimeStrf(release_date, '%Y'),
                                          media_type, age_rating))
     self.setControlLabel(self.SEARCH_QUERY,
                          'Similar to {}'.format(listitem.getLabel()))
コード例 #5
0
 def onClick(self, controlId):
     Log('onClick: {}'.format(controlId))
     if controlId in [self.RATINGBUTTON_1, self.RATINGBUTTON_2]:
         self.SetRating(controlId)
     elif controlId == self.MYLISTBUTTON:
         self.SetMyListInfo()
     elif controlId == self.PLAYBUTTON:
         if self.getControlLabel(self.PLAYBUTTON) == 'Resume':
             self.PlayMedia(seek=True)
         else:
             self.PlayMedia()
     elif controlId == self.PLAYBEGBUTTON:
         self.PlayMedia()
     elif controlId == self.PLAYTRAILBUTTON:
         from . import window_trailer
         d = window_trailer.WindowTrailer(self.dbconn,
                                          self.listitem.getArt('fanart'),
                                          self.movieItem.trailers)
         d.doModal()
         del d
     elif controlId == self.MORELIKEBUTTON:
         from . import window_more
         d = window_more.WindowMore(self.dbconn, self.listitem,
                                    self.movieItem)
         d.doModal()
         del d
     elif controlId == self.CREDITSBUTTON:
         from . import window_credits
         d = window_credits.WindowCredits(self.dbconn,
                                          self.movieItem.credits_cast,
                                          self.movieItem.credits_crew,
                                          self.movieItem.videos,
                                          self.listitem.getUniqueID('tmdb'))
         d.doModal()
         del d
コード例 #6
0
 def onClick(self, controlId):
     Log('onClick: {}'.format(controlId))
     if controlId == self.EXITBUTTON:
         self.exit = True
     else:
         self.viewselected = controlId
     self.Close()
コード例 #7
0
 def onAction(self, action):
     Log('onAction: {}'.format(action.getId()))
     if action.getId() in [
             ACTION_NAV_BACK, ACTION_PREVIOUS_MENU, ACTION_RIGHT
     ]:
         self.backtolist = True
         self.Close()
コード例 #8
0
 def onFocus(self, controlId):
     Log('onFocus: {}'.format(controlId))
     if controlId in [
             self.SIDECTRLHOME, self.SIDECTRLSEARCH, self.SIDECTRLMOVIE,
             self.SIDECTRLTV, self.SIDECTRLSETTING, self.SIDECTRLMYLIST
     ]:
         self.LoadMenuSelect()
コード例 #9
0
 def onAction(self, action):
     Log('onAction: {}'.format(action.getId()))
     if action.getId() in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.Close()
     elif action.getId() in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         if self.getFocusId() == self.TRAILERLIST:
             self.PlayMedia(
                 self.getControl(self.TRAILERLIST).getSelectedItem())
コード例 #10
0
 def onAction(self, action):
     Log('onAction: {}'.format(action.getId()))
     if action.getId() in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.Close()
     elif action.getId() in [ACTION_DOWN]:
         if self.getFocusId() in [self.RATINGBUTTON_1, self.RATINGBUTTON_2]:
             self.RatingButtonCtrl()
             self.setFocusId(self.PLAYBUTTON)
コード例 #11
0
 def setControlFadeLabel(self, controlId, label):
     if not controlId:
         return
     control = self.getControl(controlId)
     if control:
         control.addLabel(label)
     else:
         Log('controlId {} not recognized'.format(controlId))
         return
コード例 #12
0
 def setControlProgress(self, controlId, percent):
     if not controlId:
         return
     control = self.getControl(controlId)
     if control:
         control.setPercent(percent)
     else:
         Log('controlId {} not recognized'.format(controlId))
         return
コード例 #13
0
 def setControlText(self, controlId, text):
     if not controlId:
         return
     control = self.getControl(controlId)
     if control:
         control.setText(text)
     else:
         Log('controlId {} not recognized'.format(controlId))
         return
コード例 #14
0
 def setControlVisible(self, controlId, visible):
     if not controlId:
         return
     control = self.getControl(controlId)
     if control:
         control.setVisible(visible)
     else:
         Log('controlId {} not recognized'.format(controlId))
         return
コード例 #15
0
	def onAction(self,action):
		actionId = action.getId()
		focusId =  self.getFocusId()
		Log('onAction: {}'.format(actionId))
		if actionId in [ACTION_NAV_BACK,ACTION_PREVIOUS_MENU]:
			self.Close()
		elif actionId in [ACTION_SELECT_ITEM,ACTION_MOUSE_LEFT_CLICK]:
			if focusId == self.SETTINGSLIST:
				self.OpenSettings(self.getControl(focusId).getSelectedItem())
			elif focusId == self.TOOLSLIST:
				eval(self.getControl(focusId).getSelectedItem().getProperty('func'))
コード例 #16
0
 def onAction(self, action):
     Log('onAction: {}'.format(action.getId()))
     if action.getId() in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.Close()
     elif action.getId() in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         if self.getFocusId() == self.VIDEOPANEL:
             from . import dialog_player
             d = dialog_player.DialogPlayer(
                 self.getControl(self.VIDEOPANEL).getSelectedItem())
             d.doModal()
             del d
コード例 #17
0
 def onAction(self, action):
     actionId = action.getId()
     focusId = self.getFocusId()
     Log('onAction: {}'.format(action.getId()))
     if actionId in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.Close()
     elif actionId in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         if focusId == self.SEASONLIST:
             listitem = self.getControl(focusId).getSelectedItem()
             self.SetFocusEpisodeList_Season(listitem)
         elif focusId == self.EPISODELIST:
             listitem = self.getControl(focusId).getSelectedItem()
             self.PlayMedia(listitem)
コード例 #18
0
 def onClick(self, controlId):
     Log('onClick: {}'.format(controlId))
     if controlId in [self.RATINGBUTTON_1, self.RATINGBUTTON_2]:
         self.SetRating(controlId)
     elif controlId == self.MYLISTBUTTON:
         self.SetMyListInfo()
     elif controlId == self.PLAYBUTTON:
         if self.getControlLabel(self.PLAYBUTTON).startswith('Resume'):
             self.PlayMedia(True)
         else:
             self.PlayMedia()
     elif controlId == self.PLAYBEGBUTTON:
         self.PlayMedia()
     elif controlId == self.PLAYTRAILBUTTON:
         from . import window_trailer
         d = window_trailer.WindowTrailer(self.dbconn,
                                          self.listitem.getArt('fanart'),
                                          self.tvItem.trailers)
         d.doModal()
         del d
     elif controlId == self.MORELIKEBUTTON:
         from . import window_more
         d = window_more.WindowMore(self.dbconn, self.listitem, self.tvItem)
         d.doModal()
         del d
     elif controlId == self.CREDITSBUTTON:
         from . import window_credits
         d = window_credits.WindowCredits(self.dbconn,
                                          self.tvItem.credits_cast,
                                          self.tvItem.credits_crew,
                                          self.tvItem.videos,
                                          self.listitem.getUniqueID('tmdb'))
         d.doModal()
         del d
     elif controlId == self.EPISODEBUTTON:
         from . import window_tv_episodes
         d = window_tv_episodes.WindowTvEpisodes(self.dbconn, self.listitem,
                                                 self.ratingicon,
                                                 self.total_seasons_label,
                                                 self.mySeasonprogress)
         d.doModal()
         del d
コード例 #19
0
 def onAction(self, action):
     actionId = action.getId()
     focusId = self.getFocusId()
     Log('onAction: {}'.format(action.getId()))
     if actionId in [ACTION_NAV_BACK, ACTION_PREVIOUS_MENU]:
         self.Close()
     elif actionId in [ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK]:
         if focusId == self.MAINLIST:
             listitem = self.getControl(focusId).getSelectedItem()
             if self.mediatype == 'movie':
                 from . import window_item_movie
                 d = window_item_movie.WindowItemMovie(
                     self.dbconn, listitem)
                 d.doModal()
                 del d
             elif self.mediatype == 'tv':
                 from . import window_item_tv
                 d = window_item_tv.WindowItemTv(self.dbconn, listitem)
                 d.doModal()
                 del d
コード例 #20
0
 def onFocus(self, controlId):
     Log('onFocus: {}'.format(controlId))
     if controlId == self.RATINGBUTTON:
         self.RatingButtonCtrl()
コード例 #21
0
 def onClick(self, controlId):
     Log('onClick: {}'.format(controlId))
     if controlId in self.BUTTONS:
         self.buttonResponse = self.getControlLabel(controlId)
         self.buttonIndex = self.BUTTONS.index(controlId)
         self.Close()
コード例 #22
0
	def onAction(self,action):
		Log('onAction: {}'.format(action.getId()))
		if action.getId() in [ACTION_NAV_BACK,ACTION_PREVIOUS_MENU]:
			self.Close()
コード例 #23
0
	def onClick(self,controlId):
		Log('onClick:{}'.format(controlId))
		if controlId == self.LIST:
			self.listItem = self.ctrllist.getSelectedItem()
			self.listIndex = self.ctrllist.getSelectedPosition()
			self.Close()
コード例 #24
0
 def onClick(self, controlId):
     Log('onClick: {}'.format(controlId))
     '''
コード例 #25
0
 def Close(self):
     self.dbconn.Close()
     # super(WindowHome,self).close()
     Log('closing window')
     xbmc.executebuiltin('ActivateWindow(home)')