A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
qmake -project | |
# Add option by edit *.pro | |
# QT += core gui widgets | |
qmake | |
make |
#! /usr/bin/python3 | |
from PyQt5.QtWidgets import QApplication, QMainWindow | |
from PyQt5.QtCore import QCoreApplication, QSettings | |
class Window(QMainWindow): | |
def __init__(self): | |
super(Window, self).__init__() | |
settings = QSettings() | |
self.list = settings.value('list', ['a', 'b', 'c']) |
#include <vector> | |
#include <utility> // std::pair | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main(int argc, char const *argv[]) | |
{ |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> |
import os | |
import uuid | |
import threading | |
import logging | |
import subprocess | |
class LogPipe(threading.Thread): | |
def __init__(self, logfile=None, level=logging.INFO): | |
"""Setup the object with a logger and a loglevel and start the thread |
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QPushButton, QWidget | |
from PyQt5.QtCore import QObject, QRunnable, QThreadPool,pyqtSlot, pyqtSignal | |
import time | |
import traceback, sys | |
class WorkerSignals(QObject): | |
''' | |
Defines the signals available from a running worker thread. | |
Supported signals are: |
#!/usr/bin/env python3 | |
from PyQt5.QtCore import QDateTime, Qt, QTimer | |
from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox, QDateTimeEdit, | |
QDial, QDialog, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit, | |
QProgressBar, QPushButton, QRadioButton, QScrollBar, QSizePolicy, | |
QSlider, QSpinBox, QStyleFactory, QTableWidget, QTabWidget, QTextEdit, | |
QVBoxLayout, QWidget) | |
# Ignore generated files | |
/*.deb | |
/*.dsc | |
/*.changes | |
# Only care about debian/ directory | |
/*/* | |
!/*/debian | |
# Ignore files generated during build |
#!/usr/bin/python3 | |
import signal | |
import gi | |
gi.require_version('Gtk', '3.0') | |
gi.require_version('AppIndicator3', '0.1') | |
from gi.repository import Gtk | |
from gi.repository import AppIndicator3 as AppIndicator |