32
32
from elisa.core.log import Loggable
33
33
from elisa.core.utils import exception_hook, misc
34
34
from elisa.core.utils.splash_screen import SplashScreen
35
from elisa.core.utils.update_checker import UpdateChecker
35
36
from elisa.core import bus
37
from elisa.core import media_uri
37
39
from elisa.core.components.message import Message
252
253
self.interface_controller = interface_controller.InterfaceController()
253
254
self.options = options
256
system = platform.system()
257
if system == 'Windows':
258
# FIXME: the core should not depend on plugins!!!
259
from elisa.plugins.poblesec.windows_message import WindowsMessageSource
260
from win32con import WM_COPYDATA
261
self.windows_message_source = WindowsMessageSource()
262
winprocs = { WM_COPYDATA : self._on_copydata, }
263
self.windows_message_source.add_wndproc(winprocs)
265
256
def _update_check_callback(self, results):
267
258
version = results['version']
428
extra_affiliation_params = {'aen': '', 'entity_id': '', 'referrer': '',
438
430
if platform.system() == 'Windows':
439
431
from elisa.core.utils.mswin32.tools import \
440
432
should_install_recommended_plugins
433
from elisa.core.utils.mswin32 import tools
441
436
self.config.set_option('auto_install_new_recommended_plugins',
442
437
should_install_recommended_plugins(),
443
438
section='plugin_registry')
446
# Do not do the import at the beginning of the file as the update
447
# checker currently depends on the http client plugin.
448
# FIXME: the core should not depend on plugins!!!
449
from elisa.core.utils.update_checker import UpdateChecker
451
# Could happen if the elisa http client plugin is missing
454
self.update_checker = UpdateChecker(self._install_date,
455
self._user_id, __version__)
456
self.update_checker.start(self._update_check_callback)
440
elisa_reg_key = tools.ElisaRegKey(win32con.HKEY_LOCAL_MACHINE)
441
mapping = {'aen': 'aen', 'entity_id': 'aid',
442
'referrer': 'referer', 'traffic_unit': 'sid'}
443
for key, value in mapping.iteritems():
445
reg_value = elisa_reg_key.get_value(value)
446
reg_value = media_uri.quote(reg_value)
447
self.debug("Value for %r in windows registry: %r",
450
self.debug("%r not found in windows registry", value)
452
extra_affiliation_params[key] = reg_value
454
elisa_reg_key.close()
456
self.update_checker = UpdateChecker(self._install_date, self._user_id,
458
**extra_affiliation_params)
459
self.update_checker.start(self._update_check_callback)
461
self._close_splash_screen()
458
463
return defer.succeed(True)
468
473
self._close_splash_screen()
470
if self.update_checker is not None:
471
self.update_checker.stop()
475
self.update_checker.stop()
473
477
def interface_controller_stopped(result):
474
478
self.info("Stopping managers")
524
528
def _close_splash_screen(self):
525
529
if self._splash != None:
526
530
self._splash.destroy()
528
def _on_copydata(self, hwnd, msg, wparam, lparam):
530
from ctypes import Structure, c_char, sizeof, addressof, memmove
531
from ctypes.wintypes import ULONG, DWORD
532
from elisa.core.utils.mswin32.structures import COPYDATASTRUCT
534
copydata = COPYDATASTRUCT()
535
memmove(addressof(copydata), lparam, sizeof(copydata))
537
class COMMANDLINEDATA(Structure):
539
("data", c_char * copydata.cbData)
542
commandlinedata = COMMANDLINEDATA()
543
memmove(addressof(commandlinedata), copydata.lpData, sizeof(commandlinedata))
544
frontend = self.interface_controller.frontends.values()[0]
545
main = frontend.retrieve_controllers('/poblesec')[0]
546
# We use '|' as a file separator
547
files = commandlinedata.data.split('|')
549
main.play_files(files)