def run(self): button_id_prev = Gtk.ResponseType.CLOSE button_id = SUMMARY_LOG_BUTTON_ID full = False while True: if button_id == FULL_LOG_BUTTON_ID or button_id == SUMMARY_LOG_BUTTON_ID: full = (button_id == FULL_LOG_BUTTON_ID) if full: message_format = "Detailed Download Log" else: message_format = "Download Log" markup = not full log_output = command_util.download_log(full=full, markup=markup) # Set dialog content title self.dialog.set_property("text", message_format) # Set dialog content text #NOTE If full download log text is too large, it won't be displayed if markup: self.dialog.format_tertiary_scrolled_markup(log_output) else: self.dialog.format_tertiary_scrolled_text(log_output) # Grab focus to enable immediate page-up/page-down scrolling with the keyboard #label = self.dialog.get_scrolled_label() #scrolled_window = label.get_parent().get_parent() #scrolled_window.grab_focus() if button_id == FULL_LOG_BUTTON_ID or button_id == SUMMARY_LOG_BUTTON_ID: if button_id_prev != button_id: # Log view changed (different log view type or log files removed) # Scroll to top label = self.dialog.get_scrolled_label() adjustment = label.get_parent().get_vadjustment() adjustment.set_value(0.0) adjustment.value_changed() #adjustment = label.get_parent().set_vadjustment(adjustment) if button_id != RESET_ERROR_COUNT_BUTTON_ID: # No need to track RESET_ERROR_COUNT_BUTTON_ID because it doesn't affect the log view button_id_prev = button_id button_id = self.dialog.run() if button_id == CLEAR_CACHE_BUTTON_ID: command_util.clear_cache() self.main_controller.on_progress_bar_update(None) elif button_id == RESET_ERROR_COUNT_BUTTON_ID: self.main_controller.invalidate_error_offset() elif button_id == Gtk.ResponseType.CLOSE or button_id == Gtk.ResponseType.DELETE_EVENT: break
def run(self): button_id_prev = Gtk.ResponseType.CLOSE button_id = SUMMARY_LOG_BUTTON_ID full = False while True: if button_id == FULL_LOG_BUTTON_ID or button_id == SUMMARY_LOG_BUTTON_ID: full = button_id == FULL_LOG_BUTTON_ID if full: message_format = "Detailed Download Log" else: message_format = "Download Log" markup = not full log_output = command_util.download_log(full=full, markup=markup) # Set dialog content title self.dialog.set_property("text", message_format) # Set dialog content text # NOTE If full download log text is too large, it won't be displayed if markup: self.dialog.format_tertiary_scrolled_markup(log_output) else: self.dialog.format_tertiary_scrolled_text(log_output) # Grab focus to enable immediate page-up/page-down scrolling with the keyboard # label = self.dialog.get_scrolled_label() # scrolled_window = label.get_parent().get_parent() # scrolled_window.grab_focus() if button_id == FULL_LOG_BUTTON_ID or button_id == SUMMARY_LOG_BUTTON_ID: if button_id_prev != button_id: # Log view changed (different log view type or log files removed) # Scroll to top label = self.dialog.get_scrolled_label() adjustment = label.get_parent().get_vadjustment() adjustment.set_value(0.0) adjustment.value_changed() # adjustment = label.get_parent().set_vadjustment(adjustment) if button_id != RESET_ERROR_COUNT_BUTTON_ID: # No need to track RESET_ERROR_COUNT_BUTTON_ID because it doesn't affect the log view button_id_prev = button_id button_id = self.dialog.run() if button_id == CLEAR_CACHE_BUTTON_ID: command_util.clear_cache() self.main_controller.on_progress_bar_update(None) elif button_id == RESET_ERROR_COUNT_BUTTON_ID: self.main_controller.invalidate_error_offset() elif button_id == Gtk.ResponseType.CLOSE or button_id == Gtk.ResponseType.DELETE_EVENT: break
def main(): # Exit if run from the interpreter # if not sys.argv[0]: # sys.exit(1) _init_loggers() args = settings.get_args() # if args.compact and not args.list_channels: # logger.info("--compact is only used with --list-channels") if args.list_categories: config_util.list_categories() elif args.list_channels: config_util.list_channels(compact=args.compact) elif args.log: print(command_util.download_log(full=args.full)) elif args.clear_cache: command_util.clear_cache() elif args.version: print(get_iplayer_downloader.PROGRAM_NAME, get_iplayer_downloader.VERSION) else: from get_iplayer_downloader.ui.main_window import main main()
def main(): # Exit if run from the interpreter #if not sys.argv[0]: # sys.exit(1) _init_loggers() args = settings.get_args() #if args.compact and not args.list_channels: # logger.info("--compact is only used with --list-channels") if args.list_categories: config_util.list_categories() elif args.list_channels: config_util.list_channels(compact=args.compact) elif args.log: print(command_util.download_log(full=args.full)) elif args.clear_cache: command_util.clear_cache() elif args.version: print(get_iplayer_downloader.PROGRAM_NAME, get_iplayer_downloader.VERSION) else: from get_iplayer_downloader.ui.main_window import main main()