def testQGraphicsProxyWidget(self):
        scene = QGraphicsScene()

        proxy = QGraphicsProxyWidget(None, Qt.Window)
        widget = QLabel('Widget')
        proxy.setWidget(widget)
        proxy.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
        scene.addItem(proxy)
        scene.setSceneRect(scene.itemsBoundingRect())

        view = QGraphicsView(scene)
        view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
        view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
        view.show()

        timer = QTimer.singleShot(100, self.app.quit)
        self.app.exec_()
Example #2
0
 def testFontInfo(self):
     w = MyWidget()
     w._app = self.app
     w._info = None
     QTimer.singleShot(300, w.show)
     self.app.exec_()
     self.assert_(w._info)
Example #3
0
 def testPythonSlot(self):
     self._sucess = False
     view = View()
     view.called.connect(self.done)
     view.show()
     QTimer.singleShot(300, QCoreApplication.instance().quit)
     self.app.exec_()
     self.assertTrue(self._sucess)
Example #4
0
 def testSetPenWithPenStyleEnum(self):
     '''Calls QPainter.setPen with both enum and integer. Bug #511.'''
     w = Painting()
     w.show()
     QTimer.singleShot(1000, self.app.quit)
     self.app.exec_()
     self.assertEqual(w.penFromEnum.style(), Qt.NoPen)
     self.assertEqual(w.penFromInteger.style(), Qt.SolidLine)
Example #5
0
 def move_auto(self, transfered, total_steps, i=1):
     transfer = transfered[i]
     self.select(self.buckets[transfer[0] - 1])
     self.select(self.buckets[transfer[1] - 1])
     self.update_layout()
     self.update_title()
     if i != total_steps:
         QTimer.singleShot(
             500, lambda: self.move_auto(transfered, total_steps, i + 1))
Example #6
0
 def notify_changes_in_dag(self, dag):
     """Notifies the items in given dag that the dag has changed."""
     # We wait 100 msecs before do the notification. This is to avoid notifying multiple
     # times the same dag, when multiple items in that dag change.
     if dag in self._dags_about_to_be_notified:
         return
     self._dags_about_to_be_notified.add(dag)
     QTimer.singleShot(100,
                       lambda dag=dag: self._do_notify_changes_in_dag(dag))
Example #7
0
    def Activated(self):
        from .gui import AsmCmdManager
        AsmCmdManager.WorkbenchActivated = True
        for cmd in AsmCmdManager.getInfo().Types:
            cmd.workbenchActivated()

        if not 'freecad.asm3.sys_slvs' in sys.modules:
            from PySide2.QtCore import QTimer
            QTimer.singleShot(100, self.check_slvs)
Example #8
0
 def new_screenshot(self):
     if self.hide_this_window_check_box.isChecked():
         self.hide()
     self.new_screenshot_button.setDisabled(True)
     if self.delay_spin_box.value() != 0:
         QTimer.singleShot(self.delay_spin_box.value()
                           * 1000, self.shoot_screen)
     else:
         QTimer.singleShot(100, self.shoot_screen)
Example #9
0
    def executejavascript(self, scriptsrc):
        self.loop = QEventLoop()
        self.result = None
        QTimer.singleShot(250, self.loop.quit)

        self.runJavaScript(scriptsrc, self.callbackjs)
        self.loop.exec_()
        self.loop = None
        return self.result
Example #10
0
    def _open_file_deferred(self):
        if not self.file_queue:
            return

        file = self.file_queue.pop()
        self.ui.main_menu.file_menu.guess_open_file(file)

        if self.file_queue:
            QTimer.singleShot(250, self._open_file_deferred)
Example #11
0
 def testIt(self):
     app = QGuiApplication([])
     qmlRegisterType(MyClass,'Example',1,0,'MyClass')
     view = QQuickView()
     view.setSource(QUrl.fromLocalFile(adjust_filename('bug_926.qml', __file__)))
     self.assertEqual(len(view.errors()), 0)
     view.show()
     QTimer.singleShot(0, app.quit)
     app.exec_()
