def burn_data_cd(self): """ Asks confirmation for the burning of a data CD if confirmation given it calls start_burning """ logger.debug('burn_data_cd()') #lets check if we have all we need if not self.check_program(program=config.CDBURN_CDRECORD_PATH, program_name="cdrecord"): logger.debug("Unable to find %s", config.CDBURN_CDRECORD_PATH) return if not self.check_program(program=config.CDBURN_MKISOFS_PATH, program_name="mkisofs"): logger.debug("Unable to find %s", config.CDBURN_MKISOFS_PATH) return if not self.clean_up_burndir(): return #if list of files not to big just display it if len(self.files) <= 4: ConfirmBox(text=_('Start burning %s ?') % self.files, handler=self.start_burning, default_choice=0).show() else: # display the size of the burning t_sum = 0 t_files = len(self.files) for a in self.files: c = os.stat(a)[ST_SIZE] t_sum = t_sum + (int(c)/1024/1024) ConfirmBox(text=_('Start burning %(num)s entries? ( %(size)d Mb )') % ({ 'num': t_files, 'size': t_sum}), handler=self.start_burning, default_choice=0).show()
def burn_data_cd(self): _debug_('burn_data_cd (self) ') #lets check if we have all we need if not self.check_program(program=config.CDBURN_CDRECORD_PATH, program_name="cdrecord"): _debug_("Unable to find %s" % config.CDBURN_CDRECORD_PATH) return if not self.check_program(program=config.CDBURN_MKISOFS_PATH, program_name="mkisofs"): _debug_("Unable to find %s" % config.CDBURN_MKISOFS_PATH) return if not self.clean_up_burndir(): return #if list of files not to big just display it if len(self.files) <= 4: ConfirmBox(text=_('Start burning %s ?' % self.files), handler=self.start_burning, default_choice=0).show() #else display the size of the burning else: t_sum = 0 t_files = len(self.files) for a in self.files: c = os.stat(a)[ST_SIZE] t_sum = t_sum + (int(c) / 1024 / 1024) ConfirmBox(text=_('Start burning %s entries? ( %d Mb )' % (t_files, t_sum)), handler=self.start_burning, default_choice=0).show()
def burn_dvd_video(self): _debug_('burn_dvd_video(self)') """ copy this file/DIR to DVD as DVD VIDEO, NB: MUST BE DVD VIDEO ALREADY!!!!!!! (ie ripped with dvdcopy.py) """ self.file_to_burn = None name = self.files[0].split("/") self.name = name[len(name) - 1] _debug_('self.name = %s' % self.name) self.dir = self.files[0] _debug_('self.dir = %s ' % self.dir) if self.name.endswith('.iso'): self.file_to_burn = self.dir else: self.subdirs = util.getdirnames(self.dir, softlinks=False) for dir in self.subdirs: pathname = os.path.join(self.dir, f) _debug_('%s ' % pathname[-3:]) if pathname[-3:].lower() == '_ts': _debug_('OK TO BURN, folder DVD compliant %s' % pathname) self.file_to_burn = pathname else: _debug_('NOT OK to BURN, folder NOT DVD compliant: %s' % pathname) self.file_to_burn = None if self.file_to_burn: ConfirmBox(text=_('Insert media then click OK'), handler=self.start_burning, default_choice=0).show() return self.burn()
def burn_audio_cd(self): """ Checks for burn list clean-up, mplayer availability """ logger.debug('burn_audio_cd()') if not self.check_program(program=config.MPLAYER_CMD, program_name="mplayer"): return if not self.clean_up_burndir(): return ConfirmBox(text=_('Start burning %s audio files?') % len(self.files), handler=self.start_burning, default_choice=0).show()
def eventhandler(self, event, menuw=None): if self.get_selected_child() == self.name_input: if event == em.INPUT_LEFT: self.name_input.change_selected_box('left') self.draw() return True elif event == em.INPUT_RIGHT: self.name_input.change_selected_box('right') self.draw() return True elif event == em.INPUT_ENTER: self.name_input.get_selected_box().toggle_selected() self.chan_box.toggle_selected() self.draw() return True elif event == em.INPUT_UP: self.name_input.get_selected_box().charUp() self.draw() return True elif event == em.INPUT_DOWN: self.name_input.get_selected_box().charDown() self.draw() return True elif event in em.INPUT_ALL_NUMBERS: self.name_input.get_selected_box().cycle_phone_char(event) self.draw() return True elif event == em.INPUT_EXIT: self.destroy() return True elif self.get_selected_child() == self.chan_box: if event in (em.INPUT_UP, em.INPUT_DOWN): self.chan_box.change_item(event) self.draw() elif event == em.INPUT_ENTER: if self.chan_box.selected or self.chan_box.list.is_visible(): self.chan_box.toggle_box() self.draw() elif event in (em.INPUT_LEFT, em.MENU_PAGEUP): self.chan_box.toggle_selected() self.name_input.boxes[0].toggle_selected() self.draw() elif event in (em.INPUT_RIGHT, em.MENU_PAGEDOWN): self.chan_box.toggle_selected() self.dow_box.toggle_selected() self.draw() elif event == em.INPUT_EXIT: self.destroy() return True elif self.get_selected_child() == self.dow_box: if event in (em.INPUT_UP, em.INPUT_DOWN): self.dow_box.change_item(event) self.draw() elif event == em.INPUT_ENTER: if self.dow_box.selected or self.dow_box.list.is_visible(): self.dow_box.toggle_box() self.draw() elif event in (em.INPUT_LEFT, em.MENU_PAGEUP): self.dow_box.toggle_selected() self.chan_box.toggle_selected() self.draw() elif event in (em.INPUT_RIGHT, em.MENU_PAGEDOWN): self.dow_box.toggle_selected() self.tod_box.toggle_selected() self.draw() elif event == em.INPUT_EXIT: self.destroy() return True return True elif self.get_selected_child() == self.tod_box: if event in (em.INPUT_UP, em.INPUT_DOWN): self.tod_box.change_item(event) self.draw() elif event == em.INPUT_ENTER: if self.tod_box.selected or self.tod_box.list.is_visible(): self.tod_box.toggle_box() self.draw() elif event in (em.INPUT_LEFT, em.MENU_PAGEUP): self.tod_box.toggle_selected() self.dow_box.toggle_selected() self.draw() elif event in (em.INPUT_RIGHT, em.MENU_PAGEDOWN): self.tod_box.toggle_selected() self.save.toggle_selected() self.draw() elif event == em.INPUT_EXIT: self.destroy() return True return True elif self.get_selected_child() == self.save: if event == em.INPUT_ENTER: if self.oldname: record_client.removeFavorite(self.oldname) (result, msg) = record_client.addEditedFavorite( self.name_input.get_word(), self.fav.title, self.chan_box.list.get_selected_item().value, self.dow_box.list.get_selected_item().value, self.tod_box.list.get_selected_item().value, self.fav.priority, self.fav.allowDuplicates, self.fav.onlyNew) if result: #tv.view_favorites.ViewFavorites(parent=self.parent, text='Favorites').show() self.destroy() AlertBox(parent='osd', text=_('Favorite %s has been saved') % self.name_input.get_word()).show() else: AlertBox(parent=self, text=_('Failed: %s') % msg).show() return True elif event in (em.INPUT_LEFT, em.MENU_PAGEUP): self.save.toggle_selected() self.tod_box.toggle_selected() self.draw() elif event in (em.INPUT_RIGHT, em.MENU_PAGEDOWN): self.save.toggle_selected() if self.remove: self.remove.toggle_selected() else: self.cancel.toggle_selected() self.draw() elif event == em.INPUT_EXIT: self.destroy() return True return True elif self.get_selected_child() == self.remove: if event == em.INPUT_ENTER: ConfirmBox(text=_('Do you want to remove %s?') % self.name_input.get_word(), handler=self.removeFavorite).show() return True elif event in (em.INPUT_LEFT, em.MENU_PAGEUP): self.save.toggle_selected() self.remove.toggle_selected() self.draw() elif event in (em.INPUT_RIGHT, em.MENU_PAGEDOWN): self.remove.toggle_selected() self.cancel.toggle_selected() self.draw() elif event in (em.INPUT_ENTER, em.INPUT_EXIT): self.destroy() return True return True elif self.get_selected_child() == self.cancel: if event in (em.INPUT_LEFT, em.MENU_PAGEUP): if self.remove: self.remove.toggle_selected() else: self.save.toggle_selected() self.cancel.toggle_selected() self.draw() elif event in (em.INPUT_ENTER, em.INPUT_EXIT): self.destroy() return True return True if event == em.INPUT_EXIT: self.destroy() return True elif event in (em.MENU_PAGEDOWN, em.MENU_PAGEUP): return True else: return self.parent.eventhandler(event)
def confirm_image_delete(self, arg=None, menuw=None): self.menuw = menuw ConfirmBox(text=_('Delete image about\n \'%s\'?') % self.item.name, handler=self.delete_image, default_choice=1).show()
def confirm_delete(self, arg=None, menuw=None): self.menuw = menuw ConfirmBox(text=_('Do you wish to delete\n \'%s\'?') % self.item.name, handler=self.delete_file, default_choice=1, handler_message=_('Deleting...')).show()