Esempio n. 1
0
    def OnStartProgress(self, event):

        event.Skip()

        style = wx.PD_APP_MODAL
        if self.elapsedchoice.GetValue():
            style |= wx.PD_ELAPSED_TIME
        if self.cancelchoice.GetValue():
            style |= wx.PD_CAN_ABORT

        dlg = PP.PyProgress(None,
                            -1,
                            "PyProgress Example",
                            "An Informative Message",
                            agwStyle=style)

        proportion = self.slider1.GetValue()
        steps = self.slider2.GetValue()

        backcol = self.csel3.GetColour()
        firstcol = self.csel4.GetColour()
        secondcol = self.csel5.GetColour()

        dlg.SetGaugeProportion(proportion / 100.0)
        dlg.SetGaugeSteps(steps)
        dlg.SetGaugeBackground(backcol)
        dlg.SetFirstGradientColour(firstcol)
        dlg.SetSecondGradientColour(secondcol)

        max = 400
        keepGoing = True
        count = 0

        while keepGoing and count < max:
            count += 1
            wx.MilliSleep(30)

            if count >= max / 2:
                keepGoing = dlg.UpdatePulse("Half-time!")
            else:
                keepGoing = dlg.UpdatePulse()

        dlg.Destroy()
        wx.SafeYield()
        wx.GetApp().GetTopWindow().Raise()
Esempio n. 2
0
def EnumerateNode(mainFrame, tree_item, node, dlg_flag=True):
    if isinstance(node, source_scanner.SourceScanNode):
        if (node.type_indicator == definitions.TYPE_INDICATOR_TSK
                or node.type_indicator == definitions.TYPE_INDICATOR_VSHADOW):
            if mainFrame.tree_fs.GetChildrenCount(tree_item) < 1:
                if node.type_indicator == definitions.TYPE_INDICATOR_VSHADOW:
                    location = getattr(node.path_spec, 'location', None)
                    if location == u'/':
                        return
                    identifier = location[1:]
                try:
                    path_spec = node.path_spec
                    if node.type_indicator == definitions.TYPE_INDICATOR_VSHADOW:
                        path_spec = path_spec_factory.Factory.NewPathSpec(
                            definitions.TYPE_INDICATOR_TSK,
                            location=u'/',
                            parent=node.path_spec)
                    file_system = resolver.Resolver.OpenFileSystem(path_spec)
                except Exception as error:
                    file_system = None
                    print str(error)

                if file_system is not None:
                    if dlg_flag:
                        dlg = pyprogress.PyProgress(mainFrame,
                                                    -1,
                                                    "Enumerating Filesystem",
                                                    "This can take a while",
                                                    agwStyle=wx.PD_APP_MODAL
                                                    | wx.PD_ELAPSED_TIME)
                        dlg.SetGaugeProportion(.10)
                        dlg.SetGaugeSteps(100)

                    file_entry = file_system.GetRootFileEntry()

                    ProcessFolder(file_system,
                                  file_entry,
                                  u'',
                                  tree_fs=mainFrame.tree_fs,
                                  tree_item=tree_item,
                                  dlg=dlg)

                    if dlg_flag:
                        dlg.Destroy()