-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeepsync_notes.py
More file actions
231 lines (220 loc) · 6.09 KB
/
Copy pathkeepsync_notes.py
File metadata and controls
231 lines (220 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/usr/bin/env python3
"""Compatibility entry point for KeepSync Notes."""
import sys
import customtkinter as ctk
from keepsync_app import (
DESKTOP_NOTIFICATIONS_AVAILABLE,
KeepSyncNotesApp,
desktop_notification,
)
from keepsync_app_info import APP_NAME, APP_VERSION, DB_VERSION
from keepsync_attachment_editing import (
IMAGE_FILETYPES,
ImageAttachmentBatchResult,
copy_image_attachments,
copy_image_attachment,
is_supported_image_path,
note_attachment_dir,
parse_drop_file_paths,
save_clipboard_image_attachment,
unique_attachment_path,
)
from keepsync_audio_recording import (
AUDIO_MIME_TYPE,
DEFAULT_WHISPER_MODEL,
AudioRecorder,
AudioRecordingError,
AudioTranscriptionError,
append_audio_transcript,
save_audio_attachment,
transcribe_audio_file,
write_wav_file,
)
from keepsync_clipboard_import import (
CLIPBOARD_HISTORY_AVAILABLE,
clipboard_items_to_notes,
fetch_clipboard_text_items,
)
from keepsync_daily_review import pick_review_notes, review_summary
from keepsync_dragdrop import drop_copy_action, enable_file_drop
from keepsync_encrypted_backup import (
EncryptedBackupResult,
create_encrypted_backup,
read_backup_header,
restore_encrypted_backup,
)
from keepsync_backups import LocalBackupManager
from keepsync_bootstrap import run_bootstrap
from keepsync_cloud_plan import (
build_cloud_sync_plan,
cloud_base_versions,
cloud_plan_counts,
note_data_hash,
save_cloud_conflict_copy,
)
from keepsync_cloud_sync import (
CloudSyncManager,
CloudSyncProvider,
GitHubSync,
GoogleDriveSync,
)
from keepsync_credentials import (
GDRIVE_OAUTH_TOKEN_CREDENTIAL,
GITHUB_PAT_CREDENTIAL,
KEEP_MASTER_TOKEN_CREDENTIAL,
KEYRING_AVAILABLE,
KeyringCredentialStore,
migrate_file_secret,
migrate_setting_secret,
store_file_secret,
)
from keepsync_diagnostics import (
DiagnosticsManager,
log_diagnostic_event,
log_diagnostic_exception,
set_diagnostics_manager,
)
from keepsync_folders import (
FOLDER_SEPARATOR,
folder_display_name,
folder_path_depth,
folder_paths_from_label,
folder_paths_from_labels,
normalize_folder_path,
note_matches_folder,
)
from keepsync_import_reports import IMPORT_SUCCESS_STATUSES, import_summary_lines
from keepsync_import_safety import (
MAX_IMPORT_FOLDER_BYTES,
MAX_IMPORT_FOLDER_FILES,
MAX_IMPORT_TEXT_MEMBER_BYTES,
MAX_IMPORT_ZIP_MEMBERS,
MAX_IMPORT_ZIP_UNCOMPRESSED_BYTES,
ImportCancelled,
ImportSafetyError,
decode_zip_member,
extract_zip_member_safely,
guarded_import_files,
is_hidden_or_system_path,
safe_zip_member_parts,
validate_zip_members,
)
from keepsync_importers import (
HTMLTextExtractor,
MultiSourceImporter,
extract_shared_with,
html_to_text,
import_takeout_attachments,
parse_external_datetime,
)
import keepsync_keep_sync as keep_sync_state
from keepsync_keep_sync import (
GKEEPAPI_AVAILABLE,
KeepSyncEngine,
KeepWebScraper,
extract_token_from_browser,
get_master_token_cli,
)
from keepsync_models import (
Attachment,
ChecklistItem,
KEEP_COLOR_ALIASES,
KEEP_COLOR_PALETTE,
Label,
Note,
NoteType,
SyncStatus,
clamp_checklist_indent,
guess_attachment_mime,
keep_color_hex,
keep_color_name,
normalize_keep_color,
normalize_people,
sanitize_filename,
)
from keepsync_markdown_editing import MARKDOWN_PLACEHOLDERS, format_markdown_selection
from keepsync_markdown_export import (
MarkdownVaultExportResult,
export_markdown_vault,
render_note_markdown,
)
from keepsync_pdf_export import PdfExportResult, export_pdf_book
from keepsync_note_editor import NoteEditor
from keepsync_ocr import OCR_AVAILABLE, append_ocr_text, ocr_image, ocr_note_attachments
from keepsync_note_ops import (
advanced_filters_active,
default_advanced_filters,
merge_note_conflict,
normalize_import_labels,
note_conflict_diff,
note_matches_advanced_filters,
note_diff_body,
notes_equivalent,
parse_filter_date,
)
from keepsync_note_text import (
format_reminder_datetime,
is_markdown_label,
markdown_preview_blocks,
markdown_preview_text,
note_uses_markdown,
parse_reminder_datetime,
split_inline_markdown,
)
from keepsync_semantic_search import SEMANTIC_SEARCH_AVAILABLE, SemanticIndex
from keepsync_paths import (
get_app_data_dir,
get_google_drive_credentials_path,
get_google_drive_token_path,
)
from keepsync_settings_dialog import SettingsDialog
from keepsync_storage import DatabaseManager
from keepsync_tag_graph import (
TagEdge,
TagGraph,
TagNode,
build_tag_graph,
normalized_note_labels,
tag_graph_summary_lines,
)
from keepsync_theme import COLORS
from keepsync_tray import TRAY_AVAILABLE, SystemTray
from keepsync_ui_components import (
IconManager,
NoteCard,
SyncStatusBadge,
configure_note_card_helpers,
)
from keepsync_ui_dialogs import (
AdvancedFilterDialog,
DiagnosticsDialog,
ImportConflictDialog,
ImportProgressDialog,
TakeoutInstructionsDialog,
TokenGeneratorDialog,
)
from keepsync_ui_modal import configure_modal_dialog
configure_note_card_helpers(
note_uses_markdown_func=note_uses_markdown,
markdown_preview_text_func=markdown_preview_text,
format_reminder_datetime_func=format_reminder_datetime,
)
SECURE_CREDENTIALS = keep_sync_state.SECURE_CREDENTIALS
def set_secure_credential_store(store):
"""Swap the credential store for tests while preserving app-level compatibility."""
global SECURE_CREDENTIALS
keep_sync_state.set_secure_credential_store(store)
SECURE_CREDENTIALS = keep_sync_state.SECURE_CREDENTIALS
def main(argv=None):
args = sys.argv if argv is None else argv
return run_bootstrap(
args,
app_factory=KeepSyncNotesApp,
token_cli=get_master_token_cli,
app_name=APP_NAME,
app_version=APP_VERSION,
set_appearance_mode=ctk.set_appearance_mode,
set_default_color_theme=ctk.set_default_color_theme,
)
if __name__ == "__main__":
sys.exit(main())