From 55acb0c87cc83fa626dc39de11333fe6dcab4888 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 30 Dec 2014 13:18:23 -0600 Subject: [PATCH] WIP - ini edit, error check and syntax highlighting. --- calibre-plugin/config.py | 20 +++++++++++++------- calibre-plugin/dialogs.py | 23 +++++++++++++++-------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index 2e4d2a8..c646877 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -597,10 +597,14 @@ class PersonalIniTab(QWidget): label = QLabel(_('These settings provide more detailed control over what metadata will be displayed inside the ebook as well as let you set %(isa)s and %(u)s/%(p)s for different sites.')%no_trans) label.setWordWrap(True) self.l.addWidget(label) - self.l.addSpacing(5) +# self.l.addSpacing(5) + + label = QLabel(_("New: This experimental version includes find, color coding, and error checking. Red generally indicates errors. Not all errors can be found.")) + label.setWordWrap(True) + self.l.addWidget(label) - self.label = QLabel('personal.ini:') - self.l.addWidget(self.label) + # self.label = QLabel('personal.ini:') + # self.l.addWidget(self.label) # self.ini = QTextEdit(self) # try: @@ -619,14 +623,16 @@ class PersonalIniTab(QWidget): self.ini_button.clicked.connect(self.add_ini_button) self.l.addWidget(self.ini_button) - - self.defaults = QPushButton(_('View Defaults')+' (plugin-defaults.ini)', self) self.defaults.setToolTip(_("View all of the plugin's configurable settings\nand their default settings.")) self.defaults.clicked.connect(self.show_defaults) self.l.addWidget(self.defaults) + + label = QLabel(_("Changes will only be saved if you click 'OK' to leave Customize FFDL.")) + label.setWordWrap(True) + self.l.addWidget(label) - # self.l.insertStretch(-1) + self.l.insertStretch(-1) # let edit box fill the space. def show_defaults(self): @@ -659,7 +665,7 @@ class PersonalIniTab(QWidget): if errors: retry = errors_dialog(self.plugin_action.gui, _('Go back to fix errors?'), - '

'+'

'.join([ '%s %s'%e for e in errors ])+'

') + '

'+'

'.join([ '(lineno: %s) %s'%e for e in errors ])+'

') else: retry = False diff --git a/calibre-plugin/dialogs.py b/calibre-plugin/dialogs.py index b522651..a066ac2 100644 --- a/calibre-plugin/dialogs.py +++ b/calibre-plugin/dialogs.py @@ -1344,20 +1344,27 @@ class ViewLog(SizePersistedDialog): self.l = l = QVBoxLayout() self.setLayout(l) + label = QLabel(_('Eventually I intend for errors to be clickable and take you to the error in the file. For now, use copy and Find.')) + label.setWordWrap(True) + self.l.addWidget(label) + self.tb = QTextBrowser(self) self.tb.setFont(QFont("Courier", parent.font().pointSize()+1)) self.tb.setHtml(html) l.addWidget(self.tb) - self.bb = QDialogButtonBox(QDialogButtonBox.Yes | QDialogButtonBox.No) - self.bb.accepted.connect(self.accept) - self.bb.rejected.connect(self.reject) - # self.copy_button = self.bb.addButton(_('Copy to clipboard'), - # self.bb.ActionRole) - # self.copy_button.setIcon(QIcon(I('edit-copy.png'))) - # self.copy_button.clicked.connect(self.copy_to_clipboard) - l.addWidget(self.bb) + horz = QHBoxLayout() + + editagain = QPushButton(_('Edit Ini Again'), self) + editagain.clicked.connect(self.accept) + horz.addWidget(editagain) + + saveanyway = QPushButton(_('Save Ini Anyway'), self) + saveanyway.clicked.connect(self.reject) + horz.addWidget(saveanyway) + + l.addLayout(horz) self.setModal(False) self.setWindowTitle(title) self.setWindowIcon(QIcon(I('debug.png')))