From d40c4576fa602329d4233b7a69a44f66529eea40 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 7 May 2011 10:50:36 +0100 Subject: [PATCH 01/23] Add two buttons: manage authors and paste isbn --- src/calibre/gui2/metadata/basic_widgets.py | 8 +++- src/calibre/gui2/metadata/single.py | 48 ++++++++++++++++++---- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 00fa0e26e8..b2c5d471ae 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import textwrap, re, os from PyQt4.Qt import (Qt, QDateEdit, QDate, pyqtSignal, QMessageBox, - QIcon, QToolButton, QWidget, QLabel, QGridLayout, + QIcon, QToolButton, QWidget, QLabel, QGridLayout, QApplication, QDoubleSpinBox, QListWidgetItem, QSize, QPixmap, QPushButton, QSpinBox, QLineEdit, QSizePolicy) @@ -1037,6 +1037,12 @@ class IdentifiersEdit(QLineEdit): # {{{ self.setToolTip(tt+extra) self.setStyleSheet('QLineEdit { background-color: %s }'%col) + def paste_isbn(self): + cb = QApplication.clipboard() + vals = self.current_val + vals['isbn'] = cb.text() + self.current_val = vals + # }}} class PublisherEdit(MultiCompleteComboBox): # {{{ diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index f0a05d171f..0df2014438 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -125,6 +125,13 @@ class MetadataSingleDialogBase(ResizableDialog): 'Swap the author and title')) self.swap_title_author_button.clicked.connect(self.swap_title_author) + self.manage_authors_button = QToolButton(self) + self.manage_authors_button.setIcon(QIcon(I('user_profile.png'))) + self.manage_authors_button.setToolTip('
' + _( + 'Manage authors. Use to rename authors and correct ' + 'individual author\'s sort values') + '
') + self.manage_authors_button.clicked.connect(self.authors.manage_authors) + self.series = SeriesEdit(self) self.remove_unused_series_button = QToolButton(self) self.remove_unused_series_button.setToolTip( @@ -161,6 +168,12 @@ class MetadataSingleDialogBase(ResizableDialog): self.clear_identifiers_button = QToolButton(self) self.clear_identifiers_button.setIcon(QIcon(I('trash.png'))) self.clear_identifiers_button.clicked.connect(self.identifiers.clear) + self.paste_isbn_button = QToolButton(self) + self.paste_isbn_button.setToolTip('' + + _('Paste the contents of the clipboard into the ' + 'identifiers box prefixed with isbn:') + '
') + self.paste_isbn_button.setIcon(QIcon(I('edit-paste.png'))) + self.paste_isbn_button.clicked.connect(self.identifiers.paste_isbn) self.publisher = PublisherEdit(self) self.basic_metadata_widgets.append(self.publisher) @@ -499,7 +512,8 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{ sto(one, two) sto(two, three) - tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1) + tl.addWidget(self.swap_title_author_button, 0, 0, 1, 1) + tl.addWidget(self.manage_authors_button, 1, 0, 1, 1) create_row(0, self.title, self.deduce_title_sort_button, self.title_sort) sto(self.title_sort, self.authors) @@ -508,6 +522,7 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{ create_row(2, self.series, self.remove_unused_series_button, self.series_index, icon='trash.png') sto(self.series_index, self.swap_title_author_button) + sto(self.swap_title_author_button, self.manage_authors_button) tl.addWidget(self.formats_manager, 0, 6, 3, 1) @@ -518,7 +533,7 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{ self.tabs[0].gb = gb = QGroupBox(_('Change cover'), self) gb.l = l = QGridLayout() gb.setLayout(l) - sto(self.swap_title_author_button, self.cover.buttons[0]) + sto(self.manage_authors_button, self.cover.buttons[0]) for i, b in enumerate(self.cover.buttons[:3]): l.addWidget(b, 0, i, 1, 1) sto(b, self.cover.buttons[i+1]) @@ -532,10 +547,16 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{ w.setLayout(w.l) l.setMargin(0) self.splitter.addWidget(w) - def create_row2(row, widget, button=None): + def create_row2(row, widget, button=None, front_button=None): row += 1 ql = BuddyLabel(widget) - l.addWidget(ql, row, 0, 1, 1) + if front_button: + ltl = QHBoxLayout() + ltl.addWidget(front_button) + ltl.addWidget(ql) + l.addLayout(ltl, row, 0, 1, 1) + else: + l.addWidget(ql, row, 0, 1, 1) l.addWidget(widget, row, 1, 1, 2 if button is None else 1) if button is not None: l.addWidget(button, row, 2, 1, 1) @@ -550,8 +571,10 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{ create_row2(1, self.rating) sto(self.rating, self.tags) create_row2(2, self.tags, self.tags_editor_button) - sto(self.tags_editor_button, self.identifiers) - create_row2(3, self.identifiers, self.clear_identifiers_button) + sto(self.tags_editor_button, self.paste_isbn_button) + sto(self.paste_isbn_button, self.identifiers) + create_row2(3, self.identifiers, self.clear_identifiers_button, + front_button=self.paste_isbn_button) sto(self.clear_identifiers_button, self.timestamp) create_row2(4, self.timestamp, self.timestamp.clear_button) sto(self.timestamp.clear_button, self.pubdate) @@ -648,6 +671,8 @@ class MetadataSingleDialogAlt1(MetadataSingleDialogBase): # {{{ sto(widget, tab_to) tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1) + tl.addWidget(self.manage_authors_button, 2, 0, 1, 1) + tl.addWidget(self.paste_isbn_button, 11, 0, 1, 1) create_row(0, self.title, self.title_sort, button=self.deduce_title_sort_button, span=2, @@ -669,6 +694,9 @@ class MetadataSingleDialogAlt1(MetadataSingleDialogBase): # {{{ button=self.timestamp.clear_button, icon='trash.png') create_row(11, self.identifiers, self.comments, button=self.clear_identifiers_button, icon='trash.png') + sto(self.clear_identifiers_button, self.swap_title_author_button) + sto(self.swap_title_author_button, self.manage_authors_button) + sto(self.manage_authors_button, self.paste_isbn_button) tl.addItem(QSpacerItem(1, 1, QSizePolicy.Fixed, QSizePolicy.Expanding), 12, 1, 1 ,1) @@ -708,7 +736,6 @@ class MetadataSingleDialogAlt1(MetadataSingleDialogBase): # {{{ gb = QGroupBox(_('Change cover'), tab1) l = QGridLayout() gb.setLayout(l) - sto(self.swap_title_author_button, self.cover.buttons[0]) for i, b in enumerate(self.cover.buttons[:3]): l.addWidget(b, 0, i, 1, 1) sto(b, self.cover.buttons[i+1]) @@ -780,6 +807,8 @@ class MetadataSingleDialogAlt2(MetadataSingleDialogBase): # {{{ sto(widget, tab_to) tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1) + tl.addWidget(self.manage_authors_button, 2, 0, 2, 1) + tl.addWidget(self.paste_isbn_button, 11, 0, 1, 1) create_row(0, self.title, self.title_sort, button=self.deduce_title_sort_button, span=2, @@ -801,6 +830,9 @@ class MetadataSingleDialogAlt2(MetadataSingleDialogBase): # {{{ button=self.timestamp.clear_button, icon='trash.png') create_row(11, self.identifiers, self.comments, button=self.clear_identifiers_button, icon='trash.png') + sto(self.clear_identifiers_button, self.swap_title_author_button) + sto(self.swap_title_author_button, self.manage_authors_button) + sto(self.manage_authors_button, self.paste_isbn_button) tl.addItem(QSpacerItem(1, 1, QSizePolicy.Fixed, QSizePolicy.Expanding), 12, 1, 1 ,1) @@ -842,7 +874,7 @@ class MetadataSingleDialogAlt2(MetadataSingleDialogBase): # {{{ lb = QGridLayout() gb.setLayout(lb) lb.addWidget(self.cover, 0, 0, 1, 3, alignment=Qt.AlignCenter) - sto(self.clear_identifiers_button, self.cover.buttons[0]) + sto(self.manage_authors_button, self.cover.buttons[0]) for i, b in enumerate(self.cover.buttons[:3]): lb.addWidget(b, 1, i, 1, 1) sto(b, self.cover.buttons[i+1]) From 200477bef67b542c9c757c4e0eb6df2921e93dcf Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 7 May 2011 12:10:29 +0100 Subject: [PATCH 02/23] Fix the user device to not use 0x0000 as a default ID. --- src/calibre/devices/user_defined/driver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/user_defined/driver.py b/src/calibre/devices/user_defined/driver.py index c496422255..d613a09508 100644 --- a/src/calibre/devices/user_defined/driver.py +++ b/src/calibre/devices/user_defined/driver.py @@ -68,9 +68,9 @@ class USER_DEFINED(USBMS): 'is prepended to any send_to_device template') + '', ] EXTRA_CUSTOMIZATION_DEFAULT = [ - '0x0000', - '0x0000', - '0x0000', + '0xffff', + '0xffff', + '0xffff', None, '', '', From d58cf62ffc9168e99328b096109466a4a7ee56a1 Mon Sep 17 00:00:00 2001 From: GRiker]*>
', lambda match: ''), + (r'!Yir2O&m({3DstDa0i{WIWDKG_$h1D$1We!>`rF$;BA8fQ1k4!t
s>?sJqzW*?M6Vd1!`R8T+2Mhpz0Py&o=d{A2MF0Q*07*qoM6N<$g5NItGynhq
literal 0
HcmV?d00001
diff --git a/recipes/ziuaveche.recipe b/recipes/ziuaveche.recipe
new file mode 100644
index 0000000000..61df768e0a
--- /dev/null
+++ b/recipes/ziuaveche.recipe
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+
+__license__ = 'GPL v3'
+__copyright__ = u'2011, Silviu Cotoar\u0103'
+'''
+ziuaveche.ro
+'''
+
+from calibre.web.feeds.news import BasicNewsRecipe
+
+class ZiuaVeche(BasicNewsRecipe):
+ title = u'Ziua Veche'
+ __author__ = u'Silviu Cotoar\u0103'
+ description = 'Cotidian online'
+ publisher = 'Ziua Veche'
+ oldest_article = 5
+ language = 'ro'
+ max_articles_per_feed = 100
+ no_stylesheets = True
+ use_embedded_content = False
+ category = 'Ziare,Cotidiane,Stiri'
+ encoding = 'utf-8'
+ cover_url = 'http://www.ziuaveche.ro/wp-content/themes/tema/images/zv-logo-alb-old.png'
+
+ conversion_options = {
+ 'comments' : description
+ ,'tags' : category
+ ,'language' : language
+ ,'publisher' : publisher
+ }
+
+
+ keep_only_tags = [
+ dict(name='div', attrs={'id':'singlePost'})
+
+ ]
+
+ remove_tags = [
+ dict(name='div', attrs={'id':'LikePluginPagelet'})
+
+ ]
+
+ remove_tags_after = [
+ dict(name='div', attrs={'id':'LikePluginPagelet'})
+ ]
+
+ feeds = [
+ (u'Feeds', u'http://www.ziuaveche.ro/feed/rss')
+ ]
+
+ def preprocess_html(self, soup):
+ return self.adeify_images(soup)
From 85e1100db35f9ddfaffcec619b67e6bd272c749b Mon Sep 17 00:00:00 2001
From: GRiker