add string for media log title, and add button in prefs to access it

This commit is contained in:
Damien Elmes 2020-02-27 12:22:24 +10:00
parent b4c3bf99ab
commit e439e8cdec
5 changed files with 42 additions and 7 deletions

View file

@ -158,10 +158,12 @@ class MediaSyncDialog(QDialog):
self._close_when_done = close_when_done self._close_when_done = close_when_done
self.form = aqt.forms.synclog.Ui_Dialog() self.form = aqt.forms.synclog.Ui_Dialog()
self.form.setupUi(self) self.form.setupUi(self)
self.setWindowTitle(tr(FString.SYNC_MEDIA_LOG_TITLE))
self.abort_button = QPushButton(tr(FString.SYNC_ABORT_BUTTON)) self.abort_button = QPushButton(tr(FString.SYNC_ABORT_BUTTON))
self.abort_button.clicked.connect(self._on_abort) # type: ignore self.abort_button.clicked.connect(self._on_abort) # type: ignore
self.abort_button.setAutoDefault(False) self.abort_button.setAutoDefault(False)
self.form.buttonBox.addButton(self.abort_button, QDialogButtonBox.ActionRole) self.form.buttonBox.addButton(self.abort_button, QDialogButtonBox.ActionRole)
self.abort_button.setHidden(not self._syncer.is_syncing())
gui_hooks.media_sync_did_progress.append(self._on_log_entry) gui_hooks.media_sync_did_progress.append(self._on_log_entry)
gui_hooks.media_sync_did_start_or_stop.append(self._on_start_stop) gui_hooks.media_sync_did_start_or_stop.append(self._on_start_stop)

View file

@ -10,7 +10,7 @@ import aqt
from anki.lang import _ from anki.lang import _
from aqt import AnkiQt from aqt import AnkiQt
from aqt.qt import * from aqt.qt import *
from aqt.utils import askUser, openHelp, showInfo, showWarning from aqt.utils import askUser, openHelp, showInfo, showWarning, tr, FString
class Preferences(QDialog): class Preferences(QDialog):
@ -177,6 +177,8 @@ class Preferences(QDialog):
###################################################################### ######################################################################
def setupNetwork(self): def setupNetwork(self):
self.form.media_log.setText(tr(FString.SYNC_MEDIA_LOG_BUTTON))
self.form.media_log.clicked.connect(self.on_media_log)
self.form.syncOnProgramOpen.setChecked(self.prof["autoSync"]) self.form.syncOnProgramOpen.setChecked(self.prof["autoSync"])
self.form.syncMedia.setChecked(self.prof["syncMedia"]) self.form.syncMedia.setChecked(self.prof["syncMedia"])
if not self.prof["syncKey"]: if not self.prof["syncKey"]:
@ -185,6 +187,9 @@ class Preferences(QDialog):
self.form.syncUser.setText(self.prof.get("syncUser", "")) self.form.syncUser.setText(self.prof.get("syncUser", ""))
self.form.syncDeauth.clicked.connect(self.onSyncDeauth) self.form.syncDeauth.clicked.connect(self.onSyncDeauth)
def on_media_log(self):
self.mw.media_syncer.show_sync_log()
def _hideAuth(self): def _hideAuth(self):
self.form.syncDeauth.setVisible(False) self.form.syncDeauth.setVisible(False)
self.form.syncUser.setText("") self.form.syncUser.setText("")

View file

@ -371,6 +371,30 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="media_log">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -542,10 +566,10 @@
<tabstop>lrnCutoff</tabstop> <tabstop>lrnCutoff</tabstop>
<tabstop>timeLimit</tabstop> <tabstop>timeLimit</tabstop>
<tabstop>numBackups</tabstop> <tabstop>numBackups</tabstop>
<tabstop>syncOnProgramOpen</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>fullSync</tabstop>
<tabstop>syncMedia</tabstop> <tabstop>syncMedia</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>syncOnProgramOpen</tabstop>
<tabstop>fullSync</tabstop>
<tabstop>syncDeauth</tabstop> <tabstop>syncDeauth</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>

View file

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Sync</string> <string/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>

View file

@ -12,11 +12,15 @@ sync-media-failed = Media sync failed.
sync-media-aborting = Media sync aborting... sync-media-aborting = Media sync aborting...
sync-media-aborted = Media sync aborted. sync-media-aborted = Media sync aborted.
# shown in the sync log to indicate media syncing will not be done because it # Shown in the sync log to indicate media syncing will not be done, because it
# was previously disabled by the user in the preferences screen # was previously disabled by the user in the preferences screen.
sync-media-disabled = Media sync disabled. sync-media-disabled = Media sync disabled.
sync-abort-button = Abort sync-abort-button = Abort
sync-media-log-button = Media Log
# Title of the screen that shows syncing progress history
sync-media-log-title = Media Sync Log
## Error messages ## Error messages