mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get rid of another .ui file
This commit is contained in:
parent
77a4fdd8b0
commit
006a633585
@ -7,18 +7,20 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from PyQt5.Qt import QDialog, QApplication
|
from PyQt5.Qt import (
|
||||||
|
QDialog, QApplication, QIcon, QVBoxLayout, QHBoxLayout, QDialogButtonBox,
|
||||||
|
QPlainTextEdit, QPushButton, QLabel, QLineEdit
|
||||||
|
)
|
||||||
|
|
||||||
from calibre.gui2.dialogs.add_from_isbn_ui import Ui_Dialog
|
|
||||||
from calibre.ebooks.metadata import check_isbn
|
from calibre.ebooks.metadata import check_isbn
|
||||||
from calibre.constants import iswindows
|
from calibre.constants import iswindows
|
||||||
from calibre.gui2 import gprefs, question_dialog, error_dialog
|
from calibre.gui2 import gprefs, question_dialog, error_dialog
|
||||||
|
|
||||||
class AddFromISBN(QDialog, Ui_Dialog):
|
class AddFromISBN(QDialog):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setup_ui()
|
||||||
|
|
||||||
path = r'C:\Users\kovid\e-books\some_book.epub' if iswindows else \
|
path = r'C:\Users\kovid\e-books\some_book.epub' if iswindows else \
|
||||||
'/Users/kovid/e-books/some_book.epub'
|
'/Users/kovid/e-books/some_book.epub'
|
||||||
@ -30,6 +32,39 @@ class AddFromISBN(QDialog, Ui_Dialog):
|
|||||||
self.paste_button.clicked.connect(self.paste)
|
self.paste_button.clicked.connect(self.paste)
|
||||||
self.add_tags.setText(', '.join(gprefs.get('add from ISBN tags', [])))
|
self.add_tags.setText(', '.join(gprefs.get('add from ISBN tags', [])))
|
||||||
|
|
||||||
|
def setup_ui(self):
|
||||||
|
self.resize(678, 430)
|
||||||
|
self.setWindowTitle(_("Add books by ISBN"))
|
||||||
|
self.setWindowIcon(QIcon(I('add_book.png')))
|
||||||
|
self.l = l = QVBoxLayout(self)
|
||||||
|
self.h = h = QHBoxLayout()
|
||||||
|
l.addLayout(h)
|
||||||
|
self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, self)
|
||||||
|
l.addWidget(bb), bb.accepted.connect(self.accept), bb.rejected.connect(self.reject)
|
||||||
|
self.ll = l = QVBoxLayout()
|
||||||
|
h.addLayout(l)
|
||||||
|
self.isbn_box = i = QPlainTextEdit(self)
|
||||||
|
l.addWidget(i)
|
||||||
|
self.paste_button = b = QPushButton(_("&Paste from clipboard"), self)
|
||||||
|
l.addWidget(b), b.clicked.connect(self.paste)
|
||||||
|
self.lll = l = QVBoxLayout()
|
||||||
|
h.addLayout(l)
|
||||||
|
self.label = la = QLabel(_(
|
||||||
|
"<p>Enter a list of ISBNs in the box to the left, one per line. calibre will automatically"
|
||||||
|
" create entries for books based on the ISBN and download metadata and covers for them.</p>\n"
|
||||||
|
"<p>Any invalid ISBNs in the list will be ignored.</p>\n"
|
||||||
|
"<p>You can also specify a file that will be added with each ISBN. To do this enter the full"
|
||||||
|
" path to the file after a <code>>></code>. For example:</p>\n"
|
||||||
|
"<p><code>9788842915232 >> %s</code></p>"), self)
|
||||||
|
l.addWidget(la), la.setWordWrap(True)
|
||||||
|
l.addSpacing(20)
|
||||||
|
self.la2 = la = QLabel(_("&Tags to set on created book entries:"), self)
|
||||||
|
l.addWidget(la)
|
||||||
|
self.add_tags = le = QLineEdit(self)
|
||||||
|
la.setBuddy(le)
|
||||||
|
l.addWidget(le)
|
||||||
|
l.addStretch(10)
|
||||||
|
|
||||||
def paste(self, *args):
|
def paste(self, *args):
|
||||||
app = QApplication.instance()
|
app = QApplication.instance()
|
||||||
c = app.clipboard()
|
c = app.clipboard()
|
||||||
|
@ -1,127 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Dialog</class>
|
|
||||||
<widget class="QDialog" name="Dialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>678</width>
|
|
||||||
<height>430</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Add books by ISBN</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="../../../../resources/images.qrc">
|
|
||||||
<normaloff>:/images/add_book.png</normaloff>:/images/add_book.png</iconset>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0" rowspan="2">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QPlainTextEdit" name="isbn_box"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="paste_button">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Paste from clipboard</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string><p>Enter a list of ISBNs in the box to the left, one per line. calibre will automatically create entries for books based on the ISBN and download metadata and covers for them.</p>
|
|
||||||
<p>Any invalid ISBNs in the list will be ignored.</p>
|
|
||||||
<p>You can also specify a file that will be added with each ISBN. To do this enter the full path to the file after a <code>>></code>. For example:</p>
|
|
||||||
<p><code>9788842915232 >> %s</code></p></string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Tags to set on created book entries:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>add_tags</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="add_tags"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources>
|
|
||||||
<include location="../../../../resources/images.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>Dialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>Dialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
Loading…
x
Reference in New Issue
Block a user