hi,
at the moment i´m working on a script which starts a given action after a certain time without user interaction.
is there a idle time available in xbmc phyton? i haven´t found anything.
therefore i try to create a transparent window on top of everything and look for input. that works most of the time, however the key the user is pressing is only coming to my window. i´m now looking for a way to pass this key to the original visible window.
does that make sense to you?
anybody out there with an idea?
maybe i´m going the wrong direction as i#m only used to vb :verysad:
psychotik
Junior Member Posts: 14 Joined: Jun 2005 Reputation: 0 |
2005-06-22 19:48
Post: #1
|
| find quote |
EnderW
Skilled Python Coder Joined: Feb 2005 Reputation: 0 |
2005-06-22 21:11
Post: #2
import time
time.sleep(x) x = time in seconds anyhow, a send function isn't needed. on the new class (your new overlay) you can call the old overlay object's function -which you want to run - when a button is pressed. xbmcscripts.com administrator |
| find quote |
solexalex
Skilled Python Coder Posts: 706 Joined: Jul 2004 Reputation: 6 |
2005-06-22 22:31
Post: #3
time.sleep will freeze your script until delay finished...
if you need to do some more actions while time is running, you may use threading... some scripts are using threading. you can try my mycalendar. i have another script that use thread, but can't remember the name... lol this script launch a default playlist after a time if no actions has been taken by user.... you may use the search engine to find it ! |
| find quote |
psychotik
Junior Member Posts: 14 Joined: Jun 2005 Reputation: 0 |
2005-06-23 20:45
Post: #4
@solexalex & enderw
thanks for the suggestions, they gave me some new ideas! |
| find quote |
psychotik
Junior Member Posts: 14 Joined: Jun 2005 Reputation: 0 |
2005-06-23 22:09
Post: #5
(enderw @ june 22 2005,20:11 Wrote:import timehow do i get a handle of the old overlay or parent window? for example the main menu of xbmc is active. then after a a few seconds i create my overlay window. in this window i can us onaction to get all inputs, but i see no way of finding out what the parent window is. i think a possible way is using xbmcgui.window(someid), but i haven´t found out how to find the correct id as there is no findwindow function :help: |
| find quote |
EnderW
Skilled Python Coder Joined: Feb 2005 Reputation: 0 |
2005-06-23 23:07
Post: #6
pass on self to the new object (from within window1's class). like:
w2 = window2(self) w2.domodal() window2's init function should have (self, selfinstance, ...) selfintance would now be the first window's class/object. then you can do: self.window1 = selfinstance and in onaction: if action == 7: self.window1.function() i believe you can do something like that, but i haven't thought this through very much..also, my python knowlegde is rather limited. good luck
xbmcscripts.com administrator |
| find quote |
psychotik
Junior Member Posts: 14 Joined: Jun 2005 Reputation: 0 |
2005-06-24 21:29
Post: #7
i think i got it sort of working, but now i have a new strange problem.
i made a few changes on my ui and now my xbox crashes when i execute the script Quote:import xbmc, xbmcgui, time, os i can't see what i'm doiong wrong, but it's an instant kill :bomb: |
| find quote |
Nuka1195
Skilled Python Coder Posts: 3,914 Joined: Dec 2004 Reputation: 17 |
2005-06-24 22:29
Post: #8
def (self):
|
| find quote |
Nuka1195
Skilled Python Coder Posts: 3,914 Joined: Dec 2004 Reputation: 17 |
2005-06-24 22:39
Post: #9
also when using division.
this: panelx=int(float(w)/2-(float(269)/2)) will give a more accurate result than: panelx=int(w/2-(269/2)) it probably only matters on real complex formulas though. |
| find quote |
EnderW
Skilled Python Coder Joined: Feb 2005 Reputation: 0 |
2005-06-24 23:24
Post: #10
Quote:def (self): his code is probably correct on that point, this board doesn't show ..init.. (dot = underscore). i notice that your code lacks indentation, but i can only assume that it's there in the file you run ![]() try to setthe label's height to more than 50. i dunno if labels are affected, but most controls need a height more than 50 or else xbmc locks up. also, why do you do show() and not domodal()? show() only shows the screen for a split second, so you'll not see any of it. if it's just for testing if things work it's cool, was just wondering if you knew the difference... xbmcscripts.com administrator |
| find quote |



Search
Help