Example #12
0
 def attach_file(self):
     attach_file_name, _ = QFileDialog.getOpenFileName(
         self, 'Select A File',
         os.path.join(os.environ["HOMEPATH"], "Desktop"), "all files (*.*)")
     if not attach_file_name:
         return
     attachment_label = AttachmentLabel(attach_file_name)
     self.ui.attachment_grid.addWidget(attachment_label)
     # wait for 10 milliseconds (for scroll bar ui to update) before setting vertical scroll bar value
     QTimer.singleShot(10, self.focus_on_attachment)
Example #13
0
    def _setup_overlay(self):
        self.overlay = DesktopWideOverlay()

        def start():
            self.overlay.show()
            self.overlay.check_compatibility()

        # Seems like QGraphicsView has a delay before applying stylesheet
        # Put some delay to allow it to initialize and not flash
        QTimer.singleShot(1000, start)
 def sm_prediction(self):
     print("Entered sm_prediction %d persons " %
           len(self._current_person_list))
     for person in self._current_person_list:
         person.predict()
         logger.debug("Person %d predicted at (%s) " %
                      (person.person_id, str(person.pos)))
         self._update_person_list_view(self._current_person_list,
                                       self.ui._first_view)
     QTimer.singleShot(self.Period, self.predictiontoprediction)
 def testSay(self):
     engines = QTextToSpeech.availableEngines()
     if not engines:
         print('No QTextToSpeech engines available')
     else:
         speech = QTextToSpeech(engines[0])
         speech.stateChanged.connect(self._slotStateChanged)
         speech.say("Hello, PySide2")
         QTimer.singleShot(5000, self.app.quit)
         self.app.exec_()
 def undo_move(self):
     remembered = self.main_window.remember_choice_config
     undo = self.main_window.history_table.pop()
     matrix = undo[0]
     self.main_window.start_game(remembered[0], False, remembered[2],
                                 matrix)
     # heuristic bar is updated 50ms so it will happend after, because this undo create new game with 'undo'
     # starting matrix
     QTimer.singleShot(
         50, lambda: self.main_window.update_heuristic_bar(undo[1]))
Example #17
0
def selfCloseInterface(
        message: str,
        time_to_close: int = 2,
        alert_level: int = 1,  # [0,1,2,3]
        title: str = 'Alert',
        info: str = ''
):
    alert = SelfCloseMsgBox(message, alert_level, title, info)
    QTimer.singleShot(time_to_close*1000, alert, SLOT('accept()'))
    return alert.exec_()
Example #18
0
    def play(self):
        if self.player.state() == QMediaPlayer.PlayingState:
            self.player.pause()
            return
        if self.player.mediaStatus() == QMediaPlayer.LoadingMedia or\
                self.player.mediaStatus() == QMediaPlayer.StalledMedia:
            QTimer.singleShot(600, self.player.play)

        self.player.play()
        self.playlist.update_listview()
Example #19
0
    def testIt(self):
        app = QApplication([])
        self.box = MySpinBox()
        self.box.show()

        QTimer.singleShot(0, self.sendKbdEvent)
        QTimer.singleShot(100, app.quit)
        app.exec_()

        self.assertEqual(self.box.text(), '0')
Example #20
0
 def startProcess(self):
     try:
         self.fp = open(self.filePath, "r")
         self.timer.start()
         self.startSignal.emit()
     except OSError as err:
         Logger().error("Errore apertura file: " + self.filePatherr)
         Logger().error("Codice Errore: " + str(err.errno))
         Logger().error("Descrizione Errore: " + err.strerror)
         QTimer.singleShot(self.startProcess, 1000)
Example #21
0
 def _build_dl_finished(self, dl, dest):
     # here we are not in the working thread, since the connection was
     # done in the constructor
     if not dest == self.build_infos.build_file:
         return
     if dl is not None and (dl.is_canceled() or dl.error()):
         # todo handle this
         return
     # call this in the thread
     QTimer.singleShot(0, self._evaluate)
