Пример #1
0
    def __init__(self,
                 gui,
                 entries,
                 callback_fn,
                 status_msg_type='formats',
                 action_type=('Adding', 'Added')):
        '''
        :param gui: Parent gui
        :param entries: List of 3-tuples  [(target calibre id, calibre metadata object, path to epub file)]
        :param callback_fn: the function from action.py that will do the heavy lifting (process_epub_formats)
        :param status_msg_type: string to indicate what the ProgressDialog is operating on (cosmetic only)
        :param action_type: 2-tuple of strings indicating what the ProgressDialog is doing to param status_msg_type (cosmetic only)
        '''

        self.total_count = len(entries)
        QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
        self.setMinimumWidth(500)
        self.entries, self.callback_fn = entries, callback_fn
        self.action_type, self.status_msg_type = action_type, status_msg_type
        self.gui = gui
        self.setWindowTitle('{0} {1} {2}...'.format(self.action_type[0],
                                                    self.total_count,
                                                    self.status_msg_type))
        self.i, self.successes, self.failures = 0, [], []
        QTimer.singleShot(0, self.do_book_action)
        self.exec_()
Пример #2
0
 def __init__(self,
              gui,
              books,
              callback_fn,
              db,
              target_format,
              attr,
              status_msg_type='books',
              action_type='Checking'):
     self.total_count = len(books)
     QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
     self.setMinimumWidth(500)
     self.books, self.callback_fn, self.db, self.target_format, self.attr = books, callback_fn, db, target_format, attr
     self.action_type, self.status_msg_type = action_type, status_msg_type
     if attr == 'isKF8':
         self.kindle_type = 'KF8'
         self.goal = 'EPUB'
     elif attr == 'isPrintReplica':
         self.kindle_type = 'PrintReplica'
         self.goal = 'PDF'
     self.gui = gui
     zero = 0
     self.setWindowTitle('{0} {1} {2} ({3} issues)...'.format(
         self.action_type, self.total_count, self.status_msg_type, zero))
     self.i, self.successes, self.failures = 0, [], []
     QTimer.singleShot(0, self.do_multiple_book_action)
     self.exec_()
Пример #3
0
    def __init__(self,
                 gui,
                 indices,
                 callback_fn,
                 db,
                 db_type='calibre',
                 status_msg_type='books',
                 action_type=('Decrypting', 'Decryption')):
        '''
        :param gui: Parent gui
        :param indices: List of Kobo books or list calibre book maps (indicated by param db_type)
        :param callback_fn: the function from action.py that will do the heavy lifting (get_decrypted_kobo_books or add_new_books)
        :param db: kobo database object or calibre database cache (indicated by param db_type)
        :param db_type: string indicating what kind of database param db is
        :param status_msg_type: string to indicate what the ProgressDialog is operating on (cosmetic only)
        :param action_type: 2-Tuple of strings indicating what the ProgressDialog is doing to param status_msg_type (cosmetic only)
        '''

        self.total_count = len(indices)
        QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
        self.setMinimumWidth(500)
        self.indices, self.callback_fn, self.db, self.db_type = indices, callback_fn, db, db_type
        self.action_type, self.status_msg_type = action_type, status_msg_type
        self.gui = gui
        self.setWindowTitle('{0} {1} {2}...'.format(self.action_type[0],
                                                    self.total_count,
                                                    self.status_msg_type))
        self.i, self.successes, self.failures = 0, [], []
        QTimer.singleShot(0, self.do_book_action)
        self.exec_()
Пример #4
0
 def __init__(self, thread, show_file, parent=None):
     QProgressDialog.__init__(self, _('Printing, this will take a while, please wait...'), _('&Cancel'), 0, 0, parent)
     self.show_file = show_file
     self.setWindowTitle(_('Printing...'))
     self.setWindowIcon(QIcon(I('print.png')))
     self.thread = thread
     self.timer = t = QTimer(self)
     t.timeout.connect(self.check)
     self.canceled.connect(self.do_cancel)
     t.start(100)
Пример #5
0
 def __init__(self, thread, show_file, parent=None):
     QProgressDialog.__init__(self, _('Printing, this will take a while, please wait...'), _('&Cancel'), 0, 0, parent)
     self.show_file = show_file
     self.setWindowTitle(_('Printing...'))
     self.setWindowIcon(QIcon(I('print.png')))
     self.thread = thread
     self.timer = t = QTimer(self)
     t.timeout.connect(self.check)
     self.canceled.connect(self.do_cancel)
     t.start(100)
