This is from one of the first projects i worked on, making a maya-style hotbox in xsi. I havent been able to solve the issue where holding space and using the dropdown messes up selection, even when event.ignore() is used. The sub menus work as expected.
[ul]
[li]I call the hotbox with space and hold it down. If I release space the hotbox will close
[/li][li]pressing one of the floating windows opens its dropdown menu
[/li][li]if i move the mouse up and down the mouse is erratic
[/li][li]if I let go of space now then the keyrelease doesnt pick up and the window stays open
[/li][li]I close the window with ctrl+space as a workaround.
[/li][/ul]
Heres a video of what I mean and a sample code. Im no longer interested in assigning mr materials or similar things anymore so I will be deleting the content of the code soon. This same problem happens in maya as well.
import blurdev
from PyQt4 import QtGui, QtCore, Qt
import win32com.client
from win32com.client import constants as c
xsi = win32com.client.Dispatch( "XSI.Application" ).Application
class MainWindowNoSpace(QtGui.QMainWindow):
def keypressEvent(self,event):
event.ignore()
def keyReleaseEvent(self, event):
event.ignore()
class renderBranch(MainWindowNoSpace):
def __init__(self, parent = None):
super(renderBranch, self).__init__(parent, QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
menubar = self.menuBar()
renderMenu = menubar.addMenu("Shaders")
renderMenu.setTearOffEnabled(True)
renderMenu.setWindowTitle("Shaders")
Phong = QtGui.QAction(self)
Phong.setText("Phong")
Phong.triggered.connect(self.Phong_assign())
Lambert = QtGui.QAction(self)
Lambert.setText("Lambert")
Lambert.triggered.connect(self.Lambert_assign())
surfaceShaderMenu = renderMenu.addMenu("Surface")
surfaceShaderMenu.setTearOffEnabled(True)
surfaceShaderMenu.setWindowTitle("Surface")
surfaceShaderMenu.addAction(Phong)
surfaceShaderMenu.addAction(Lambert)
def Phong_assign(self):
xsi.ApplyShader("", "", "", "", "siLetLocalMaterialsOverlap")
def Lambert_assign(self):
xsi.ApplyShader("$XSI_DSPRESETS\\Shaders\\Material\\Lambert.Preset", "", "", "", "siLetLocalMaterialsOverlap")
def keypressEvent(self,event):
event.ignore()
def keyReleaseEvent(self, event):
event.ignore()