Example #22
0
        def setUp(self, timeout=100):
            '''Setups this Application.

            timeout - timeout in milisseconds'''
            global _timed_instance
            if _timed_instance is None:
                _timed_instance = QApplication([])

            self.app = _timed_instance
            QTimer.singleShot(timeout, self.app.quit)
Example #23
0
    def test_two(self):
        def do_task():
            self.assertIsNotNone(self.qapp)

            # This test also takes about 3 seconds as well before succeeding
            QTimer.singleShot(3000, self.qapp.quit)

        QTimer.singleShot(0, do_task)
        self._fail_if_timeout()
        self.assertEqual(0, self.qapp.exec_())
Example #24
0
    def __init__(self, parent):
        """
        Provide access to GUI QMainWindow via parent.
        """
        super().__init__(parent)
        self.gui = parent.parent()  # this is not the main gui

        QTimer.singleShot(
            200,
            self.style_me)  # not sure whu the ui isnt unpdating these here.
Example #25
0
        def setUp(self, timeout=100):
            '''Setups this Application.

            timeout - timeout in milisseconds'''
            global _timed_instance
            if _timed_instance is None:
                _timed_instance = QApplication([])

            self.app = _timed_instance
            QTimer.singleShot(timeout, self.app.quit)
Example #26
0
 def testIt(self):
     app = QGuiApplication([])
     qmlRegisterType(MyClass, 'Example', 1, 0, 'MyClass')
     view = QQuickView()
     view.setSource(
         QUrl.fromLocalFile(adjust_filename('bug_926.qml', __file__)))
     self.assertEqual(len(view.errors()), 0)
     view.show()
     QTimer.singleShot(0, app.quit)
     app.exec_()
Example #27
0
    def __init__(self, design: QDesign = None):
        """
        Args:
            design (QDesign, optional): Pass in the design that the GUI should handle.
                Defaults to None.
        """

        from .utility._handle_qt_messages import QtCore, _qt_message_handler
        QtCore.qInstallMessageHandler(_qt_message_handler)

        self.qApp = kick_start_qApp()
        if not self.qApp:
            logging.error("Could not start Qt event loop using QApplication.")

        super().__init__()

        # use set_design
        self.design = None  # type: QDesign

        # UIs
        self.plot_win = None  # type: QMainWindowPlot
        self.elements_win = None  # type: ElementsWindow
        self.component_window = ComponentWidget(self, self.ui.dockComponent)
        self.variables_window = PropertyTableWidget(self, gui=self)

        self.build_log_window = None
        self.is_dev_mode = False
        self.action_rebuild_deactive_icon = QIcon()
        self.action_rebuild_deactive_icon.addPixmap(QPixmap(":/rebuild"),
                                                    QIcon.Normal, QIcon.Off)
        self.action_rebuild_active_icon = QIcon()
        self.action_rebuild_active_icon.addPixmap(QPixmap(":/rebuild_needed"),
                                                  QIcon.Normal, QIcon.Off)
        self.ui.actionRebuild.setIcon(self.action_rebuild_deactive_icon)
        #self.ui.toolBarDesign.setIconSize(QSize(20,20))

        self._setup_component_widget()
        self._setup_plot_widget()
        self._setup_design_components_widget()
        self._setup_elements_widget()
        self._setup_variables_widget()
        self._ui_adjustments_final()
        self._setup_library_widget()

        # Show and raise
        self.main_window.show()
        # self.qApp.processEvents(QEventLoop.AllEvents, 1)
        # - don't think I need this here, it doesn't help to show and raise
        # - need to call from different thread.
        QTimer.singleShot(150, self._raise)

        if design:
            self.set_design(design)
        else:
            self._set_enabled_design_widgets(False)
Example #28
0
def createNextWebView():
    global functionID

    nListCount = len(FUNCTIONS_LIST) - 1
    functionID = functionID + 1
    print functionID

    if functionID < nListCount:
        createWebView( functionID )
    else:
        QTimer.singleShot(300, QApplication.instance().quit)
