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

View file

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

View file

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

View file

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

View file

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

View file

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