Update of /cvsroot/freevo/freevo/WIP/Ruelle
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397
Modified Files:
powershutdown.py
Log Message:
make it respect confirm shutdown
Index: powershutdown.py
===================================================================
RCS file: /cvsroot/freevo/freevo/WIP/Ruelle/powershutdown.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** powershutdown.py 27 Jun 2004 00:36:45 -0000 1.1
--- powershutdown.py 27 Jun 2004 23:40:47 -0000 1.2
***************
*** 10,15 ****
# -----------------------------------------------------------------------
# $Log$
! # Revision 1.1 2004/06/27 00:36:45 mikeruelle
! # adding in powershutdown for its "fans"
#
#
--- 10,15 ----
# -----------------------------------------------------------------------
# $Log$
! # Revision 1.2 2004/06/27 23:40:47 mikeruelle
! # make it respect confirm shutdown
#
#
***************
*** 35,44 ****
# ----------------------------------------------------------------------- */
#endif
!
import config
import plugin
import event as em
import shutdown
!
TRUE = 1
FALSE = 0
--- 35,48 ----
# ----------------------------------------------------------------------- */
#endif
! import os.path
! import time
import config
import plugin
import event as em
+ import rc
import shutdown
! from gui import ConfirmBox
! import traceback
!
TRUE = 1
FALSE = 0
***************
*** 58,61 ****
--- 62,67 ----
self.poll_menu_only = TRUE
self.poll_interval = 0
+ self.sentexit = 0
+ self.menuw = None
def eventhandler(self, event = None, menuw=None, arg=None):
***************
*** 64,72 ****
are just a listener and really can"t send back true.
"""
! _debug_("Saver saw %s" % event.name)
if event == em.BUTTON and event.arg == "POWER":
! _debug_("Shutting Down")
! shutdown.shutdown(menuw=menuw, argshutdown=config.ENABLE_SHUTDOWN_SYS,
argrestart=FALSE)
!
return FALSE
--- 70,112 ----
are just a listener and really can"t send back true.
"""
! _debug_("PowerShutdown saw %s with %s" % (event.name, event.arg))
+ if menuw:
+ self.menuw = menuw
+
+ # only respond to the main loop to avoid events echoed from menu
+ mycaller = os.path.basename(traceback.extract_stack(limit=2)[0][0])
+ _debug_('called from: %s' % mycaller)
+ if mycaller == 'menu.py':
+ return FALSE
+
if event == em.BUTTON and event.arg == "POWER":
! self.do_shutdown()
return FALSE
+
+ def do_shutdown(self):
+ if config.CONFIRM_SHUTDOWN:
+ # post an exit once and then keep sending power until
+ # we can see the menuw to popup our confirmbox
+ context = rc.get_singleton().context
+ _debug_('%s is the context' % context)
+ if context not in ('menu', 'tvmenu', 'input'):
+ _debug_('have app')
+ if not self.sentexit:
+ _debug_('sent STOP')
+ self.sentexit = 1
+ rc.post_event(em.STOP)
+ rc.post_event(em.Event(em.BUTTON, arg='POWER'))
+ else:
+ _debug_('no app')
+ if self.sentexit:
+ self.sentexit = 0
+ what = _('Do you really want to shutdown?')
+ ConfirmBox(text=what, handler=self.confirm_shut_down,
default_choice=1).show();
+ else:
+ _debug_("Shutting Down")
+ self.confirm_shut_down()
+
+ def confirm_shut_down(self):
+ shutdown.shutdown(menuw=self.menuw, argshutdown=config.ENABLE_SHUTDOWN_SYS,
argrestart=FALSE)
+
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog