Skip to content

Conversation

@kvesik
Copy link
Collaborator

@kvesik kvesik commented Jul 30, 2025

Facilitates importing .json files that have been previously exported (whether in minimal or maximal form) by SLP-AA.

Also includes a couple of small changes to exports to ensure that imports run smoothly. Therefore, exports made before this PR are not guaranteed to be complete, nor are they guaranteed to be imported accurately.

kvesik and others added 30 commits March 10, 2025 09:49
 - add import option to file menu
 - permit user to select file for import
 - comb selected import file for signs and sign-level information
when nonman_specs is None, programmatically generate what would be generated by wrapper_get_nonman_specs() with no selections on gui.
if nonman spec is partially specified and minimal exported, fill in the omitted specs.
…mports-nonman-fallback

408 allow json imports with fallback non-manual
@kvesik
Copy link
Collaborator Author

kvesik commented Aug 8, 2025

@kchall thank you very much for your comments and the test corpus. I've addressed the list of three concerns you raised above, but I'm not sure I understand your parenthetical note. When you say that you were not able to write anything in to specify any of the 'other' options... do you mean the user-specifiable options in the movement tree (e.g., for number of repetitions)? Or something different? Thank you!

@kchall
Copy link
Member

kchall commented Aug 11, 2025

@kvesik Thanks! The wizard is great -- definitely a 'safer' approach for making changes and exiting when intended.

A few things:

  1. The toggles don't quite seem to be working visually for the minimal / maximal choices and the last modified date choices. That is, they appear, and clicking on them does seem to change how things work, but visually (on my Mac) the 'default' choice is always apparently selected, even if the other choice is actually chosen.

Here is what it looks like with 'maximal' chosen (the default):

image

...and here is what it looks like with 'minimal' chosen:

image
  1. My default window size isn't big enough for the whole message about the importable formats:
image
  1. This may be a moot point, but in the original version of the test corpus I made, entry 004 has two x-slots. When I first did the minimal / maximal exports and reimported, that sign was then imported with no x-slot information extant:
image

However, on re-opening the original test corpus, I discovered that this entry still had no x-slots, so in some sense the importing was happening 'faithfully,' and the error is in the test corpus. I re-added the x-slots and saved it; then re-exported and re-imported. This time, the imported versions did have the x-slots -- but re-opening the original corpus, it's still missing them. Signs in the sample corpus with multiple x-slots seem to be okay, on loading / exporting / importing. So maybe this is an issue just on that branch with creating multiple x-slots that will get fixed on merging with main??

@kchall
Copy link
Member

kchall commented Aug 11, 2025

@kvesik Oh, forgot to say -- on this version of the 408 branch, I did now have access to the 'other' options -- before, yes, it was the cases you describe, and they just didn't have boxes in which to actually type in things I wanted to 'specify.' But they appear now and seem to be sticky on export / import. :)

@kvesik
Copy link
Collaborator Author

kvesik commented Aug 18, 2025

@kchall re your comments from last week:

  1. Do you experience the same issue with any of the other toggles, whether on this branch or on main? This same kind of toggle object appears in the Import wizard (leave "last modified" timestamps as they are vs reset to now), Corpus view (one gloss per row / one sign per row), Relation module (Y / existing module / Location vs Movement), etc. I'm very intrigued to know if it is only the minimal/maximal export toggle that misbehaves.
  2. It looks like you might also lose some or all of the text on the first page of the export wizard; is that true (see screenshot from my display, below, for comparison)?
  3. The problem with the number of x-slots turned out to be a loading issue (side effect on x-slot structure when I changed signtype loading code) as opposed to saving issue. This is fixed now.

Screenshot from first page of export wizard:
image

@kvesik
Copy link
Collaborator Author

kvesik commented Aug 18, 2025

@stannam do you mind doing a Mac check, please? See Kathleen's comments 1 and 2 from here and my follow-ups here -- do you have the same issues? Thanks!

@stannam
Copy link
Member

stannam commented Aug 18, 2025

@kvesik of course
1. defult toggles
I also have the same issue as Kathleen. The default option is apparently not unselectable.
The 'Export Corpus' dialog opens up like below
image

... and when I select 'Minimal', both appear as if activated.
image

Other toggle objects in SLPAA seem fine.

2. missing texts on the first page
Only when I 'Continue' and 'Go back' to the first step, the instructions show up. (Both maximal and minimal are still selected)
Screenshot 2025-08-18 at 2 01 10 PM

3. the default size
The default window is not big enough for me as well. It is resizable, though.
image

