# Path: src/controllers/utils.py
# def registerContext(func):
#     @functools.wraps(func)
#     def wrapper(*args, **kwargs):
#         self = args[0]
#         if hasattr(self, '__contextName__'):
#             contexts.update({self.__contextName__: self})
#         func(*args, **kwargs)
# 
#     return wrapper
# 
# def duration_to_string(value, default="00:00", i=1000):
#     ''' convert duration to string. '''
#     if not value: return default
#     if (value / i) < 1: i = 1
#     if value < 1000:
#         return default
#     else:
#         duration = "%02d:%02d" % (value / (60 * i), (value / i) % 60)
#         if value / (60 * i) / 60 >= 2:
#             duration = "%03d:%02d" % (value / (60 * i), (value / i) % 60)
#         return duration


import os
import sys
from PyQt5.QtCore import (QObject, pyqtSignal, pyqtSlot, pyqtProperty, QUrl)
from PyQt5.QtGui import QCursor, QDesktopServices
from .utils import registerContext, duration_to_string
#!/usr/bin/python
# -*- coding: utf-8 -*-



class UtilWorker(QObject):

    __contextName__ = 'UtilWorker'

    @registerContext
    def __init__(self, parent=None):
        super(UtilWorker, self).__init__(parent)

    @pyqtSlot(int, result='QString')
    def int_to_string(self, value):
        return str(value)

    @pyqtSlot(int, result='QString')
    def duration_to_string(self, duration):

# Path: src/controllers/utils.py
# def registerContext(func):
#     @functools.wraps(func)
#     def wrapper(*args, **kwargs):
#         self = args[0]
#         if hasattr(self, '__contextName__'):
#             contexts.update({self.__contextName__: self})
#         func(*args, **kwargs)
# 
#     return wrapper
# 
# def duration_to_string(value, default="00:00", i=1000):
#     ''' convert duration to string. '''
#     if not value: return default
#     if (value / i) < 1: i = 1
#     if value < 1000:
#         return default
#     else:
#         duration = "%02d:%02d" % (value / (60 * i), (value / i) % 60)
#         if value / (60 * i) / 60 >= 2:
#             duration = "%03d:%02d" % (value / (60 * i), (value / i) % 60)
#         return duration


# Path: src/controllers/utilworker.py
import os
import sys
from PyQt5.QtCore import (QObject, pyqtSignal, pyqtSlot, pyqtProperty, QUrl)
from PyQt5.QtGui import QCursor, QDesktopServices
from .utils import registerContext, duration_to_string

#!/usr/bin/python
# -*- coding: utf-8 -*-



class UtilWorker(QObject):

    __contextName__ = 'UtilWorker'

    @registerContext
    def __init__(self, parent=None):
        super(UtilWorker, self).__init__(parent)

    @pyqtSlot(int, result='QString')
    def int_to_string(self, value):
        return str(value)

    @pyqtSlot(int, result='QString')
    def duration_to_string(self, duration):

        return duration_to_string(duration)