Example #29
0
    def test_one(self):
        def do_task():
            # This would be the main test logic, running in the qapp's event loop
            self.assertIsNotNone(self.qapp)

            # Pretend that the test takes about 3 seconds of non-blocking work to complete
            QTimer.singleShot(3000, self.qapp.quit)

        QTimer.singleShot(0, do_task)
        self._fail_if_timeout()
        self.assertEqual(0, self.qapp.exec_())
Example #30
0
    def __init__(self, ui, menu_edit):
        """

        :param modules.gui.main_ui.KnechtWindow ui:
        :param modules.widgets.menu_edit.EditMenu menu_edit:
        """
        super(DocHistoryWidget, self).__init__(ui)
        SetupWidget.from_ui_file(self, Resource.ui_paths['knecht_history'])

        self.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint)
        self.setWindowIcon(IconRsc.get_icon('later'))

        # --- Setup Fields ---
        self.ui = ui
        self.menu_edit = menu_edit

        self.view_mgr: UiViewManager = None
        self.viewList: QListWidget = self.viewList
        self.tab: QTabWidget = self.ui.srcTabWidget
        self.undo_grp: QUndoGroup = ui.app.undo_grp
        self.time_machine = None

        # --- Buttons ---
        self.jumpBtn: QPushButton = self.jumpBtn
        self.jumpBtn.setIcon(IconRsc.get_icon('history'))
        self.jumpBtn.setText(_('Zum gewählten Schritt springen'))
        self.jumpBtn.pressed.connect(self.time_jump)

        self.redoBtn: QPushButton = self.redoBtn
        self.undoBtn: QPushButton = self.undoBtn
        self.redoBtn.setEnabled(False)
        self.undoBtn.setEnabled(False)
        self.redoBtn.setIcon(IconRsc.get_icon('redo'))
        self.redoBtn.setText(_('Schritt Vorwärts'))
        self.undoBtn.setIcon(IconRsc.get_icon('undo'))
        self.undoBtn.setText(_('Schritt Zurück'))
        # Create undo/redo actions from undo_grp
        self.redo = self.undo_grp.createRedoAction(self, 'Redo')
        self.redo.changed.connect(self.undo_action_changed)
        self.undo = self.undo_grp.createUndoAction(self, 'Undo')
        self.undo.changed.connect(self.undo_action_changed)

        self.redoBtn.released.connect(self.redo.trigger)
        self.undoBtn.released.connect(self.undo.trigger)
        self.addActions([self.redo, self.undo])

        # --- Update delay ---
        self.update_view_timer.timeout.connect(self._update_view)

        # --- Connect viewList ---
        self.viewList.itemDoubleClicked.connect(self.time_jump_item_click)

        self.active_stack: QUndoStack = self.undo_grp.activeStack()
        QTimer.singleShot(1, self.delayed_setup)
Example #31
0
    def __init__(self, app: QApplication):
        super(MainWindow, self).__init__()
        self.app = app
        SetupWidget.from_ui_file(self, Resource.ui_paths['tieflader'])

        self.app_icon = IconRsc.get_icon('tieflader_icon')
        self.setWindowIcon(self.app_icon)

        # Set version window title
        self.setWindowTitle(f'{_("Tieflader")} - v{self.app.version}')

        # ---- Setup overlay progress widget ----
        self.progress_widget = ProgressOverlay(self.topWidget)

        # --- Setup main window resolution box ---
        # Setup expand area
        self.res_btn: QPushButton
        self.res_label: QLabel

        # Setup Resolution line edits
        self.res_x_edit = self.replace_resolution_edit(self.res_x_edit)
        self.res_y_edit = self.replace_resolution_edit(self.res_y_edit)
        self.update_resolution(from_settings=True)
        self.res_x_edit.textEdited.connect(self.update_resolution)
        self.res_y_edit.textEdited.connect(self.update_resolution)

        # Setup expandable resolution widget
        self.res_widget.setVisible(self.res_btn.isChecked())

        # Prepare translations
        self.translations()

        # ---- Setup Main Menu ----
        self.main_menu = MainWindowMenu(self)

        # Setup Main Window Open PSD CheckBox
        self.open_psd_box: QCheckBox
        self.open_psd_box.setText(
            self.main_menu.settings_menu.open_action.text())
        self.open_psd_box.setChecked(
            self.main_menu.settings_menu.open_action.isChecked())
        self.open_psd_box.toggled.connect(
            self.main_menu.settings_menu.open_action.toggle)
        self.main_menu.settings_menu.open_action.toggled.connect(
            self._update_psd_box)

        self.adv_settings_btn: QPushButton
        self.adv_settings_btn.clicked.connect(
            self.main_menu.settings_menu.open_settings_dialog)

        # ---- Setup File Drop ----
        self.drop = FileDrop(self)

        QTimer.singleShot(10, self.delayed_setup)
