Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / simple_treeWidget_2_customDrop_0.py
Created September 1, 2014 02:12
drop items with itemWidgets by recreating them recursively in dropEvent
#!/usr/bin/env python2
import os
import sys
import re
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt, QString
class CommandWidget(QtGui.QDialog):
@oglops
oglops / mute_screen_grab_drag.py
Last active March 16, 2022 18:41
Attempt to cheat maya into thinking that my custom drag is from script editor, but it did not work, even if I used pickled "real" data when dragging from script editor
def startDrag(self, supportedActions):
print('start drag')
listsQModelIndex = self.selectedIndexes()
if listsQModelIndex:
# dataQMimeData = self.model().mimeData(listsQModelIndex)
# insert fake x-maya-data
dataQMimeData = QtCore.QMimeData()
encoded = QtCore.QByteArray()
# failed attempt to cheat maya
@oglops
oglops / mimedata_maya_drag_scripteditor_to_shelf.py
Last active March 16, 2022 18:34
drag from script editor to shelf in maya 2020
from PySide2 import QtWidgets, QtGui, QtCore
class Window(QtWidgets.QWidget):
def __init__(self, *args):
QtWidgets.QWidget.__init__(self, *args)
layout = QtWidgets.QVBoxLayout(self)
label= QtWidgets.QLabel('drop here')
label.setAlignment(QtCore.Qt.AlignCenter)
layout.addWidget(label)
self.setLayout(layout)
@oglops
oglops / config.yml
Last active February 10, 2022 07:39
chd experiment
chd:
disable: [ seen, seen_info_hash, retry_failed, history ]
html_rss:
url: xxx
cookie: xxx
params: '&passkey=xxx'
root_element_selector: 'table.torrents > tbody > tr:not(:first-child)'
fields:
title:
@oglops
oglops / drag_between_two_list_widgets_check_2_multi.py
Created August 26, 2014 08:49
从上方的list widget 拖动到下方的list widget, show checkbox after dropping, spacebar to multi toggle, avoid creating duplicated items in the bottom list widget
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt, QString
import sys
import os
class ThumbListWidget(QtGui.QListWidget):
_rows_to_del = []
@oglops
oglops / docker-compose.yml
Last active January 17, 2022 07:26
media library docker compose
---
version: "3.8"
x-env-vars: &env-vars
PUID: 1000
PGID: 1000
TZ: Asia/Shanghai
UMASK: 002
x-common-settings: &common-settings
@oglops
oglops / syncScriptEditor.py
Last active September 6, 2021 03:06
sync maya script editor tabs among multiple maya sessions
import re
import maya.cmds as mc
import maya.mel as mel
def get_optionvar(var, type='iv'):
pref_file = mc.internalVar(userPrefDir=1)+'userPrefs.mel'
values = []
with open(pref_file) as f:
for line in f.readlines():
@oglops
oglops / AEaddModelPanel.py
Last active March 26, 2021 22:34
embed a model panel into script editor with xml attribute editor template in maya 2015
import maya.cmds as cmds
import maya.utils as mutils
def AEaddModelPanelModule( plug, uiLabel, annot):
paneLayoutName = cmds.paneLayout(h=300)
modelPanel = "customModelPanel"
if cmds.modelPanel(modelPanel, q=1, ex=1):
cmds.modelPanel(modelPanel, e=1, p=paneLayoutName)
else:
@oglops
oglops / script_editor_font.py
Created February 16, 2016 08:46
set script editor font for maya
# You can put this inside your userSetup.py
# import maya.utils as mu
# import script_editor_font as SE
# mu.executeDeferred(SE.launchFromCmdWndIcon)
from PyQt4 import QtGui, QtCore
from maya import cmds, mel
import maya.OpenMayaUI as apiUI
import sip
@oglops
oglops / .ctng.config
Last active July 14, 2020 10:03
config file for crosstools-ng 1.22 with custom uclibc 0.9.33 config file
#
# Automatically generated file; DO NOT EDIT.
# Crosstool-NG Configuration
#
CT_CONFIGURE_has_xz=y
CT_CONFIGURE_has_svn=y
CT_MODULES=y
#
# Paths and misc options