Uses 3874K of libraries. Click here for Pure Java version (11159L/79K/271K).
1 | !7 |
2 | |
3 | concept UserScreenshot { // see #1006593, don't change this here |
4 | S text; |
5 | new Ref<PNGFile> pngFile; |
6 | } |
7 | |
8 | concept Task { |
9 | new Ref<UserScreenshot> s1; |
10 | new Ref<UserScreenshot> s2; |
11 | Pt p1, p2; |
12 | } |
13 | |
14 | concept Forwarded { |
15 | new Ref<Task> task; |
16 | S programID; |
17 | long conceptID; |
18 | } |
19 | |
20 | p-substance { |
21 | db(); |
22 | final Concepts in = new Concepts(#1006593).load(); |
23 | final JComboBox cb1 = jcomboboxFromConcepts(in, UserScreenshot, "text"); |
24 | final JComboBox cb2 = jcomboboxFromConcepts(in, UserScreenshot, "text"); |
25 | JComponent form = makeForm("", "Please choose 2 screenshots to compare.", |
26 | "Screenshot 1", cb1, |
27 | "Screenshot 2", cb2, r { |
28 | UserScreenshot s1 = conceptFromComboBox(cb1, in, UserScreenshot); |
29 | UserScreenshot s2 = conceptFromComboBox(cb2, in, UserScreenshot); |
30 | doIt(s1, s2); |
31 | }); |
32 | print("Buttons: " + childrenOfType(form, JButton.class)); |
33 | renameSubmitButton(form, "Yo!"); |
34 | final JTable tasks = makeConceptsTable(Task); |
35 | JTable forwarded = makeConceptsTable(Forwarded); |
36 | JPanel tasksPanel = centerAndSouth(tasks, |
37 | jRightAligned(tableDependButton(tasks, jbutton("Forward", |
38 | r { forwardTask(selectedConcept(tasks, Task)) })))); |
39 | showFrame(jtabs("New Task", form, "Tasks", tasksPanel, |
40 | "Forwarded", forwarded)); |
41 | } |
42 | |
43 | static void doIt(UserScreenshot a, UserScreenshot b) { |
44 | Pt p1 = parseFirstPoint(a.text); |
45 | Pt p2 = parseFirstPoint(b.text); |
46 | if (p1 == null || p2 == null) { |
47 | messageBox("Not sure what to do"); |
48 | ret; |
49 | } |
50 | |
51 | Task task = cnew(Task, s1 := copyScreenshot(a), s2 := copyScreenshot(b), +p1, +p2); |
52 | |
53 | messageBox("Made task " + task.id + ". " + p1 + " vs " + p2); |
54 | } |
55 | |
56 | static UserScreenshot copyScreenshot(UserScreenshot s) { |
57 | PNGFile pngFile = copyPNGFile(s.pngFile!); |
58 | ret cnew(UserScreenshot, text := s.text, +pngFile); |
59 | } |
60 | |
61 | svoid forwardTask(Task task) { |
62 | Forwarded fw = findBackRef(Forwarded, task); |
63 | if (fw != null) { messageBox("Already forwarded!"); ret; } |
64 | |
65 | // TODO: Forward to image distinguisher |
66 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006612 |
Snippet name: | Screenshot Distinguisher [v1, working on function] |
Eternal ID of this version: | #1006612/2 |
Text MD5: | e8f664b6aca86be2583065bcec179d63 |
Transpilation MD5: | 9add50de2d6b94d9a3092c23f0f9a2da |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-15 19:45:01 |
Source code size: | 2026 bytes / 66 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 608 / 976 |
Version history: | 1 change(s) |
Referenced in: | [show references] |