Пример #6
0
 def __init__(self, gui, book_ids, queue, db):
     QProgressDialog.__init__(self, '', '', 0, len(book_ids), gui)
     self.setWindowTitle('Queueing books for extracting ISBN')
     self.setMinimumWidth(500)
     self.book_ids, self.queue, self.db = book_ids, queue, db
     self.gui = gui
     self.i = 0
     self.failed_ids, self.no_format_ids, self.books_to_scan = [], [], []
     self.input_map = prefs['input_format_order']
     QTimer.singleShot(0, self.do_book)
     self.exec_()
Пример #7
0
 def __init__(self, parent, book_ids, output_format, queue, db, user_recs,
         args, use_saved_single_settings=True):
     QProgressDialog.__init__(self, '',
             None, 0, len(book_ids), parent)
     self.setWindowTitle(_('Queueing books for bulk conversion'))
     self.book_ids, self.output_format, self.queue, self.db, self.args, self.user_recs = \
             book_ids, output_format, queue, db, args, user_recs
     self.parent = parent
     self.use_saved_single_settings = use_saved_single_settings
     self.i, self.bad, self.jobs, self.changed = 0, [], [], False
     QTimer.singleShot(0, self.do_book)
     self.exec_()
Пример #8
0
 def __init__(self, parent, book_ids, output_format, queue, db, user_recs,
         args, use_saved_single_settings=True):
     QProgressDialog.__init__(self, '',
             None, 0, len(book_ids), parent)
     self.setWindowTitle(_('Queueing books for bulk conversion'))
     self.book_ids, self.output_format, self.queue, self.db, self.args, self.user_recs = \
             book_ids, output_format, queue, db, args, user_recs
     self.parent = parent
     self.use_saved_single_settings = use_saved_single_settings
     self.i, self.bad, self.jobs, self.changed = 0, [], [], False
     QTimer.singleShot(0, self.do_book)
     self.exec_()
Пример #9
0
 def __init__(self, gui, container, match_list, criteria, callback_fn, action_type='Checking'):
     self.file_list = [i[0] for i in container.mime_map.items() if i[1] in match_list]
     self.clean = True
     self.changed_files = []
     self.total_count = len(self.file_list)
     QProgressDialog.__init__(self, '', _('Cancel'), 0, self.total_count, gui)
     self.setMinimumWidth(500)
     self.container, self.criteria, self.callback_fn, self.action_type = container, criteria, callback_fn, action_type
     self.gui = gui
     self.setWindowTitle('{0}...'.format(self.action_type))
     self.i = 0
     QTimer.singleShot(0, self.do_action)
     self.exec_()
Пример #10
0
 def __init__(self, report, parent=None):
     total = 2 + len(report.name_map)
     QProgressDialog.__init__(self, _('Losslessly optimizing images, please wait...'), _('&Abort'), 0, total, parent)
     self.setWindowTitle(self.labelText())
     self.setWindowIcon(QIcon(I('lt.png')))
     self.setMinimumDuration(0)
     self.update_signal.connect(self.do_update, type=Qt.QueuedConnection)
     self.raw = self.prefix = None
     self.abort = Event()
     self.canceled.connect(self.abort.set)
     self.t = Thread(name='CompressIcons', target=self.run_compress, args=(report,))
     self.t.daemon = False
     self.t.start()
Пример #11
0
 def __init__(self, gui, books, callback_fn, db, target_format, attr, status_msg_type='books', action_type='Checking'):
     self.total_count = len(books)
     QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
     self.setMinimumWidth(500)
     self.books, self.callback_fn, self.db, self.target_format, self.attr = books, callback_fn, db, target_format, attr
     self.action_type, self.status_msg_type = action_type, status_msg_type
     if attr == 'isKF8':
         self.kindle_type = 'KF8'
         self.goal = 'EPUB'
     elif attr == 'isPrintReplica':
         self.kindle_type = 'PrintReplica'
         self.goal = 'PDF'
     self.gui = gui
     zero = 0
     self.setWindowTitle('{0} {1} {2} ({3} issues)...'.format(self.action_type, self.total_count, self.status_msg_type, zero))
     self.i, self.successes, self.failures = 0, [], []
     QTimer.singleShot(0, self.do_multiple_book_action)
     self.exec_()
Пример #12
0
    def __init__(self, gui, entries, callback_fn, status_msg_type='formats', action_type=('Adding','Added')):
        '''
        :param gui: Parent gui
        :param entries: List of 3-tuples  [(target calibre id, calibre metadata object, path to epub file)]
        :param callback_fn: the function from action.py that will do the heavy lifting (process_epub_formats)
        :param status_msg_type: string to indicate what the ProgressDialog is operating on (cosmetic only)
        :param action_type: 2-tuple of strings indicating what the ProgressDialog is doing to param status_msg_type (cosmetic only)
        '''

        self.total_count = len(entries)
        QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
        self.setMinimumWidth(500)
        self.entries, self.callback_fn = entries, callback_fn
        self.action_type, self.status_msg_type = action_type, status_msg_type
        self.gui = gui
        self.setWindowTitle('{0} {1} {2}...'.format(self.action_type[0], self.total_count, self.status_msg_type))
        self.i, self.successes, self.failures = 0, [], []
        QTimer.singleShot(0, self.do_book_action)
        self.exec_()
