remove unnecessary setMod() calls

This commit is contained in:
Damien Elmes 2021-03-05 13:11:10 +10:00
parent 57d7e3e2ab
commit 605ad1c9ee
6 changed files with 1 additions and 14 deletions

View File

@ -214,7 +214,7 @@ class Collection:
ls = property(_get_ls, _set_ls)
# legacy
def setMod(self, mod: Optional[int] = None) -> None:
def setMod(self) -> None:
# this is now a no-op, as modifications to things like the config
# will mark the collection modified automatically
pass
@ -322,7 +322,6 @@ class Collection:
if check and not hooks.schema_will_change(proceed=True):
raise AnkiError("abortSchemaMod")
self.scm = intTime(1000)
self.setMod()
self.save()
def schemaChanged(self) -> Any:
@ -655,11 +654,9 @@ class Collection:
return default
def set_config(self, key: str, val: Any) -> None:
self.setMod()
self.conf.set(key, val)
def remove_config(self, key: str) -> None:
self.setMod()
self.conf.remove(key)
def all_config(self) -> Dict[str, Any]:
@ -670,14 +667,12 @@ class Collection:
return self._backend.get_config_bool(key)
def set_config_bool(self, key: Config.Bool.Key.V, value: bool) -> None:
self.setMod()
self._backend.set_config_bool(key=key, value=value)
def get_config_string(self, key: Config.String.Key.V) -> str:
return self._backend.get_config_string(key)
def set_config_string(self, key: Config.String.Key.V, value: str) -> None:
self.setMod()
self._backend.set_config_string(key=key, value=value)
# Stats

View File

@ -296,7 +296,6 @@ class AnkiExporter(Exporter):
self.dst.crt = self.src.crt
# todo: tags?
self.count = self.dst.cardCount()
self.dst.setMod()
self.postExport()
self.dst.close(downgrade=True)

View File

@ -166,7 +166,6 @@ class ModelManager:
def setCurrent(self, m: NoteType) -> None:
self.col.conf["curModel"] = m["id"]
self.col.setMod()
# Retrieving and creating models
#############################################################

View File

@ -855,13 +855,11 @@ QTableView {{ gridline-color: {grid} }}
if type == "noteFld":
ord = not ord
self.col.set_config_bool(Config.Bool.BROWSER_SORT_BACKWARDS, ord)
self.col.setMod()
self.col.save()
self.search()
else:
if self.col.get_config_bool(Config.Bool.BROWSER_SORT_BACKWARDS) != ord:
self.col.set_config_bool(Config.Bool.BROWSER_SORT_BACKWARDS, ord)
self.col.setMod()
self.col.save()
self.model.reverse()
self.setSortIndicator()

View File

@ -165,8 +165,6 @@ class Preferences(QDialog):
self.mw.col.set_preferences(self.prefs)
d.setMod()
# Network
######################################################################
@ -209,7 +207,6 @@ class Preferences(QDialog):
)
if self.form.fullSync.isChecked():
self.mw.col.modSchema(check=False)
self.mw.col.setMod()
# Backup
######################################################################

View File

@ -222,7 +222,6 @@ class Previewer(QDialog):
def _on_show_both_sides(self, toggle: bool) -> None:
self._show_both_sides = toggle
self.mw.col.set_config_bool(Config.Bool.PREVIEW_BOTH_SIDES, toggle)
self.mw.col.setMod()
if self._state == "answer" and not toggle:
self._state = "question"
self.render_card()