This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: asyncstuff | |
channels: | |
- defaults | |
- krisvanneste | |
- david_baddeley | |
- conda-forge | |
- danieljfarrell_teraview | |
- teraview | |
- pkgs/main | |
- pkgs/free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code was helpful, | |
https://stackoverflow.com/questions/32141623/pyqt5-and-asyncio-yield-from-never-finishes | |
""" | |
import os | |
import sys | |
import quamash | |
import asyncio | |
import traceback | |
import PyQt5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread, Event, Timer | |
import time | |
def TimerReset(*args, **kwargs): | |
""" Global function for Timer """ | |
return _TimerReset(*args, **kwargs) | |
class _TimerReset(Thread): | |
"""Call a function after a specified number of seconds: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import sys | |
import asyncio | |
from functools import partial, wraps | |
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QProgressBar, QErrorMessage | |
from PyQt5.QtCore import Qt | |
from quamash import QEventLoop | |
import traceback | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtWidgets import QSlider | |
class DoubleSlider(QSlider): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.decimals = 5 | |
self._max_int = 10 ** self.decimals | |
super().setMinimum(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
from PyQt5.QtCore import QAbstractItemModel, QFile, QIODevice, QModelIndex, Qt | |
from PyQt5.QtWidgets import QApplication, QTreeView | |
import sys | |
from tree_model import TreeModel, TreeNode, RefNode | |
class NamedElement(object): # your internal structure | |
def __init__(self, name, subelements): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import traceback | |
import enum | |
import functools | |
class InvalidVisitedState(Exception): | |
""" Raised when an state change sequence is incorrect. | |
""" | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Reworked code based on | |
http://trevorius.com/scrapbook/uncategorized/pyqt-custom-abstractitemmodel/ | |
Adapted to Qt5 and fixed column/row bug. | |
TODO: handle changing data. | |
""" | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
traefik: | |
image: traefik:v2.0 | |
container_name: traefik | |
restart: unless-stopped | |
security_opt: | |
- no-new-privileges:true | |
networks: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll["Global`*"]; | |
eqns = {X'[t] == P - (k1 + k2) X[t] + A k1 X[t], Y'[t] == k1 X[t] - A k1 X[t] - k3 Y[t], X[0] == 0, Y[0] == 0} | |
s = Assuming[k0 > 0 && k1 > 0 && k2 > 0 && k3 > 0 && P > 0 && A >= 0 && A < 1, Limit[DSolveValue[eqns,{X[t], Y[t]}, t], t -> \[Infinity]]] |