Пример #13
0
    def __init__(self,
                 gui,
                 book_list,
                 foreach_function,
                 init_label=_("Collecting ..."),
                 win_title=_("Summing Columns"),
                 status_prefix=_("Books collected")):
        QProgressDialog.__init__(self, init_label, _('Cancel'), 0,
                                 len(book_list), gui)
        self.setWindowTitle(win_title)
        self.setMinimumWidth(500)
        self.book_list = book_list
        self.foreach_function = foreach_function
        self.status_prefix = status_prefix
        self.i = 0

        ## self.do_loop does QTimer.singleShot on self.do_loop also.
        ## A weird way to do a loop, but that was the example I had.
        QTimer.singleShot(0, self.do_loop)
        self.exec_()
Пример #14
0
    def __init__(self,
                 gui,
                 book_list,
                 foreach_function,
                 init_label=_("Starting..."),
                 win_title=_("Working"),
                 status_prefix=_("Completed so far")):
        QProgressDialog.__init__(self,
                                 init_label,
                                 _('Cancel'), 0, len(book_list), gui)
        self.setWindowTitle(win_title)
        self.setMinimumWidth(500)
        self.book_list = book_list
        self.foreach_function = foreach_function
        self.status_prefix = status_prefix
        self.i = 0

        ## self.do_loop does QTimer.singleShot on self.do_loop also.
        ## A weird way to do a loop, but that was the example I had.
        QTimer.singleShot(0, self.do_loop)
        self.exec_()
Пример #15
0
    def __init__(self, gui, indices, callback_fn, db, db_type='calibre', status_msg_type='books', action_type=('Decrypting','Decryption')):
        '''
        :param gui: Parent gui
        :param indices: List of Kobo books or list calibre book maps (indicated by param db_type)
        :param callback_fn: the function from action.py that will do the heavy lifting (get_decrypted_kobo_books or add_new_books)
        :param db: kobo database object or calibre database cache (indicated by param db_type)
        :param db_type: string indicating what kind of database param db is
        :param status_msg_type: string to indicate what the ProgressDialog is operating on (cosmetic only)
        :param action_type: 2-Tuple of strings indicating what the ProgressDialog is doing to param status_msg_type (cosmetic only)
        '''

        self.total_count = len(indices)
        QProgressDialog.__init__(self, '', 'Cancel', 0, self.total_count, gui)
        self.setMinimumWidth(500)
        self.indices, self.callback_fn, self.db, self.db_type = indices, callback_fn, db, db_type
        self.action_type, self.status_msg_type = action_type, status_msg_type
        self.gui = gui
        self.setWindowTitle('{0} {1} {2}...'.format(self.action_type[0], self.total_count, self.status_msg_type))
        self.i, self.successes, self.failures = 0, [], []
        QTimer.singleShot(0, self.do_book_action)
        self.exec_()
Пример #16
0
    def __init__(self,
                 gui,
                 split_list,
                 foreach_function,
                 init_label=_("Splitting Sections..."),
                 win_title=_("Splitting Sections..."),
                 status_prefix=_("Splitting Sections...")):
        QProgressDialog.__init__(self, init_label, _('Cancel'), 0,
                                 len(split_list), gui)
        self.setWindowTitle(win_title)
        self.setMinimumWidth(500)
        self.split_list = split_list
        self.foreach_function = foreach_function
        self.status_prefix = status_prefix
        self.i = 0
        self.start_time = datetime.now()

        ## self.do_loop does QTimer.singleShot on self.do_loop also.
        ## A weird way to do a loop, but that was the example I had.
        QTimer.singleShot(0, self.do_loop)
        self.exec_()
Пример #17
0
    def __init__(self, gui,
                 split_list,
                 foreach_function,
                 init_label=_("Splitting Sections..."),
                 win_title=_("Splitting Sections..."),
                 status_prefix=_("Splitting Sections...")):
        QProgressDialog.__init__(self,
                                 init_label,
                                 _('Cancel'), 0, len(split_list), gui)
        self.setWindowTitle(win_title)
        self.setMinimumWidth(500)
        self.split_list = split_list
        self.foreach_function = foreach_function
        self.status_prefix = status_prefix
        self.i = 0
        self.start_time = datetime.now()

        ## self.do_loop does QTimer.singleShot on self.do_loop also.
        ## A weird way to do a loop, but that was the example I had.
        QTimer.singleShot(0, self.do_loop)
        self.exec_()