Skip to content

Instantly share code, notes, and snippets.

@estan
estan / test.py
Created April 19, 2016 09:26
test.py
import sys
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QPixmap
class GraphWidget(QtGui.QGraphicsView):
def __init__(self, mainwindow, *args, **kwargs):
super(GraphWidget, self).__init__(*args, **kwargs)
self.scene = QtGui.QGraphicsScene()
self.setScene(self.scene)
(machine) [estan@pyret orexplore.machine]$ svn propget svn:ignore
.idea
.cache
.eggs
*.egg-info
*.pyc
__pycache__
.coverage
(machine) [estan@pyret orexplore.machine]$ svn status
@estan
estan / .bashrc
Last active November 22, 2018 14:22
How I set up kwallet-pam, ssh-agent, ksshaskpass (your login and KWallet passwords must match)
#
# Add this to your ~/.bashrc:
#
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
from sys import exit, argv
from PyQt5.QtWidgets import QWidget, QApplication, QFormLayout, QLabel, \
QComboBox, QLineEdit
class Widget(QWidget):
def __init__(self, parent=None):
@estan
estan / test.py
Created May 7, 2016 12:59
Shortcut not working
from sys import argv, exit
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
@estan
estan / test.cpp
Created May 7, 2016 13:17
Shortcut not working with Qt 5, works with Qt 4
#include <QApplication>
#include <QMainWindow>
#include <QPushButton>
#include <QWidget>
#include <QDebug>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
@estan
estan / process.py
Created May 10, 2016 09:25
QProcess with built-in timeout (bad approach)
class Process(QProcess):
succeeded = pyqtSignal()
failed = pyqtSignal()
timedOut = pyqtSignal()
def __init__(self, timeout=1000, *args, **kwargs):
super().__init__(*args, **kwargs)
self._timer = QTimer()
@estan
estan / process.py
Created May 10, 2016 14:04
QProcess subclass with built-in timeout
from logging import getLogger
from PyQt5.QtCore import QProcess, QTimer, pyqtSignal, pyqtProperty
log = getLogger(__name__)
class Process(QProcess):
"""Process class with built-in timeout
@estan
estan / copyright
Created May 21, 2016 14:29
copyright
@estan
estan / example.py
Created May 27, 2016 14:23
QML Enum Example
from sys import exit, argv
from PyQt5.QtCore import pyqtSignal, pyqtProperty, Q_ENUMS, QObject
from PyQt5.QtQml import QQmlApplicationEngine, qmlRegisterType
from PyQt5.QtGui import QGuiApplication
app = None