Skip to content

Commit

Permalink
Refactor: Rename sync_every to sync_interval
Browse files Browse the repository at this point in the history
Renamed the `sync_every` setting to `sync_interval` for clarity and consistency. This improves the readability and understanding of the plugin's settings.
  • Loading branch information
RedAtman committed Aug 3, 2024
1 parent 55b5857 commit f5e91e6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ After setting them it will download the notes.
Hit the shortcut again after the download is done (check the message bar) and it will **show a list of the notes**:
![Alt Notes](assets/images/note_list.png "Note List")

It will download notes every time sublime text is launched and every now and then if the _sync_every_ configuration is enabled (has a positive value), so take a look at the bar to check the status.
It will download notes every time sublime text is launched and every now and then if the _sync_interval_ configuration is enabled (has a positive value), so take a look at the bar to check the status.

If a note gets updated from somewhere else
![Alt External Update](http://i.imgur.com/p9pAY6z.png "External Update")
Expand Down
4 changes: 2 additions & 2 deletions Simplenote.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// --------------------------------
// Sync when sublime text starts:
,"autostart": true
// Sync automatically (in seconds)
,"sync_every": 30
// Sync automatically interval (in seconds)
,"sync_interval": 30
// Number of notes synchronized each time
,"sync_note_number": 1000
// Conflict resolution (If a file was edited on another client and also here, on sync..)
Expand Down
2 changes: 1 addition & 1 deletion _config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// Sync when sublime text starts:
,"autostart": true
// Sync automatically (in seconds)
,"sync_every": 30
,"sync_interval": 30
// Number of notes synchronized each time
,"sync_note_number": 1000
// Conflict resolution (If a file was edited on another client and also here, on sync..)
Expand Down
14 changes: 7 additions & 7 deletions lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def sync_once():
logger.debug("Sync omitted")


def sync(sync_every: int = 30):
def sync(sync_interval: int = 30):
sync_once()
sublime.set_timeout(sync, sync_every * 1000)
sublime.set_timeout(sync, sync_interval * 1000)


def start():
Expand All @@ -52,13 +52,13 @@ def start():
if username and password:
if global_storage.get(CONFIG.SIMPLENOTE_SYNC_TIMES_KEY) != 0:
return
sync_every = settings.get("sync_every", 0)
if not isinstance(sync_every, int):
show_message("`sync_every` must be an integer. Please check settings file.")
sync_interval = settings.get("sync_interval", 30)
if not isinstance(sync_interval, int):
show_message("`sync_interval` must be an integer. Please check settings file.")
return
if sync_every <= 0:
if sync_interval <= 0:
return
sync(sync_every)
sync(sync_interval)
return
show_message("Simplenote: Please configure username/password in settings file.")
edit_settings()
Expand Down
1 change: 0 additions & 1 deletion lib/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def on_select(list__modificationDate: List[float], selected_index: int):


def show_quick_panel(first_sync: bool = False):
logger.warning("show_quick_panel")
if Note.tree.count <= 0:
show_message(
"No notes found. Please wait for the synchronization to complete, or press [super+shift+s, super+shift+c] to create a note."
Expand Down

0 comments on commit f5e91e6

Please sign in to comment.