eagle-cooler 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1078 @@
1
+ from typing import Optional, Dict, Any, List
2
+
3
+ # get script path
4
+ import os
5
+ import sys
6
+
7
+ from eagle_cooler.core import EagleCoolerCore
8
+
9
+ _script_path = os.path.join(os.getcwd(), "main.py")
10
+ _script_dir = os.getcwd()
11
+ _plugin_manifest = None
12
+ # check if plugin.json exists in parent _script_path
13
+ if os.path.exists(os.path.join(_script_dir, "plugin.json")):
14
+ import json
15
+
16
+ with open(
17
+ os.path.join(_script_dir, "plugin.json"), "r", encoding="utf-8"
18
+ ) as f:
19
+ _plugin_manifest = json.load(f)
20
+
21
+ _stderr = sys.stderr
22
+
23
+
24
+ class EagleCallbackCore:
25
+ """
26
+ this class is used for PowerEagle python-script plugins to callback to the host plugin
27
+ using stderr for handshake
28
+
29
+ the signal being passed is $$${api token}$$${plugin id}$$${method to call}({varname}={value}, ...)(({map}))
30
+
31
+ for example
32
+
33
+ $$${api token}$$${plugin id}$$$folder.createSubfolder(parentId=123)((options))(name=New Folder)(description=This is a new folder)((options))
34
+
35
+ will call
36
+ await eagle.folder.createSubfolder(parentId=123, options={name: "New Folder", description: "This is a new folder"})
37
+ """
38
+
39
+ @staticmethod
40
+ def _callback(method: str, kwargs: dict):
41
+ if _plugin_manifest is None:
42
+ raise Exception("plugin.json not found in script directory")
43
+ plugin_id = _plugin_manifest.get("id")
44
+ token = EagleCoolerCore.token()
45
+ if token is None:
46
+ raise Exception(
47
+ "POWEREAGLE_CONTEXT environment variable not found, are you running inside PowerEagle?"
48
+ )
49
+ signal = f"$$${token}$$${plugin_id}$$${method}"
50
+ for k, v in kwargs.items():
51
+ if isinstance(v, dict):
52
+ signal += f"(({k}))"
53
+ for mk, mv in v.items():
54
+ signal += f"({mk}={mv})"
55
+ signal += f"(({k}))"
56
+ else:
57
+ signal += f"({k}={v})"
58
+ print(signal, file=_stderr)
59
+ _stderr.flush()
60
+
61
+
62
+ # List of methods that return values and cannot be implemented with the callback system
63
+ METHODS_WITH_RETURN_VALUES = [
64
+ # Tag methods
65
+ "tag.get",
66
+ "tag.get_recents",
67
+ # TagGroup methods
68
+ "tag_group.get",
69
+ "tag_group.create",
70
+ # Library methods
71
+ "library.info",
72
+ "library.get_name",
73
+ "library.get_path",
74
+ "library.get_modification_time",
75
+ # Window methods
76
+ "window.is_minimized",
77
+ "window.is_maximized",
78
+ "window.is_full_screen",
79
+ "window.get_size",
80
+ "window.get_bounds",
81
+ "window.is_resizable",
82
+ "window.is_always_on_top",
83
+ "window.get_position",
84
+ "window.get_opacity",
85
+ # App methods
86
+ "app.is_dark_colors",
87
+ "app.get_path",
88
+ "app.get_file_icon",
89
+ "app.get_version",
90
+ "app.get_build",
91
+ "app.get_locale",
92
+ "app.get_arch",
93
+ "app.get_platform",
94
+ "app.get_env",
95
+ "app.get_exec_path",
96
+ "app.get_pid",
97
+ "app.is_windows",
98
+ "app.is_mac",
99
+ "app.is_running_under_arm64_translation",
100
+ "app.get_theme",
101
+ # OS methods
102
+ "os.tmpdir",
103
+ "os.version",
104
+ "os.type",
105
+ "os.release",
106
+ "os.hostname",
107
+ "os.homedir",
108
+ "os.arch",
109
+ # Screen methods
110
+ "screen.get_cursor_screen_point",
111
+ "screen.get_primary_display",
112
+ "screen.get_all_displays",
113
+ "screen.get_display_nearest_point",
114
+ # Item methods
115
+ "item.get",
116
+ "item.get_all",
117
+ "item.get_by_id",
118
+ "item.get_by_ids",
119
+ "item.get_selected",
120
+ "item.add_from_url",
121
+ "item.add_from_base64",
122
+ "item.add_from_path",
123
+ "item.add_bookmark",
124
+ "item.open",
125
+ # Folder methods
126
+ "folder.create",
127
+ "folder.create_subfolder",
128
+ "folder.get",
129
+ "folder.get_all",
130
+ "folder.get_by_id",
131
+ "folder.get_by_ids",
132
+ "folder.get_selected",
133
+ "folder.get_recents",
134
+ # Dialog methods
135
+ "dialog.show_open_dialog",
136
+ "dialog.show_save_dialog",
137
+ #"dialog.show_message_box",
138
+ # Clipboard methods
139
+ "clipboard.has",
140
+ "clipboard.read_text",
141
+ "clipboard.read_buffer",
142
+ "clipboard.read_image",
143
+ "clipboard.read_html",
144
+ ]
145
+
146
+
147
+ class EagleCallback:
148
+ """Python interface for Eagle native API methods"""
149
+
150
+ class _Tag:
151
+ """Tag-related API methods"""
152
+
153
+ @staticmethod
154
+ def get():
155
+ """Returns all tags"""
156
+ raise NotImplementedError(
157
+ "tag.get returns data and cannot be used with callback system. Use EagleWebApi instead."
158
+ )
159
+
160
+ @staticmethod
161
+ def get_recents():
162
+ """Returns recently used tags"""
163
+ raise NotImplementedError(
164
+ "tag.get_recents returns data and cannot be used with callback system. Use EagleWebApi instead."
165
+ )
166
+
167
+ class _TagGroup:
168
+ """TagGroup-related API methods"""
169
+
170
+ @staticmethod
171
+ def get():
172
+ """Returns all tag groups"""
173
+ raise NotImplementedError(
174
+ "tag_group.get returns data and cannot be used with callback system. Use EagleWebApi instead."
175
+ )
176
+
177
+ @staticmethod
178
+ def create(name: str, color: str, tags: List[str]):
179
+ """Creates a new tag group - returns created group data"""
180
+ raise NotImplementedError(
181
+ "tag_group.create returns data and cannot be used with callback system. Use EagleWebApi instead."
182
+ )
183
+
184
+ class _Library:
185
+ """Library-related API methods"""
186
+
187
+ @staticmethod
188
+ def info():
189
+ """Gets library information"""
190
+ raise NotImplementedError(
191
+ "library.info returns data and cannot be used with callback system. Use EagleWebApi instead."
192
+ )
193
+
194
+ @staticmethod
195
+ def get_name():
196
+ """Gets library name"""
197
+ raise NotImplementedError(
198
+ "library.get_name returns data and cannot be used with callback system. Use EagleWebApi instead."
199
+ )
200
+
201
+ @staticmethod
202
+ def get_path():
203
+ """Gets library path"""
204
+ raise NotImplementedError(
205
+ "library.get_path returns data and cannot be used with callback system. Use EagleWebApi instead."
206
+ )
207
+
208
+ @staticmethod
209
+ def get_modification_time():
210
+ """Gets library modification time"""
211
+ raise NotImplementedError(
212
+ "library.get_modification_time returns data and cannot be used with callback system. Use EagleWebApi instead."
213
+ )
214
+
215
+ class _Window:
216
+ """Window-related API methods"""
217
+
218
+ @staticmethod
219
+ def show():
220
+ """Shows the window"""
221
+ EagleCallbackCore._callback("window.show", {})
222
+
223
+ @staticmethod
224
+ def show_inactive():
225
+ """Shows the window without focusing"""
226
+ EagleCallbackCore._callback("window.showInactive", {})
227
+
228
+ @staticmethod
229
+ def hide():
230
+ """Hides the window"""
231
+ EagleCallbackCore._callback("window.hide", {})
232
+
233
+ @staticmethod
234
+ def focus():
235
+ """Focuses the window"""
236
+ EagleCallbackCore._callback("window.focus", {})
237
+
238
+ @staticmethod
239
+ def minimize():
240
+ """Minimizes the window"""
241
+ EagleCallbackCore._callback("window.minimize", {})
242
+
243
+ @staticmethod
244
+ def is_minimized():
245
+ """Checks if window is minimized"""
246
+ raise NotImplementedError(
247
+ "window.is_minimized returns data and cannot be used with callback system."
248
+ )
249
+
250
+ @staticmethod
251
+ def restore():
252
+ """Restores the window"""
253
+ EagleCallbackCore._callback("window.restore", {})
254
+
255
+ @staticmethod
256
+ def maximize():
257
+ """Maximizes the window"""
258
+ EagleCallbackCore._callback("window.maximize", {})
259
+
260
+ @staticmethod
261
+ def unmaximize():
262
+ """Unmaximizes the window"""
263
+ EagleCallbackCore._callback("window.unmaximize", {})
264
+
265
+ @staticmethod
266
+ def is_maximized():
267
+ """Checks if window is maximized"""
268
+ raise NotImplementedError(
269
+ "window.is_maximized returns data and cannot be used with callback system."
270
+ )
271
+
272
+ @staticmethod
273
+ def set_full_screen(flag: bool):
274
+ """Sets fullscreen mode"""
275
+ EagleCallbackCore._callback("window.setFullScreen", {"flag": flag})
276
+
277
+ @staticmethod
278
+ def is_full_screen():
279
+ """Checks if window is in fullscreen"""
280
+ raise NotImplementedError(
281
+ "window.is_full_screen returns data and cannot be used with callback system."
282
+ )
283
+
284
+ @staticmethod
285
+ def set_aspect_ratio(aspect_ratio: float):
286
+ """Sets window aspect ratio"""
287
+ EagleCallbackCore._callback(
288
+ "window.setAspectRatio", {"aspectRatio": aspect_ratio}
289
+ )
290
+
291
+ @staticmethod
292
+ def set_background_color(background_color: str):
293
+ """Sets window background color"""
294
+ EagleCallbackCore._callback(
295
+ "window.setBackgroundColor", {"backgroundColor": background_color}
296
+ )
297
+
298
+ @staticmethod
299
+ def set_size(width: int, height: int):
300
+ """Sets window size"""
301
+ EagleCallbackCore._callback(
302
+ "window.setSize", {"width": width, "height": height}
303
+ )
304
+
305
+ @staticmethod
306
+ def get_size():
307
+ """Gets window size [width, height]"""
308
+ raise NotImplementedError(
309
+ "window.get_size returns data and cannot be used with callback system."
310
+ )
311
+
312
+ @staticmethod
313
+ def set_bounds(bounds: Dict[str, int]):
314
+ """Sets window bounds
315
+
316
+ Args:
317
+ bounds: Dictionary with x, y, width, height keys
318
+ """
319
+ EagleCallbackCore._callback("window.setBounds", {"bounds": bounds})
320
+
321
+ @staticmethod
322
+ def get_bounds():
323
+ """Gets window bounds"""
324
+ raise NotImplementedError(
325
+ "window.get_bounds returns data and cannot be used with callback system."
326
+ )
327
+
328
+ @staticmethod
329
+ def set_resizable(resizable: bool):
330
+ """Sets if window is resizable"""
331
+ EagleCallbackCore._callback("window.setResizable", {"resizable": resizable})
332
+
333
+ @staticmethod
334
+ def is_resizable():
335
+ """Checks if window is resizable"""
336
+ raise NotImplementedError(
337
+ "window.is_resizable returns data and cannot be used with callback system."
338
+ )
339
+
340
+ @staticmethod
341
+ def set_always_on_top(flag: bool):
342
+ """Sets always on top flag"""
343
+ EagleCallbackCore._callback("window.setAlwaysOnTop", {"flag": flag})
344
+
345
+ @staticmethod
346
+ def is_always_on_top():
347
+ """Checks if window is always on top"""
348
+ raise NotImplementedError(
349
+ "window.is_always_on_top returns data and cannot be used with callback system."
350
+ )
351
+
352
+ @staticmethod
353
+ def set_position(x: int, y: int):
354
+ """Sets window position"""
355
+ EagleCallbackCore._callback("window.setPosition", {"x": x, "y": y})
356
+
357
+ @staticmethod
358
+ def get_position():
359
+ """Gets window position [x, y]"""
360
+ raise NotImplementedError(
361
+ "window.get_position returns data and cannot be used with callback system."
362
+ )
363
+
364
+ @staticmethod
365
+ def set_opacity(opacity: float):
366
+ """Sets window opacity (0.0 to 1.0)"""
367
+ EagleCallbackCore._callback("window.setOpacity", {"opacity": opacity})
368
+
369
+ @staticmethod
370
+ def get_opacity():
371
+ """Gets window opacity"""
372
+ raise NotImplementedError(
373
+ "window.get_opacity returns data and cannot be used with callback system."
374
+ )
375
+
376
+ @staticmethod
377
+ def flash_frame(flag: bool):
378
+ """Flashes the window frame"""
379
+ EagleCallbackCore._callback("window.flashFrame", {"flag": flag})
380
+
381
+ @staticmethod
382
+ def set_ignore_mouse_events(ignore: bool):
383
+ """Sets ignore mouse events"""
384
+ EagleCallbackCore._callback(
385
+ "window.setIgnoreMouseEvents", {"ignore": ignore}
386
+ )
387
+
388
+ @staticmethod
389
+ def capture_page(rect: Optional[Dict[str, int]] = None):
390
+ """Captures page screenshot"""
391
+ kwargs = {}
392
+ if rect:
393
+ kwargs["rect"] = rect
394
+ EagleCallbackCore._callback("window.capturePage", kwargs)
395
+
396
+ @staticmethod
397
+ def set_referer(url: str):
398
+ """Sets referer URL"""
399
+ EagleCallbackCore._callback("window.setReferer", {"url": url})
400
+
401
+ class _App:
402
+ """Application-related API methods"""
403
+
404
+ @staticmethod
405
+ def is_dark_colors():
406
+ """Checks if using dark colors"""
407
+ raise NotImplementedError(
408
+ "app.is_dark_colors returns data and cannot be used with callback system."
409
+ )
410
+
411
+ @staticmethod
412
+ def get_path(name: str):
413
+ """Gets system path"""
414
+ raise NotImplementedError(
415
+ "app.get_path returns data and cannot be used with callback system."
416
+ )
417
+
418
+ @staticmethod
419
+ def get_file_icon(path: str, size: str = "normal"):
420
+ """Gets file icon"""
421
+ raise NotImplementedError(
422
+ "app.get_file_icon returns data and cannot be used with callback system."
423
+ )
424
+
425
+ @staticmethod
426
+ def create_thumbnail_from_path(path: str, max_size: Dict[str, int]):
427
+ """Creates thumbnail from path - action only, no return"""
428
+ EagleCallbackCore._callback(
429
+ "app.createThumbnailFromPath", {"path": path, "maxSize": max_size}
430
+ )
431
+
432
+ @staticmethod
433
+ def get_version():
434
+ """Gets app version"""
435
+ raise NotImplementedError(
436
+ "app.get_version returns data and cannot be used with callback system."
437
+ )
438
+
439
+ @staticmethod
440
+ def get_build():
441
+ """Gets app build number"""
442
+ raise NotImplementedError(
443
+ "app.get_build returns data and cannot be used with callback system."
444
+ )
445
+
446
+ @staticmethod
447
+ def get_locale():
448
+ """Gets app locale"""
449
+ raise NotImplementedError(
450
+ "app.get_locale returns data and cannot be used with callback system."
451
+ )
452
+
453
+ @staticmethod
454
+ def get_arch():
455
+ """Gets app architecture"""
456
+ raise NotImplementedError(
457
+ "app.get_arch returns data and cannot be used with callback system."
458
+ )
459
+
460
+ @staticmethod
461
+ def get_platform():
462
+ """Gets app platform"""
463
+ raise NotImplementedError(
464
+ "app.get_platform returns data and cannot be used with callback system."
465
+ )
466
+
467
+ @staticmethod
468
+ def get_env():
469
+ """Gets environment variables"""
470
+ raise NotImplementedError(
471
+ "app.get_env returns data and cannot be used with callback system."
472
+ )
473
+
474
+ @staticmethod
475
+ def get_exec_path():
476
+ """Gets executable path"""
477
+ raise NotImplementedError(
478
+ "app.get_exec_path returns data and cannot be used with callback system."
479
+ )
480
+
481
+ @staticmethod
482
+ def get_pid():
483
+ """Gets process ID"""
484
+ raise NotImplementedError(
485
+ "app.get_pid returns data and cannot be used with callback system."
486
+ )
487
+
488
+ @staticmethod
489
+ def is_windows():
490
+ """Checks if running on Windows"""
491
+ raise NotImplementedError(
492
+ "app.is_windows returns data and cannot be used with callback system."
493
+ )
494
+
495
+ @staticmethod
496
+ def is_mac():
497
+ """Checks if running on Mac"""
498
+ raise NotImplementedError(
499
+ "app.is_mac returns data and cannot be used with callback system."
500
+ )
501
+
502
+ @staticmethod
503
+ def is_running_under_arm64_translation():
504
+ """Checks if running under ARM64 translation"""
505
+ raise NotImplementedError(
506
+ "app.is_running_under_arm64_translation returns data and cannot be used with callback system."
507
+ )
508
+
509
+ @staticmethod
510
+ def get_theme():
511
+ """Gets current theme"""
512
+ raise NotImplementedError(
513
+ "app.get_theme returns data and cannot be used with callback system."
514
+ )
515
+
516
+ class _OS:
517
+ """Operating system API methods"""
518
+
519
+ @staticmethod
520
+ def tmpdir():
521
+ """Gets temporary directory"""
522
+ raise NotImplementedError(
523
+ "os.tmpdir returns data and cannot be used with callback system."
524
+ )
525
+
526
+ @staticmethod
527
+ def version():
528
+ """Gets OS version"""
529
+ raise NotImplementedError(
530
+ "os.version returns data and cannot be used with callback system."
531
+ )
532
+
533
+ @staticmethod
534
+ def type():
535
+ """Gets OS type"""
536
+ raise NotImplementedError(
537
+ "os.type returns data and cannot be used with callback system."
538
+ )
539
+
540
+ @staticmethod
541
+ def release():
542
+ """Gets OS release"""
543
+ raise NotImplementedError(
544
+ "os.release returns data and cannot be used with callback system."
545
+ )
546
+
547
+ @staticmethod
548
+ def hostname():
549
+ """Gets hostname"""
550
+ raise NotImplementedError(
551
+ "os.hostname returns data and cannot be used with callback system."
552
+ )
553
+
554
+ @staticmethod
555
+ def homedir():
556
+ """Gets home directory"""
557
+ raise NotImplementedError(
558
+ "os.homedir returns data and cannot be used with callback system."
559
+ )
560
+
561
+ @staticmethod
562
+ def arch():
563
+ """Gets OS architecture"""
564
+ raise NotImplementedError(
565
+ "os.arch returns data and cannot be used with callback system."
566
+ )
567
+
568
+ class _Screen:
569
+ """Screen-related API methods"""
570
+
571
+ @staticmethod
572
+ def get_cursor_screen_point():
573
+ """Gets cursor screen point"""
574
+ raise NotImplementedError(
575
+ "screen.get_cursor_screen_point returns data and cannot be used with callback system."
576
+ )
577
+
578
+ @staticmethod
579
+ def get_primary_display():
580
+ """Gets primary display info"""
581
+ raise NotImplementedError(
582
+ "screen.get_primary_display returns data and cannot be used with callback system."
583
+ )
584
+
585
+ @staticmethod
586
+ def get_all_displays():
587
+ """Gets all displays info"""
588
+ raise NotImplementedError(
589
+ "screen.get_all_displays returns data and cannot be used with callback system."
590
+ )
591
+
592
+ @staticmethod
593
+ def get_display_nearest_point(point: Dict[str, int]):
594
+ """Gets display nearest to point"""
595
+ raise NotImplementedError(
596
+ "screen.get_display_nearest_point returns data and cannot be used with callback system."
597
+ )
598
+
599
+ class _Notification:
600
+ """Notification API methods"""
601
+
602
+ @staticmethod
603
+ def show(
604
+ title: str,
605
+ description: str,
606
+ icon: Optional[str] = None,
607
+ mute: Optional[bool] = None,
608
+ duration: Optional[int] = None,
609
+ ):
610
+ """Shows notification
611
+
612
+ Args:
613
+ title: Notification title
614
+ description: Notification description
615
+ icon: Optional icon path
616
+ mute: Optional mute flag
617
+ duration: Optional duration in ms
618
+ """
619
+ options = {"title": title, "description": description}
620
+ if icon is not None:
621
+ options["icon"] = icon
622
+ if mute is not None:
623
+ options["mute"] = mute
624
+ if duration is not None:
625
+ options["duration"] = duration
626
+ EagleCallbackCore._callback("notification.show", {"options": options})
627
+
628
+ class _Event:
629
+ """Event handling API methods"""
630
+
631
+ @staticmethod
632
+ def on_plugin_create(callback_name: str):
633
+ """Register plugin create event callback"""
634
+ EagleCallbackCore._callback(
635
+ "event.onPluginCreate", {"callback": callback_name}
636
+ )
637
+
638
+ @staticmethod
639
+ def on_plugin_run(callback_name: str):
640
+ """Register plugin run event callback"""
641
+ EagleCallbackCore._callback(
642
+ "event.onPluginRun", {"callback": callback_name}
643
+ )
644
+
645
+ @staticmethod
646
+ def on_plugin_before_exit(callback_name: str):
647
+ """Register plugin before exit event callback"""
648
+ EagleCallbackCore._callback(
649
+ "event.onPluginBeforeExit", {"callback": callback_name}
650
+ )
651
+
652
+ @staticmethod
653
+ def on_plugin_show(callback_name: str):
654
+ """Register plugin show event callback"""
655
+ EagleCallbackCore._callback(
656
+ "event.onPluginShow", {"callback": callback_name}
657
+ )
658
+
659
+ @staticmethod
660
+ def on_plugin_hide(callback_name: str):
661
+ """Register plugin hide event callback"""
662
+ EagleCallbackCore._callback(
663
+ "event.onPluginHide", {"callback": callback_name}
664
+ )
665
+
666
+ @staticmethod
667
+ def on_library_changed(callback_name: str):
668
+ """Register library changed event callback"""
669
+ EagleCallbackCore._callback(
670
+ "event.onLibraryChanged", {"callback": callback_name}
671
+ )
672
+
673
+ @staticmethod
674
+ def on_theme_changed(callback_name: str):
675
+ """Register theme changed event callback"""
676
+ EagleCallbackCore._callback(
677
+ "event.onThemeChanged", {"callback": callback_name}
678
+ )
679
+
680
+ class _Item:
681
+ """Item-related API methods"""
682
+
683
+ @staticmethod
684
+ def get(
685
+ id: Optional[str] = None,
686
+ ids: Optional[List[str]] = None,
687
+ is_selected: Optional[bool] = None,
688
+ is_untagged: Optional[bool] = None,
689
+ is_unfiled: Optional[bool] = None,
690
+ keywords: Optional[List[str]] = None,
691
+ tags: Optional[List[str]] = None,
692
+ folders: Optional[List[str]] = None,
693
+ ext: Optional[str] = None,
694
+ annotation: Optional[str] = None,
695
+ rating: Optional[int] = None,
696
+ url: Optional[str] = None,
697
+ shape: Optional[str] = None,
698
+ ):
699
+ """Gets items with filters - returns data"""
700
+ raise NotImplementedError(
701
+ "item.get returns data and cannot be used with callback system. Use EagleWebApi instead."
702
+ )
703
+
704
+ @staticmethod
705
+ def get_all():
706
+ """Gets all items"""
707
+ raise NotImplementedError(
708
+ "item.get_all returns data and cannot be used with callback system. Use EagleWebApi instead."
709
+ )
710
+
711
+ @staticmethod
712
+ def get_by_id(item_id: str):
713
+ """Gets item by ID"""
714
+ raise NotImplementedError(
715
+ "item.get_by_id returns data and cannot be used with callback system. Use EagleWebApi instead."
716
+ )
717
+
718
+ @staticmethod
719
+ def get_by_ids(item_ids: List[str]):
720
+ """Gets items by IDs"""
721
+ raise NotImplementedError(
722
+ "item.get_by_ids returns data and cannot be used with callback system. Use EagleWebApi instead."
723
+ )
724
+
725
+ @staticmethod
726
+ def get_selected():
727
+ """Gets selected items"""
728
+ raise NotImplementedError(
729
+ "item.get_selected returns data and cannot be used with callback system. Use EagleWebApi instead."
730
+ )
731
+
732
+ @staticmethod
733
+ def add_from_url(
734
+ url: str,
735
+ name: Optional[str] = None,
736
+ website: Optional[str] = None,
737
+ tags: Optional[List[str]] = None,
738
+ folders: Optional[List[str]] = None,
739
+ annotation: Optional[str] = None,
740
+ ):
741
+ """Adds item from URL - returns item ID"""
742
+ raise NotImplementedError(
743
+ "item.add_from_url returns data and cannot be used with callback system. Use EagleWebApi instead."
744
+ )
745
+
746
+ @staticmethod
747
+ def add_from_base64(
748
+ base64: str,
749
+ name: Optional[str] = None,
750
+ website: Optional[str] = None,
751
+ tags: Optional[List[str]] = None,
752
+ folders: Optional[List[str]] = None,
753
+ annotation: Optional[str] = None,
754
+ ):
755
+ """Adds item from base64 - returns item ID"""
756
+ raise NotImplementedError(
757
+ "item.add_from_base64 returns data and cannot be used with callback system. Use EagleWebApi instead."
758
+ )
759
+
760
+ @staticmethod
761
+ def add_from_path(
762
+ path: str,
763
+ name: Optional[str] = None,
764
+ website: Optional[str] = None,
765
+ tags: Optional[List[str]] = None,
766
+ folders: Optional[List[str]] = None,
767
+ annotation: Optional[str] = None,
768
+ ):
769
+ """Adds item from file path - returns item ID"""
770
+ raise NotImplementedError(
771
+ "item.add_from_path returns data and cannot be used with callback system. Use EagleWebApi instead."
772
+ )
773
+
774
+ @staticmethod
775
+ def add_bookmark(
776
+ url: str,
777
+ name: Optional[str] = None,
778
+ base64: Optional[str] = None,
779
+ tags: Optional[List[str]] = None,
780
+ folders: Optional[List[str]] = None,
781
+ annotation: Optional[str] = None,
782
+ ):
783
+ """Adds bookmark - returns item ID"""
784
+ raise NotImplementedError(
785
+ "item.add_bookmark returns data and cannot be used with callback system. Use EagleWebApi instead."
786
+ )
787
+
788
+ @staticmethod
789
+ def open(item_id: str):
790
+ """Opens item - returns success status"""
791
+ raise NotImplementedError(
792
+ "item.open returns data and cannot be used with callback system."
793
+ )
794
+
795
+ class _Folder:
796
+ """Folder-related API methods"""
797
+
798
+ @staticmethod
799
+ def create(
800
+ name: str, description: Optional[str] = None, parent: Optional[str] = None
801
+ ):
802
+ """Creates folder - returns folder data"""
803
+ raise NotImplementedError(
804
+ "folder.create returns data and cannot be used with callback system. Use EagleWebApi instead."
805
+ )
806
+
807
+ @staticmethod
808
+ def create_subfolder(
809
+ parent_id: str, name: str, description: Optional[str] = None
810
+ ):
811
+ """Creates subfolder - returns folder data"""
812
+ raise NotImplementedError(
813
+ "folder.create_subfolder returns data and cannot be used with callback system. Use EagleWebApi instead."
814
+ )
815
+
816
+ @staticmethod
817
+ def get(
818
+ id: Optional[str] = None,
819
+ ids: Optional[List[str]] = None,
820
+ is_selected: Optional[bool] = None,
821
+ is_recent: Optional[bool] = None,
822
+ ):
823
+ """Gets folders with filters"""
824
+ raise NotImplementedError(
825
+ "folder.get returns data and cannot be used with callback system. Use EagleWebApi instead."
826
+ )
827
+
828
+ @staticmethod
829
+ def get_all():
830
+ """Gets all folders"""
831
+ raise NotImplementedError(
832
+ "folder.get_all returns data and cannot be used with callback system. Use EagleWebApi instead."
833
+ )
834
+
835
+ @staticmethod
836
+ def get_by_id(folder_id: str):
837
+ """Gets folder by ID"""
838
+ raise NotImplementedError(
839
+ "folder.get_by_id returns data and cannot be used with callback system. Use EagleWebApi instead."
840
+ )
841
+
842
+ @staticmethod
843
+ def get_by_ids(folder_ids: List[str]):
844
+ """Gets folders by IDs"""
845
+ raise NotImplementedError(
846
+ "folder.get_by_ids returns data and cannot be used with callback system. Use EagleWebApi instead."
847
+ )
848
+
849
+ @staticmethod
850
+ def get_selected():
851
+ """Gets selected folders"""
852
+ raise NotImplementedError(
853
+ "folder.get_selected returns data and cannot be used with callback system. Use EagleWebApi instead."
854
+ )
855
+
856
+ @staticmethod
857
+ def get_recents():
858
+ """Gets recent folders"""
859
+ raise NotImplementedError(
860
+ "folder.get_recents returns data and cannot be used with callback system. Use EagleWebApi instead."
861
+ )
862
+
863
+ @staticmethod
864
+ def open(folder_id: str):
865
+ """Opens folder - action only"""
866
+ EagleCallbackCore._callback("folder.open", {"folderId": folder_id})
867
+
868
+ class _ContextMenu:
869
+ """Context menu API methods"""
870
+
871
+ @staticmethod
872
+ def open(menu_items: List[Dict[str, Any]]):
873
+ """Opens context menu
874
+
875
+ Args:
876
+ menu_items: List of menu item dictionaries with id, label, click, submenu
877
+ """
878
+ EagleCallbackCore._callback("contextMenu.open", {"menuItems": menu_items})
879
+
880
+ class _Dialog:
881
+ """Dialog API methods"""
882
+
883
+ @staticmethod
884
+ def show_open_dialog(
885
+ title: Optional[str] = None,
886
+ default_path: Optional[str] = None,
887
+ button_label: Optional[str] = None,
888
+ filters: Optional[List[Dict[str, Any]]] = None,
889
+ properties: Optional[List[str]] = None,
890
+ message: Optional[str] = None,
891
+ ):
892
+ """Shows open dialog - returns result"""
893
+ raise NotImplementedError(
894
+ "dialog.show_open_dialog returns data and cannot be used with callback system."
895
+ )
896
+
897
+ @staticmethod
898
+ def show_save_dialog(
899
+ title: Optional[str] = None,
900
+ default_path: Optional[str] = None,
901
+ button_label: Optional[str] = None,
902
+ filters: Optional[List[Dict[str, Any]]] = None,
903
+ properties: Optional[List[str]] = None,
904
+ ):
905
+ """Shows save dialog - returns result"""
906
+ raise NotImplementedError(
907
+ "dialog.show_save_dialog returns data and cannot be used with callback system."
908
+ )
909
+
910
+ @staticmethod
911
+ def show_message_box(
912
+ message: str,
913
+ title: Optional[str] = None,
914
+ detail: Optional[str] = None,
915
+ buttons: Optional[List[str]] = None,
916
+ type: Optional[str] = None,
917
+ ):
918
+ """Shows message box - returns button response"""
919
+ EagleCallbackCore._callback(
920
+ "dialog.showMessageBox",
921
+ {
922
+ "message": message,
923
+ "title": title,
924
+ "detail": detail,
925
+ "buttons": buttons,
926
+ "type": type,
927
+ },
928
+ )
929
+
930
+ @staticmethod
931
+ def show_error_box(title: str, content: str):
932
+ """Shows error box - action only"""
933
+ EagleCallbackCore._callback(
934
+ "dialog.showErrorBox", {"title": title, "content": content}
935
+ )
936
+
937
+ class _Clipboard:
938
+ """Clipboard API methods"""
939
+
940
+ @staticmethod
941
+ def clear():
942
+ """Clears clipboard"""
943
+ EagleCallbackCore._callback("clipboard.clear", {})
944
+
945
+ @staticmethod
946
+ def has(format: str):
947
+ """Checks if clipboard has format - returns boolean"""
948
+ raise NotImplementedError(
949
+ "clipboard.has returns data and cannot be used with callback system."
950
+ )
951
+
952
+ @staticmethod
953
+ def write_text(text: str):
954
+ """Writes text to clipboard - action only"""
955
+ EagleCallbackCore._callback("clipboard.writeText", {"text": text})
956
+
957
+ @staticmethod
958
+ def read_text():
959
+ """Reads text from clipboard - returns text"""
960
+ raise NotImplementedError(
961
+ "clipboard.read_text returns data and cannot be used with callback system."
962
+ )
963
+
964
+ @staticmethod
965
+ def write_buffer(format: str, buffer: bytes):
966
+ """Writes buffer to clipboard - action only"""
967
+ EagleCallbackCore._callback(
968
+ "clipboard.writeBuffer", {"format": format, "buffer": buffer}
969
+ )
970
+
971
+ @staticmethod
972
+ def read_buffer(format: str):
973
+ """Reads buffer from clipboard - returns buffer"""
974
+ raise NotImplementedError(
975
+ "clipboard.read_buffer returns data and cannot be used with callback system."
976
+ )
977
+
978
+ @staticmethod
979
+ def write_image(image: Dict[str, Any]):
980
+ """Writes image to clipboard - action only"""
981
+ EagleCallbackCore._callback("clipboard.writeImage", {"image": image})
982
+
983
+ @staticmethod
984
+ def read_image():
985
+ """Reads image from clipboard - returns image"""
986
+ raise NotImplementedError(
987
+ "clipboard.read_image returns data and cannot be used with callback system."
988
+ )
989
+
990
+ @staticmethod
991
+ def write_html(markup: str):
992
+ """Writes HTML to clipboard - action only"""
993
+ EagleCallbackCore._callback("clipboard.writeHTML", {"markup": markup})
994
+
995
+ @staticmethod
996
+ def read_html():
997
+ """Reads HTML from clipboard - returns HTML"""
998
+ raise NotImplementedError(
999
+ "clipboard.read_html returns data and cannot be used with callback system."
1000
+ )
1001
+
1002
+ @staticmethod
1003
+ def copy_files(paths: List[str]):
1004
+ """Copies files to clipboard - action only"""
1005
+ EagleCallbackCore._callback("clipboard.copyFiles", {"paths": paths})
1006
+
1007
+ class _Drag:
1008
+ """Drag and drop API methods"""
1009
+
1010
+ @staticmethod
1011
+ def start_drag(file_paths: List[str]):
1012
+ """Starts drag operation"""
1013
+ EagleCallbackCore._callback("drag.startDrag", {"filePaths": file_paths})
1014
+
1015
+ class _Shell:
1016
+ """Shell API methods"""
1017
+
1018
+ @staticmethod
1019
+ def beep():
1020
+ """Makes system beep"""
1021
+ EagleCallbackCore._callback("shell.beep", {})
1022
+
1023
+ @staticmethod
1024
+ def open_external(url: str):
1025
+ """Opens URL externally"""
1026
+ EagleCallbackCore._callback("shell.openExternal", {"url": url})
1027
+
1028
+ @staticmethod
1029
+ def open_path(path: str):
1030
+ """Opens file path"""
1031
+ EagleCallbackCore._callback("shell.openPath", {"path": path})
1032
+
1033
+ @staticmethod
1034
+ def show_item_in_folder(path: str):
1035
+ """Shows item in folder"""
1036
+ EagleCallbackCore._callback("shell.showItemInFolder", {"path": path})
1037
+
1038
+ class _Log:
1039
+ """Logging API methods"""
1040
+
1041
+ @staticmethod
1042
+ def info(message: str):
1043
+ """Logs info message"""
1044
+ EagleCallbackCore._callback("log.info", {"message": message})
1045
+
1046
+ @staticmethod
1047
+ def warn(message: str):
1048
+ """Logs warning message"""
1049
+ EagleCallbackCore._callback("log.warn", {"message": message})
1050
+
1051
+ @staticmethod
1052
+ def error(message: str):
1053
+ """Logs error message"""
1054
+ EagleCallbackCore._callback("log.error", {"message": message})
1055
+
1056
+ @staticmethod
1057
+ def debug(message: str):
1058
+ """Logs debug message"""
1059
+ EagleCallbackCore._callback("log.debug", {"message": message})
1060
+
1061
+ # Create class-level aliases for easier access
1062
+ tag = _Tag()
1063
+ tag_group = _TagGroup()
1064
+ library = _Library()
1065
+ window = _Window()
1066
+ app = _App()
1067
+ os = _OS()
1068
+ screen = _Screen()
1069
+ notification = _Notification()
1070
+ event = _Event()
1071
+ item = _Item()
1072
+ folder = _Folder()
1073
+ context_menu = _ContextMenu()
1074
+ dialog = _Dialog()
1075
+ clipboard = _Clipboard()
1076
+ drag = _Drag()
1077
+ shell = _Shell()
1078
+ log = _Log()