1
# -*- coding: utf-8 -*-
4
# Jose Chaso (pchaso) <jose.chaso at gmail>
6
# [es] Modulo disc - Módulo que implementa el "actor hardware" para los
7
# discos ROM (CDROM, DVDROM, etc)
8
# [en] disc module - "Hardware actor" module implementation for ROM discs
11
# Copyright (C) 2009 Junta de Andalucía
13
# ----------------------------[es]-----------------------------
15
# Este fichero es parte de Detección de Hardware de Guadalinex V6
17
# Este programa es software libre: puede redistribuirlo y/o modificarlo bajo
18
# los términos de la Licencia Pública General version 3 de GNU según
19
# es publicada por la Free Software Foundation.
21
# Este programa se distribuye con la esperanza de que será útil, pero
22
# SIN NINGUNA GARANTÍA, incluso sin la garantías implicitas de
23
# MERCANTILIZACION, CALIDAD SATISFACTORIA o de CONVENIENCIA PARA UN PROPÓSITO
24
# PARTICULAR. Véase la Licencia Pública General de GNU para más detalles.
26
# Debería haber recibido una copia de la Licencia Pública General
27
# junto con este programa; si no ha sido así,
28
# visite <http://www.gnu.org/licenses/>
29
# o escriba a la Free Software Foundation, Inc.,
30
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
32
# ----------------------------[en]-----------------------------
34
# This file is part of Guadalinex V6 Hardware Detection.
36
# This program is free software: you can redistribute it and/or modify it
37
# under the terms of the GNU General Public License version 3, as published
38
# by the Free Software Foundation.
40
# This program is distributed in the hope that it will be useful, but
41
# WITHOUT ANY WARRANTY; without even the implied warranties of
42
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
43
# PURPOSE. See the GNU General Public License for more details.
45
# You should have received a copy of the GNU General Public License
46
# along with this program; if not, visit <http://www.gnu.org/licenses/>
47
# or write to the Free Software Foundation, Inc.,
48
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
54
from deviceactor import DeviceActor
55
from gettext import gettext as _
58
class Actor (DeviceActor):
60
[es] Implementacion de clase Actor para discos (hereda del actor para
62
--------------------------------------------------------------------------
63
[en] Actor class implementation for disks (uses volume actor as
67
__required__ = {'info.category': 'volume', 'volume.is_disc': 1 }
68
__icon_path__ = os.path.abspath('actors/img/disc.png') # añadir icono de disco
69
__iconoff_path__ = os.path.abspath('actors/img/discoff.png')
70
__device_title__ = _("Disc")
71
__device_conn_description__ = _("Disc inserted")
72
__device_disconn_description__ = _("Disc ejected")
73
__filesystem_mounted__ = _("Filesystem mounted")
74
__filesystem_umounted__ = _("Filesystem umounted")
75
__listener_factories__ = []
77
def on_modified(self, key):
79
[es] Acciones a ejecutar cuando se detecta un cambio en el estado
80
-----------------------------------------------------------------------
81
[en] Actions to take when a status change is detected
83
if key == 'volume.is_mounted':
85
if self.properties['volume.is_mounted']:
86
mount_point = self.properties['volume.mount_point']
89
os.system('nautilus "%s"' % mount_point)
91
self.msg_render.show(self.__device_title__,
92
self.__filesystem_mounted__,
94
actions = {mount_point: open_volume})
96
for listener in self.listeners:
97
if listener.is_valid(self.properties):
98
listener.volume_mounted(mount_point)
101
self.msg_render.show(self.__device_title__,
102
self.__filesystem_umounted__, self.__iconoff_path__)
104
for listener in self.listeners:
105
if listener.is_valid(self.properties):
106
listener.volume_unmounted()
109
self.logger.error(_("Error") + ": " + str(e))