mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement #2325 ('Fetch All News Now' Option)
This commit is contained in:
parent
075f59b8d1
commit
94c66a4eb9
@ -131,6 +131,10 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
self.categories = sorted(self.category_map.keys(), cmp=self.sort_categories)
|
self.categories = sorted(self.category_map.keys(), cmp=self.sort_categories)
|
||||||
self._map = dict(self.category_map)
|
self._map = dict(self.category_map)
|
||||||
|
|
||||||
|
def scheduled_recipes(self):
|
||||||
|
for recipe in self.category_map[_('Scheduled')]:
|
||||||
|
yield recipe
|
||||||
|
|
||||||
def sort_categories(self, x, y):
|
def sort_categories(self, x, y):
|
||||||
|
|
||||||
def decorate(x):
|
def decorate(x):
|
||||||
@ -305,6 +309,8 @@ class SchedulerDialog(QDialog, Ui_Dialog):
|
|||||||
self.connect(button, SIGNAL('toggled(bool)'), self.do_schedule)
|
self.connect(button, SIGNAL('toggled(bool)'), self.do_schedule)
|
||||||
self.connect(self.search, SIGNAL('search(PyQt_PyObject)'), self._model.search)
|
self.connect(self.search, SIGNAL('search(PyQt_PyObject)'), self._model.search)
|
||||||
self.connect(self._model, SIGNAL('modelReset()'), lambda : self.detail_box.setVisible(False))
|
self.connect(self._model, SIGNAL('modelReset()'), lambda : self.detail_box.setVisible(False))
|
||||||
|
self.connect(self.download_all_button, SIGNAL('clicked()'),
|
||||||
|
self.download_all)
|
||||||
self.connect(self.download, SIGNAL('clicked()'), self.download_now)
|
self.connect(self.download, SIGNAL('clicked()'), self.download_now)
|
||||||
self.search.setFocus(Qt.OtherFocusReason)
|
self.search.setFocus(Qt.OtherFocusReason)
|
||||||
self.old_news.setValue(gconf['oldest_news'])
|
self.old_news.setValue(gconf['oldest_news'])
|
||||||
@ -317,6 +323,10 @@ class SchedulerDialog(QDialog, Ui_Dialog):
|
|||||||
if current.parent().isValid():
|
if current.parent().isValid():
|
||||||
self.show_recipe(current)
|
self.show_recipe(current)
|
||||||
|
|
||||||
|
def download_all(self, *args):
|
||||||
|
for recipe in self._model.scheduled_recipes():
|
||||||
|
self.emit(SIGNAL('download_now(PyQt_PyObject)'), recipe)
|
||||||
|
|
||||||
def download_now(self):
|
def download_now(self):
|
||||||
recipe = self._model.data(self.recipes.currentIndex(), Qt.UserRole)
|
recipe = self._model.data(self.recipes.currentIndex(), Qt.UserRole)
|
||||||
self.emit(SIGNAL('download_now(PyQt_PyObject)'), recipe)
|
self.emit(SIGNAL('download_now(PyQt_PyObject)'), recipe)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>Dialog</class>
|
<class>Dialog</class>
|
||||||
<widget class="QDialog" name="Dialog">
|
<widget class="QDialog" name="Dialog">
|
||||||
@ -17,7 +18,7 @@
|
|||||||
<normaloff>:/images/scheduler.svg</normaloff>:/images/scheduler.svg</iconset>
|
<normaloff>:/images/scheduler.svg</normaloff>:/images/scheduler.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item rowspan="3" row="0" column="0" >
|
<item row="0" column="0" rowspan="3">
|
||||||
<widget class="QGroupBox" name="recipe_box">
|
<widget class="QGroupBox" name="recipe_box">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Recipes</string>
|
<string>Recipes</string>
|
||||||
@ -42,6 +43,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="download_all_button">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Download all scheduled recipes at once</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Download &all scheduled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="rnumber">
|
<widget class="QLabel" name="rnumber">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -67,7 +78,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>361</width>
|
<width>381</width>
|
||||||
<height>500</height>
|
<height>500</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -105,7 +116,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" native="1" name="widget" >
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -159,7 +170,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSpinBox" name="interval">
|
<widget class="QDoubleSpinBox" name="interval">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user