Example #32
0
 def __init__(self, filename):
     super().__init__()
     self.setWindowTitle(f'{APPNAME} {VERSION}')
     self.make_variables()
     self.make_widgets()
     self.make_actions()
     self.make_connections()
     qApp.commitDataRequest.connect(self.close)
     options = self.load_options(filename)
     self.update_ui()
     QTimer.singleShot(0, lambda: self.initalize_toggle_actions(options))
Example #33
0
 def __init__(self, parent: QtWidgets.QWidget):
     """
     Args:
         parent (QtWidgets.QWidget): parent widget
     """
     QTableView.__init__(self, parent)
     QWidget_PlaceholderText.__init__(self, "Select a QComponent to edit"\
         "\n\nfrom the QComponents window")
     QTimer.singleShot(
         200,
         self.style_me)  # not sure whu the ui isnt unpdating these here.
def qt_getfile():
    app = QApplication.instance()
    if app is None:
        app = QApplication(sys.argv)
    w = QWidget()
    data_dir_str = QFileDialog.getOpenFileName(w, caption='Select file')[0]
    datapath = Path(data_dir_str)
    # Let the event loop terminate after 1 ms and quit QApplication
    QTimer.singleShot(1, app.quit)
    app.exec_()
    return datapath
Example #35
0
    def __init__(self, version, logging_queue):
        LOGGER.info('Sys argv: %s', sys.argv)
        super(KnechtApp, self).__init__(sys.argv)

        splash = show_splash_screen_movie(self)

        self.version = version
        self.logging_queue = logging_queue

        # History widget will set active Undo Stack on view change
        self.undo_grp = QtWidgets.QUndoGroup(self)

        # -- Main Window --
        self.ui = KnechtWindow(self)
        self.ui.closeEvent = self.ui_close_event
        load_style(self)

        # -- Init DeltaGen thread --
        self.send_dg = SendToDeltaGen(self.ui)

        # -- Init Rendering Controller spawning rendering threads --
        self.render_dg = KnechtRender(self.ui)

        # -- Exception error box --
        self.error_message_box = GenericErrorBox(self.ui)

        # Prepare exception handling
        KnechtExceptionHook.app = self
        KnechtExceptionHook.setup_signal_destination(self.report_exception)

        # -- Show main window --
        self.ui.show()

        self.ready_to_quit = False
        self.aboutToQuit.connect(self.about_to_quit)

        splash.finish(self.ui)

        # Applying the style before showing the main window will not update
        # the menu font sizes
        self.setFont(FontRsc.regular)

        self.session_handler = None

        self.file_queue = list()
        if len(sys.argv) > 1:
            for a in sys.argv:
                if path_exists(a):
                    self.file_queue.append(Path(a))

            QTimer.singleShot(250, self._open_file_deferred)

        # Restore SessionData
        QTimer.singleShot(50, self.init_session)
