You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1018 B
40 lines
1018 B
14 years ago
|
from couchpotato.core.event import fireEvent, addEvent
|
||
|
from couchpotato.core.logger import CPLog
|
||
|
from couchpotato.core.plugins.base import Plugin
|
||
|
from couchpotato.environment import Env
|
||
|
|
||
|
log = CPLog(__name__)
|
||
|
|
||
11 years ago
|
autoload = 'Desktop'
|
||
|
|
||
|
|
||
14 years ago
|
if Env.get('desktop'):
|
||
14 years ago
|
|
||
14 years ago
|
class Desktop(Plugin):
|
||
14 years ago
|
|
||
14 years ago
|
def __init__(self):
|
||
14 years ago
|
|
||
14 years ago
|
desktop = Env.get('desktop')
|
||
|
desktop.setSettings({
|
||
|
'base_url': fireEvent('app.base_url', single = True),
|
||
|
'api_url': fireEvent('app.api_url', single = True),
|
||
|
'api': Env.setting('api'),
|
||
|
})
|
||
14 years ago
|
|
||
14 years ago
|
# Events from desktop
|
||
|
desktop.addEvents({
|
||
|
'onClose': self.onClose,
|
||
|
})
|
||
14 years ago
|
|
||
14 years ago
|
# Events to desktop
|
||
|
addEvent('app.after_shutdown', desktop.afterShutdown)
|
||
11 years ago
|
addEvent('app.load', desktop.onAppLoad, priority = 110)
|
||
14 years ago
|
|
||
14 years ago
|
def onClose(self, event):
|
||
13 years ago
|
return fireEvent('app.shutdown', single = True)
|
||
14 years ago
|
|
||
14 years ago
|
else:
|
||
|
|
||
|
class Desktop(Plugin):
|
||
|
pass
|