mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error message if the user tries to import data while the content server is running
This commit is contained in:
parent
0f77ec7467
commit
4bbad155a3
@ -183,6 +183,7 @@ class ConnectShareAction(InterfaceAction):
|
||||
popup_type = QToolButton.InstantPopup
|
||||
|
||||
def genesis(self):
|
||||
self.content_server_is_running = False
|
||||
self.share_conn_menu = ShareConnMenu(self.gui)
|
||||
self.share_conn_menu.aboutToShow.connect(self.set_smartdevice_action_state)
|
||||
self.share_conn_menu.toggle_server.connect(self.toggle_content_server)
|
||||
@ -208,8 +209,10 @@ class ConnectShareAction(InterfaceAction):
|
||||
def content_server_state_changed(self, running):
|
||||
self.share_conn_menu.server_state_changed(running)
|
||||
if running:
|
||||
self.content_server_is_running = True
|
||||
self.qaction.setIcon(QIcon(I('connect_share_on.png')))
|
||||
else:
|
||||
self.content_server_is_running = False
|
||||
self.qaction.setIcon(QIcon(I('connect_share.png')))
|
||||
|
||||
def toggle_content_server(self):
|
||||
@ -285,5 +288,3 @@ class ConnectShareAction(InterfaceAction):
|
||||
ac = self.share_conn_menu.control_smartdevice_action
|
||||
ac.setIcon(QIcon(I('dot_%s.png'%icon)))
|
||||
ac.setText(text)
|
||||
|
||||
|
||||
|
@ -277,6 +277,14 @@ class EximDialog(Dialog):
|
||||
l.addStretch()
|
||||
|
||||
def validate_import(self):
|
||||
from calibre.gui2.ui import get_gui
|
||||
g = get_gui()
|
||||
if g is not None:
|
||||
if g.iactions['Connect Share'].content_server_is_running:
|
||||
error_dialog(self, _('Content Server running'), _(
|
||||
'Cannot import while the content server is running, shut it down first by clicking the'
|
||||
' Connect/share button on the calibre toolbar'), show=True)
|
||||
return False
|
||||
if self.import_panel.stack.currentIndex() == 0:
|
||||
error_dialog(self, _('No folder selected'), _(
|
||||
'You must select a folder containing the previously exported data that you wish to import'), show=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user