Finally fixed the mythtv / Gstreamer issue and playback from Myth is now smooth :) :) :)
Further updates to menu theme code Found regression in roll_menu - still unfixed
This commit is contained in:
parent
718e142557
commit
591b9c201e
35
GlossMgr.py
35
GlossMgr.py
|
@ -50,9 +50,9 @@ class GlossMgr:
|
||||||
|
|
||||||
def transition_fade_zoom(self, fromMenu, toMenu):
|
def transition_fade_zoom(self, fromMenu, toMenu):
|
||||||
oldGroup = fromMenu.getItemGroup()
|
oldGroup = fromMenu.getItemGroup()
|
||||||
oldMenuGroup = fromMenu.getMenuGroup()
|
oldMenuGroup = fromMenu #.getMenuGroup()
|
||||||
newGroup = toMenu.getItemGroup()
|
newGroup = toMenu.getItemGroup()
|
||||||
newMenuGroup = toMenu.getMenuGroup()
|
newMenuGroup = toMenu #.getMenuGroup()
|
||||||
|
|
||||||
oldGroup.set_opacity(255)
|
oldGroup.set_opacity(255)
|
||||||
|
|
||||||
|
@ -179,23 +179,16 @@ class GlossMgr:
|
||||||
|
|
||||||
class MenuSelector(clutter.Texture):
|
class MenuSelector(clutter.Texture):
|
||||||
x_offset = -50
|
x_offset = -50
|
||||||
width = 400
|
|
||||||
|
|
||||||
def __init__ (self, menuMgr):
|
def __init__ (self, glossMgr):
|
||||||
clutter.Texture.__init__ (self)
|
clutter.Texture.__init__ (self)
|
||||||
self.menuMgr = menuMgr
|
self.glossMgr = glossMgr
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file("ui/active_bar.png")
|
glossMgr.themeMgr.get_texture("selector_bar", glossMgr.stage, self)
|
||||||
self.set_pixbuf(pixbuf)
|
self.set_position(0, self.get_y())
|
||||||
self.set_width(self.width)
|
self.x_offset = int(glossMgr.themeMgr.get_value("texture", "selector_bar", "position.x"))
|
||||||
|
|
||||||
#pixbuf = gtk.gdk.pixbuf_new_from_file("ui/spinner1.gif")
|
|
||||||
#self.spinner = clutter.Texture()
|
|
||||||
#self.spinner.set_pixbuf(pixbuf)
|
|
||||||
#self.spinner.hide()
|
|
||||||
|
|
||||||
|
|
||||||
def selectItem(self, selectee, timeline):
|
|
||||||
|
|
||||||
|
#This is a utility function that gets the coordinates of an that has been scaled
|
||||||
|
def get_true_abs_position(self, selectee):
|
||||||
#This whole clone label thing is a HORRIBLE hack but is there to compensate for the movement caused by scaling using GRAVITY_WEST
|
#This whole clone label thing is a HORRIBLE hack but is there to compensate for the movement caused by scaling using GRAVITY_WEST
|
||||||
#Essentially a clone of the selectee is made and scaled to its final position to retrieve the final abs_position coords
|
#Essentially a clone of the selectee is made and scaled to its final position to retrieve the final abs_position coords
|
||||||
cloneLabel = clutter.Label()
|
cloneLabel = clutter.Label()
|
||||||
|
@ -204,14 +197,20 @@ class MenuSelector(clutter.Texture):
|
||||||
(scale_x, scale_y) = selectee.get_scale()
|
(scale_x, scale_y) = selectee.get_scale()
|
||||||
cloneLabel.set_scale_with_gravity(scale_x, scale_y, clutter.GRAVITY_WEST)
|
cloneLabel.set_scale_with_gravity(scale_x, scale_y, clutter.GRAVITY_WEST)
|
||||||
selectee.get_parent().add(cloneLabel)
|
selectee.get_parent().add(cloneLabel)
|
||||||
|
|
||||||
cloneLabel.set_position(selectee.get_x(), selectee.get_y())
|
cloneLabel.set_position(selectee.get_x(), selectee.get_y())
|
||||||
|
|
||||||
#Now that all the cloning is done, find out what the scale is to become and set it on the clone
|
#Now that all the cloning is done, find out what the scale is to become and set it on the clone
|
||||||
scale = selectee.currentZoom
|
scale = selectee.currentZoom
|
||||||
cloneLabel.set_scale_with_gravity(scale, scale, clutter.GRAVITY_WEST)
|
cloneLabel.set_scale_with_gravity(scale, scale, clutter.GRAVITY_WEST)
|
||||||
|
|
||||||
|
return cloneLabel.get_abs_position()
|
||||||
|
|
||||||
|
def selectItem(self, selectee, timeline):
|
||||||
|
|
||||||
|
|
||||||
#Now get the end position of the clone
|
#Now get the end position of the clone
|
||||||
(x, y) = cloneLabel.get_abs_position()
|
(x, y) = self.get_true_abs_position(selectee)
|
||||||
|
|
||||||
#Do some minor adjustments for centering etc
|
#Do some minor adjustments for centering etc
|
||||||
x = x + self.x_offset
|
x = x + self.x_offset
|
||||||
|
@ -274,8 +273,6 @@ class MenuSelector(clutter.Texture):
|
||||||
|
|
||||||
def get_x_offset(self):
|
def get_x_offset(self):
|
||||||
return self.x_offset
|
return self.x_offset
|
||||||
def get_width(self):
|
|
||||||
return self.width
|
|
||||||
|
|
||||||
class message():
|
class message():
|
||||||
font = "Lucida Grande "
|
font = "Lucida Grande "
|
||||||
|
|
55
Menu.py
55
Menu.py
|
@ -6,7 +6,6 @@ import time
|
||||||
from ReflectionTexture import Texture_Reflection
|
from ReflectionTexture import Texture_Reflection
|
||||||
|
|
||||||
class Menu(clutter.Group):
|
class Menu(clutter.Group):
|
||||||
item_gap = 10 #Distance between items
|
|
||||||
font = ""
|
font = ""
|
||||||
zoomLevel = 0.5
|
zoomLevel = 0.5
|
||||||
opacityStep = 120
|
opacityStep = 120
|
||||||
|
@ -15,6 +14,7 @@ class Menu(clutter.Group):
|
||||||
clutter.Group.__init__(self)
|
clutter.Group.__init__(self)
|
||||||
self.glossMgr = glossMgr
|
self.glossMgr = glossMgr
|
||||||
self.stage = self.glossMgr.get_stage()
|
self.stage = self.glossMgr.get_stage()
|
||||||
|
self.itemGroup = clutter.Group()
|
||||||
self.glossMgr.themeMgr.setup_menu("main", self)
|
self.glossMgr.themeMgr.setup_menu("main", self)
|
||||||
|
|
||||||
self.menuItems = []
|
self.menuItems = []
|
||||||
|
@ -23,33 +23,35 @@ class Menu(clutter.Group):
|
||||||
self.moveQueue = 0
|
self.moveQueue = 0
|
||||||
self.displaySize = self.displayMax - self.displayMin
|
self.displaySize = self.displayMax - self.displayMin
|
||||||
self.displayPosition = (0, 0)
|
self.displayPosition = (0, 0)
|
||||||
self.itemGroup = clutter.Group()
|
|
||||||
#self.menuGroup = clutter.Group()
|
|
||||||
self.stage.add(self.itemGroup)
|
self.stage.add(self.itemGroup)
|
||||||
#self.stage.add(self.menuGroup)
|
|
||||||
#self.hasTimeline = False
|
|
||||||
self.timeline = clutter.Timeline(15, 75) #This timeline is used on any movements that occur when changing items
|
self.timeline = clutter.Timeline(15, 75) #This timeline is used on any movements that occur when changing items
|
||||||
self.timeline_completed=True
|
self.timeline_completed=True
|
||||||
self.glossMgr.addMenu(self)
|
self.glossMgr.addMenu(self)
|
||||||
#self.itemGroup.hide_all()
|
|
||||||
self.stage.add(self)
|
self.stage.add(self)
|
||||||
|
|
||||||
def addItem(self, itemLabel, imagePath):
|
def addItem(self, itemLabel, imagePath):
|
||||||
if len(self.menuItems) == 0:
|
if len(self.menuItems) == 0:
|
||||||
label_height = 0
|
tempLabel = clutter.Label()
|
||||||
|
tempLabel.set_font_name(self.font)
|
||||||
|
tempLabel.set_text("S")
|
||||||
|
#tempLabel.set_scale_with_gravity(self.zoomStep0, self.zoomStep0, clutter.GRAVITY_WEST)
|
||||||
|
self.label_height = tempLabel.get_height()
|
||||||
|
#self.label_height = self.label_height * self.zoomStep1
|
||||||
label_width = 0
|
label_width = 0
|
||||||
else:
|
#else:
|
||||||
(label_width, label_height) = self.menuItems[0].get_size()
|
# (label_width, label_height) = self.menuItems[0].get_size()
|
||||||
|
|
||||||
label_y = label_height * len(self.menuItems)+self.item_gap
|
label_y = len(self.menuItems) * (self.label_height + self.item_gap)
|
||||||
|
print "Label height: " + str(self.label_height)
|
||||||
|
|
||||||
newItem = ListItem(self, itemLabel, label_y, imagePath)
|
newItem = ListItem(self, itemLabel, label_y, imagePath)
|
||||||
self.menuItems.append(newItem)
|
self.menuItems.append(newItem)
|
||||||
self.itemGroup.add(newItem)
|
self.itemGroup.add(newItem)
|
||||||
|
|
||||||
group_x = self.itemGroup.get_x()
|
#group_x = self.itemGroup.get_x()
|
||||||
group_y = self.itemGroup.get_y() - (label_height)
|
#group_y = self.itemGroup.get_y() - (self.label_height)
|
||||||
self.itemGroup.set_position(group_x, group_y)
|
#self.itemGroup.set_position(group_x, group_y)
|
||||||
|
|
||||||
return newItem
|
return newItem
|
||||||
|
|
||||||
|
@ -71,17 +73,17 @@ class Menu(clutter.Group):
|
||||||
return self.glossMgr
|
return self.glossMgr
|
||||||
|
|
||||||
def setMenuPositionByName(self, location):
|
def setMenuPositionByName(self, location):
|
||||||
|
return None
|
||||||
if location == "center":
|
if location == "center":
|
||||||
menu_y = (self.stage.get_height()-self.itemGroup.get_height())/2
|
menu_y = (self.stage.get_height()-self.itemGroup.get_height())/2
|
||||||
menu_x = (self.stage.get_width()-self.itemGroup.get_width())/2
|
menu_x = (self.stage.get_width()-self.itemGroup.get_width())/2
|
||||||
self.itemGroup.set_position(menu_x, menu_y)
|
self.itemGroup.set_position(menu_x, menu_y)
|
||||||
self.displayPosition = (menu_x, menu_y)
|
|
||||||
#print "Original Group size: " + str(self.itemGroup.get_width())
|
#print "Original Group size: " + str(self.itemGroup.get_width())
|
||||||
#print "Starting at : " + str(menu_x) + ":" + str(menu_y)
|
#print "Starting at : " + str(menu_x) + ":" + str(menu_y)
|
||||||
|
|
||||||
#The display position is the x, y coords of where the menu is when it is active
|
#The display position is the x, y coords of where the menu is when it is active
|
||||||
def get_display_position(self):
|
def get_display_position(self):
|
||||||
return self.displayPosition
|
return (self.itemGroup.get_x(), self.itemGroup.get_y())
|
||||||
|
|
||||||
def setMenuPosition(self, x, y):
|
def setMenuPosition(self, x, y):
|
||||||
self.itemGroup.set_position(x,y)
|
self.itemGroup.set_position(x,y)
|
||||||
|
@ -89,9 +91,6 @@ class Menu(clutter.Group):
|
||||||
def getItemGroup(self):
|
def getItemGroup(self):
|
||||||
return self.itemGroup
|
return self.itemGroup
|
||||||
|
|
||||||
def getMenuGroup(self):
|
|
||||||
return self.menuGroup
|
|
||||||
|
|
||||||
def setListFont(self, newFont):
|
def setListFont(self, newFont):
|
||||||
currentY= 0 #self.itemGroup.get_y()
|
currentY= 0 #self.itemGroup.get_y()
|
||||||
self.font = newFont
|
self.font = newFont
|
||||||
|
@ -228,26 +227,28 @@ class Menu(clutter.Group):
|
||||||
def rollMenu(self, incomingMenuItem, outgoingMenuItem, timeline):
|
def rollMenu(self, incomingMenuItem, outgoingMenuItem, timeline):
|
||||||
(group_x, group_y) = self.itemGroup.get_abs_position()
|
(group_x, group_y) = self.itemGroup.get_abs_position()
|
||||||
(bar_x, bar_y) = self.glossMgr.get_selector_bar().get_abs_position() # incomingMenuItem.get_menu().getMenuMgr().
|
(bar_x, bar_y) = self.glossMgr.get_selector_bar().get_abs_position() # incomingMenuItem.get_menu().getMenuMgr().
|
||||||
(incoming_x, incoming_y) = incomingMenuItem.get_abs_position()
|
(incoming_x, incoming_y) = self.glossMgr.get_selector_bar().get_true_abs_position(incomingMenuItem) #incomingMenuItem.get_abs_position()
|
||||||
|
|
||||||
#print self.itemGroup.get_abs_position()
|
#print self.itemGroup.get_abs_position()
|
||||||
#print "Starting group position: " + self.itemGroup.get_abs_position()
|
#print "Starting group position: " + self.itemGroup.get_abs_position()
|
||||||
|
|
||||||
if incoming_y > bar_y:
|
if incoming_y > bar_y:
|
||||||
#Then the incoming item is below the selector bar
|
#Then the incoming item is below the selector bar
|
||||||
gap = (incoming_y - bar_y - (self.item_gap/2)) * -1
|
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
|
||||||
#gap = -65
|
#gap = -65
|
||||||
self.displayMin = self.displayMin+1
|
self.displayMin = self.displayMin+1
|
||||||
self.displayMax = self.displayMax+1
|
self.displayMax = self.displayMax+1
|
||||||
else:
|
else:
|
||||||
#Then the incoming item is above the selector bar
|
#Then the incoming item is above the selector bar
|
||||||
gap = bar_y - incoming_y + (self.item_gap/2)
|
gap = bar_y - incoming_y# + (self.item_gap/2)
|
||||||
#gap = 65
|
#gap = 65
|
||||||
self.displayMin = self.displayMin-1
|
self.displayMin = self.displayMin-1
|
||||||
self.displayMax = self.displayMax-1
|
self.displayMax = self.displayMax-1
|
||||||
|
|
||||||
#print "Gap: " + str(gap)
|
#print "Gap: " + str(gap)
|
||||||
new_y = (group_y+gap)
|
new_y = (group_y + gap)
|
||||||
knots = (\
|
knots = (\
|
||||||
(group_x, group_y),\
|
(group_x, group_y),\
|
||||||
(group_x, new_y )\
|
(group_x, new_y )\
|
||||||
|
@ -320,21 +321,21 @@ class ListItem (clutter.Label):
|
||||||
self.onStage = True
|
self.onStage = True
|
||||||
#self.itemTexturesGroup.show_all()
|
#self.itemTexturesGroup.show_all()
|
||||||
if level==1:
|
if level==1:
|
||||||
zoomTo = self.zoomLevel * self.menu.zoomStep1
|
zoomTo = self.menu.zoomStep1
|
||||||
opacityTo = self.menu.opacityStep1
|
opacityTo = self.menu.opacityStep1
|
||||||
if self.onStage:
|
if self.onStage:
|
||||||
self.menu.remove(self.itemTexturesGroup)
|
self.menu.remove(self.itemTexturesGroup)
|
||||||
self.onStage = False
|
self.onStage = False
|
||||||
#self.itemTexturesGroup.hide_all()
|
#self.itemTexturesGroup.hide_all()
|
||||||
if level==2:
|
if level==2:
|
||||||
zoomTo = self.zoomLevel * self.menu.zoomStep2
|
zoomTo = self.menu.zoomStep2
|
||||||
opacityTo = self.menu.opacityStep2
|
opacityTo = self.menu.opacityStep2
|
||||||
if self.onStage:
|
if self.onStage:
|
||||||
self.menu.remove(self.itemTexturesGroup)
|
self.menu.remove(self.itemTexturesGroup)
|
||||||
self.onStage = False
|
self.onStage = False
|
||||||
#self.itemTexturesGroup.hide_all()
|
#self.itemTexturesGroup.hide_all()
|
||||||
|
|
||||||
if zoomTo == self.currentZoom:
|
if (zoomTo == self.currentZoom) and (opacityTo == self.currentOpacity):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
||||||
|
@ -343,9 +344,13 @@ class ListItem (clutter.Label):
|
||||||
self.behaviour1.apply(self)
|
self.behaviour1.apply(self)
|
||||||
self.behaviour2.apply(self)
|
self.behaviour2.apply(self)
|
||||||
|
|
||||||
|
#timeline.connect('completed', self.scale_end_event, zoomTo, opacityTo)
|
||||||
self.currentZoom = zoomTo
|
self.currentZoom = zoomTo
|
||||||
self.currentOpacity = opacityTo
|
self.currentOpacity = opacityTo
|
||||||
|
|
||||||
|
def scale_end_event(self, data, zoomTo, opacityTo):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_zoom_level(self):
|
def get_zoom_level(self):
|
||||||
return self.zoomLevel
|
return self.zoomLevel
|
||||||
|
|
||||||
|
|
|
@ -52,24 +52,24 @@ class VideoController:
|
||||||
#Now we can start the video
|
#Now we can start the video
|
||||||
self.video_texture.set_playing(True)
|
self.video_texture.set_playing(True)
|
||||||
#self.bin.set_state(gst.STATE_PAUSED)
|
#self.bin.set_state(gst.STATE_PAUSED)
|
||||||
#self.bin.set_state(gst.STATE_PLAYING)
|
self.bin.set_state(gst.STATE_PLAYING)
|
||||||
self.isPlaying = True
|
self.isPlaying = True
|
||||||
|
|
||||||
decodebin = self.bin.get_by_name("decodebin0")
|
#decodebin = self.bin.get_by_name("decodebin0")
|
||||||
#for element in decodebin.elements():
|
#for element in decodebin.elements():
|
||||||
# print "GST Element 1: " + str(element.get_name())
|
# print "GST Element 1: " + str(element.get_name())
|
||||||
#queue = decodebin.get_by_name("queue0")
|
#queue = decodebin.get_by_name("queue0")
|
||||||
#print queue.get_name()
|
#print queue.get_name()
|
||||||
#ypefind = decodebin.get_by_name("typefind")
|
#ypefind = decodebin.get_by_name("typefind")
|
||||||
|
|
||||||
decodebin.connect("pad-added", self.on_pad_added)
|
#decodebin.connect("pad-added", self.on_pad_added)
|
||||||
#vid = demuxer.get_by_name("video_00")
|
#vid = demuxer.get_by_name("video_00")
|
||||||
self.queue1 = gst.element_factory_make("queue", "queue1")
|
#self.queue1 = gst.element_factory_make("queue", "queue1")
|
||||||
self.queue1.set_property("max-size-time", 50000)
|
#self.queue1.set_property("max-size-time", 50000)
|
||||||
self.queue1.set_property("max-size-buffers", 0)
|
#self.queue1.set_property("max-size-buffers", 0)
|
||||||
|
|
||||||
#self.queue2 = gst.element_factory_make("queue", "queue2")
|
#self.queue2 = gst.element_factory_make("queue", "queue2")
|
||||||
self.bin.add(self.queue1)
|
#self.bin.add(self.queue1)
|
||||||
#self.bin.add(self.queue2)
|
#self.bin.add(self.queue2)
|
||||||
#decodebin.link(self.queue1)
|
#decodebin.link(self.queue1)
|
||||||
#self.queue1.link(decodebin)
|
#self.queue1.link(decodebin)
|
||||||
|
|
|
@ -174,22 +174,9 @@ class MythBackendConnection(threading.Thread):
|
||||||
max_request_size = 270000
|
max_request_size = 270000
|
||||||
request_size_step = 16384
|
request_size_step = 16384
|
||||||
|
|
||||||
#Need to create a bit of a buffer so playback will begin
|
#Data is sent through a pipe to GStreamer
|
||||||
"""
|
(pipe_rfd, pipe_wfd) = os.pipe()
|
||||||
x=0
|
self.videoPlayer.begin_playback(pipe_rfd)
|
||||||
while x<80:
|
|
||||||
transfer_cmd = "QUERY_FILETRANSFER "+ str(socket_id) + "[]:[]REQUEST_BLOCK[]:[]"+str(request_size)
|
|
||||||
self.send_cmd(cmd_sock, transfer_cmd)
|
|
||||||
num_bytes = int(self.receive_reply(cmd_sock))
|
|
||||||
data = data_sock.recv(num_bytes)
|
|
||||||
self.buffer_file.write(data)
|
|
||||||
x=x+1
|
|
||||||
self.buffer_file.flush()
|
|
||||||
"""
|
|
||||||
|
|
||||||
#self.videoPlayer.begin_playback(buffer_file_name)
|
|
||||||
reader_fd = os.dup(data_sock.fileno())
|
|
||||||
self.videoPlayer.begin_playback(reader_fd)
|
|
||||||
|
|
||||||
print "BEGINNING PLAYBACK!"
|
print "BEGINNING PLAYBACK!"
|
||||||
self.Playing = True
|
self.Playing = True
|
||||||
|
@ -197,12 +184,11 @@ class MythBackendConnection(threading.Thread):
|
||||||
transfer_cmd = "QUERY_FILETRANSFER "+ str(socket_id) + "[]:[]REQUEST_BLOCK[]:[]"+str(request_size)
|
transfer_cmd = "QUERY_FILETRANSFER "+ str(socket_id) + "[]:[]REQUEST_BLOCK[]:[]"+str(request_size)
|
||||||
self.send_cmd(cmd_sock, transfer_cmd)
|
self.send_cmd(cmd_sock, transfer_cmd)
|
||||||
num_bytes = int(self.receive_reply(cmd_sock))
|
num_bytes = int(self.receive_reply(cmd_sock))
|
||||||
data_sock.recv(num_bytes)
|
data = data_sock.recv(num_bytes)
|
||||||
#self.buffer_file.write(data)
|
os.write(pipe_wfd, data)
|
||||||
#self.buffer_file.flush()
|
|
||||||
|
|
||||||
#This tries to optimise the request size
|
#This tries to optimise the request size
|
||||||
#print "Received: " + str(num_bytes)
|
|
||||||
if (num_bytes == request_size) and (request_size < max_request_size):
|
if (num_bytes == request_size) and (request_size < max_request_size):
|
||||||
request_size = request_size + request_size_step
|
request_size = request_size + request_size_step
|
||||||
if request_size > max_request_size:
|
if request_size > max_request_size:
|
||||||
|
@ -212,7 +198,8 @@ class MythBackendConnection(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
print "Ending playback"
|
print "Ending playback"
|
||||||
#self.buffer_file.close()
|
os.close(pipe_wfd)
|
||||||
|
os.close(pipe_rfd)
|
||||||
|
|
||||||
def message_socket_mgr(self, msg_socket):
|
def message_socket_mgr(self, msg_socket):
|
||||||
#Do the protocol version check
|
#Do the protocol version check
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Module():
|
||||||
return
|
return
|
||||||
|
|
||||||
#Create a backdrop for the player. In this case we just use the same background as the menus
|
#Create a backdrop for the player. In this case we just use the same background as the menus
|
||||||
self.backdrop = glossMgr.get_themeMgr().get_texture("background", None) #clutter.CloneTexture(glossMgr.get_skinMgr().get_Background())
|
self.backdrop = glossMgr.get_themeMgr().get_texture("background", None, None) #clutter.CloneTexture(glossMgr.get_skinMgr().get_Background())
|
||||||
self.backdrop.set_size(self.stage.get_width(), self.stage.get_height())
|
self.backdrop.set_size(self.stage.get_width(), self.stage.get_height())
|
||||||
self.backdrop.set_opacity(0)
|
self.backdrop.set_opacity(0)
|
||||||
self.backdrop.show()
|
self.backdrop.show()
|
||||||
|
|
18
themeMgr.py
18
themeMgr.py
|
@ -129,6 +129,14 @@ class ThemeMgr:
|
||||||
#This is the generic function for setting up an actor.
|
#This is the generic function for setting up an actor.
|
||||||
#It sets up all the 'common' properties:
|
#It sets up all the 'common' properties:
|
||||||
#Currently: size, position, opacity
|
#Currently: size, position, opacity
|
||||||
|
def get_value(self, type, name, property):
|
||||||
|
element = self.search_docs(type, name).childNodes
|
||||||
|
#Quick check to make sure we found something
|
||||||
|
if element is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return self.find_child_value(element, property)
|
||||||
|
|
||||||
def setup_actor(self, actor, element, parent):
|
def setup_actor(self, actor, element, parent):
|
||||||
#Set the size
|
#Set the size
|
||||||
#First setup the parent
|
#First setup the parent
|
||||||
|
@ -148,14 +156,15 @@ class ThemeMgr:
|
||||||
|
|
||||||
width = (float(width[:-1]) / 100.0) * parent.get_width()
|
width = (float(width[:-1]) / 100.0) * parent.get_width()
|
||||||
#print "width: " + str(width)
|
#print "width: " + str(width)
|
||||||
width = int(width)
|
width = int(width)
|
||||||
height = self.find_child_value(element, "dimensions.height")
|
height = self.find_child_value(element, "dimensions.height")
|
||||||
if (not height == "default") and (not height is None):
|
if (not height == "default") and (not height is None):
|
||||||
if height[-1] == "%":
|
if height[-1] == "%":
|
||||||
height = (float(height[:-1]) / 100.0) * parent.get_height()
|
height = (float(height[:-1]) / 100.0) * parent.get_height()
|
||||||
height = int(height)
|
height = int(height)
|
||||||
|
|
||||||
actor.set_size(width, height)
|
if (not width is None) and (not width == "default"): actor.set_width(width)
|
||||||
|
if (not height is None) and (not height == "default"): actor.set_height(height)
|
||||||
|
|
||||||
#Set the position of the actor
|
#Set the position of the actor
|
||||||
(x,y) = (0,0)
|
(x,y) = (0,0)
|
||||||
|
@ -285,3 +294,6 @@ class ThemeMgr:
|
||||||
menu.opacityStep0 = int(self.find_child_value(element, "opacity_step0"))
|
menu.opacityStep0 = int(self.find_child_value(element, "opacity_step0"))
|
||||||
menu.opacityStep1 = int(self.find_child_value(element, "opacity_step1"))
|
menu.opacityStep1 = int(self.find_child_value(element, "opacity_step1"))
|
||||||
menu.opacityStep2 = int(self.find_child_value(element, "opacity_step2"))
|
menu.opacityStep2 = int(self.find_child_value(element, "opacity_step2"))
|
||||||
|
|
||||||
|
#Finally set general actor properties (position etc)
|
||||||
|
self.setup_actor(menu.getItemGroup(), element, self.stage)
|
|
@ -8,7 +8,16 @@
|
||||||
<size id="800x600">30</size>
|
<size id="800x600">30</size>
|
||||||
</font>
|
</font>
|
||||||
|
|
||||||
<item_gap>10</item_gap>
|
<dimensions type="relativeToStage">
|
||||||
|
<width>40%</width>
|
||||||
|
<height>40%</height>
|
||||||
|
</dimensions>
|
||||||
|
<position type="relativeToStage">
|
||||||
|
<x>60%</x>
|
||||||
|
<y>30%</y>
|
||||||
|
</position>
|
||||||
|
|
||||||
|
<item_gap>0</item_gap>
|
||||||
<num_visible_elements>6</num_visible_elements>
|
<num_visible_elements>6</num_visible_elements>
|
||||||
|
|
||||||
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
||||||
|
@ -17,20 +26,11 @@
|
||||||
<opacity_step1>135</opacity_step1>
|
<opacity_step1>135</opacity_step1>
|
||||||
<opacity_step2>50</opacity_step2>
|
<opacity_step2>50</opacity_step2>
|
||||||
<scale_step0>1</scale_step0>
|
<scale_step0>1</scale_step0>
|
||||||
<scale_step1>0.85</scale_step1>
|
<scale_step1>0.5</scale_step1>
|
||||||
<scale_step2>0.75</scale_step2>
|
<scale_step2>0.4</scale_step2>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<font id="main">
|
|
||||||
<face>Tahoma</face>
|
|
||||||
<size id="default">40</size>
|
|
||||||
<size id="1024x768">40</size>
|
|
||||||
<size id="800x600">30</size>
|
|
||||||
</font>
|
|
||||||
|
|
||||||
<texture id="background">
|
<texture id="background">
|
||||||
<image>background.png</image>
|
<image>background.png</image>
|
||||||
<dimensions type="relativeToStage">
|
<dimensions type="relativeToStage">
|
||||||
|
@ -46,11 +46,11 @@
|
||||||
<texture id="selector_bar">
|
<texture id="selector_bar">
|
||||||
<image>active_bar.png</image>
|
<image>active_bar.png</image>
|
||||||
<dimensions type="relativeToStage">
|
<dimensions type="relativeToStage">
|
||||||
<width>40</width>
|
<width>40%</width>
|
||||||
<height>default</height>
|
<height>default</height>
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>50</x>
|
<x>-50</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
</position>
|
</position>
|
||||||
</texture>
|
</texture>
|
||||||
|
|
Loading…
Reference in New Issue