Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / test_drop_shelf_button.py
Last active Mar 17, 2022
drag from qtableview and drop on maya shelf to insert shelf button
View test_drop_shelf_button.py
from __future__ import division
import maya.OpenMayaUI
import maya.cmds
from pymel.core import melGlobals
from PySide2 import QtCore, QtGui, QtWidgets
import shiboken2
@oglops
oglops / mute_screen_grab_drag.py
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
View mute_screen_grab_drag.py
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 Mar 16, 2022
drag from script editor to shelf in maya 2020
View mimedata_maya_drag_scripteditor_to_shelf.py
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 / excel_style_filter.py
Last active Feb 18, 2022
filtered qtableview widgets
View excel_style_filter.py
import sys
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import Qt
# https://www.pythonguis.com/tutorials/qtableview-modelviews-numpy-pandas/
class TableModel(QtCore.QAbstractTableModel):
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
@oglops
oglops / config.yml
Last active Feb 10, 2022
chd experiment
View config.yml
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 / 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
[user]
name = x
email = x
[push]
default = simple
[diff]
tool = vscode
[merge]
tool = vscode
[mergetool "kdiff3"]
@oglops
oglops / fix_tomato_gui_clean.py
Last active Sep 24, 2017
restore leading spaces/tabs/newlines from original www files
View fix_tomato_gui_clean.py
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
oglops / build.sh
Created Jul 13, 2017
build svn in csh
View build.sh
# 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 \
./autogen.sh && \
./configure --host=mipsel-linux --build=x86_64-redhat-linux --prefix=/usr
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader