Skip to content

Instantly share code, notes, and snippets.

View keithel's full-sized avatar

Keith Kyzivat keithel

  • New Hampshire, USA
View GitHub Profile
@keithel
keithel / ReStructured_text_resources.txt
Created October 31, 2022 17:21
ReStructured Text resources
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude
https://docutils.sourceforge.io/docs/ref/rst/directives.html#line-block
Here is the Qt for Python example docs that I was writing when I needed to refer to these resources, and how to generate it:
file:///home/t_kyzik/Build/qt-git/pyside-setup/html/pyside6/examples/example_charts__pointselectionandmarkers.html
(venv) [t_kyzik@localhost pyside-setup]$ python tools/example_gallery/main.py
(venv) [t_kyzik@localhost pyside-setup]$ python setup.py build_rst_docs --qtpaths=/home/t_kyzik/Qt/6.5.0/gcc_64/bin/qtpaths
Here's the docs for the Qt C++ example that I based this off of (that I also wrote):
https://doc.qt.io/qt-6/qtcharts-pointsselectionandmarkers-example.html
@keithel
keithel / https:∕∕devblogs.microsoft.com∕oldnewthing∕20120731-00∕?p=7003
Last active October 27, 2022 21:08
Windows Batch - Capturing command output to a batch file variable
https://devblogs.microsoft.com/oldnewthing/20120731-00/?p=7003
Reading the output of a command into a batch file variable
Raymond Chen
July 31st, 2012
It’s Day Two of Batch File Week. Don’t worry, it’ll be over in a few days.
There is no obvious way to read the output of a command into a batch file variable. In unix-style shells, this is done via backquoting.
@keithel
keithel / ts_test.py
Created October 18, 2022 14:17
Testing failing qtwebengine-chromium v6.4.0 build failure in the following snippit
# Extracted from https://code.qt.io/cgit/qt/qtwebengine-chromium.git/tree/chromium/tools/typescript/ts_library.py?id=1dc53de694e05a192d4757835f66e0797b7d29b6#n72
import argparse
import sys
import collections
import os
parser = argparse.ArgumentParser()
parser.add_argument('--path_mappings', nargs='*')
args = parser.parse_args(sys.argv[1:])
@keithel
keithel / git-rebase-advanced-use--onto.md
Last active December 23, 2022 18:39
Git rebase advanced use: --onto

I thought I'd share some new understanding of git I just learned today.

With the Qt builds, we maintain a set of patches ontop of the qt5 repository that pertain to the Jenkins build pipeline / automated builds. Every time we move from Qt version to Qt version, those changes need to be moved to a new branch based off the new Qt release. For instance we had a branch called adsk-maya-contrib-v5.12.5, based off Qt tag v5.12.5. We moved to v5.15.2, and created an adsk-maya-contrib-v5.15.2 branch. All the script changes we made needed to be moved over to this new branch. In the past we've just squashed all those changes into a single commit and cherry-picked that commit or just manually copied the files over into the new branch. I never liked that because you couldn't easily follow the history of edits - I find it extremely useful to use git blame to get into the head of the developer when there's a bug - why was the change made in the first place? Anyway -- I much prefer just transplanting the commit

@keithel
keithel / VersionComparator.groovy
Last active September 16, 2022 13:59 — forked from founddrama/VersionComparator.groovy
a version comparator (e.g., "1.0.2" < "1.0.10")
def versions = []
def f = new File('mock-version-tags.txt')
f.eachLine { versions << it }
def versionComparator = { a, b ->
def VALID_TOKENS = /._/
a = a.tokenize(VALID_TOKENS)
b = b.tokenize(VALID_TOKENS)
for (i in 0..<Math.max(a.size(), b.size())) {
@keithel
keithel / progressbar-styling.py
Created September 14, 2022 14:53
Styling a QProgressBar with a stylesheet
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout
from PySide6.QtWidgets import QWidget, QLabel, QProgressBar, QPushButton
from PySide6.QtCore import Qt, Slot, QTimer
class Window(QMainWindow):
def __init__(self):
super().__init__()
@keithel
keithel / Vagrantfile
Created September 13, 2022 22:52
Vagrant Ubuntu PySide2 virtual environment with unattended Qt installation, Rust
# -*- mode: ruby -*-
# vi: set ft=ruby :
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
@keithel
keithel / find_pyside2_deprecations.py
Created August 25, 2022 18:30
Qt5 obsolete classes discovery
#!/usr/bin/env python3
# Boilerplate generated from https://www.python-boilerplate.com/py3+executable+argparse
"""
find_pyside2_deprecations
try:
Tool to search python files for usage of PySide6 5.15 / Qt 5.15 deprecated
except:
@keithel
keithel / pyside2and6.py
Last active August 25, 2022 18:25
Reverse Pyside2and6 fallback to PySide6
import sys
import os
import re
def print_usage():
print("Usage: python pyside2and6.py <Python file>...")
print("Modify python files with blocks of PySide2 and shiboken2 imports so that first")
print("PySide6/shiboken6 imports are tried, then it falls back to PySide2/shiboken2.")
print()
@keithel
keithel / updated-completer.py
Created August 24, 2022 15:32
Update a QCompleter model on textEdited and show updated completions
from PySide6 import QtCore, QtWidgets
from __feature__ import snake_case, true_property # noqa: F401
class Window(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.main_widget = QtWidgets.QWidget(self)
self.set_central_widget(self.main_widget)
self.layout_ = QtWidgets.QVBoxLayout(self.main_widget)