window without focus
#1
Hi there,

I'm working on a (tiny) script where I show a (transparent) WindowDialog with a ControlLabel on top of the xbmc interface when I get an event.

The only thing that I can't manage to get right is: when the Window is visible, it automatically has focus, and therefore, the main interface can't be controlled.

So is there a way to display a label on top of the xbmc interface, and allow to navigate at the same time?
Something like passing the buttons to the main interface or something..

The rest works, it just 'locks up' the interface as long as the labeled window is displayed.

Can anyone shed a light on this?

Thanks in advance


Cheers!

To describe my script: I just wanted to do two things: play a movie or mp3, and keep up with an IRC channel, so I wrote this kind of 'irc ticker' (threw some scripts in a blender, just because I didn't know python before I started on this) like the rss feed does at the Home page
using an XBMC rev30380 with updated LCD code
Reply
#2
check out xinbox, i think it uses the notification dialog.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
Does it have to be a window you display? You could just show a group control on top of the xbmc UI
Reply
#4
you need a window to add the control to.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#5
first, thanks for the fast replies

Nuka, I couldn't test xinbox fully: it crashed with a buffer overrun on my pc, and just wouldn't login on my xbox.
But I think you meant this one:
Code:
xbmc.executebuiltin('XBMC.Notification(%s,%s)' % (header,message))
Which is indeed a handy feature, but probably less suitable for (long and many) chat messages.

It would be a cool feature for the script like ctcp, topic or pm events, so I will definately look into that.


skunkmonkee, I had to do some trial/error before I got the picture, but I think I managed it like this:
Code:
import xbmc, xbmcgui

win = xbmcgui.Window( 10020 ) # myscripts window
scrollabel = xbmcgui.ControlLabel(150, 30, 350, 50, 'hi there', 'font18', '0xffffffff')

while( 1 ):
  xbmc.sleep( 700 )

Which indeed adds a label to one of the windows I choose, but 'closes' the window on exit/kill Big Grin

All I have to figure out now, is to put it on all trivial screens without bloating it.

I sure have work to do.. well, first catch some sleep.

Thanks!


Cheers,

tinux
using an XBMC rev30380 with updated LCD code
Reply
#6
Well, it works somehow, but now I have another problem with my script. (even slightly bigger)

When I add a label on the current skin window, the animation just won't work.
I'm using the following code (part of a class):
Code:
nWin = xbmcgui.getCurrentWindowId()
    self.m_win = xbmcgui.Window( nWin )
    
    self.m_scrollabel = xbmcgui.ControlLabel( 100, 30, self.m_nTextWidth, 300, self.m_strMessage, 'font18', '0xffffffff')
    self.scrollabel.setVisible( False )
    self.m_win.addControl(self.scrollabel)
    self.scrollabel.setAnimations([('Visible', 'effect=slide end=-100,0 time=20000' )])
    self.scrollabel.setVisible( True )

-without adding an animation, the label is displayed
-adding the animation after the label is added, the label is also displayed, but doesn't animate
-adding the animation before the label is added, crashes xbmc. (using member variables just made my label dissapear)

I also tried setting all other animation types: i.e. WindowOpen, Conditional w/ condition=True, but it just won't work.

Am I missing something here?
using an XBMC rev30380 with updated LCD code
Reply
#7
ah damn, I sure missed something
Code:
self.m_win.addControl(self.scrollabel)
    self.scrollabel.setAnimations([('Conditional', 'condition=True effect=slide end=-100,0 time=200' )])
seems to work now, so I will try to put the member variables in

* tinux bangs his head to the wall
using an XBMC rev30380 with updated LCD code
Reply
#8
Were you able to do this on any window of the skin? That is really cool, I think I tried something very similar a while back and failed miserably.

I didnt think it was possible to get at the controls on non-python windows. I'll need to have a look at this sometime Smile

You should have nuka or pike hook you up with the scripting SVN repository.
Reply
#9
I'm curious also.

1. does the script continuaously run? If not what do edit in the windows.xml to launch the scripts.
If you are editing an xml, wouldn't it be better to add the label with it's <label> tag set to a skin setting in the xml and have the script set a skin setting?

2. if it does run continuosly, do you keep checking for the current windowID. If this does it slow anything down.

I would like to see your full code.

If you have a g-mail account i can add you to the scripting svn if you like.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#10
Well, I sort of managed it, partially
It doesn't quite work perfectly, but with the code posted above it's possible to add a label (animated if you want)

I only tested it for the 'Home' and 'My Script' screen where I ran the scripts.
It wouldn't display on the output page though..

My script uses a while ( 1 ), because by creating a window (including using the skin ID's) in python, all those windows are closed upon exiting the script.
This will remove your skin window temporarily (gives a black screen)
Navigating back and forth restores this.

It's far from finished or optimized, and I think some of my code is not correct, since I get the black screen after my class is finished 'sleep'ing.

I think the best way to get the current window, is to hold two global script variables: one containing the window ID, the other containing the window object.
Upon creating a new label, one has to check if the current ID isn't the same anymore as the ID used to get the window, and thus recreating the window with the new ID.

I hope to get back on this in a couple of hours.

By the way: I'm not very familiar with python, just learned it a week ago using other samples of this website Smile

Maybe I'm not the best person for the job, but I will definitely release the code if I get it to work.


Cheers,

tinux
using an XBMC rev30380 with updated LCD code
Reply
#11
I think I managed it Smile

Here you have 'tIRCker', an IRC ticker.
synopsis:
-it connects to an IRC server, and joins a channel
-then it logs the chat messages just like the RSS feed, but this one is also visible on top of a movie or visualisation (as far as I tested it)

tried to upload it on XBMCScripts.com, but it threw error on me.
You can find it here

Note that there are some issues using it:
1. there can be only two messages at the same time on screen (I just wrote a lame queue system)
2. Stopping the script probably won't work that well and may even lockup your xbmc. Instead, use /ctcp <xboxnick> KILLME with an interactive irc client
3. The way of checking if the bot is on a channel is lame, and won't work correctly if the nick was already in use
4. No on-screen config, just edit the settings at the top of the default.py


There are some things that might be fun to know (and use in your own scripts):
1. Controls dynamically placed in the skin using python and build-in commands only, including restoring the skin correctly when quitting
2. Joel Rosdahl's IRC and BigBellyBilly's bbb Libraries
3. Notifications (just a build-in command)
4. Has some CTCP's built-in:
-KILLME, kills the client
-PLAYING, quick and dirty way of broadcasting 'Currently playing' on the channel
-INFO, just the cpu info
-VERSION, does what it must do

Remember, I just know python for about a week now, so some things may look lame Smile


Cheers, and have fun!

tinux
using an XBMC rev30380 with updated LCD code
Reply
#12
soory, but xbmcscripts.com is very unstable atm, so upload function is down.
Reply

Logout Mark Read Team Forum Stats Members Help
window without focus0