papersearch 0.4.11 → 0.5.0
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.
- package/.env.example +8 -0
- package/README.en.md +97 -75
- package/README.md +98 -76
- package/assets/overview.en.png +0 -0
- package/assets/overview.png +0 -0
- package/carsi/paper_search_carsi/adapters/ams/__init__.py +12 -0
- package/carsi/paper_search_carsi/adapters/elsevier/__init__.py +5 -2
- package/carsi/paper_search_carsi/adapters/elsevier/sciencedirect.py +18 -1
- package/carsi/paper_search_carsi/adapters/iop/__init__.py +11 -2
- package/carsi/paper_search_carsi/adapters/platforms/atypon/__init__.py +24 -14
- package/carsi/paper_search_carsi/api_keys.py +138 -0
- package/carsi/paper_search_carsi/assets/api_keys.json +146 -0
- package/carsi/paper_search_carsi/assets/capsule.html +327 -30
- package/carsi/paper_search_carsi/assets/capsule_en.json +437 -0
- package/carsi/paper_search_carsi/browser/preview.py +16 -3
- package/carsi/paper_search_carsi/browser/watchdog.py +15 -0
- package/carsi/paper_search_carsi/capsule_placement.py +51 -31
- package/carsi/paper_search_carsi/cli.py +46 -4
- package/carsi/paper_search_carsi/cli_config.py +51 -0
- package/carsi/paper_search_carsi/config.py +2 -0
- package/carsi/paper_search_carsi/download_diagnostics.py +1 -0
- package/carsi/paper_search_carsi/download_directory.py +5 -33
- package/carsi/paper_search_carsi/engine/access_rules.py +11 -0
- package/carsi/paper_search_carsi/engine/batch.py +13 -1
- package/carsi/paper_search_carsi/engine/batch_access.py +3 -0
- package/carsi/paper_search_carsi/engine/batch_capture.py +39 -10
- package/carsi/paper_search_carsi/engine/batch_common.py +4 -0
- package/carsi/paper_search_carsi/engine/batch_institution.py +27 -18
- package/carsi/paper_search_carsi/engine/bridge.py +7 -3
- package/carsi/paper_search_carsi/engine/pdf_guard.py +3 -6
- package/carsi/paper_search_carsi/engine/supplements.py +34 -6
- package/carsi/paper_search_carsi/extractors/pdf_extractor.py +4 -18
- package/carsi/paper_search_carsi/i18n.py +46 -0
- package/carsi/paper_search_carsi/orchestrator.py +14 -1
- package/carsi/paper_search_carsi/pdf_text.py +84 -0
- package/carsi/paper_search_carsi/pdf_utils.py +3 -12
- package/carsi/paper_search_carsi/progress_capsule.py +181 -19
- package/carsi/paper_search_carsi/progress_macos.py +35 -10
- package/carsi/paper_search_carsi/progress_reporter.py +76 -9
- package/carsi/paper_search_carsi/progress_view.py +7 -1
- package/carsi/paper_search_carsi/server.py +9 -1
- package/carsi/paper_search_carsi/user_settings.py +17 -4
- package/carsi/pyproject.toml +6 -4
- package/dist/capabilities/citation-expansion/CitationService.d.ts +8 -0
- package/dist/capabilities/citation-expansion/CitationService.d.ts.map +1 -1
- package/dist/capabilities/citation-expansion/CitationService.js +14 -4
- package/dist/capabilities/citation-expansion/CitationService.js.map +1 -1
- package/dist/capabilities/citation-expansion/CrossrefReferences.d.ts +18 -0
- package/dist/capabilities/citation-expansion/CrossrefReferences.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/CrossrefReferences.js +83 -0
- package/dist/capabilities/citation-expansion/CrossrefReferences.js.map +1 -0
- package/dist/capabilities/citation-expansion/OpenAlexGraph.d.ts +36 -0
- package/dist/capabilities/citation-expansion/OpenAlexGraph.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/OpenAlexGraph.js +120 -0
- package/dist/capabilities/citation-expansion/OpenAlexGraph.js.map +1 -0
- package/dist/capabilities/citation-expansion/handler.d.ts +14 -5
- package/dist/capabilities/citation-expansion/handler.d.ts.map +1 -1
- package/dist/capabilities/citation-expansion/handler.js +64 -14
- package/dist/capabilities/citation-expansion/handler.js.map +1 -1
- package/dist/capabilities/citation-expansion/schemas.d.ts +1 -5
- package/dist/capabilities/citation-expansion/schemas.d.ts.map +1 -1
- package/dist/capabilities/citation-expansion/schemas.js +2 -2
- package/dist/capabilities/citation-expansion/schemas.js.map +1 -1
- package/dist/capabilities/citation-expansion/tools.d.ts +0 -18
- package/dist/capabilities/citation-expansion/tools.d.ts.map +1 -1
- package/dist/capabilities/citation-expansion/tools.js +4 -16
- package/dist/capabilities/citation-expansion/tools.js.map +1 -1
- package/dist/capabilities/citation-expansion/types.d.ts +4 -0
- package/dist/capabilities/citation-expansion/types.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js +2 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts +8 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +36 -24
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts +3 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js +5 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.js +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts +5 -0
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.js +2 -1
- package/dist/capabilities/pdf-discovery/outputLayout.js.map +1 -1
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js +1 -0
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js.map +1 -1
- package/dist/cli.js +85 -12
- package/dist/cli.js.map +1 -1
- package/dist/config/ConfigService.d.ts +1 -1
- package/dist/config/ConfigService.d.ts.map +1 -1
- package/dist/config/ConfigService.js +3 -0
- package/dist/config/ConfigService.js.map +1 -1
- package/dist/config/apiKeySignup.d.ts +11 -1
- package/dist/config/apiKeySignup.d.ts.map +1 -1
- package/dist/config/apiKeySignup.js +18 -6
- package/dist/config/apiKeySignup.js.map +1 -1
- package/dist/config/apiKeyTest.d.ts +18 -0
- package/dist/config/apiKeyTest.d.ts.map +1 -0
- package/dist/config/apiKeyTest.js +109 -0
- package/dist/config/apiKeyTest.js.map +1 -0
- package/dist/config/selfCommand.d.ts +8 -0
- package/dist/config/selfCommand.d.ts.map +1 -0
- package/dist/config/selfCommand.js +10 -0
- package/dist/config/selfCommand.js.map +1 -0
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +2 -0
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/management/capability-profile/index.js +4 -4
- package/dist/management/capability-profile/index.js.map +1 -1
- package/dist/management/carsi/autoUpdate.d.ts +21 -0
- package/dist/management/carsi/autoUpdate.d.ts.map +1 -0
- package/dist/management/carsi/autoUpdate.js +88 -0
- package/dist/management/carsi/autoUpdate.js.map +1 -0
- package/dist/management/carsi/installer.d.ts +1 -1
- package/dist/management/carsi/installer.d.ts.map +1 -1
- package/dist/management/carsi/installer.js +38 -7
- package/dist/management/carsi/installer.js.map +1 -1
- package/dist/management/carsi/runtime.d.ts +9 -0
- package/dist/management/carsi/runtime.d.ts.map +1 -1
- package/dist/management/carsi/runtime.js +11 -0
- package/dist/management/carsi/runtime.js.map +1 -1
- package/dist/management/carsi/settingsWindow.d.ts +30 -0
- package/dist/management/carsi/settingsWindow.d.ts.map +1 -0
- package/dist/management/carsi/settingsWindow.js +51 -0
- package/dist/management/carsi/settingsWindow.js.map +1 -0
- package/dist/management/diagnostics/index.d.ts.map +1 -1
- package/dist/management/diagnostics/index.js +16 -0
- package/dist/management/diagnostics/index.js.map +1 -1
- package/dist/management/skills/nextSteps.d.ts +2 -0
- package/dist/management/skills/nextSteps.d.ts.map +1 -0
- package/dist/management/skills/nextSteps.js +16 -0
- package/dist/management/skills/nextSteps.js.map +1 -0
- package/dist/management/updates/index.d.ts +6 -1
- package/dist/management/updates/index.d.ts.map +1 -1
- package/dist/management/updates/index.js +18 -11
- package/dist/management/updates/index.js.map +1 -1
- package/dist/platforms/ACMSearcher.d.ts.map +1 -1
- package/dist/platforms/ACMSearcher.js +3 -2
- package/dist/platforms/ACMSearcher.js.map +1 -1
- package/dist/platforms/CrossrefSearcher.d.ts.map +1 -1
- package/dist/platforms/CrossrefSearcher.js +4 -3
- package/dist/platforms/CrossrefSearcher.js.map +1 -1
- package/dist/platforms/OpenAlexSearcher.d.ts.map +1 -1
- package/dist/platforms/OpenAlexSearcher.js +4 -1
- package/dist/platforms/OpenAlexSearcher.js.map +1 -1
- package/dist/registry/platformMetadata.d.ts.map +1 -1
- package/dist/registry/platformMetadata.js +1 -0
- package/dist/registry/platformMetadata.js.map +1 -1
- package/dist/utils/plainText.d.ts +7 -0
- package/dist/utils/plainText.d.ts.map +1 -0
- package/dist/utils/plainText.js +19 -0
- package/dist/utils/plainText.js.map +1 -0
- package/package.json +3 -3
- package/skills/paper-search/SKILL.md +20 -15
- package/skills/paper-search/references/browser-download.md +1 -1
- package/skills/paper-search/references/capability-routing.md +5 -3
- package/skills/paper-search/references/carsi-setup.md +6 -3
- package/skills/paper-search/references/cli-contract.md +9 -4
- package/skills/paper-search/references/management-layer.md +4 -4
- package/skills/paper-search/references/publisher-support.md +4 -4
- package/skills/paper-search/references/troubleshooting.md +1 -1
- package/NOTICE +0 -23
- package/carsi/NOTICE +0 -5
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exact": {
|
|
3
|
+
"暂无下载任务": "No downloads",
|
|
4
|
+
"成功": "Saved",
|
|
5
|
+
"失败": "Failed",
|
|
6
|
+
"剩余": "Left",
|
|
7
|
+
"用时": "Time",
|
|
8
|
+
"按原因": "by reason",
|
|
9
|
+
"正文已保存": "main text saved",
|
|
10
|
+
"没权限": "No access",
|
|
11
|
+
"外部原因": "External",
|
|
12
|
+
"暂不支持": "Unsupported",
|
|
13
|
+
"原因不明": "Unclear",
|
|
14
|
+
"其他": "Other",
|
|
15
|
+
"文件夹": "Folder",
|
|
16
|
+
"打开文件夹": "Open folder",
|
|
17
|
+
"跳过": "Skip",
|
|
18
|
+
"终止": "Stop",
|
|
19
|
+
"跳过本篇": "Skip this",
|
|
20
|
+
"本刊无权限": "No access: journal",
|
|
21
|
+
"出版社无权限": "No access: publisher",
|
|
22
|
+
"报告问题": "Report issue",
|
|
23
|
+
"取消": "Cancel",
|
|
24
|
+
"关闭": "Close",
|
|
25
|
+
"最小化": "Minimize",
|
|
26
|
+
"最小化到程序坞": "Minimize to Dock",
|
|
27
|
+
"设置": "Settings",
|
|
28
|
+
"返回": "Back",
|
|
29
|
+
"更多": "More",
|
|
30
|
+
"点击打开浏览器,查看并继续": "Click to open the browser",
|
|
31
|
+
"在浏览器打开这篇文章": "Open in your browser",
|
|
32
|
+
"点击切到下载浏览器": "Show download browser",
|
|
33
|
+
"打开下载浏览器": "Open download browser",
|
|
34
|
+
"切到下载浏览器": "Show download browser",
|
|
35
|
+
"未能激活进度窗口,请重试": "Window didn't respond; retry",
|
|
36
|
+
"终止整个下载任务?这一篇立即结束。": "Stop the whole task? This paper ends now.",
|
|
37
|
+
"下载": "Downloads",
|
|
38
|
+
"等待和提醒": "Waits & alerts",
|
|
39
|
+
"语言": "Language",
|
|
40
|
+
"系统通知开": "Notifications on",
|
|
41
|
+
"系统通知关": "Notifications off",
|
|
42
|
+
"已保存,之后的下载按新设置": "Saved; applies to later downloads",
|
|
43
|
+
"默认下载文件夹": "Default download folder",
|
|
44
|
+
"输入完整路径": "Full path",
|
|
45
|
+
"选择…": "Choose…",
|
|
46
|
+
"用于后续下载;命令中指定路径时优先使用指定路径。": "For later downloads; a path in a command wins.",
|
|
47
|
+
"恢复默认": "Defaults",
|
|
48
|
+
"保存": "Save",
|
|
49
|
+
"需要处理时发系统通知": "Notify me when needed",
|
|
50
|
+
"系统通知": "Notifications",
|
|
51
|
+
"通知设置保存失败": "Couldn't save",
|
|
52
|
+
"填写": "Add",
|
|
53
|
+
"未填": "Not set",
|
|
54
|
+
"去申请": "Get key",
|
|
55
|
+
"教程": "Guide",
|
|
56
|
+
"测试": "Test",
|
|
57
|
+
"清除": "Clear",
|
|
58
|
+
"确认清除": "Confirm",
|
|
59
|
+
"粘贴 key": "Paste key",
|
|
60
|
+
"显示 key": "Show key",
|
|
61
|
+
"正在测试…": "Testing…",
|
|
62
|
+
"读取配置失败": "Couldn't read settings",
|
|
63
|
+
"返回进度 ›": "Back to progress ›",
|
|
64
|
+
"去处理 ›": "Handle ›",
|
|
65
|
+
"正文": "Main",
|
|
66
|
+
"附录": "Supp.",
|
|
67
|
+
"正文+附录": "Main+Supp.",
|
|
68
|
+
"准备中": "Preparing",
|
|
69
|
+
"正在打开文章": "Opening article",
|
|
70
|
+
"正在检查访问权限": "Checking access",
|
|
71
|
+
"等待机构登录": "Waiting for login",
|
|
72
|
+
"等待人机验证": "Waiting for check",
|
|
73
|
+
"正在获取 PDF": "Getting PDF",
|
|
74
|
+
"已读到 PDF,正在核对": "Checking PDF",
|
|
75
|
+
"已保存": "Saved",
|
|
76
|
+
"这条路没走通,正在换路": "Trying another route",
|
|
77
|
+
"附录检查完成": "Supp. checked",
|
|
78
|
+
"打开文章": "Open",
|
|
79
|
+
"权限": "Access",
|
|
80
|
+
"取 PDF": "PDF",
|
|
81
|
+
"核对": "Check",
|
|
82
|
+
"检查权限": "Access",
|
|
83
|
+
"等待登录": "Login",
|
|
84
|
+
"等待验证": "Verify",
|
|
85
|
+
"换一条路": "Reroute",
|
|
86
|
+
"核对 PDF": "Check PDF",
|
|
87
|
+
"查找附录": "Finding supp.",
|
|
88
|
+
"正在查找附录文件": "Finding supp. files",
|
|
89
|
+
"处理中": "Working",
|
|
90
|
+
"正在切到下载浏览器": "Showing download browser",
|
|
91
|
+
"已终止任务:这一篇结束,剩下的不再下载": "Stopped: this one ends, the rest won't run",
|
|
92
|
+
"已跳过本篇,进入下一篇": "Skipped; moving on",
|
|
93
|
+
"已记住:本刊无权限,以后自动跳过(可用 entitlements 撤销)": "Noted: no access; journal skipped from now",
|
|
94
|
+
"已记住:该出版社无权限,以后自动跳过": "Noted: no access; publisher skipped from now",
|
|
95
|
+
"请查看浏览器,可能需要手动操作": "Check the browser; you may need to act",
|
|
96
|
+
"页面暂时无进展": "Page stuck",
|
|
97
|
+
"请选择学校": "Choose school",
|
|
98
|
+
"请登录学校": "Sign in to school",
|
|
99
|
+
"请完成验证": "Complete the check",
|
|
100
|
+
"需要你处理": "Needs you",
|
|
101
|
+
"需要你操作": "Action needed",
|
|
102
|
+
"下载中": "Downloading",
|
|
103
|
+
"已终止任务": "Stopped",
|
|
104
|
+
"下载中断": "Interrupted",
|
|
105
|
+
"下载未成功": "Download failed",
|
|
106
|
+
"下载结束,部分失败": "Done, some failed",
|
|
107
|
+
"下载完成": "Done",
|
|
108
|
+
"其他原因": "Other reasons",
|
|
109
|
+
"未知论文": "Unknown paper",
|
|
110
|
+
"下载浏览器已关闭": "Download browser closed",
|
|
111
|
+
"出版社内容服务错误,当前路径已停止": "Publisher server error; route stopped",
|
|
112
|
+
"出版社尚未发布这篇论文的全文,当前路径已停止": "Full text not out yet; route stopped",
|
|
113
|
+
"安全验证": "Security check",
|
|
114
|
+
"安全验证等待已结束,正在检查页面": "Check wait over; checking page",
|
|
115
|
+
"已从打开的 PDF 读取,正在核对并保存": "Read from the open PDF; checking and saving",
|
|
116
|
+
"已切到下载浏览器": "Download browser shown",
|
|
117
|
+
"未能切到下载浏览器,请从程序坞或任务栏打开": "Couldn't switch; open it from the Dock or taskbar",
|
|
118
|
+
"未能切到下载浏览器,请从程序坞打开": "Couldn't switch; open it from the Dock",
|
|
119
|
+
"机构登录": "School login",
|
|
120
|
+
"浏览器下载": "Browser download",
|
|
121
|
+
"点击时这一篇已经保存好了,没有跳过": "Already saved; not skipped",
|
|
122
|
+
"自动验证尚未完成,请在浏览器中检查并完成验证": "Auto check not done; finish it in the browser",
|
|
123
|
+
"请在浏览器窗口完成机构登录": "Sign in to school in the browser",
|
|
124
|
+
"请在浏览器窗口选择学校并完成机构登录": "Choose your school and sign in, in the browser",
|
|
125
|
+
"跳过已尝试": "Skipping tried",
|
|
126
|
+
"进入机构访问": "School access",
|
|
127
|
+
"PDF 已保存,待内容核验": "PDF saved; checking",
|
|
128
|
+
"下载未完成": "Not finished",
|
|
129
|
+
"下载进程已结束,结果未确认": "Download ended; unconfirmed",
|
|
130
|
+
"已检查,页面未列出补充材料": "Checked; no supp. listed",
|
|
131
|
+
"批量下载已停止,结果未确认": "Batch stopped; result unconfirmed",
|
|
132
|
+
"机构 PDF 下载": "School PDF download",
|
|
133
|
+
"机构 PDF 批量下载": "School PDF batch",
|
|
134
|
+
"等待下载进程响应(暂无新进度)": "Waiting for the download (no news)",
|
|
135
|
+
"DOI 没指向能登录的网站": "DOI leads to no login site",
|
|
136
|
+
"PDF 身份未确认": "PDF identity unconfirmed",
|
|
137
|
+
"下载已取消": "Download cancelled",
|
|
138
|
+
"下载时程序出错": "Program error",
|
|
139
|
+
"下载环境不可用": "Download setup down",
|
|
140
|
+
"下载环境被占用": "Download setup busy",
|
|
141
|
+
"下载等待超时": "Download timed out",
|
|
142
|
+
"人机验证没通过": "Failed bot check",
|
|
143
|
+
"任务已终止": "Task stopped",
|
|
144
|
+
"你标记过无权限": "You marked no access",
|
|
145
|
+
"你跳过了这一篇": "You skipped it",
|
|
146
|
+
"全文尚未发布": "Full text not out yet",
|
|
147
|
+
"全文未确认有效": "Full text unconfirmed",
|
|
148
|
+
"出版社网站没响应": "Publisher site silent",
|
|
149
|
+
"出版社页面出错": "Publisher page error",
|
|
150
|
+
"到了每小时下载上限": "Hourly limit reached",
|
|
151
|
+
"只在其他平台提供": "Only on another platform",
|
|
152
|
+
"后端结果无法使用": "Backend result unusable",
|
|
153
|
+
"学校密码已过期": "School password expired",
|
|
154
|
+
"学校没有订阅": "No school subscription",
|
|
155
|
+
"学校登录系统出错": "School login error",
|
|
156
|
+
"学校登录被拒绝": "School login refused",
|
|
157
|
+
"学校账号被锁定": "School account locked",
|
|
158
|
+
"找不到学校的登录路线": "No login route for school",
|
|
159
|
+
"找不到机构登录入口": "No institution login",
|
|
160
|
+
"拿到的 PDF 无效": "Invalid PDF",
|
|
161
|
+
"拿到的是别篇 PDF": "Another paper's PDF",
|
|
162
|
+
"拿到网页不是文件": "Got a page, not a file",
|
|
163
|
+
"没取到 PDF": "No PDF",
|
|
164
|
+
"没找到可用 PDF": "No usable PDF",
|
|
165
|
+
"没进入学校登录页": "School login not reached",
|
|
166
|
+
"浏览器没有响应": "Browser not responding",
|
|
167
|
+
"登录后没回到出版社": "No return to publisher",
|
|
168
|
+
"登录重试已用尽": "Login retries used up",
|
|
169
|
+
"登录页被关闭": "Login page closed",
|
|
170
|
+
"等学校登录超时": "School login timed out",
|
|
171
|
+
"网站人机验证拦截": "Blocked by bot check",
|
|
172
|
+
"网站拦截了当前网络": "Site blocked network",
|
|
173
|
+
"网站暂不支持附录": "Supp. not supported here",
|
|
174
|
+
"认证入口未注册": "Login entry unregistered",
|
|
175
|
+
"需要学校登录": "School login needed",
|
|
176
|
+
"页面处理超时": "Page timed out",
|
|
177
|
+
"页面提示全文受限": "Full text restricted",
|
|
178
|
+
"没有有效 DOI": "No valid DOI",
|
|
179
|
+
"没有进行机构下载": "No school download",
|
|
180
|
+
"附录没下载成功": "Supp. not downloaded",
|
|
181
|
+
"机构订阅": "Subscription",
|
|
182
|
+
"预印本": "Preprint",
|
|
183
|
+
"出版社 API": "Publisher API",
|
|
184
|
+
"开放获取": "Open access",
|
|
185
|
+
"学校登录页最多等": "Wait for school login",
|
|
186
|
+
"其他页面最多等": "Wait for other pages",
|
|
187
|
+
"验证提醒前最多等": "Wait before check alert",
|
|
188
|
+
"每家出版社每小时最多": "Per publisher per hour",
|
|
189
|
+
"秒": "s",
|
|
190
|
+
"篇": "papers",
|
|
191
|
+
"查期刊、搜正文": "Journals & snippets",
|
|
192
|
+
"出版社接口": "Publisher APIs",
|
|
193
|
+
"增加检索来源": "More sources",
|
|
194
|
+
"提高限额": "Higher limits",
|
|
195
|
+
"查影响因子和分区": "Impact factor & rank",
|
|
196
|
+
"搜正文片段": "Full-text snippets",
|
|
197
|
+
"下载全文,检索 ScienceDirect、Scopus": "Full text; search ScienceDirect, Scopus",
|
|
198
|
+
"下载全文,检索 Springer": "Full text; search Springer",
|
|
199
|
+
"检索 Web of Science": "Search Web of Science",
|
|
200
|
+
"检索 IEEE Xplore": "Search IEEE Xplore",
|
|
201
|
+
"检索 PubMed 更快(每秒 3 次提到 10 次)": "Faster PubMed (3 → 10 per second)",
|
|
202
|
+
"检索 CORE 开放全文,更稳定": "Steadier CORE open full text",
|
|
203
|
+
"检索 OpenAIRE,限额更高": "Higher OpenAIRE limits",
|
|
204
|
+
"查引文的限额更高,被引过万也能列全": "Higher citation limits; lists 10k+",
|
|
205
|
+
"申请教程": "Guide",
|
|
206
|
+
"可以用": "Works",
|
|
207
|
+
"没有填": "Empty",
|
|
208
|
+
"key 里不能有空格、换行或中文字符": "No spaces, line breaks or Chinese",
|
|
209
|
+
"太长了,请确认粘贴的是 key": "Too long; is this the key?",
|
|
210
|
+
"没有这一项": "Unknown item",
|
|
211
|
+
"测试超时,没法判断;检查网络或代理后再试": "Timed out; check network or proxy",
|
|
212
|
+
"请先粘贴 key;要删除请点“清除”": "Paste a key first; Clear removes it",
|
|
213
|
+
"此路径是文件,请选择文件夹": "That's a file; choose a folder",
|
|
214
|
+
"请输入完整的绝对路径": "Enter a full path",
|
|
215
|
+
"请选择下载文件夹或输入完整路径": "Choose a folder or enter a full path",
|
|
216
|
+
"PDF 已打开,但没保存": "PDF opened, not saved",
|
|
217
|
+
"一直加载或验证过不去": "Stuck loading or checking",
|
|
218
|
+
"其他问题": "Other problem",
|
|
219
|
+
"没出现机构登录或选学校": "No school login shown",
|
|
220
|
+
"跳到了个人账号登录": "Went to personal login",
|
|
221
|
+
"跳到了无关页面": "Went to unrelated page",
|
|
222
|
+
"选错了学校": "Wrong school",
|
|
223
|
+
"已在浏览器打开这篇文章": "Opened in your browser",
|
|
224
|
+
"当前没有正在下载的浏览器": "No download browser now",
|
|
225
|
+
"打开失败:不是有效的 DOI": "Couldn't open: not a DOI",
|
|
226
|
+
"打开失败:没有找到默认浏览器": "Couldn't open: no default browser",
|
|
227
|
+
"打开失败:没有这一项": "Couldn't open: unknown",
|
|
228
|
+
"这一篇在查开放来源,没有打开浏览器": "Checking open sources; no browser",
|
|
229
|
+
"通知开关必须为开启或关闭": "Must be on or off",
|
|
230
|
+
"语言只能是中文或英文": "Chinese or English only",
|
|
231
|
+
"需要你在浏览器里处理": "Needed in the browser",
|
|
232
|
+
"完成": "Done",
|
|
233
|
+
"已终止": "Stopped",
|
|
234
|
+
"已中断": "Interrupted",
|
|
235
|
+
"被拒绝:key 不对,或已失效": "Rejected: wrong or expired key",
|
|
236
|
+
"服务器限流,稍后再试;key 本身可能没问题": "Rate-limited; try later",
|
|
237
|
+
"没连上服务器,没法判断;检查网络或代理后再试": "Couldn't reach the server"
|
|
238
|
+
},
|
|
239
|
+
"patterns": [
|
|
240
|
+
[
|
|
241
|
+
"^完成 (\\d+)/(\\d+)$",
|
|
242
|
+
"Done $1/$2"
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
"^已终止 (\\d+)/(\\d+)$",
|
|
246
|
+
"Stopped $1/$2"
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
"^已中断 (\\d+)/(\\d+)$",
|
|
250
|
+
"Interrupted $1/$2"
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
"^(\\d+) 篇失败$",
|
|
254
|
+
"$1 failed"
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"^已用 (.+)$",
|
|
258
|
+
"$1 elapsed"
|
|
259
|
+
],
|
|
260
|
+
[
|
|
261
|
+
"^共 (\\d+) 篇$",
|
|
262
|
+
"$1 papers"
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
"^未完成 (\\d+) 篇$",
|
|
266
|
+
"Not saved: $1"
|
|
267
|
+
],
|
|
268
|
+
[
|
|
269
|
+
"^正文未下到 (\\d+) 篇$",
|
|
270
|
+
"No main text: $1"
|
|
271
|
+
],
|
|
272
|
+
[
|
|
273
|
+
"^附录未下全 (\\d+) 篇$",
|
|
274
|
+
"Supp. missing: $1"
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
"^已完成 (\\d+) 篇$",
|
|
278
|
+
"Saved: $1"
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
"^另有 (\\d+) 篇未列出$",
|
|
282
|
+
"+$1 more"
|
|
283
|
+
],
|
|
284
|
+
[
|
|
285
|
+
"^另有 (\\d+) 项$",
|
|
286
|
+
"+$1 more"
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
"^剩 (.+)$",
|
|
290
|
+
"$1 left"
|
|
291
|
+
],
|
|
292
|
+
[
|
|
293
|
+
"^终止整个下载任务?这一篇立即结束,剩下的 (\\d+) 篇不再下载。$",
|
|
294
|
+
"Stop the whole task? This one ends now; $1 more won't run."
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
"^正在下载 (.+)$",
|
|
298
|
+
"Downloading $1"
|
|
299
|
+
],
|
|
300
|
+
[
|
|
301
|
+
"^每家每小时 (\\d+) 篇$",
|
|
302
|
+
"$1/hour per publisher"
|
|
303
|
+
],
|
|
304
|
+
[
|
|
305
|
+
"^登录页 (\\d+) 秒$",
|
|
306
|
+
"Login $1 s"
|
|
307
|
+
],
|
|
308
|
+
[
|
|
309
|
+
"^已填 (\\d+)/(\\d+)$",
|
|
310
|
+
"$1/$2 set"
|
|
311
|
+
],
|
|
312
|
+
[
|
|
313
|
+
"^附录 (\\d+)/(\\d+)$",
|
|
314
|
+
"Supp. $1/$2"
|
|
315
|
+
],
|
|
316
|
+
[
|
|
317
|
+
"^已保存 (\\d+)/(\\d+)$",
|
|
318
|
+
"Saved $1/$2"
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
"^正文 (\\d+) 篇$",
|
|
322
|
+
"Main $1"
|
|
323
|
+
],
|
|
324
|
+
[
|
|
325
|
+
"^附录 (\\d+) 个$",
|
|
326
|
+
"Supp. $1"
|
|
327
|
+
],
|
|
328
|
+
[
|
|
329
|
+
"^(\\d+) 篇未列出附录$",
|
|
330
|
+
"$1 list no supp."
|
|
331
|
+
],
|
|
332
|
+
[
|
|
333
|
+
"^(.+) 等$",
|
|
334
|
+
"$1 etc."
|
|
335
|
+
],
|
|
336
|
+
[
|
|
337
|
+
"^机构订阅 (\\d+)$",
|
|
338
|
+
"Subscription $1"
|
|
339
|
+
],
|
|
340
|
+
[
|
|
341
|
+
"^预印本 (\\d+)$",
|
|
342
|
+
"Preprint $1"
|
|
343
|
+
],
|
|
344
|
+
[
|
|
345
|
+
"^出版社 API (\\d+)$",
|
|
346
|
+
"Publisher API $1"
|
|
347
|
+
],
|
|
348
|
+
[
|
|
349
|
+
"^开放获取 (\\d+)$",
|
|
350
|
+
"Open access $1"
|
|
351
|
+
],
|
|
352
|
+
[
|
|
353
|
+
"^附录 (\\d+) 个已保存$",
|
|
354
|
+
"$1 supp. saved"
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
"^补充材料已保存 (\\d+) 个$",
|
|
358
|
+
"$1 supp. files saved"
|
|
359
|
+
],
|
|
360
|
+
[
|
|
361
|
+
"^已完成 (\\d+)/(\\d+) 篇,等待下一篇$",
|
|
362
|
+
"Done $1/$2; next soon"
|
|
363
|
+
],
|
|
364
|
+
[
|
|
365
|
+
"^批量下载结束:成功 (\\d+),失败 (\\d+)$",
|
|
366
|
+
"Batch done: $1 saved, $2 failed"
|
|
367
|
+
],
|
|
368
|
+
[
|
|
369
|
+
"^第 (\\d+)/(\\d+) 篇已检查,等待下一篇$",
|
|
370
|
+
"Paper $1/$2 checked; next soon"
|
|
371
|
+
],
|
|
372
|
+
[
|
|
373
|
+
"^第 (\\d+)/(\\d+) 篇已保存,等待下一篇$",
|
|
374
|
+
"Paper $1/$2 saved; next soon"
|
|
375
|
+
],
|
|
376
|
+
[
|
|
377
|
+
"^第 (\\d+)/(\\d+) 篇未完成,等待下一篇$",
|
|
378
|
+
"Paper $1/$2 not saved; next soon"
|
|
379
|
+
],
|
|
380
|
+
[
|
|
381
|
+
"^第 (\\d+)/(\\d+) 篇:进入机构访问$",
|
|
382
|
+
"Paper $1/$2: school access"
|
|
383
|
+
],
|
|
384
|
+
[
|
|
385
|
+
"^这篇文章只在 (.+) 平台提供,暂不支持,当前路径已停止$",
|
|
386
|
+
"Only on $1, not supported yet; route stopped"
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
"^被拒绝:key 不对,或已失效((.+))$",
|
|
390
|
+
"Rejected: wrong or expired key ($1)"
|
|
391
|
+
],
|
|
392
|
+
[
|
|
393
|
+
"^服务器限流,稍后再试;key 本身可能没问题((.+))$",
|
|
394
|
+
"Rate-limited; try later ($1)"
|
|
395
|
+
],
|
|
396
|
+
[
|
|
397
|
+
"^没连上服务器,没法判断;检查网络或代理后再试((.+))$",
|
|
398
|
+
"Couldn't reach the server ($1)"
|
|
399
|
+
],
|
|
400
|
+
[
|
|
401
|
+
"^请输入 (\\d+) 到 (\\d+) 之间的整数$",
|
|
402
|
+
"Enter a whole number $1–$2"
|
|
403
|
+
],
|
|
404
|
+
[
|
|
405
|
+
"^保存失败:(.+)$",
|
|
406
|
+
"Save failed: $1"
|
|
407
|
+
],
|
|
408
|
+
[
|
|
409
|
+
"^清除失败:(.+)$",
|
|
410
|
+
"Clear failed: $1"
|
|
411
|
+
],
|
|
412
|
+
[
|
|
413
|
+
"^记录失败:(.+)$",
|
|
414
|
+
"Report failed: $1"
|
|
415
|
+
],
|
|
416
|
+
[
|
|
417
|
+
"^读取配置失败:(.+)$",
|
|
418
|
+
"Couldn't read settings: $1"
|
|
419
|
+
],
|
|
420
|
+
[
|
|
421
|
+
"^打开失败:(.+)$",
|
|
422
|
+
"Couldn't open: $1"
|
|
423
|
+
],
|
|
424
|
+
[
|
|
425
|
+
"^测试没有完成:(.+)$",
|
|
426
|
+
"Test didn't finish: $1"
|
|
427
|
+
],
|
|
428
|
+
[
|
|
429
|
+
"^已收到:.+,正在处理$",
|
|
430
|
+
"Got it; working on it"
|
|
431
|
+
],
|
|
432
|
+
[
|
|
433
|
+
"^找不到 paper-search 命令,没法测试;也可以在终端运行 (.+)$",
|
|
434
|
+
"paper-search not found; run $1 in a terminal"
|
|
435
|
+
]
|
|
436
|
+
]
|
|
437
|
+
}
|
|
@@ -23,7 +23,7 @@ from urllib.parse import urlsplit
|
|
|
23
23
|
from uuid import UUID, uuid4
|
|
24
24
|
from weakref import WeakKeyDictionary
|
|
25
25
|
|
|
26
|
-
from .watchdog import BrowserUnresponsive, operation_remaining
|
|
26
|
+
from .watchdog import BrowserUnresponsive, CallAbandoned, call_limit, operation_remaining
|
|
27
27
|
from ..entitlements import UserMarkedNoEntitlement
|
|
28
28
|
|
|
29
29
|
_OBSERVERS = WeakKeyDictionary()
|
|
@@ -33,6 +33,7 @@ OBSERVE_INTERVAL_SEC = 4 # between unforced frames (waits refresh at most this
|
|
|
33
33
|
MAX_KEPT_FRAMES = 5 # earlier page states kept per download, besides each tab's newest frame
|
|
34
34
|
JPEG_QUALITY = 60
|
|
35
35
|
SCREENSHOT_TIMEOUT_MS = 1500
|
|
36
|
+
CAPTURE_BACKOFF_SEC = 30 # after a frame that never came, for the same page state
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
def _atomic(path: Path, data: bytes) -> None:
|
|
@@ -63,6 +64,7 @@ class BrowserPreview:
|
|
|
63
64
|
self.observing = False
|
|
64
65
|
self.paused = 0
|
|
65
66
|
self._cdp = WeakKeyDictionary()
|
|
67
|
+
self._no_frame = WeakKeyDictionary() # page -> (url, until): its capture timed out
|
|
66
68
|
self._navigation_listeners = {}
|
|
67
69
|
context.on('close', self.close)
|
|
68
70
|
self._write([])
|
|
@@ -145,8 +147,19 @@ class BrowserPreview:
|
|
|
145
147
|
session = False
|
|
146
148
|
self._cdp[page] = session
|
|
147
149
|
if session:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
url, until = self._no_frame.get(page, ("", 0.0))
|
|
151
|
+
if url == page.url and time.monotonic() < until:
|
|
152
|
+
raise TimeoutError("no frame from this page yet")
|
|
153
|
+
# The capture waits for a drawn frame and has no timeout of its own:
|
|
154
|
+
# Thieme's article tab after the school login held it for 90 s, and the
|
|
155
|
+
# watchdog ended the article as browser_unresponsive (2026-11-08).
|
|
156
|
+
try:
|
|
157
|
+
with call_limit(SCREENSHOT_TIMEOUT_MS / 1000):
|
|
158
|
+
data = session.send("Page.captureScreenshot",
|
|
159
|
+
{"format": "jpeg", "quality": JPEG_QUALITY, "fromSurface": True})
|
|
160
|
+
except CallAbandoned:
|
|
161
|
+
self._no_frame[page] = (page.url, time.monotonic() + CAPTURE_BACKOFF_SEC)
|
|
162
|
+
raise
|
|
150
163
|
return base64.b64decode(data["data"])
|
|
151
164
|
return page.screenshot(timeout=SCREENSHOT_TIMEOUT_MS, full_page=False, type="jpeg", quality=JPEG_QUALITY)
|
|
152
165
|
|
|
@@ -116,6 +116,21 @@ def abandon(owners: set) -> int:
|
|
|
116
116
|
return count
|
|
117
117
|
|
|
118
118
|
|
|
119
|
+
@contextmanager
|
|
120
|
+
def call_limit(seconds: float):
|
|
121
|
+
"""Abandon this greenlet's calls still running after ``seconds`` (:func:`abandon`):
|
|
122
|
+
for calls whose answer is optional, such as a preview frame."""
|
|
123
|
+
owners: set = set()
|
|
124
|
+
timer = threading.Timer(seconds, abandon, args=(owners,))
|
|
125
|
+
timer.daemon = True
|
|
126
|
+
with owned_by(owners):
|
|
127
|
+
timer.start()
|
|
128
|
+
try:
|
|
129
|
+
yield
|
|
130
|
+
finally:
|
|
131
|
+
timer.cancel()
|
|
132
|
+
|
|
133
|
+
|
|
119
134
|
@contextmanager
|
|
120
135
|
def operation(seconds: float, label: str):
|
|
121
136
|
"""One monotonic deadline shared by all calls and retries in this scope."""
|
|
@@ -41,11 +41,16 @@ class ScreenArea:
|
|
|
41
41
|
work: Rect
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
def _overlap(a: Rect, b: Rect) -> float:
|
|
45
|
+
return (max(0, min(a.right, b.right) - max(a.x, b.x))
|
|
46
|
+
* max(0, min(a.bottom, b.bottom) - max(a.y, b.y)))
|
|
47
|
+
|
|
48
|
+
|
|
44
49
|
def screen_for(rect: Rect, screens: list[ScreenArea]) -> ScreenArea:
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
"""The display holding most of the rectangle, otherwise the nearest (unplugged display)."""
|
|
51
|
+
best = max(screens, key=lambda s: _overlap(rect, s.bounds))
|
|
52
|
+
if _overlap(rect, best.bounds) > 0:
|
|
53
|
+
return best
|
|
49
54
|
x, y = rect.x + rect.width / 2, rect.y + rect.height / 2
|
|
50
55
|
return min(screens, key=lambda s: max(s.bounds.x - x, 0, x - s.bounds.right) ** 2
|
|
51
56
|
+ max(s.bounds.y - y, 0, y - s.bounds.bottom) ** 2)
|
|
@@ -57,9 +62,16 @@ def fit_rect(rect: Rect, work: Rect) -> Rect:
|
|
|
57
62
|
max(work.y, min(rect.y, work.bottom - rect.height)), rect.width, rect.height)
|
|
58
63
|
|
|
59
64
|
|
|
60
|
-
def
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
def pill_anchor(pill: Rect, work: Rect) -> tuple[str, str]:
|
|
66
|
+
"""Grow away from the nearer screen edges, keeping the pill's sides there fixed."""
|
|
67
|
+
return ("down" if pill.y + pill.height / 2 < work.y + work.height / 2 else "up",
|
|
68
|
+
"right" if pill.x + pill.width / 2 < work.x + work.width / 2 else "left")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def direction_for(pill: Rect, work: Rect, height: float) -> tuple[str, str]:
|
|
72
|
+
"""Open down unless the card does not fit below; sideways away from the nearer edge."""
|
|
73
|
+
below, above = work.bottom - pill.y, pill.bottom - work.y
|
|
74
|
+
return "down" if below >= height or below >= above else "up", pill_anchor(pill, work)[1]
|
|
63
75
|
|
|
64
76
|
|
|
65
77
|
def _edge(start: float, end: float, low: float, high: float) -> int:
|
|
@@ -80,6 +92,7 @@ class Placement:
|
|
|
80
92
|
self.direction = ("down" if corner == "top" else "up", "left")
|
|
81
93
|
self.edges = (0, 0)
|
|
82
94
|
self.expanded = False
|
|
95
|
+
self._direction_fixed = False
|
|
83
96
|
self.scale = 1.0
|
|
84
97
|
self._saved: dict = {}
|
|
85
98
|
try:
|
|
@@ -138,7 +151,7 @@ class Placement:
|
|
|
138
151
|
self.home = fit_rect(Rect(b.right - EDGE - w,
|
|
139
152
|
b.y + TOP_GAP if self.corner == "top" else b.bottom - BOTTOM_GAP - h,
|
|
140
153
|
w, h), self.screen.work)
|
|
141
|
-
self.direction = self._direction(self.home)
|
|
154
|
+
self.direction = self._direction(pill_anchor(self.home, self.screen.work))
|
|
142
155
|
return round(self.home.x), round(self.home.y)
|
|
143
156
|
|
|
144
157
|
def rescale(self, scale: float) -> None:
|
|
@@ -163,7 +176,8 @@ class Placement:
|
|
|
163
176
|
self.home = actual
|
|
164
177
|
self.screen = screen_for(self.home, screens)
|
|
165
178
|
if not self.expanded:
|
|
166
|
-
self.direction = self._direction(self.home)
|
|
179
|
+
self.direction = self._direction(pill_anchor(self.home, self.screen.work))
|
|
180
|
+
self._direction_fixed = False
|
|
167
181
|
if expanded:
|
|
168
182
|
self.expanded = True
|
|
169
183
|
|
|
@@ -171,14 +185,21 @@ class Placement:
|
|
|
171
185
|
assert self.home is not None and self.screen is not None
|
|
172
186
|
home, work = self.home, self.screen.work
|
|
173
187
|
width, height = min(width, int(work.width)), min(height, int(work.height))
|
|
174
|
-
if expanded
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
188
|
+
if expanded:
|
|
189
|
+
# Chosen once per expansion: taller panels such as settings are
|
|
190
|
+
# clamped to the work area instead of flipping the card.
|
|
191
|
+
if not self._direction_fixed:
|
|
192
|
+
self.direction = self._direction(direction_for(home, work, height))
|
|
193
|
+
self._direction_fixed = True
|
|
194
|
+
anchor, (vertical, horizontal) = self._dragged_card or home, self.direction
|
|
195
|
+
elif self.expanded:
|
|
196
|
+
# Back into the corner the card grew from, also when the status
|
|
197
|
+
# changed the pill's width while it was open.
|
|
198
|
+
anchor, (vertical, horizontal) = home, self.direction
|
|
179
199
|
else:
|
|
180
|
-
|
|
181
|
-
|
|
200
|
+
anchor, (vertical, horizontal) = home, self._direction(pill_anchor(home, work))
|
|
201
|
+
x = anchor.right - width if horizontal == "left" else anchor.x
|
|
202
|
+
y = anchor.bottom - height if vertical == "up" else anchor.y
|
|
182
203
|
return self._fit(Rect(x, y, width, height))
|
|
183
204
|
|
|
184
205
|
def finish(self, expanded: bool, actual: Rect) -> None:
|
|
@@ -195,8 +216,9 @@ class Placement:
|
|
|
195
216
|
y = work.y if vertical < 0 else work.bottom - rect.height if vertical > 0 else rect.y
|
|
196
217
|
return fit_rect(Rect(x, y, rect.width, rect.height), work)
|
|
197
218
|
|
|
198
|
-
def _direction(self,
|
|
199
|
-
|
|
219
|
+
def _direction(self, free: tuple[str, str]) -> tuple[str, str]:
|
|
220
|
+
"""A docked edge decides its axis; the other axis keeps the free choice."""
|
|
221
|
+
vertical, horizontal = free
|
|
200
222
|
x, y = self.edges
|
|
201
223
|
return ("down" if y < 0 else "up" if y > 0 else vertical,
|
|
202
224
|
"right" if x < 0 else "left" if x > 0 else horizontal)
|
|
@@ -227,29 +249,27 @@ class Placement:
|
|
|
227
249
|
|
|
228
250
|
def dragged(self, after: Rect, screens: list[ScreenArea],
|
|
229
251
|
pointer: tuple[float, float] | None = None) -> Rect:
|
|
230
|
-
# At a display seam the
|
|
231
|
-
#
|
|
232
|
-
self.screen =
|
|
233
|
-
if self.screen is None:
|
|
234
|
-
self.screen = screen_for(after, screens)
|
|
252
|
+
# At a display seam the pointer may already be on the next display;
|
|
253
|
+
# the window stays on the one that holds most of it.
|
|
254
|
+
self.screen = screen_for(after, screens)
|
|
235
255
|
work = self.screen.work
|
|
236
256
|
point = pointer if pointer and self.screen.bounds.contains(*pointer) else None
|
|
237
257
|
self.edges = self._drop_edges(after, work, point)
|
|
238
258
|
after = self._fit(Rect(after.x, after.y, min(after.width, work.width), min(after.height, work.height)))
|
|
239
|
-
self.direction = self._direction(after)
|
|
240
259
|
if self.home is None or not self.expanded:
|
|
241
260
|
self.home = after
|
|
261
|
+
self.direction = self._direction(pill_anchor(after, work))
|
|
242
262
|
else:
|
|
263
|
+
# The pill goes to the card's top corner on the side nearer the
|
|
264
|
+
# screen edge (bottom corner when docked there), so opening it
|
|
265
|
+
# again puts the card back where it was dropped.
|
|
243
266
|
self._dragged_card = after
|
|
267
|
+
self.direction = self._direction(("down", pill_anchor(after, work)[1]))
|
|
268
|
+
self._direction_fixed = True
|
|
244
269
|
vertical, horizontal = self.direction
|
|
245
270
|
w, h = self.home.width, self.home.height
|
|
246
|
-
if
|
|
247
|
-
|
|
248
|
-
# much smaller pill lands along the side.
|
|
249
|
-
self.home = Rect(point[0] - w / 2, point[1] - h / 2, w, h)
|
|
250
|
-
else:
|
|
251
|
-
self.home = Rect(after.right - w if horizontal == "left" else after.x,
|
|
252
|
-
after.bottom - h if vertical == "up" else after.y, w, h)
|
|
271
|
+
self.home = Rect(after.right - w if horizontal == "left" else after.x,
|
|
272
|
+
after.bottom - h if vertical == "up" else after.y, w, h)
|
|
253
273
|
self.home = self._fit(self.home)
|
|
254
274
|
self.save()
|
|
255
275
|
return after
|