- Fixed some regressions on menu scrolling
- Fixed selector bar positioning when using slide transition - Added more theme capabilities to video_player
This commit is contained in:
parent
dceec7074d
commit
536eeb2369
10
GlossMgr.py
10
GlossMgr.py
|
@ -154,6 +154,7 @@ class GlossMgr:
|
|||
|
||||
class MenuSelector(clutter.Texture):
|
||||
x_offset = -50
|
||||
position_0 = None
|
||||
|
||||
def __init__ (self, glossMgr):
|
||||
clutter.Texture.__init__ (self)
|
||||
|
@ -187,10 +188,15 @@ class MenuSelector(clutter.Texture):
|
|||
|
||||
#Now get the end position of the clone
|
||||
(x, y) = self.get_true_abs_position(selectee)
|
||||
#print (x, y)
|
||||
|
||||
#Do some minor adjustments for centering etc
|
||||
x = x + self.x_offset
|
||||
y = y - int( (self.get_height()-selectee.get_height())/2 )
|
||||
|
||||
#Yet another little hack, but this stores the position of the first element
|
||||
if self.position_0 is None:
|
||||
self.position_0 = (x, y)
|
||||
|
||||
#Move the bar
|
||||
self.move_to(x, y, timeline)
|
||||
|
@ -321,7 +327,7 @@ class message():
|
|||
|
||||
self.timeline = clutter.Timeline(10,30)
|
||||
alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
|
||||
self.behaviour_group = clutter.BehaviourOpacity(opacty_start=0, opacity_end=255, alpha=alpha)
|
||||
self.behaviour_group = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha)
|
||||
self.behaviour_backdrop = clutter.BehaviourOpacity(opacity_start=0, opacity_end=180, alpha=alpha)
|
||||
self.behaviour_group.apply(self.main_group)
|
||||
self.behaviour_backdrop.apply(self.backdrop)
|
||||
|
@ -332,7 +338,7 @@ class message():
|
|||
|
||||
self.timeline = clutter.Timeline(10,30)
|
||||
alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
|
||||
self.behaviour_group = clutter.BehaviourOpacity(opacty_start=255, opacity_end=0, alpha=alpha)
|
||||
self.behaviour_group = clutter.BehaviourOpacity(opacity_start=255, opacity_end=0, alpha=alpha)
|
||||
self.behaviour_backdrop = clutter.BehaviourOpacity(opacity_start=180, opacity_end=0, alpha=alpha)
|
||||
self.behaviour_group.apply(self.main_group)
|
||||
self.behaviour_backdrop.apply(self.backdrop)
|
||||
|
|
14
Menu.py
14
Menu.py
|
@ -3,6 +3,7 @@ import pygtk
|
|||
import gtk
|
||||
import pango
|
||||
import time
|
||||
import math
|
||||
from ReflectionTexture import Texture_Reflection
|
||||
from InputQueue import InputQueue
|
||||
|
||||
|
@ -245,15 +246,18 @@ class Menu(clutter.Group):
|
|||
|
||||
if incoming_y > bar_y:
|
||||
#Then the incoming item is below the selector bar
|
||||
height_diff = int(self.glossMgr.get_selector_bar().get_height() - self.glossMgr.get_selector_bar().get_height())
|
||||
print "height diff: " + str(height_diff)
|
||||
gap = (incoming_y - bar_y) * -1 #- (self.item_gap/2)) * -1
|
||||
height_diff = int(self.glossMgr.get_selector_bar().get_height() - incomingMenuItem.get_height()) #self.glossMgr.get_selector_bar().get_height())
|
||||
#print "height diff: " + str(height_diff)
|
||||
gap = ((incoming_y - bar_y) - math.floor(height_diff/2)) * -1
|
||||
gap = int(gap)
|
||||
#gap = -65
|
||||
self.displayMin = self.displayMin+1
|
||||
self.displayMax = self.displayMax+1
|
||||
else:
|
||||
#Then the incoming item is above the selector bar
|
||||
gap = bar_y - incoming_y# + (self.item_gap/2)
|
||||
height_diff = int(self.glossMgr.get_selector_bar().get_height() - incomingMenuItem.get_height()) #self.glossMgr.get_selector_bar().get_height())
|
||||
gap = bar_y - incoming_y + math.ceil(height_diff/2)
|
||||
gap = int(gap)
|
||||
#gap = 65
|
||||
self.displayMin = self.displayMin-1
|
||||
self.displayMax = self.displayMax-1
|
||||
|
@ -267,7 +271,7 @@ class Menu(clutter.Group):
|
|||
|
||||
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
||||
self.behaviour1 = clutter.BehaviourPath(alpha, knots)
|
||||
self.behaviour2 = clutter.BehaviourOpacity(alpha, outgoingMenuItem.get_opacity(), 0)
|
||||
self.behaviour2 = clutter.BehaviourOpacity(opacity_start=outgoingMenuItem.get_opacity(), opacity_end=0, alpha=alpha)
|
||||
|
||||
#print "Going to: "+ str(new_y)
|
||||
#print behaviour1.get_knots()
|
||||
|
|
|
@ -24,12 +24,16 @@ class Module():
|
|||
title = "Videos"
|
||||
STATE_FOLDERS, STATE_COVERS, STATE_VIDEO = range(3)
|
||||
|
||||
#The are just some default values to be used in case of an emergency
|
||||
coverViewerWidth = 750
|
||||
coverViewerHeight = 600
|
||||
coverViewerPosX = 300
|
||||
coverViewerPosY = 50
|
||||
coverViewerRows = 3
|
||||
coverViewerColumns = 4
|
||||
coverDetailsWidth = 750
|
||||
foldersPosX = 50
|
||||
foldersPosX = 50
|
||||
cover_size = int(coverViewerWidth / coverViewerColumns)
|
||||
|
||||
def __init__(self, glossMgr, dbMgr):
|
||||
|
@ -44,42 +48,62 @@ class Module():
|
|||
#Setup initial vars
|
||||
self.is_playing = False
|
||||
self.controlState = self.STATE_FOLDERS
|
||||
self.foldersPosX = (self.coverViewerPosX - self.cover_size) / 2
|
||||
self.foldersPosY = (self.stage.get_height() - self.coverViewerHeight) / 2
|
||||
|
||||
|
||||
#This block can be moved to begin() but causes a performance hit when loading the module *shrug*
|
||||
#base_cover_viewer = coverViewer(self.stage, self.coverViewerWidth, self.coverViewerHeight)
|
||||
#All it does is load the initial folders into the viewers
|
||||
self.baseDir = dbMgr.get_setting("VideoStartupDir")
|
||||
self.cwd = self.baseDir
|
||||
self.folder_level = 0
|
||||
base_folder_menu = folderMenu(self.stage, self.coverViewerRows, self.cover_size)
|
||||
base_folder_menu = folderMenu(self.stage, self.coverViewerRows, self.folders_cover_size)
|
||||
base_folder_menu.set_position(self.foldersPosX, self.foldersPosY)
|
||||
self.folderLibrary.append(base_folder_menu)
|
||||
self.load_base_folders(self.baseDir, base_folder_menu)
|
||||
|
||||
#Set the current viewer
|
||||
self.currentViewer = base_folder_menu.get_current_viewer()
|
||||
self.video_details = video_details(200)
|
||||
|
||||
#Create the details group
|
||||
self.video_details = video_details(self.coverDetailsWidth)
|
||||
self.video_details.set_position(self.coverDetailsPosX, self.coverDetailsPosY)
|
||||
|
||||
def setup_ui(self):
|
||||
self.menu_image = self.glossMgr.themeMgr.get_texture("video_menu_image", None, None)
|
||||
|
||||
#Add the background
|
||||
self.covers_background = self.glossMgr.themeMgr.get_texture("video_covers_background", self.stage, None)
|
||||
#backgroundImg = "ui/cover_bg_long.png"
|
||||
#pixbuf = gtk.gdk.pixbuf_new_from_file(self.backgroundImg)
|
||||
#self.bgImg = clutter.Texture()
|
||||
#self.bgImg.set_pixbuf(pixbuf)
|
||||
#bgImg_height = height - ((height - (self.cover_size * rows)) / 2) + self.detailBox_height
|
||||
#self.bgImg.set_size(width, bgImg_height)
|
||||
#self.bgImg.set_depth(1)
|
||||
#self.bgImg.show()
|
||||
#self.stage.add(self.bgImg)
|
||||
|
||||
#Set the number of rows / cols for the viewer (These come from the MythVideo settings in the backend DB)
|
||||
tmp_rows = self.dbMgr.get_setting("VideoGalleryRowsPerPage")
|
||||
tmp_cols = self.dbMgr.get_setting("VideoGalleryColsPerPage")
|
||||
if not tmp_rows is None: self.coverViewerRows = int(tmp_rows)
|
||||
if not tmp_cols is None: self.coverViewerColumns = int(tmp_cols)
|
||||
|
||||
#Set the size / position of the cover_viewer
|
||||
element = self.glossMgr.themeMgr.search_docs("video_cover_viewer", "main").childNodes
|
||||
(self.coverViewerWidth, self.coverViewerHeight) = self.glossMgr.themeMgr.get_dimensions(element, self.stage)
|
||||
(self.coverViewerPosX, self.coverViewerPosY) = self.glossMgr.themeMgr.get_position(element, self.stage)
|
||||
|
||||
#Set the all important cover size
|
||||
self.cover_size = int(self.coverViewerWidth / self.coverViewerColumns)
|
||||
|
||||
#set the size / position of the details group
|
||||
element = self.glossMgr.themeMgr.search_docs("video_cover_details", "main").childNodes
|
||||
(self.coverDetailsWidth, self.coverDetailsHeight) = self.glossMgr.themeMgr.get_dimensions(element, self.stage)
|
||||
(self.coverDetailsPosX, self.coverDetailsPosY) = self.glossMgr.themeMgr.get_position(element, self.stage)
|
||||
|
||||
#set the size / position of the folder menu
|
||||
element = self.glossMgr.themeMgr.search_docs("video_folder_menu", "main").childNodes
|
||||
(self.foldersWidth, self.foldersHeight) = self.glossMgr.themeMgr.get_dimensions(element, self.stage)
|
||||
(self.foldersPosX, self.foldersPosY) = self.glossMgr.themeMgr.get_position(element, self.stage)
|
||||
self.folders_cover_size = self.foldersWidth #int(self.foldersWidth / self.coverViewerColumns)
|
||||
|
||||
|
||||
def load_base_folders(self, dirPath, folder_menu):
|
||||
try:
|
||||
new_file_list = os.listdir(dirPath)
|
||||
except os.error, (errno, errstr):
|
||||
self.MenuMgr.display_msg("File Error", "Could not load Slideshow directory")
|
||||
self.glossMgr.display_msg("File Error", "Could not load Slideshow directory")
|
||||
return
|
||||
|
||||
#Images and Directories
|
||||
|
@ -194,7 +218,7 @@ class Module():
|
|||
#Find whether the current item is a folder or video
|
||||
item = self.currentViewer.get_current_item()
|
||||
if item.isFolder:
|
||||
self.MenuMgr.display_msg("Msg", "Its a folder")
|
||||
self.glossMgr.display_msg("Msg", "Its a folder")
|
||||
else:
|
||||
self.play_video()
|
||||
|
||||
|
|
|
@ -70,9 +70,14 @@ class mythDB():
|
|||
sql = "SELECT * FROM settings where value = '" + setting_name + "'"
|
||||
self.cursor.execute(sql)
|
||||
data = self.cursor.fetchall()
|
||||
return data[1][1]
|
||||
if not data == ():
|
||||
return data[1][1]
|
||||
else:
|
||||
return None
|
||||
|
||||
# get the resultset as a tuple
|
||||
return data[0][1]
|
||||
|
||||
|
||||
#Gets the backend server details, which, in theory, can be different from the SQL server details and/or default port
|
||||
def get_backend_server(self):
|
||||
|
|
Binary file not shown.
|
@ -7,6 +7,8 @@ class Transition:
|
|||
self.glossMgr = GlossMgr
|
||||
|
||||
def do_transition(self, fromMenu, toMenu):
|
||||
|
||||
|
||||
oldGroup = fromMenu.getItemGroup()
|
||||
oldMenuGroup = fromMenu #.getMenuGroup()
|
||||
newGroup = toMenu.getItemGroup()
|
||||
|
@ -65,15 +67,10 @@ class Transition:
|
|||
|
||||
|
||||
#Finally, move the selector bar
|
||||
self.glossMgr.selector_bar.selectItem(fromMenu.getItem(0), self.timeline)
|
||||
#(to_x, to_y) = toMenu.get_display_position() #fromMenu.getItem(0).get_abs_position()
|
||||
#self.selector_bar.move_to(int(to_x), int(to_y), self.timeline)
|
||||
(bar_x, bar_y) = self.glossMgr.selector_bar.position_0
|
||||
self.glossMgr.selector_bar.move_to(bar_x, bar_y, self.timeline)
|
||||
toMenu.selectFirst(False)
|
||||
|
||||
#self.timeline.connect('completed', self.on_transition_complete, fromMenu)
|
||||
self.timeline.start()
|
||||
|
||||
self.glossMgr.currentMenu = toMenu
|
||||
|
||||
def on_transition_complete(self, data):
|
||||
pass
|
||||
self.glossMgr.currentMenu = toMenu
|
|
@ -18,7 +18,7 @@
|
|||
</position>
|
||||
|
||||
<item_gap>0</item_gap>
|
||||
<num_visible_elements>6</num_visible_elements>
|
||||
<num_visible_elements>3</num_visible_elements>
|
||||
|
||||
<!-- The following properties all relate to the image / textures that accompany each menu item -->
|
||||
<menu_item_texture>
|
||||
|
|
|
@ -22,4 +22,38 @@
|
|||
<y>0</y>
|
||||
</position>
|
||||
</texture>
|
||||
|
||||
<video_cover_viewer id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>60%</width>
|
||||
<height>60%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>30%</x>
|
||||
<y>5%</y>
|
||||
</position>
|
||||
</video_cover_viewer>
|
||||
|
||||
<video_cover_details id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>60%</width>
|
||||
<height>20%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>30%</x>
|
||||
<y>70%</y>
|
||||
</position>
|
||||
</video_cover_details>
|
||||
|
||||
<video_folder_menu id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>20%</width>
|
||||
<height>60%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>5%</x>
|
||||
<y>5%</y>
|
||||
</position>
|
||||
</video_folder_menu>
|
||||
|
||||
</gloss-theme>
|
||||
|
|
|
@ -1,25 +1,59 @@
|
|||
<gloss-theme>
|
||||
<texture id="background">
|
||||
<image>background.png</image>
|
||||
<texture id="video_covers_background">
|
||||
<image>video_player/cover_bg_long.png</image>
|
||||
<dimensions type="relativeToStage">
|
||||
<width>100%</width>
|
||||
<height>100%</height>
|
||||
<width>80%</width>
|
||||
<height>80%</height>
|
||||
</dimensions>
|
||||
<position type="blah">
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<position type="relativeToStage">
|
||||
<x>15%</x>
|
||||
<y>15%</y>
|
||||
</position>
|
||||
</texture>
|
||||
|
||||
<texture id="video_menu_image">
|
||||
<image>video_player/videos.png</image>
|
||||
<dimensions type="relativeToStage">
|
||||
<width>30%</width>
|
||||
<height>30%</height>
|
||||
<dimensions type="relativeToSelf">
|
||||
<width>100%</width>
|
||||
<height>relative</height>
|
||||
</dimensions>
|
||||
<position type="relativeToParent">
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
</position>
|
||||
</texture>
|
||||
|
||||
<video_cover_viewer id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>60%</width>
|
||||
<height>60%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>30%</x>
|
||||
<y>5%</y>
|
||||
</position>
|
||||
</video_cover_viewer>
|
||||
|
||||
<video_cover_details id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>60%</width>
|
||||
<height>20%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>30%</x>
|
||||
<y>70%</y>
|
||||
</position>
|
||||
</video_cover_details>
|
||||
|
||||
<video_folder_menu id="main">
|
||||
<dimensions type="relativeToStage">
|
||||
<width>20%</width>
|
||||
<height>60%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>5%</x>
|
||||
<y>5%</y>
|
||||
</position>
|
||||
</video_folder_menu>
|
||||
|
||||
</gloss-theme>
|
||||
|
|
Loading…
Reference in New Issue