forked from sickmartian/quick_simplenote
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from RedAtman/dev
Dev
- Loading branch information
Showing
14 changed files
with
269 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import logging | ||
|
||
import sublime | ||
|
||
from .._config import CONFIG | ||
from .gui import edit_settings, remove_status, show_message | ||
from .operations import OperationManager | ||
|
||
|
||
logger = logging.getLogger() | ||
SIMPLENOTE_STARTED = False | ||
|
||
|
||
def sync(): | ||
manager = OperationManager() | ||
if not manager.running: | ||
sublime.run_command("simplenote_sync") | ||
else: | ||
logger.debug("Sync omitted") | ||
|
||
settings = sublime.load_settings(CONFIG.SIMPLENOTE_SETTINGS_FILE_PATH) | ||
sync_every = settings.get("sync_every", 0) | ||
logger.debug(("Simplenote sync_every", sync_every)) | ||
if not isinstance(sync_every, int): | ||
show_message("`sync_every` must be an integer. Please check settings file.") | ||
return | ||
|
||
if sync_every > 0: | ||
sublime.set_timeout(sync, sync_every * 1000) | ||
|
||
|
||
def start(): | ||
global SIMPLENOTE_STARTED | ||
settings = sublime.load_settings("Simplenote.sublime-settings") | ||
username = settings.get("username") | ||
password = settings.get("password") | ||
|
||
if username and password: | ||
sync() | ||
SIMPLENOTE_STARTED = True | ||
else: | ||
edit_settings() | ||
show_message("Simplenote: Please configure username/password, Please check settings file.") | ||
sublime.set_timeout(remove_status, 2000) | ||
SIMPLENOTE_STARTED = False | ||
return SIMPLENOTE_STARTED |
Oops, something went wrong.