mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Change the automatic management checkbox into a pushbutton
This commit is contained in:
parent
42213fc01e
commit
6a96eb62f0
@ -5,9 +5,9 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import netifaces, socket
|
import netifaces
|
||||||
|
|
||||||
from PyQt4.Qt import (QDialog, QLineEdit, Qt)
|
from PyQt4.Qt import (QDialog, QLineEdit, Qt, QPushButton, QDialogButtonBox)
|
||||||
|
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre.gui2.dialogs.smartdevice_ui import Ui_Dialog
|
from calibre.gui2.dialogs.smartdevice_ui import Ui_Dialog
|
||||||
@ -81,13 +81,6 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
|
|||||||
'to the port, try another number. You can use any number between '
|
'to the port, try another number. You can use any number between '
|
||||||
'8,000 and 32,000.') + '</p>')
|
'8,000 and 32,000.') + '</p>')
|
||||||
|
|
||||||
self.enable_auto_management_box.setToolTip('<p>' +
|
|
||||||
_('If this box is checked, calibre will send any changes you made '
|
|
||||||
"to book's metadata when your device is connected. If it is not "
|
|
||||||
'checked, changes are sent only when you send the book. You can '
|
|
||||||
'get more information or change the preference to some other '
|
|
||||||
'choice at Preferences -> Send to device -> Metadata management')
|
|
||||||
+ '</p>')
|
|
||||||
|
|
||||||
self.ip_addresses.setToolTip('<p>' +
|
self.ip_addresses.setToolTip('<p>' +
|
||||||
_('These are the IP addresses detected by calibre for the computer '
|
_('These are the IP addresses detected by calibre for the computer '
|
||||||
@ -122,16 +115,29 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
|
|||||||
if pw:
|
if pw:
|
||||||
self.password_box.setText(pw)
|
self.password_box.setText(pw)
|
||||||
|
|
||||||
self.auto_management_is_set = False
|
auto_mgmt_button = QPushButton(_('Enable automatic metadata management'))
|
||||||
|
auto_mgmt_button.clicked.connect(self.auto_mgmt_button_clicked)
|
||||||
|
auto_mgmt_button.setToolTip('<p>' +
|
||||||
|
_('Enabling automatic metadata management tells calibre to send any '
|
||||||
|
'changes you made to books\' metadata when your device is '
|
||||||
|
'connected. If it is not enabled, changes are sent only when '
|
||||||
|
'you send a book. You can get more information or change this '
|
||||||
|
'preference to some other choice at Preferences -> '
|
||||||
|
'Send to device -> Metadata management')
|
||||||
|
+ '</p>')
|
||||||
|
self.buttonBox.addButton(auto_mgmt_button, QDialogButtonBox.ActionRole)
|
||||||
|
self.set_auto_management = False
|
||||||
if prefs['manage_device_metadata'] == 'on_connect':
|
if prefs['manage_device_metadata'] == 'on_connect':
|
||||||
self.enable_auto_management_box.setChecked(True)
|
auto_mgmt_button.setText(_('Automatic metadata management is enabled'))
|
||||||
self.enable_auto_management_box.setEnabled(False)
|
auto_mgmt_button.setEnabled(False)
|
||||||
self.auto_management_is_set = True
|
|
||||||
|
|
||||||
self.ip_addresses.setText(', '.join(get_all_ip_addresses()))
|
self.ip_addresses.setText(', '.join(get_all_ip_addresses()))
|
||||||
|
|
||||||
self.resize(self.sizeHint())
|
self.resize(self.sizeHint())
|
||||||
|
|
||||||
|
def auto_mgmt_button_clicked(self):
|
||||||
|
self.set_auto_management = True
|
||||||
|
|
||||||
def use_fixed_port_changed(self, state):
|
def use_fixed_port_changed(self, state):
|
||||||
self.fixed_port.setEnabled(state == Qt.Checked)
|
self.fixed_port.setEnabled(state == Qt.Checked)
|
||||||
|
|
||||||
@ -177,8 +183,7 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
|
|||||||
self.device_manager.set_option('smartdevice', 'port_number',
|
self.device_manager.set_option('smartdevice', 'port_number',
|
||||||
self.orig_port_number)
|
self.orig_port_number)
|
||||||
else:
|
else:
|
||||||
if not self.auto_management_is_set and \
|
if self.set_auto_management:
|
||||||
self.enable_auto_management_box.isChecked():
|
|
||||||
prefs.set('manage_device_metadata', 'on_connect')
|
prefs.set('manage_device_metadata', 'on_connect')
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
|
||||||
|
@ -125,13 +125,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="enable_auto_management_box">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Enable automatic sending of book metadata when your device connects</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0" colspan="3">
|
<item row="10" column="0" colspan="3">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user