Python wx 模块,PD_APP_MODAL 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用wx.PD_APP_MODAL

项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def OnPopupDeleteAll(self, event):
        dlg = wxskinMessageDialog(self, self.delete_confirm_text,
                              'Confirm Deletion', wx.YES_NO | wx.ICON_INFORMATION)
        ret = dlg.ShowModal()
        dlg.Destroy()
        if ret == wx.ID_YES:

            dlg = wxskinProgressDialog("Phonebook deletion", "Deleting your %d phonebook entries" % len(self.itemDataMap), len(self.itemDataMap) + 1, self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
            try:
                self.SIM.gotoFile(LND_FILE_PATH)
                if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                    raise "Access conditions not met."
                i = 1
                for key in self.itemDataMap.keys()[:]:   # Make a copy of key table!!
                    if not dlg.Update(i):
                        break
                    self.writePhonebookEntry(key)
                    del self.itemDataMap[key]
                    i += 1
            except:
                print_exc()
                pySIMmessage(self, "Unable to delete all phonebook entries!", "SIM card error")

            dlg.Destroy()
            self.UpdateView()

    # Override the column sorting function. We need to compare 'a' and 'A' as equal
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def OnPopupDeleteAll(self, event):
        dlg = wxskinMessageDialog(self, self.delete_confirm_text,
                              'Confirm Deletion', wx.YES_NO | wx.ICON_INFORMATION)
        ret = dlg.ShowModal()
        dlg.Destroy()
        if ret == wx.ID_YES:

            dlg = wxskinProgressDialog("Phonebook deletion", "Deleting your %d phonebook entries" % len(self.itemDataMap), len(self.itemDataMap) + 1, self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
            try:
                self.SIM.gotoFile(self.filepath)
                if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                    raise "Access conditions not met."
                i = 1
                for key in self.itemDataMap.keys()[:]:   # Make a copy of key table!!
                    if not dlg.Update(i):
                        break
                    self.writePhonebookEntry(key)
                    del self.itemDataMap[key]
                    i += 1
            except:
                print_exc()
                pySIMmessage(self, "Unable to delete all phonebook entries!", "SIM card error")

            dlg.Destroy()
            self.UpdateView()

    # Override the column sorting function. We need to compare 'a' and 'A' as equal
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def read(self):
        try:
            self.SIM.gotoFile(SMS_FILE_PATH)
            # Send the get response command, to find out record length
            data, sw = self.SIM.sendAPDUmatchSW("A0C000000F", SW_OK)
            self.recordLength  = int(data[28:30], 16) # Should be 0xB0 (176)
            self.numberRecords = int(data[4:8], 16) / self.recordLength
        except:
            pySIMmessage(self, "Unable to access your SMS folder on your SIM card.", "SIM card error")
            return

        if not self.SIM.checkAndVerifyCHV1(CHV_READ, data):
            return

        apdu = "A0B2%s04" + IntToHex(self.recordLength)
        dlg = wxskinProgressDialog("SMS", "Reading your SMS messages", self.numberRecords + 1, self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
        try:
            for i in range(1, self.numberRecords + 1):
                if not dlg.Update(i):
                    break
                data, sw = self.SIM.sendAPDUmatchSW(apdu % IntToHex(i), SW_OK)
                # See if SMS record is used
                status = int(data[0:2], 16)
                if status & 1 or data[2:4] != 'FF':
                    try:
                        sms = SMSmessage()
                        sms.smsFromData(data)
                        self.itemDataMap[i] = (sms.status, sms.timestamp, sms.number, sms.message, sms)
                    except:
                        #~ print i
                        #~ print data
                        #~ print_exc()
                        pass
        except:
            # Finished with the guage
            print_exc()
            pySIMmessage(self, "Unable to read your SMS messages on your SIM card.", "SIM card error")
        dlg.Destroy()
项目:yt    作者:yt-project    | 项目源码 | 文件源码
def __init__(self, title, maxval):
        import wx
        self.maxval = maxval
        self.last = 0
        self._pbar = wx.ProgressDialog("Working...",
                    title, maximum=maxval,
                    style=wx.PD_REMAINING_TIME|wx.PD_ELAPSED_TIME|wx.PD_APP_MODAL)
项目:multiplierz    作者:BlaisProteomics    | 项目源码 | 文件源码
def __init__(self, title, entries):
        self.progressBar = wx.ProgressDialog(title, "Time remaining", entries, style=wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE | wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def read(self, *args):
        print "reading last numbers!"
        try:
            self.SIM.gotoFile(LND_FILE_PATH)
            # Send the get response command, to find out record length
            data, sw = self.SIM.sendAPDUmatchSW("A0C000000F", SW_OK)
            self.recordLength  = int(data[28:30], 16) # Usually 0x20
            # Now we can work out the name length & number of records
            self.nameLength = self.recordLength - 14 # Defined GSM 11.11
            self.numberRecords = int(data[4:8], 16) / self.recordLength
        except:
            pySIMmessage(self, "Unable to find your phonebook on your SIM card.", "SIM card error")
            return

        if not self.SIM.checkAndVerifyCHV1(CHV_READ, data):
            return

        apdu = "A0B2%s04" + IntToHex(self.recordLength)
        dlg = wxskinProgressDialog("Last Dialed Numbers", "Reading your last dialed numbers", self.numberRecords + 1, self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
        try:
            hexNameLen = self.nameLength << 1
            for i in range(1, self.numberRecords + 1):
                if not dlg.Update(i):
                    self.abortedRead = 1
                    break
                data, sw = self.SIM.sendAPDUmatchSW(apdu % IntToHex(i), SW_OK)
                # Find the end of the name
                #print data

                name = ""
                number = ""
                if data[0:2] != 'FF':
                    name = GSM3_38ToASCII(unhexlify(data[:hexNameLen]))
                    if ord(name[-1]) > 0x80:
                        # Nokia phones add this as a group identifier. Remove it.
                        name = name[:-1].rstrip()
                if data[hexNameLen:hexNameLen+2] != 'FF':
                    if name == "":
                        name == "(unknown)"
                    numberLen = int(data[hexNameLen:hexNameLen+2], 16)
                    if numberLen > 0 and numberLen <= (11): # Includes TON/NPI byte
                        hexNumber = data[hexNameLen+2:hexNameLen+2+(numberLen<<1)]
                        if hexNumber[:2] == '91':
                            number = "+"
                        number += GSMPhoneNumberToString(hexNumber[2:])
                    self.itemDataMap[i] = (name, number)
            self.abortedRead = 0
        except:
            # Finished with the guage
            self.abortedRead = 1
            print_exc()
            pySIMmessage(self, "Unable to read the phonebook on your SIM card.", "SIM card error")
        dlg.Destroy()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def read(self, *args):
        try:
            self.SIM.gotoFile(self.filepath)
            # Send the get response command, to find out record length
            data, sw = self.SIM.sendAPDUmatchSW("A0C000000F", SW_OK)
            self.recordLength  = int(data[28:30], 16) # Usually 0x20
            # Now we can work out the name length & number of records
            self.nameLength = self.recordLength - 14 # Defined GSM 11.11
            self.numberRecords = int(data[4:8], 16) / self.recordLength
        except:
            pySIMmessage(self, "Unable to find your phonebook on your SIM card.", "SIM card error")
            return

        if not self.SIM.checkAndVerifyCHV1(CHV_READ, data):
            return

        apdu = "A0B2%s04" + IntToHex(self.recordLength)
        dlg = wxskinProgressDialog("Phonebook", "Reading your phonebook entries", self.numberRecords + 1, self, wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
        try:
            hexNameLen = self.nameLength << 1
            for i in range(1, self.numberRecords + 1):
                if not dlg.Update(i):
                    self.abortedRead = 1
                    break
                data, sw = self.SIM.sendAPDUmatchSW(apdu % IntToHex(i), SW_OK)
                # Find the end of the name
                #print data
                if data[0:2] != 'FF':
                    name = GSM3_38ToASCII(unhexlify(data[:hexNameLen]))
                    if ord(name[-1]) > 0x80:
                        # Nokia phones add this as a group identifier. Remove it.
                        name = name[:-1].rstrip()
                    number = ""
                    numberLen = int(data[hexNameLen:hexNameLen+2], 16)
                    if numberLen > 0 and numberLen <= (11): # Includes TON/NPI byte
                        hexNumber = data[hexNameLen+2:hexNameLen+2+(numberLen<<1)]
                        if hexNumber[:2] == '91':
                            number = "+"
                        number += GSMPhoneNumberToString(hexNumber[2:])
                    self.itemDataMap[i] = (name, number)
            self.abortedRead = 0
        except:
            # Finished with the guage
            self.abortedRead = 1
            print_exc()
            pySIMmessage(self, "Unable to read the phonebook on your SIM card.", "SIM card error")
        dlg.Destroy()
项目:PancakeViewer    作者:forensicmatt    | 项目源码 | 文件源码
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()