def move_tray(self, direction='toggle'): """ Move the tray. direction can be toggle/open/close """ global im_thread if direction == 'toggle': if self.is_tray_open(): direction = 'close' else: direction = 'open' if direction == 'open' and self.can_eject: pop = PopupBox(text=_('Ejecting disc in drive %s') % self.drivename) pop.show() if util.is_mounted(self.mountdir): self.umount() self.mount_ref_count = 0 self.open_tray() pop.destroy() elif direction == 'close' and self.can_close: pop = PopupBox(text=_('Reading disc in drive %s') % self.drivename) pop.show() self.close_tray() if im_thread: im_thread.check_all() pop.destroy()
def is_mounted(self): """ Check if the media is mounted (and the consistency of internal data) """ r = util.is_mounted(self.mountdir) o = os.path.ismount(self.mountdir) if not o and self.mount_ref_count > 0: logger.warning('Drive was unmounted out of rom_drives.py: ' + self.mountdir) self.mount_ref_count = 0 if o and self.mount_ref_count == 0: logger.warning('Drive was mounted out of rom_drives.py: ' + self.mountdir) self.mount_ref_count = 1 if (o and not r) or (not o and r): logger.warning('Inconsistency regarding the mount status of: ' + self.mountdir) return r
def is_mounted(self): """ Check if the media is mounted """ return util.is_mounted(self.mountdir)