Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full compatibility for Sumatra custom path #2781

Merged
merged 7 commits into from
Nov 22, 2022

Conversation

MisterDeenis
Copy link
Contributor

Fix #2737

Summary of additions and changes

Added full support when inputting a custom Sumatra path, so that it appears in PDF Viewer ComboBox, and making it work with Forward Search and the Configure Inverse Search.

  1. Changed isSumatraAvailable in SumatraConversation to a singleton object that checks if Sumatra is available.
  2. Added an InputVerifier on the TextField of Custom Sumatra Path that checks the validity of the path, and updates the value of isSumatraAvailable and updates the items in the PDF Viewer ComboBox.
  3. Changed the availability in the InternalPdfViewer to a function so that it can be changed during execution.
  4. Removed the lines checking if the Sumatra Custom Path was null in addOpenViewerListener so that the user can select which PDF Viewer to open, even if a Sumatra Custom Path is present.
  5. Added support for inverse search action for custom SumatraPath
  6. Added support for loading custom SumatraPath at startup
  7. Redone update of the PdfViewerComboBox to eliminate errors
  8. Changed SumatraConversation from a class to a singleton object to better match InternalPdfViewers and to don't allow multiple instances of SumatraConversation to be opened by multiple parts of the program (Sumatra link conversation is constant over the scope of the program).
  9. Added a run function that doesn't wait for a return of the program executed (useful for setting up Inverse search)

In brief : when inputting a correct custom Sumatra path (valid path and that contains SumatraPDF.exe), after clicking away from the TextBox, Sumatra automatically appears in the ComboBox of PDF Viewer. And then, making it work with Forward Search and the Configure Inverse Search.

How to test this pull request

Open TeXiFy with only global PATH set to Sumatra (afterwards, do the same with registry keys)
Under LaTeX configuration, under "PDF viewer", "Sumatra" should appear.
Under Tools/LaTeX, option to "Configure Inverse Search" should work as normal.
Forward search should work as normal.

Set no PATH and no registry keys to Sumatra.
Set custom path to Sumatra in Run Configuration to real Sumatra install and click away from the text box.
Under "PDF viewer", "Sumatra" should appear.
Set custom path to Sumatra in Run Configuration to a real folder that doesn't contain Sumatra and click away from the text box.
Under "PDF viewer", "Sumatra" shouldn't appear and an error popup should appear.
Set custom path to Sumatra in Run Configuration to a folder that doesn't exist and click away from the text box.
Under "PDF viewer", "Sumatra" shouldn't appear and an error popup should appear.

Select a "PDF viewer" of your choice under LaTeX configuration, under "PDF viewer".
Run LaTeX project, the PDF viewer selected should open (even if Sumatra is in the Path).

MisterDeenis added 4 commits October 31, 2022 12:07
…ppears in PDF Viewer ComboBox, and making it work with Forward Search and the Configure Inverse Search.

1. Changed isSumatraAvailable in SumatraConversation to a singleton object that checks if Sumatra is available.
2. Added an InputVerifier on the TextField of Custom Sumatra Path that checks the validity of the path, and updates the value of isSumatraAvailable and updates the items in the PDF Viewer ComboBox.
3. Changed the availability in the InternalPdfViewer to a function so that it can be changed during execution.
4. Removed the lines checking if the Sumatra Custom Path was null in addOpenViewerListener so that the user can select which PDF Viewer to open, even if a Sumatra Custom Path is present.
Inverse search action supported for custom SumatraPath
Added support for loading custom SumatraPath at startup
Redone update of the PdfViewerComboBox to eliminate errors
Changed SumatraConversation from a class to an object to better match InternalPdfViewers
Added a run function that doesn't wait for a return of the program executed
@MisterDeenis MisterDeenis changed the title Sumatra path Full compatibility for Sumatra custom path Nov 17, 2022
Copy link
Collaborator

@PHPirates PHPirates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, nice work! Just a few minor comments, but I think functionality is good as it is.

MisterDeenis added 2 commits November 20, 2022 16:30
Configure Inverse Search Action back to showing when Sumatra is available.
Redone InputVerifier in LatexSettingsEditor to just update the ComboBox and SumatraAvailabilityChecker, no focus changes.
Added a file for SumatraAvailabilityChecker.
Initialization of SumatraConversation done in execute().
SystemEnvironment updated to be a non-blocking function when necessary.
Moved verification of custom Sumatra path from LatexSettingsEditor InputVerifier to LatexRunConfiguration@checkConfiguration.
- Added enableSumatraPath reference in LatexRunConfiguration to make it work.
- LatexSettingsEditor edits runConfiguration.enableSumatraPath.
- Kept the InputVerifier to update the PDFViewer ComboBox
Changed isSumatraPathAvailable to know when a customPath is valid (even if Sumatra is in PATH).
- Now returns if Sumatra is available globally (in PATH and custom path) and if Sumatra is available in custom path.
- Necessary to make the LatexRunConfiguration@checkConfiguration work.
Removed some unnecessary assignation to SumatraAvailabilityChecker.
Added some comments.
Copy link
Collaborator

@PHPirates PHPirates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This is a much better user experience, works for me as expected.

@PHPirates PHPirates added this to the b0.7.25 milestone Nov 22, 2022
@PHPirates PHPirates merged commit b7c173d into Hannah-Sten:master Nov 22, 2022
@MisterDeenis MisterDeenis deleted the sumatra-path branch November 22, 2022 20:36
@MisterDeenis MisterDeenis restored the sumatra-path branch November 22, 2022 20:36
@MisterDeenis MisterDeenis deleted the sumatra-path branch November 22, 2022 20:37
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.

Full support for custom Sumatra path
2 participants