@kchall
Copy link
Member

kchall commented Aug 18, 2025

@kvesik

  1. Most other toggles work for me, but not the ones for importing: Here "Keep original values" is selected:
image

...but here "Reset to now" is selected:
image

All other toggles you mention (which all appear on the main branch) are fine. E.g. in the relation module:
image
vs.
image

  1. Oh! Yes, I didn't even realize there was text on the first part of the Export box. It shows up as follows on first loading:
image

...but as Stanley says, if you either re-size or continue and then go back (even without re-sizing), it shows up correctly (i.e., it auto-resizes when you 'go back'):

image
  1. It does look like the x-slots are there in the test corpus now, thank you!

@kvesik
Copy link
Collaborator Author

kvesik commented Aug 25, 2025

@kchall and @stannam I'm a little perplexed about the apparently-never-deselected default option on a couple of those switches, especially because they are not coded with a default at all! I wonder if the macos highlights the first button in a dialog as the default choice. To to test this, I've made a few adjustments to the OptionSwitch code as well as added a "decoy" button to the first page of the export corpus wizard. With this in place, can you please let me know:

  1. Whether the Maximal/Minimal buttons now behave as expected?
  2. Whether the "Keep original values as per exported file" / "Reset to now" buttons in the import corpus wizard (without a decoy button) also behave as expected?

Thank you!

@stannam
Copy link
Member

stannam commented Aug 25, 2025

@kvesik
1. Maximal/Minimal buttons

The decoy works with the Maximal/Minimal buttons!

1

However, the labels are still not showing up initially. Forcing a minimum size seems to fix the issue. I added setMinimumWidth() (with any value, including 0) at the very end of ExportCorpusWizard.__init__() and it worked.

2. the buttons in import

As for the "Keep original values as per exported file" / "Reset to now" buttons, they are still acting up. However, switching pages fixes the issue. And of course, set minimum size does not solve it.

2

@stannam
Copy link
Member

stannam commented Aug 25, 2025

.... and it got me thinking, as a quick band-aid, what about adding a dummy front page ("welcome to import???") to the import dialog so that the buttons do not show up on the first page?

… options are the same as the default windows options
@kvesik
Copy link
Collaborator Author

kvesik commented Aug 25, 2025

Thanks so much, Stanley! And thank you for the idea about the dummy front page, but since the import wizard switch is already on a non-initial page (and it is still not working properly), I suspect that the pages are not the issue. Anyway, I've tried fiddling with some wizard settings and would appreciate if @stannam and/or @kchall could try the export and import wizards once again, and let me know if the default highlighting problem persists on Maximal/Minimal (in export wizard) or "Keep original values as per exported file" / "Reset to now" (in import wizard). Thanks!

@stannam
Copy link
Member

stannam commented Aug 25, 2025

@kvesik Right! Sorry, what was I thinking!

The export Corpus dialog now contains all labels and buttons, and the buttons toggle correctly.

image

However, the issue persists with the import buttons. Switching pages does not seem to solve it this time...

image

@kvesik
Copy link
Collaborator Author

kvesik commented Aug 25, 2025

OK! @stannam I've added you to issue #408 -- could you please see what you can figure out re the mac issues on import and export wizards (text width and OptionSwitch behaviour), as discussed above? Relevant classes are ImportCorpusWizard and ExportCorpusWizard.

There's also a third wizard MergeCorporaWizard that has an OptionSwitch as well... can you please check if that one also behaves oddly?

And recently I added the two lines

        self.setOption(QWizard.NoDefaultButton, False)
        self.setOption(QWizard.NoCancelButton, False)

to those three wizards (because of the documentation on QWizard.setOptions(), but they apparently aren't actually doing anything, so those can maybe get removed again.

- in export window, set a minimum width
  to reveal text label
- in import window, replaced push buttons to
  radio buttons
- also added variable SYSTEM for easy
  reference to sys.platform
Added a spacer to the left of two radio buttons for timestamp options in the import dialog
@stannam
Copy link
Member

stannam commented Sep 8, 2025

Thanks @kvesik,

Fortunately, MergeCorporaWizard does not actually use an OptionSwitch. The Merge Corpora wizard looks ok on mac.

I couldn't find a fix for OptionSwitch instances in the import wizard, so I'm wondering if we must use it there. Instead, we can use radio buttons like below.

Screenshot 2025-09-08 123446 Screenshot 2025-09-08 at 12 35 35 PM

Added a spacer on Page 1 of the export dialog
@stannam stannam merged commit f1797de into main Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow json imports

4 participants