Skip to content

Instantly share code, notes, and snippets.

View martin-chatterjee's full-sized avatar

Martin Chatterjee martin-chatterjee

View GitHub Profile
@martin-chatterjee
martin-chatterjee / repro_PySide2_modal_QFileDialog_ignores_accept.py
Last active March 8, 2018 12:06
PySide2: A QFileDialog displayed modally can not be closed by triggering accept().
# -*- coding: utf-8 -*-
# try to import PySide2, fall back to PySide
try:
from PySide2 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide import QtCore, QtGui
import PySide.QtGui as QtWidgets
import sys
@martin-chatterjee
martin-chatterjee / README.md
Last active September 1, 2016 14:31 — forked from mottosso/README.md
Restore Script Editor focus

Problem

image

On Windows systems using Autodesk Maya, the text input field of the Script Editor doesn't regain focus after having restored focus to the main window. This event handler explicitly restores focus, if it turns out to have been the last active panel at the time of leaving the application.

Usage

Place the full contents of the script below into your userSetup.py and never again lose focus.