Example #36
0
 def __init__(self, parent: QtWidgets.QWidget):
     """
     Args:
         parent (QtWidgets.QWidget): The parent widget
     """
     QTreeView.__init__(self, parent)
     QWidget_PlaceholderText.__init__(self, "Select a QComponent to edit"\
                 "\n\nfrom the QComponents window")
     # not sure whu the ui isn't updating these here.
     QTimer.singleShot(200, self.style_me)
     self.expanded.connect(self.resize_on_expand)
Example #37
0
def createNextWebView():
    global functionID

    nListCount = len(FUNCTIONS_LIST) - 1
    functionID = functionID + 1
    print functionID

    if functionID < nListCount:
        createWebView(functionID)
    else:
        QTimer.singleShot(300, QApplication.instance().quit)
    def test_setParentItem(self):
        global qgraphics_item_painted

        scene = QGraphicsScene()
        scene.addText("test")
        view = QGraphicsView(scene)

        rect = self.createRoundRect(scene)
        view.show()
        QTimer.singleShot(1000, self.quit_app)
        self.app.exec_()
        self.assert_(qgraphics_item_painted)
Example #39
0
    def generateEvent(self):
        o = QTest.touchEvent(self)
        o.press(0, QPoint(10, 10))
        o.commit()
        del o

        QTest.touchEvent(self).press(0, QPoint(10, 10))
        QTest.touchEvent(self).stationary(0).press(1, QPoint(40, 10))
        QTest.touchEvent(self).move(0, QPoint(12, 12)).move(1, QPoint(45, 5))
        QTest.touchEvent(self).release(0, QPoint(12, 12)).release(1, QPoint(45, 5))

        QTimer.singleShot(200, self.deleteLater)
Example #40
0
    def testSignalStarted(self):
        #QThread.started() (signal)
        obj = Dummy()
        QObject.connect(obj, SIGNAL('started()'), self.cb)
        obj.start()

        self._thread = obj
        QTimer.singleShot(1000, self.abort_application)
        self.app.exec_()

        self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method
        self.assert_(self.called)
    def testIt(self):

        self.textEdit = QTextEdit()
        self.textEdit.show()

        interface = Foo()
        self.textEdit.document().documentLayout().registerHandler(QAbstractTextDocumentLayoutTest.objectType, interface)

        QTimer.singleShot(0, self.foo)
        self.app.exec_()

        self.assertTrue(Foo.called)
Example #42
0
    def testIt(self):
        app = QGuiApplication([])

        qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
        qmlRegisterType(PieSlice, "Charts", 1, 0, "PieSlice");

        view = QQuickView()
        view.setSource(QUrl.fromLocalFile(helper.adjust_filename('registertype.qml', __file__)))
        view.show()
        QTimer.singleShot(250, view.close)
        app.exec_()
        self.assertTrue(appendCalled)
        self.assertTrue(paintCalled)
Example #43
0
    def testSignalFinished(self):
        #QThread.finished() (signal)
        obj = Dummy()
        QObject.connect(obj, SIGNAL('finished()'), self.cb)
        mutex.lock()
        obj.start()
        mutex.unlock()

        self._thread = obj
        QTimer.singleShot(1000, self.abort_application)
        self.app.exec_()

        self.assert_(self.called)
Example #44
0
 def animate(animation: QPropertyAnimation, start: Union[QPointF, int, float], end: Union[QPointF, int, float],
             curve: QEasingCurve=QEasingCurve.Linear, speed: float=1 / 50, delay: int=-1):
     animation.setStartValue(start)
     animation.setEndValue(end)
     animation.setEasingCurve(curve)
     if type(start) == type(end) == QPointF:
         distance = (end - start).manhattanLength()
     else:
         distance = abs(end - start)
     animation.setDuration(round(distance / speed))
     if delay == 0:
         animation.start()
     if delay > 0:
         QTimer.singleShot(delay, animation.start)
