Beispiel #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from PyQt4.QtCore import QObject, pyqtSignal, Qt, QUrl, QString, QTimer, SIGNAL, QSize
from PyQt4.QtGui import QWidget, QSizePolicy, QFont, QLabel, QHBoxLayout, QSpacerItem, QVBoxLayout, QSpinBox, QLineEdit, \
    QApplication
from PyQt4.QtDeclarative import QDeclarativeView, QDeclarativeProperty, QDeclarativeItem
import os
try:
    from lib import global_vars
except ImportError:
    global_vars = QObject()
    global_vars.configuration = {"GENERAL": {"sleeptimerdigitalspinbox":False}}  #use spinner
    #global_vars.configuration = {"GENERAL": {"sleeptimerdigitalspinbox":True}}  #use spinbox

cwd = os.path.dirname(os.path.realpath(__file__))      # gives the path, where the script is located

class SleepTimer(QWidget):
    '''
    A resizable Widget with two Spinboxes Labeled with "h" and "min", also a Time-bomb containing a countdownclock.
    If a spinbox is changed, start is triggered. After 2 Seconds, countdown is startet.
    When countdown ends, signal "sleepTimerelapsed()" is emitted.
    '''
    sleepTimerelapsed = pyqtSignal()
    sleepTimertenseconds = pyqtSignal()

    def __init__(self, parent=None):
        super(SleepTimer, self).__init__(parent)
        self.forceSpinBoxWidget = global_vars.configuration.get("GENERAL").get("sleeptimerdigitalspinbox")
        self.setStyleSheet("SleepTimer {"
                            "background-color: rgb(76, 76, 76);"
Beispiel #2
0
from PyQt4.QtGui import QWidget, QSizePolicy, QFont, QLabel, QHBoxLayout, QSpacerItem, QVBoxLayout, QSpinBox, QLineEdit, \
    QApplication
from PyQt4.QtDeclarative import QDeclarativeView, QDeclarativeProperty, QDeclarativeItem
import os
import logging

logger = logging.getLogger(__name__)

try:
    from lib import global_vars
except ImportError, e:
    logger.warn("Could not import global_vars: {}".format(e))
    global_vars = QObject()
    global_vars.configuration = {
        "GENERAL": {
            "sleeptimerdigitalspinbox": False
        }
    }  #use spinner
    #global_vars.configuration = {"GENERAL": {"sleeptimerdigitalspinbox":True}}  #use spinbox

cwd = os.path.dirname(
    os.path.realpath(__file__))  # gives the path, where the script is located


class SleepTimer(QWidget):
    '''
    A resizable Widget with two Spinboxes Labeled with "h" and "min", also a Time-bomb containing a countdownclock.
    If a spinbox is changed, start is triggered. After 2 Seconds, countdown is startet.
    When countdown ends, signal "sleepTimerelapsed()" is emitted.
    '''
    sleepTimerelapsed = pyqtSignal()