mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a button to easily clear server logs in Preferences->Sharing over the net->Show server logs. Fixes #1730046 [Add a button to clear Content server log](https://bugs.launchpad.net/calibre/+bug/1730046)
This commit is contained in:
parent
d5445e6ef1
commit
0ada98b5ec
@ -1059,6 +1059,21 @@ class ConfigWidget(ConfigWidgetBase):
|
||||
bx = QDialogButtonBox(QDialogButtonBox.Ok)
|
||||
layout.addWidget(bx)
|
||||
bx.accepted.connect(d.accept)
|
||||
b = bx.addButton(_('&Clear logs'), bx.ActionRole)
|
||||
|
||||
def clear_logs():
|
||||
if getattr(self.server, 'is_running', False):
|
||||
return error_dialog(d, _('Server running'), _(
|
||||
'Cannot clear logs while the server is running. First stop the server.'), show=True)
|
||||
for x in (log_error_file, log_access_file):
|
||||
try:
|
||||
os.remove(x)
|
||||
except EnvironmentError as err:
|
||||
if err.errno != errno.ENOENT:
|
||||
raise
|
||||
el.setPlainText(''), al.setPlainText('')
|
||||
|
||||
b.clicked.connect(clear_logs)
|
||||
d.show()
|
||||
|
||||
def save_changes(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user