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

Cannot focus view/sheet/group after opening an image #2219

Closed
evandrocoan opened this issue Mar 8, 2018 · 3 comments
Closed

Cannot focus view/sheet/group after opening an image #2219

evandrocoan opened this issue Mar 8, 2018 · 3 comments

Comments

@evandrocoan
Copy link

evandrocoan commented Mar 8, 2018

Summary

I have a thread continually processing the current file and opening the generated image for PlantUml diagrams:

image

But doing this, does not restore the focus back after opening the image:

                change_count = view.change_count()
                active_sheet = window.active_sheet()
                group, view_index = window.get_view_index(view)

                create_and_open_image()

                window.focus_view( view )
                window.focus_group( group )
                window.focus_sheet( active_sheet )

After generating the image, I still have to press Ctrl+1 (command: focus_group {"group": 0}) to the focus to be set to the first view/sheet.

Environment

  • Operating system and version:
    • Windows 10 build 15063 x64
    • Mac OS ...
    • Linux ...
  • Monitor:
    • Resolution 1920x1080
    • dpi_scale used in ST 1.0
  • Sublime Text:
    • Build 3157
    • 32 bit
@evandrocoan
Copy link
Author

I finally make it work by using a 1.0 seconds sleep, 0.5 does work:

                self.sleepEvent.wait( 1.0 )
                print("group: %s" % group)
                window.run_command( "focus_group", {"group": group} )

This is for the issue:

  1. Request: Option to display preview in sidebar during typing jvantuyl/sublime_diagram_plugin#61 Request: Option to display preview in sidebar during typing

With this 1.0 delay I cannot implement it, because it will cut off the text typing, as the view will be focused on the image for some milliseconds.

@evandrocoan
Copy link
Author

Closing for now as I just saw this:

        sourceFile = view.file_name()
        t = Thread(target=render_and_view, args=(sourceFile, diagrams,))

The open image call seems to be async.

@evandrocoan
Copy link
Author

I just confirmed it is working correctly by fully implementing the feature on this pull request:

  1. Continuous update automatic sync evandrocoan/PlantUmlDiagrams#1 Continuous update automatic sync

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

No branches or pull requests

1 participant