Navigation Menu

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
import sys
from PyQt5.QtCore import pyqtSlot, QSortFilterProxyModel, Qt, QUrl, QDir, QAbstractListModel
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine
class SortProxyModel(QSortFilterProxyModel):
@pyqtSlot(str, Qt.SortOrder)
def sortData(self, roleName, order):
@eyllanesc
eyllanesc / CompleterWithQSqlTableModel.pro
Created September 22, 2017 18:34
Example QCompleter with QSqlTableModel
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-17T11:02:01
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql
@eyllanesc
eyllanesc / 47339044.py
Created November 16, 2017 23:32
47339044
import sys
import PyQt5
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
# This is our window from QtCreator
import mainwindow_auto
class DataCaptureThread(QThread):
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-01T21:56:52
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
from PySide2.QtCore import Qt, QSize, QRect, QEvent
from PySide2.QtWidgets import QStyledItemDelegate, QStyleOptionViewItem, QApplication, QStyle, QTableWidget, \
QTableWidgetItem
class ItemDelegate(QStyledItemDelegate):
def paint(self, painter, option, index):
opt = QStyleOptionViewItem(option)
if index.column() == 0:
textMargin = QApplication.style().pixelMetric(QStyle.PM_FocusFrameHMargin) + 1
@eyllanesc
eyllanesc / 47091216.py
Last active November 25, 2020 09:38
47091216
from PyQt5.QtCore import *
from PyQt5.QtGui import QDrag
from PyQt5.QtWidgets import *
class TreeWidget(QTreeWidget):
customMimeType = "application/x-customTreeWidgetdata"
def mimeTypes(self):
mimetypes = QTreeWidget.mimeTypes(self)
@eyllanesc
eyllanesc / main.py
Created May 16, 2018 20:30
50314865
import sys
import os
from PySide2.QtCore import Qt, QObject, Signal, Slot, Property
from PySide2.QtWidgets import QApplication
from PySide2.QtQml import QQmlApplicationEngine
my_list = ['here','is','my','list']
class Manager(QObject):
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
if __name__ == '__main__':
app = QApplication(sys.argv)
view = QWebView()
view.settings().setAttribute(QWebSettings.JavascriptEnabled, True)
from PySide2.QtWidgets import *
from PySide2.QtCore import *
class Model(QAbstractTableModel):
def __init__(self, cycles = [[]], headers = [], parent = None):
QAbstractTableModel.__init__(self, parent)
self.cycles = cycles
self.headers = headers
self.values_checked = []
from PySide2.QtCore import Property, QObject, Signal, QCoreApplication, QTimer
class QtProperty(Property):
def __init__(self, value, name='', type_=None, notify=None):
if type_ and notify:
super().__init__(type_, self.getter, self.setter, notify=notify)
self.value = value
self.name = name
def getter(self, inst=None):