Ejemplo n.º 1
0
def _test_isalive():
    frame = wx.GetApp().GetTopWindow()
    sizer = wx.BoxSizer(wx.VERTICAL)
    panel = wx.Panel(frame)
    child1 = wx.Panel(panel)
    child2 = wx.Panel(panel)

    sizer.Add(panel, flag=wx.EXPAND, proportion=1)
    frame.SetSizer(sizer)

    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(child1, flag=wx.EXPAND, proportion=1)
    sizer.Add(child2, flag=wx.EXPAND, proportion=1)
    panel.SetSizer(sizer)

    assert fw.isalive(child1)
    assert fw.isalive(child2)

    sizer.Detach(child1)
    child1.Destroy()

    sizer.Layout()
    frame.Refresh()

    realYield(100)

    assert not fw.isalive(child1)
    assert fw.isalive(child2)
Ejemplo n.º 2
0
    def isAlive(self):
        """Returns ``True`` if the widget contained by this ``BoundWidget`` is
        still alive, ``False`` otherwise.
        """

        import wx

        if not fwidgets.isalive(self.parent):
            return False

        if isinstance(self.widget, wx.MenuItem):
            return fwidgets.isalive(self.menu)

        else:
            return fwidgets.isalive(self.widget)
Ejemplo n.º 3
0
        def onFinish():

            if not fwidgets.isalive(grid):
                return

            status.update('All clusters loaded.')
            self.Enable()
            grid.Show()
            grid.Refresh()
Ejemplo n.º 4
0
        def realAutoBounce():

            if not isalive(self):
                return

            if not self.__bouncing:
                return

            if self.DoBounce():
                wx.CallLater(self.__delay, realAutoBounce)
Ejemplo n.º 5
0
    def _setGLContext(self):
        """Configures the GL context for drawing to this canvas.

        This method should be called before any OpenGL operations related to
        this canvas take place (e.g. texture/data creation, drawing, etc).
        """
        if not (fwidgets.isalive(self) and self.IsShownOnScreen()):
            return False

        log.debug('Setting context target to {} ({})'.format(
            type(self).__name__, id(self)))

        self.__context.setTarget(self)
        return True
Ejemplo n.º 6
0
        def eval():
            value = dlg.GetValue()

            for i in range(10):

                realYield(centis + 0.5 * centis)
                newval = dlg.GetValue()

                passed[0] = passed[0] and (newval != value)
                value = newval

            value = dlg.GetValue()
            dlg.StopBounce()
            getattr(dlg, endfunc)()

            realYield((delay * 2) / 10)

            if isalive(dlg):
                passed[0] = passed[0] and (dlg.GetValue() == value)
Ejemplo n.º 7
0
        def addCluster(i, clust):

            if not fwidgets.isalive(grid):
                return

            zmaxbtn = makeCoordButton((clust.zmaxx, clust.zmaxy, clust.zmaxz))
            zcogbtn = makeCoordButton((clust.zcogx, clust.zcogy, clust.zcogz))
            copemaxbtn = makeCoordButton(
                (clust.copemaxx, clust.copemaxy, clust.copemaxz))

            def fmt(v):
                return '{}'.format(v)

            grid.SetText(i, cols['index'], fmt(clust.index))
            grid.SetText(i, cols['nvoxels'], fmt(clust.nvoxels))
            grid.SetText(i, cols['p'], fmt(clust.p))
            grid.SetText(i, cols['logp'], fmt(clust.logp))
            grid.SetText(i, cols['zmax'], fmt(clust.zmax))
            grid.SetWidget(i, cols['zmaxcoords'], zmaxbtn)
            grid.SetWidget(i, cols['zcogcoords'], zcogbtn)
            grid.SetText(i, cols['copemax'], fmt(clust.copemax))
            grid.SetWidget(i, cols['copemaxcoords'], copemaxbtn)
            grid.SetText(i, cols['copemean'], fmt(clust.copemean))
Ejemplo n.º 8
0
 def doRefresh():
     if fwidgets.isalive(self):
         self.Refresh()
Ejemplo n.º 9
0
 def numClipPlanesChanged(*a):
     if fwidgets.isalive(panel) and \
        fwidgets.isalive(parent):
         idle.idle(panel.updateWidgets, target, '3d')
Ejemplo n.º 10
0
 def finish():
     if isalive(self.__progdlg):
         self.__progdlg.Hide()
         self.__progdlg.Close()
     self.__progdlg = None
Ejemplo n.º 11
0
 def update(frame):
     if self.__progdlg is not None and isalive(self.__progdlg):
         self.__progdlg.DoBounce('Saved frame {}...'.format(frame))
         return not self.__progdlg.WasCancelled()
     else:
         return False