Пример #1
0
def _create_system_tray_icon():
    if "qtpy" in sys.modules:
        from qtpy.QtWidgets import QApplication

        if QApplication.instance():
            from qtpy.QtWidgets import QSystemTrayIcon
            from qtpy.QtGui import QIcon, QPixmap
            from xicam.gui.static import path

            global trayicon
            trayicon = QSystemTrayIcon(
                QIcon(QPixmap(str(
                    path("icons/cpu.png")))))  # TODO: better icon
Пример #2
0
    INFO: "INFO",
    WARNING: "WARNING",
    ERROR: "ERROR",
    CRITICAL: "CRITICAL"
}

trayicon = None
if "qtpy" in sys.modules:
    from qtpy.QtWidgets import QApplication

    if QApplication.instance():
        from qtpy.QtWidgets import QSystemTrayIcon
        from qtpy.QtGui import QIcon, QPixmap
        from xicam.gui.static import path

        trayicon = QSystemTrayIcon(QIcon(QPixmap(str(
            path("icons/cpu.png")))))  # TODO: better icon

_thread_count = 0


def _increment_thread():
    global _thread_count
    _thread_count += 1
    return _thread_count


threadIds = defaultdict(_increment_thread)


def showProgress(value: int, minval: int = 0, maxval: int = 100):
    """
Пример #3
0
    INFO: 'INFO',
    WARNING: 'WARNING',
    ERROR: 'ERROR',
    CRITICAL: 'CRITICAL'
}

trayicon = None
if 'qtpy' in sys.modules:
    from qtpy.QtWidgets import QApplication

    if QApplication.instance():
        from qtpy.QtWidgets import QSystemTrayIcon
        from qtpy.QtGui import QIcon, QPixmap
        from xicam.gui.static import path

        trayicon = QSystemTrayIcon(QIcon(QPixmap(str(
            path('icons/xicam.gif')))))  # TODO: better icon


def showProgress(value: int, minval: int = 0, maxval: int = 100):
    """
    Displays the progress value on the subscribed QProgressBar (set as the global progressbar)

    Parameters
    ----------
    value   : int
        Progress value.
    minval  : int
        Minimum value (default: 0)
    maxval  : int
        Maximum value (default: 100)