Example #45
0
    def testPlugin(self):
        view = QWebView()
        fac = PluginFactory()
        view.page().setPluginFactory(fac)
        QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)

        view.load(QUrl(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'qmlplugin', 'index.html')))

        view.resize(840, 600)
        view.show()

        QTimer.singleShot(500, self.app.quit)

        self.app.exec_()
    def testBasic(self):
        '''QStateMachine.configuration converting QSet to python set'''
        machine = QStateMachine()
        s1 = QState()
        machine.addState(s1)
        machine.setInitialState(s1)
        machine.start()

        QTimer.singleShot(100, self.app.quit)
        self.app.exec_()

        configuration = machine.configuration()

        self.assert_(isinstance(configuration, set))
        self.assert_(s1 in configuration)
Example #47
0
    def testFromData(self):
        picture = QPicture()
        painter = QPainter()
        painter.begin(picture)
        painter.drawEllipse(10, 20, 80, 70)
        painter.end()

        data = picture.data()
        picture2 = QPicture()
        picture2.setData(data)

        self.assertEqual(picture2.data(), picture.data())

        w = MyWidget()
        w._picture = picture2
        w._app = self.app

        QTimer.singleShot(300, w.show)
        self.app.exec_()
    def testBasic(self):
        self.machine = QStateMachine()
        s1 = QState()
        s2 = QState()
        s3 = QFinalState()

        QObject.connect(self.machine, SIGNAL("started()"), self.cb)

        self.anim = QParallelAnimationGroup()

        self.machine.addState(s1)
        self.machine.addState(s2)
        self.machine.addState(s3)
        self.machine.setInitialState(s1)
        self.machine.addDefaultAnimation(self.anim)
        self.machine.start()

        QTimer.singleShot(100, self.app.quit)
        self.app.exec_()
Example #49
0
 def changeEvent(self, event):
     if event.type() == QEvent.WindowStateChange:
         if self.windowState() & Qt.WindowMinimized:
             self.icon.show()
             QTimer.singleShot(0, self, SLOT('hide()'))
             event.ignore()
Example #50
0
    def testSetMenu(self):
        w = MyWidget()
        w.show()

        timer = QTimer.singleShot(100, self.app.quit)
        self.app.exec_()
Example #51
0
 def suspended(self):
     self.has_suspended += 1
     # Will emit evaluationResumed until there are more instructions to be run
     QTimer.singleShot(100, self.debugger.action(QScriptEngineDebugger.StepIntoAction).trigger)
Example #52
0
 def testDestructor(self):
     w = Test()
     w.show()
     QTimer.singleShot(0, w.close)
 def testSingleShotSignal(self):
     emitter = SigEmitter()
     emitter.sig1.connect(self.callback)
     QTimer.singleShot(100, emitter.sig1)
     self.app.exec_()
     self.assert_(self.called)
 def testSingleShot(self):
     QTimer.singleShot(100, self.callback)
     self.app.exec_()
     self.assert_(self.called)
Example #55
0
 def __init__(self, parent = None):
     QWidget.__init__(self, parent)
     self._sequence = []
     self.setAttribute(Qt.WA_AcceptTouchEvents)
     QTimer.singleShot(200, self.generateEvent)
Example #56
0
import sys

from PySide2.QtCore import QTimer, QPointF
from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsEllipseItem

class Ball(QGraphicsEllipseItem):
    def __init__(self, d, parent=None):
        super(Ball, self).__init__(0, 0, d, d, parent)
        self.vel = QPointF(0,0)   #commenting this out prevents the crash

class Foo(QGraphicsView):
    def __init__(self):
        super(Foo, self).__init__(None)
        self.scene = QGraphicsScene(self.rect())
        self.setScene(self.scene)
        self.scene.addItem(Ball(10))


if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = Foo()
    w.show()
    w.raise_()
    QTimer.singleShot(0, w.close)
    sys.exit(app.exec_())
Example #57
0
def onLoadFinished( result ):
    QTimer.singleShot( 100, createNextWebView )
Example #58
0
 def testCase(self):
     o = QObject()
     o.deleteLater()
     del o
     QTimer.singleShot(100, self.app.quit)
     self.app.exec_()