Thank you Marcus! and Justin!
it works for me and seems ok to select Script editor always as it does.
Yury


On Fri, Oct 16, 2015 at 4:29 AM, Marcus Ottosson <[email protected]>
wrote:

> Intrigued by the possibility eliminating this minor annoyance, I followed
> Justin’s suggestion and wrote a solution.
>
> Run this, or put it in your userSetup.py, and it will restore focus to the
> Script Editor, if it is available.
>
> from PySide import QtCore, QtGui
> class RestoreScriptEditorFocus(QtCore.QObject):
>     def eventFilter(self, obj, event):
>         if event.type() != QtCore.QEvent.ApplicationActivate:
>             return super(RestoreScriptEditorFocus, self).eventFilter(obj, 
> event)
>
>         script_editor = next(w for w in QtGui.qApp.topLevelWidgets() if 
> w.objectName() == "scriptEditorPanel1Window")
>         script_editor.activateWindow()
>         return True
>
> f = RestoreScriptEditorFocus()
> QtGui.qApp.installEventFilter(f)
>
> It’ll also “restore” focus to it, even if it wasn’t the last thing to have
> focus at the time of leaving the Maya window. Whether that’s a problem or
> not is too soon to tell, but I’ll leave the implementation for that to the
> reader.
>
> Enjoy!
> ​
>
> On 15 October 2015 at 19:22, yury nedelin <[email protected]> wrote:
>
>> Well for now I have a ghetto workflow to avoid the mouse.
>>
>> I have assigned this mel command to the ALT+1 hot key
>>
>> *selectCurrentExecuterControl*
>> its in *scriptEditorPanel.mel*
>>
>> so now I do ALT+TAB ALT+1
>>
>> It seems none of Maya windows is selected when user ALT+TAB back to Maya
>> so just selecting menu panel of the script editor fixes this. I will try
>> Justin's solution later this week, it might all we need.
>>
>>
>> On Wed, Oct 14, 2015 at 2:49 PM, Marcus Ottosson <[email protected]>
>> wrote:
>>
>>> That only seems relevant to the command-line text input box, and not the
>>> script editor.
>>>
>>> I get this too, on Windows, and also find it quite bothersome. If a fix
>>> comes up, my mind would produce more endorphins.
>>>
>>> On 14 October 2015 at 19:24, Chris Lesage <[email protected]>
>>> wrote:
>>>
>>>> Hey Yury,
>>>>
>>>> If I understand correctly, this is a preference and if I remember it
>>>> isn't on by default.
>>>>
>>>> Preferences -> Interface -> Command Line: Hold Focus [x]
>>>>
>>>> Does checking this box solve your problem?
>>>>
>>>> Chris
>>>>
>>>>
>>>> On Wed, Oct 14, 2015 at 10:09 AM, yury nedelin <[email protected]>
>>>> wrote:
>>>>
>>>>> Justin,
>>>>> Thanks for replying, I will try this approach to put script editor in
>>>>> focus.
>>>>>
>>>>> There is an added issue of putting  the command input section of the
>>>>> script editor in focus.
>>>>>
>>>>> Yury
>>>>> On Oct 14, 2015 12:51 AM, "Justin Israel" <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I don't know much about this particular problem, since on my OSX
>>>>>> machine w/ Maya 2015 it does not lose focus. But you could probably 
>>>>>> install
>>>>>> an event filter on the QApplication, to detect the ApplicationDeactivate
>>>>>> and ApplicationActivate events. You could then handle checking if the
>>>>>> script editor is up and on top, and if so, give it editing focus again.
>>>>>>
>>>>>> Justin
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, 14 Oct 2015 5:30 PM ynedelin <[email protected]> wrote:
>>>>>>
>>>>>>> Behavior I am used to is this:
>>>>>>> if I am typing something in Maya Script Editor Command Input
>>>>>>> (bottom) section and then ALT+TAB into another software like Notepad and
>>>>>>> then ALT+TAB back into Maya my cursor is back in script editor at the 
>>>>>>> place
>>>>>>> I left it so I can continue to type stuff.
>>>>>>>
>>>>>>> This how it used to be on window machines in classic theme until
>>>>>>> windows 8 and that how it works on osx.
>>>>>>>
>>>>>>> I got a new machine with windows 8 and now when I ALT-TAB back to
>>>>>>> Maya script editor cursor is not back in the script editor's Command 
>>>>>>> Input
>>>>>>> (bottom) but some other panel is in focus in Maya so now I have to grab 
>>>>>>> the
>>>>>>> mouse and click in the Command Input aria manually !
>>>>>>> This is very annoying.
>>>>>>>
>>>>>>> Anyone has any suggestions ?
>>>>>>> is there a way to force cursor into the Command Input section of the
>>>>>>> Script editor with code?
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>> Yury
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Python Programming for Autodesk Maya" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/516e6c92-4325-42b4-8f01-24f2b164a1f8%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/516e6c92-4325-42b4-8f01-24f2b164a1f8%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Python Programming for Autodesk Maya" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1B1_Zqkbwsp-%3Dk6Kf%3DDwU8fqpcuRqyHnxv%2BNN1m2r90g%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1B1_Zqkbwsp-%3Dk6Kf%3DDwU8fqpcuRqyHnxv%2BNN1m2r90g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Python Programming for Autodesk Maya" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/python_inside_maya/CACqGSchoWTKf7Mi5xKp58rLirkB6Y-hRY5s5oYy-XE_hcpPS0A%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CACqGSchoWTKf7Mi5xKp58rLirkB6Y-hRY5s5oYy-XE_hcpPS0A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Python Programming for Autodesk Maya" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/python_inside_maya/CAHUba0JoCuOefm2n9M9-3gmL-nz7ztUgz_eTLBMqhoRLKwFi-g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAHUba0JoCuOefm2n9M9-3gmL-nz7ztUgz_eTLBMqhoRLKwFi-g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> *Marcus Ottosson*
>>> [email protected]
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODgOO74jUp4iE%3DrzW6LXJcbyFTyxDCeFBpwPqmxS9QS8w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODgOO74jUp4iE%3DrzW6LXJcbyFTyxDCeFBpwPqmxS9QS8w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CACqGScjeg9RLFoFX7UMhwFw-gzgmSWD9KUENUaE98DdhDHiQHw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CACqGScjeg9RLFoFX7UMhwFw-gzgmSWD9KUENUaE98DdhDHiQHw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Marcus Ottosson*
> [email protected]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAA7%2B%3DdByo55CD%2BDqHN2Gy3FiWYcz-ZaFeHCUwSw8oi%3DQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAA7%2B%3DdByo55CD%2BDqHN2Gy3FiWYcz-ZaFeHCUwSw8oi%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CACqGSciEK-Km-b9-fqX73W3wUvwsrnw6RBE42eE1Cy2vOsVw7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • [Maya-Python]... ynedelin
    • Re: [May... Justin Israel
      • Re: ... yury nedelin
        • ... Chris Lesage
          • ... Marcus Ottosson
            • ... yury nedelin
              • ... Marcus Ottosson
                • ... yury nedelin
                • ... Justin Israel
                • ... Joe Weidenbach
                • ... Marcus Ottosson
                • ... eRiC Werner
                • ... Marcus Ottosson
                • ... Marcus Ottosson
                • ... Marcus Ottosson
                • ... eRiC Werner
                • ... 'Martin Chatterjee' via Python Programming for Autodesk Maya
                • ... Marcus Ottosson

Reply via email to