Skip to content

Instantly share code, notes, and snippets.

@Siecje
Siecje / init
Created March 8, 2024 20:18
switch_root with encrypted partition
#!/bin/sh
mount -t devtmpfs none /dev
mount -t proc proc /proc
mount -t sysfs sysfs /sys
until [ -b "/dev/mmcblk0p2" ]; do
sleep 5
done
import graphene
class GeoInput(graphene.InputObjectType):
lat = graphene.Float(required=True)
lng = graphene.Float(required=True)
@property
def latlng(self):
return "({},{})".format(self.lat, self.lng)
@Siecje
Siecje / client.py
Created March 12, 2019 21:04
Simple network pygame
import json
import sys
import pygame
import requests
pygame.init()
window_w = 800
@Siecje
Siecje / main.py
Created June 14, 2018 18:35
PySide2 signal with list of strings
import os
import sys
import threading
from PySide2 import QtCore, QtGui, QtQml
QML = b"""
import QtQuick 2.7
import QtQuick.Controls 2.0
@Siecje
Siecje / main.py
Created February 7, 2018 17:16
pyqtProperty(dict) fails in PyQt 5.10 with TypeError but works in 5.8.2
import sys
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQml import QQmlApplicationEngine, qmlRegisterType
class Interface(QObject):
def __init__(self, parent=None):
super().__init__(parent=parent)
import QtQuick 2.0
import QtQuick.Controls 2.0
Popup {
id: popup
modal: false
focus: false
property alias text: txt.text
closePolicy: Popup.NoAutoClose // To close click the notification or wait 5 seconds
@Siecje
Siecje / simple.qml
Last active December 11, 2017 19:43
GridLayout Cell already taken example
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3 as Layouts
Item {
id: base
property var categories: ['one', 'two', 'three']
width: 800
height: 600
@Siecje
Siecje / output.sh
Last active December 11, 2017 16:40
Complains about item already being in cell
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
@Siecje
Siecje / simple.py
Last active December 11, 2017 14:17
How to set the colour of a QML component in a QtWidgets application?
import sys
from PyQt5 import QtCore, QtQuick, QtQuickWidgets, QtWidgets
QML = """
import QtQuick 2.1
Rectangle {
id: rectangle
color: "red"
@Siecje
Siecje / output.sh
Created November 30, 2017 16:22
How do you test a TextField in QML?
$ qmltestrunner
********* Start testing of qmltestrunner *********
Config: Using QtTest library 5.9.2, Qt 5.9.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6))
PASS : qmltestrunner::initTestCase()
PASS : qmltestrunner::test_focus()
FAIL! : qmltestrunner::test_input() window not shown
Loc: [/home/siecje/Qt/5.9.2/gcc_64/qml/QtTest/TestCase.qml(1634)]
PASS : qmltestrunner::test_placeholder()
PASS : qmltestrunner::cleanupTestCase()
Totals: 4 passed, 1 failed, 0 skipped, 0 blacklisted, 4ms