Beispiel #1
0
class InvokeEvent(QEvent):
    EVENT_TYPE = QEvent.Type(QEvent.registerEventType())

    def __init__(self, fn, *args, **kwargs):
        QEvent.__init__(self, InvokeEvent.EVENT_TYPE)
        self.fn = fn
        self.args = args
        self.kwargs = kwargs
Beispiel #2
0
 def closeEvent(self, event: QtCore.QEvent):
     if self._base_check_is_modified():
         event.ignore()
         return
     self.unload_document()
     self.base_stop_threads = True
     for thread in self.base_threads:
         thread.join()
     super().closeEvent(event)
Beispiel #3
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
    def testFlagAccess(self):
        #QEvent.Type flags usage

        event = QEvent(QEvent.Timer)
        self.assertEqual(event.type(), QEvent.Timer)

        event = QEvent(QEvent.Close)
        self.assertEqual(event.type(), QEvent.Close)

        event = QEvent(QEvent.IconTextChange)
        self.assertEqual(event.type(), QEvent.IconTextChange)
Beispiel #5
0
    def on_actionCopyInspectorData_triggered(self):
        string = 'Node inspector data\n-------------------'
        # raise()
        for qModelIndex in self.ui.nodeInspector.selectedIndexes():
            string += '\n' + qModelIndex.internalPointer().toString('    ')

        clipboard = app.clipboard()
        clipboard.setText(string)
        event = QEvent(QEvent.Clipboard)
        app.sendEvent(clipboard, event)
Beispiel #6
0
    def testFlagAccess(self):
        #QEvent.Type flags usage

        event = QEvent(QEvent.Timer)
        self.assertEqual(event.type(), QEvent.Timer)

        event = QEvent(QEvent.Close)
        self.assertEqual(event.type(), QEvent.Close)

        event = QEvent(QEvent.IconTextChange)
        self.assertEqual(event.type(), QEvent.IconTextChange)
Beispiel #7
0
from PySide.QtCore import QEvent, Qt
import PySide

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):
        self.assert_(
            QEvent.User <= int(TestEvent.TestEventType) <= QEvent.MaxUser)
        self.assert_(QEvent.User <= int(TEST_EVENT_TYPE) <= QEvent.MaxUser)

    def testUserTypesRepr(self):
        self.assertEqual(eval(repr(TestEvent.TestEventType)),
                         TestEvent.TestEventType)
        self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE)

Beispiel #8
0
 def __init__(self, i):
     print("TYPE:", type(QEvent.User))
     super(MyEvent, self).__init__(QEvent.Type(QEvent.User + 100))
     self.i = i
Beispiel #9
0
from PySide.QtCore import QEvent, Qt
import PySide

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):
        self.assert_(QEvent.User <= int(TestEvent.TestEventType) <= QEvent.MaxUser)
        self.assert_(QEvent.User <= int(TEST_EVENT_TYPE) <= QEvent.MaxUser)

    def testUserTypesRepr(self):
        self.assertEqual(eval(repr(TestEvent.TestEventType)), TestEvent.TestEventType)
        self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE)

if __name__ == '__main__':
    unittest.main()
Beispiel #10
0
 def __init__(self):
     QEvent.__init__(self, QEvent.Type(999))
Beispiel #11
0
 def __init__(self, fn, *args, **kwargs):
     QEvent.__init__(self, InvokeEvent.EVENT_TYPE)
     self.fn = fn
     self.args = args
     self.kwargs = kwargs
Beispiel #12
0
 def __init__(self, fn, *args, **kwargs):
     QEvent.__init__(self, InvokeEvent.EVENT_TYPE)
     self.fn = fn
     self.args = args
     self.kwargs = kwargs
Beispiel #13
0
 def __init__(self):
     QEvent.__init__(self, QEvent.Type(999))