I am having some trouble understanding the use of menuw.delete_menu(arg, menuw)

below is a plugin I am experimenting with. it will shutdown your
computer after your video file is finished playing
============================================
#!/usr/bin/env python

import os
import time
import commands
import thread

import plugin

from gui.PopupBox import PopupBox
from gui.ConfirmBox import ConfirmBox

class PluginInterface(plugin.ItemPlugin):
    """
    this plugin allows you to set a timer that will shutdown the
    system after your avi file has finished. you can enable it
    by adding this to your local conf file
    plugin.activate('video.autoshutdown')
    """
    def __init__(self):
        plugin.ItemPlugin.__init__(self)

    def actions(self, item):
        self.item = item
        if item.type == 'video':
                    return [ (self.confirm_start_timer, 'engage autoshutoff') ]
        else:
            return []

    def confirm_start_timer(self, arg=None, menuw=None):
        ConfirmBox(text=_('Shutdown computer'),
                   handler=self.start_timer, default_choice=1).show()

    def start_timer(self, arg=None, menuw=None):
        box = PopupBox(text=_('setting autoshutoff'))
        box.show()
        time.sleep(2)
        box.destroy()
        thread.start_new_thread(self.run_timer,())

    def run_timer(self):
        while True:
            time.sleep(60)
            if commands.getoutput('ps
-ewf').__contains__(self.item.filename)== False:
                os.system('shutdown -h now')
                break
============================================



After running the start_timer() method I want the menu to go back, so
I thought to use
menuw.delete_menu(arg, menuw) like this:


def start_timer(self, arg=None, menuw=None):
        box = PopupBox(text=_('setting autoshutoff'))
        box.show()
        time.sleep(2)
        box.destroy()
        thread.start_new_thread(self.run_timer,())
        menuw.delete_menu(arg, menuw

but I get the following error I do not really understand what is happening

menuw.delete_menu(arg, menuw)
AttributeError: 'NoneType' object has no attribute 'delete_menu'


Thank You for your time :-)

shane


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to