Exemplo n.º 1
0
    def test_tmpdir_gives_consistent_results(self):
        utils.tmpdir.func.cache.clear()

        first = utils.tmpdir()
        second = utils.tmpdir()
        third = utils.tmpdir()

        self.assertEqual(first, second)
        self.assertEqual(first, third)

        shutil.rmtree(first)
Exemplo n.º 2
0
    def test_tmpdir_gives_consistent_results(self):
        utils.tmpdir.func.cache.clear()

        first = utils.tmpdir()
        second = utils.tmpdir()
        third = utils.tmpdir()

        self.assertEqual(first, second)
        self.assertEqual(first, third)

        shutil.rmtree(first)
Exemplo n.º 3
0
def application_start(context, view):
    """Show the GUI and start the main event loop"""
    # Store the view for session management
    context.app.set_view(view)

    # Make sure that we start out on top
    view.show()
    view.raise_()

    # Scan for the first time
    runtask = qtutils.RunTask(view)
    init_update_task(view, runtask, context.model)

    # Start the inotify thread
    inotify.start()

    msg_timer = QtCore.QTimer()
    msg_timer.setSingleShot(True)
    msg_timer.connect(msg_timer, SIGNAL('timeout()'), _send_msg)
    msg_timer.start(0)

    # Start the event loop
    result = context.app.exec_()

    # All done, cleanup
    inotify.stop()
    QtCore.QThreadPool.globalInstance().waitForDone()

    tmpdir = utils.tmpdir()
    shutil.rmtree(tmpdir, ignore_errors=True)

    return result
Exemplo n.º 4
0
def application_start(context, view, monitor_refs_only=False):
    """Show the GUI and start the main event loop"""
    # Store the view for session management
    context.app.set_view(view)

    # Make sure that we start out on top
    view.show()
    view.raise_()

    # Scan for the first time
    runtask = qtutils.RunTask(parent=view)
    init_update_task(view, runtask, context.model)

    # Start the filesystem monitor thread
    fsmonitor.instance().start(monitor_refs_only)

    msg_timer = QtCore.QTimer()
    msg_timer.setSingleShot(True)
    msg_timer.connect(msg_timer, SIGNAL('timeout()'), _send_msg)
    msg_timer.start(0)

    # Start the event loop
    result = context.app.exec_()

    # All done, cleanup
    fsmonitor.instance().stop()
    QtCore.QThreadPool.globalInstance().waitForDone()

    tmpdir = utils.tmpdir()
    shutil.rmtree(tmpdir, ignore_errors=True)

    return result
Exemplo n.º 5
0
    def test_tmp_filename_gives_good_file(self):
        utils.tmpdir.func.cache.clear()

        tmpdir = utils.tmpdir()
        first = utils.tmp_filename('test')
        second = utils.tmp_filename('test')

        self.assertNotEqual(first, second)
        self.assertTrue(first.startswith(os.path.join(tmpdir, 'test')))
        self.assertTrue(second.startswith(os.path.join(tmpdir, 'test')))

        shutil.rmtree(tmpdir)
Exemplo n.º 6
0
    def test_tmp_filename_gives_good_file(self):
        utils.tmpdir.func.cache.clear()

        tmpdir = utils.tmpdir()
        first = utils.tmp_filename('test')
        second = utils.tmp_filename('test')

        self.assertNotEqual(first, second)
        self.assertTrue(first.startswith(os.path.join(tmpdir, 'test')))
        self.assertTrue(second.startswith(os.path.join(tmpdir, 'test')))

        shutil.rmtree(tmpdir)