Ejemplo n.º 1
0
class QSlotEvent(QEvent):
    EVENT_TYPE = QEvent.Type(QEvent.registerEventType())

    def __init__(self, reference, *args, **kwargs):
        QEvent.__init__(self, QSlotEvent.EVENT_TYPE)
        self.reference = reference
        self.args = args
        self.kwargs = kwargs
Ejemplo n.º 2
0
class TestEvent(QEvent):
    TestEventType = QEvent.Type(QEvent.registerEventType())

    def __init__(self, rand=0):
        super(TestEvent, self).__init__(TestEvent.TestEventType)
        self._rand = rand

    def getRand(self):
        return self._rand
Ejemplo n.º 3
0
class _MethodInvokeEvent(QEvent):

    EVENT_TYPE = QEvent.Type(QEvent.registerEventType())

    def __init__(self, func, args, kwargs):
        # type: (Callable[[Any], Any], Any, Any) -> NoReturn
        super(_MethodInvokeEvent, self).__init__(_MethodInvokeEvent.EVENT_TYPE)
        self.func = func
        self.args = args
        self.kwargs = kwargs
Ejemplo n.º 4
0
def headless_main(args):
    """
    Executes a project using :class:`QCoreApplication`.

    Args:
        args (argparser.Namespace): parsed command line arguments.
    Returns:
        int: exit status code; 0 for success, everything else for failure
    """
    application = QCoreApplication(sys.argv)
    startup_event_type = QEvent.Type(QEvent.registerEventType())
    task = ExecuteProject(args, startup_event_type, application)
    application.postEvent(task, QEvent(startup_event_type))
    return application.exec_()
Ejemplo n.º 5
0
 def __init__(self):
     QEvent.__init__(self, QEvent.Type(999))
Ejemplo n.º 6
0
 def __init__(self, i):
     print("TYPE:", type(QEvent.User))
     super(MyEvent, self).__init__(QEvent.Type(QEvent.User + 100))
     self.i = i
Ejemplo n.º 7
0
## General Public License version 3 as published by the Free Software
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################

from PySide2.QtCore import QEvent, Qt
import PySide2

import unittest

TEST_EVENT_TYPE = QEvent.Type(QEvent.registerEventType())


class TestEvent(QEvent):
    TestEventType = QEvent.Type(QEvent.registerEventType())

    def __init__(self, rand=0):
        super(TestEvent, self).__init__(TestEvent.TestEventType)
        self._rand = rand

    def getRand(self):
        return self._rand


class TestEnums(unittest.TestCase):
    def testUserTypesValues(self):