Skip to content

Instantly share code, notes, and snippets.

View eyllanesc's full-sized avatar
:octocat:
I may be slow to respond.

Edwin Yllanes eyllanesc

:octocat:
I may be slow to respond.
View GitHub Profile
from PyQt5 import QtCore, QtGui, QtQuick
class RadialBar(QtQuick.QQuickPaintedItem):
class DialType():
FullDial = 0
MinToMax = 1
NoDial = 2
@eyllanesc
eyllanesc / builder.py
Created October 19, 2019 21:41
Qt.py patch
def _patch():
import os
import sys
import importlib.util
module_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "QtSiteConfig.py"
)
spec = importlib.util.spec_from_file_location("QtSiteConfig", module_path)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es">
<context>
<name>Form</name>
<message>
<location filename="main_ui.py" line="31"/>
<source>Form</source>
<translation>Formulario</translation>
</message>
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>L_PREFER_CANVAS=false; L_NO_TOUCH=false; L_DISABLE_3D=false;</script>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.3.4/dist/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.3.4/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
from PySide2 import QtCore, QtGui, QtWidgets
class InfoBox(QtWidgets.QGraphicsItem):
Type = QtWidgets.QGraphicsItem.UserType + 1
def __init__(self, parent=None):
super(InfoBox, self).__init__(parent)
self.setZValue(4)
proxy = QtWidgets.QGraphicsProxyWidget(self)
widget = QtWidgets.QLabel("TEST!")
@eyllanesc
eyllanesc / index.html
Created August 15, 2017 13:04
OpenLayers Geolocation in PyQt 5.9
<!DOCTYPE html>
<html>
<head>
<title>Accessible Map</title>
<link rel="stylesheet" href="https://openlayers.org/en/v4.2.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://openlayers.org/en/v4.2.0/build/ol-debug.js"></script>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<style>
from PyQt5 import QtCore, QtWidgets
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self._gv = QtWidgets.QGraphicsView()
self.setCentralWidget(self._gv)
self._gv.viewport().installEventFilter(self)
def eventFilter(self, obj, event):
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
def copy_widget(w):
if isinstance(w, QtWidgets.QWidget):
new_w = type(w)()
if isinstance(w, QtWidgets.QComboBox):
vals = [w.itemText(ix) for ix in range(w.count())]
new_w.addItems(vals)
return new_w
import random
from PyQt5 import QtCore, QtGui, QtWidgets
class FlowLayout(QtWidgets.QLayout):
def __init__(self, parent=None, margin=-1, hspacing=-1, vspacing=-1):
super(FlowLayout, self).__init__(parent)
self._hspacing = hspacing
self._vspacing = vspacing
self._items = []
self.setContentsMargins(margin, margin, margin, margin)
from PyQt5 import QtCore, QtWidgets
import queue
import threading
import pyqtgraph as pg
import numpy as np
class App(QtWidgets.QMainWindow):
def __init__(self):
super(App, self).__init__()
self.initUI()