Skip to content

Instantly share code, notes, and snippets.

View paint_in_eventfilter.py
# -*- coding: utf-8 -*-
from PySide.QtCore import *
from PySide.QtGui import *
class xxxx(QListWidget):
def __init__(self, parent=None):
super(xxxx, self).__init__(parent)
self.installEventFilter(self)
# def paintEvent(self, event):
@oglops
oglops / client.py
Created Sep 9, 2016
simplest socket server and client - before making socket server threaded and supporting multiple client
View client.py
import os
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import socket
class MyWindow(QDialog):
@oglops
oglops / test_middle_mouse_dragging.py
Created Sep 8, 2016
test middle mouse dragging event
View test_middle_mouse_dragging.py
import maya.OpenMaya as om
import maya.cmds as mc
from PyQt4 import QtCore, QtGui
callbacks = []
def do_something(*args):
if QtGui.qApp.mouseButtons()==QtCore.Qt.MidButton:
print "anything",mc.currentTime(q=1)
@oglops
oglops / libA.py
Created Sep 6, 2016
test multiprocessing env var
View libA.py
from random import randint
from time import sleep
import os
def slow_func( ):
print 'in slow_func, start processing: %s' % os.environ['SHOT']
sleep(randint(2,7))
print 'in slow_func, done processing: %s' % os.environ['SHOT']
@oglops
oglops / _.md
Last active Sep 1, 2016
dim scripteditor inactive highlight selection color
@oglops
oglops / _.md
Last active Sep 1, 2016
show original line number after item is selected in dropdown menu, mimic sublime ctrl+r
@oglops
oglops / ask_keep_completer.py
Last active Sep 5, 2016
hack script editor wip, 测试 lineedit 按到rect范围内就setfocus
View ask_keep_completer.py
#!/usr/bin/env python2
import os
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
@oglops
oglops / AEaddGraphEditor.py
Last active Aug 28, 2016
embed a graph editor into attribute editor in maya 2015 with xml attribute editor template
View AEaddGraphEditor.py
import maya.cmds as cmds
import maya.mel as mel
import maya.utils as mutils
import maya.OpenMayaUI as apiUI
from PyQt4 import QtGui, QtCore
import sip
import time
import sys
from PyQt4.QtCore import *
@oglops
oglops / AEaddGraphEditor.py
Created Aug 26, 2016
embed graph editor test
View AEaddGraphEditor.py
import maya.cmds as cmds
import maya.utils as mutils
import maya.OpenMayaUI as apiUI
from PyQt4 import QtGui, QtCore
import sip
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def toQtObject(mayaName):