Skip to content

Instantly share code, notes, and snippets.

oglops /
Last active Mar 17, 2022
drag from qtableview and drop on maya shelf to insert shelf button
from __future__ import division
import maya.OpenMayaUI
import maya.cmds
from pymel.core import melGlobals
from PySide2 import QtCore, QtGui, QtWidgets
import shiboken2
oglops /
Last active Mar 16, 2022
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 /
Last active Mar 16, 2022
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')
oglops /
Last active Feb 18, 2022
filtered qtableview widgets
import sys
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import Qt
class TableModel(QtCore.QAbstractTableModel):
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
oglops / config.yml
Last active Feb 10, 2022
chd experiment
View config.yml
disable: [ seen, seen_info_hash, retry_failed, history ]
url: xxx
cookie: xxx
params: '&passkey=xxx'
root_element_selector: 'table.torrents > tbody > tr:not(:first-child)'
oglops / docker-compose.yml
Last active Jan 17, 2022
media library docker compose
View docker-compose.yml
version: "3.8"
x-env-vars: &env-vars
PUID: 1000
PGID: 1000
TZ: Asia/Shanghai
UMASK: 002
x-common-settings: &common-settings
View .gitconfig
name = x
email = x
default = simple
tool = vscode
tool = vscode
[mergetool "kdiff3"]
oglops /
Last active Sep 24, 2017
restore leading spaces/tabs/newlines from original www files
import os
import re
cn_dir = '~/github/tomato-gui'
en_dir = '~/github/tomato-gui-en'
cn_dir = os.path.expanduser(cn_dir)
en_dir = os.path.expanduser(en_dir)
oglops /
Created Jul 13, 2017
build svn in csh
# build serf lib first
scons PREFIX=$HOME/Downloads/serf-install
scons install
# run one line command with temp env var
( make distclean ; setenv LDFLAGS -Wl,-rpath,\\\$\$ORIGIN/../lib ; ./configure --prefix=$HOME/svn --with-serf=$HOME/Downloads/serf-install ; make ; make install)
View after changing to LT_INIT it turns out i don't need to after adding dirlist
cd /home/oglop/tomato/release/src-rt/router/libjson-c && CC=mipsel-uclibc-gcc STRIP=mipsel-uclibc-strip \
./ && \
./configure --host=mipsel-linux --build=x86_64-redhat-linux --prefix=/usr
autoreconf: Entering directory `.'
autoreconf: not using Gettext
autoreconf: running: aclocal
autoreconf: tracing
autoreconf: not using Libtool
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader