Skip to content

Instantly share code, notes, and snippets.

# -*- 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 September 9, 2016 06:51
simplest socket server and client - before making socket server threaded and supporting multiple client
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 September 8, 2016 06:04
test middle mouse dragging event
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 September 6, 2016 07:42
test multiprocessing env var
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 September 1, 2016 05:36
dim scripteditor inactive highlight selection color
We couldn’t find that file to show.
@oglops
oglops / _.md
Last active September 1, 2016 05:09
show original line number after item is selected in dropdown menu, mimic sublime ctrl+r
We couldn’t find that file to show.
@oglops
oglops / ask_keep_completer.py
Last active September 5, 2016 20:19
hack script editor wip, 测试 lineedit 按到rect范围内就setfocus
#!/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 August 28, 2016 06:44
embed a graph editor into attribute editor in maya 2015 with xml attribute editor template
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 August 26, 2016 07:33
embed graph editor test
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):
@oglops
oglops / AEaddImgBrowser.py
Last active August 26, 2016 04:41
embed a image browser button into script editor with xml attribute editor template in maya 2015
import maya.cmds as cmds
import maya.utils as mutils
def AEaddImgBrowserModule( plug, uiLabel, annot):
cmds.rowLayout( nc=3 )
cmds.text(l=uiLabel)
p=cmds.textField('imagePathField')
cmds.symbolButton('browser',i="navButtonBrowse.png" )