Python wx 模块,ICON_WARNING 实例源码

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

项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def writePhonebookEntry(self, pos, name='', number=''):
        if self.abortedRead:
            dlg = wxskinMessageDialog(self, "Did not finish reading your entire SIM card phonebook.\nAs a result, this may overwrite any exisiting phonebook contacts that have not been read yet!\n\nDo you wish to continue anyway?",
                                  'Overwrite warning', wx.YES_NO | wx.ICON_WARNING)
            ret = dlg.ShowModal()
            dlg.Destroy()
            if ret == wx.ID_NO:
                return wx.ID_NO
            else:
                self.abortedRead = 0

        if not name:
            data = "FF" * self.recordLength
        else:
            GSMnumber = StringToGSMPhoneNumber(number)
            data = "%s%s%sFFFF" % ( padString(hexlify(ASCIIToGSM3_38(name)), self.nameLength << 1, "F"),
                                    IntToHex(len(GSMnumber) / 2),
                                    padString(GSMnumber, 22, 'F'))
        pdu = self.updateRecordPDU % (IntToHex(pos), IntToHex(self.recordLength), data)
        self.SIM.sendAPDUmatchSW(pdu, SW_OK)
        return wx.ID_YES
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def writePhonebookEntry(self, pos, name='', number=''):
        if self.abortedRead:
            dlg = wxskinMessageDialog(self, "Did not finish reading your entire SIM card phonebook.\nAs a result, this may overwrite any exisiting phonebook contacts that have not been read yet!\n\nDo you wish to continue anyway?",
                                  'Overwrite warning', wx.YES_NO | wx.ICON_WARNING)
            ret = dlg.ShowModal()
            dlg.Destroy()
            if ret == wx.ID_NO:
                return wx.ID_NO
            else:
                self.abortedRead = 0

        if not name:
            data = "FF" * self.recordLength
        else:
            GSMnumber = StringToGSMPhoneNumber(number)
            data = "%s%s%sFFFF" % ( padString(hexlify(ASCIIToGSM3_38(name)), self.nameLength << 1, "F"),
                                    IntToHex(len(GSMnumber) / 2),
                                    padString(GSMnumber, 22, 'F'))
        pdu = self.updateRecordPDU % (IntToHex(pos), IntToHex(self.recordLength), data)
        self.SIM.sendAPDUmatchSW(pdu, SW_OK)
        return wx.ID_YES
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def on_ok(self, event):
        songs = yt_extract(self.audio_links.GetValue().split(','))
        if not songs:
            error = wx.MessageDialog(parent=self,
                                     message="Invalid/Unsupported URL!",
                                     caption="Error!", style=wx.OK | wx.ICON_WARNING)
            error.ShowModal()
            error.Destroy()
            return

        self.num_songs = len(songs)

        self.progress_dialog = wx.ProgressDialog(title="Download", message="Downloading songs...",
                                                 maximum=self.num_songs * 100, parent=self, style=PD_STYLE)

        self.downloader = DownloaderThread(self, songs, self.out_dir.GetPath())
        self.downloader.start()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def on_search(self, event):
        query = self.search_query.GetValue()
        if not query or query.isspace():
            alert = wx.MessageDialog(parent=self, message="Search term can't be empty!", caption="pyjam Audio Search")
            alert.ShowModal()
            alert.Destroy()
            return
        if query in self.search_recent:
            self.search_recent.remove(query)
        self.search_recent.appendleft(query)
        self.search_query.SetMenu(self.search_menu())

        results = yt_search(query)
        if not results:
            alert = wx.MessageDialog(parent=self,
                                     message="There was an error processing your request.\nPlease try again later",
                                     caption="pyjam Audio Search", style=wx.OK | wx.ICON_WARNING)
            alert.ShowModal()
            alert.Destroy()
            return

        self.result_list.SetObjects(results)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def copy_url(self, event):
        if not wx.TheClipboard.Open():
            alert = wx.MessageDialog(parent=self, message="There was an error opening the clipboard",
                                     caption="pyjam Audio Search", style=wx.OK | wx.ICON_WARNING)
            alert.ShowModal()
            alert.Destroy()
            return

        url = self.result_list.GetObjects()[self.selected_video]["url"]
        wx.TheClipboard.SetData(wx.TextDataObject(url))
        wx.TheClipboard.Close()
项目:kicad-action-scripts    作者:jsreynaud    | 项目源码 | 文件源码
def Warn(self, message, caption='Warning!'):
        dlg = wx.MessageDialog(
            None, message, caption, wx.OK | wx.ICON_WARNING)
        dlg.ShowModal()
        dlg.Destroy()
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def OnChooseImage(self, evt, bitmap, face_id):
        """Choose Image"""
        dlg = wx.FileDialog(self, wildcard=util.IMAGE_WILDCARD)
        if dlg.ShowModal() != wx.ID_OK:
            return
        path = dlg.GetPath()

        self.log.log('Request: Detecting {}'.format(path))
        res = util.CF.face.detect(path)
        faces = [model.Face(face, path) for face in res]
        self.log.log('Response: Success. Detected {} face(s) in {}'.format(
            len(res), path))

        if len(faces) > 1:
            text = (
                'Verification accepts two faces as input, please pick images'
                'with only one detectable face in it.'
            )
            title = 'Warning'
            style = wx.OK | wx.ICON_WARNING
            wx.MessageBox(text, title, style)
            return

        bitmap.set_path(path)
        util.draw_bitmap_rectangle(bitmap, faces)
        self.face_ids[face_id] = faces[0].id
        self.check_btn_verify()
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def OnUnitConvert(self, event):     
        uid, tree_tid = self.popup_obj
        OM = ObjectManager(self)       
        obj = OM.get(uid)
        try:
            unit = UOM.get_unit(obj.unit)
            dim = UOM.get_unit_dimension(unit.dimension)
            qc = UOM.get_quantity_class(dim.name)
            UNITS_OPTIONS = OrderedDict()
            for mu in qc.memberUnit:
                UNITS_OPTIONS[mu] = mu 
        except:    
            msg = 'Unit ' + obj.unit + ' cannot be converted.'
            wx.MessageBox(msg, 'Warning', wx.OK | wx.ICON_WARNING)
            return 
            #
        UIM = UIManager()
        dlg = UIM.create('dialog_controller', title='Unit conversion')        
        #
        try:
            ctn_details = dlg.view.AddCreateContainer('StaticBox', label='Object details', orient=wx.VERTICAL, proportion=0, flag=wx.EXPAND|wx.TOP, border=5)
            dlg.view.AddStaticText(ctn_details, proportion=0, flag=wx.EXPAND|wx.TOP, border=5, label='Name: ' + obj.name)
            #
            dlg.view.AddStaticText(ctn_details, proportion=0, flag=wx.EXPAND|wx.TOP, border=5, label='Type id: ' + obj.tid)
            dlg.view.AddStaticText(ctn_details, proportion=0, flag=wx.EXPAND|wx.TOP, border=5, label='Object id: ' + str(obj.oid))
            dlg.view.AddStaticText(ctn_details, proportion=0, flag=wx.EXPAND|wx.TOP, border=5, label='Current unit: ' + obj.unit)
            #
            ctn_new_unit = dlg.view.AddCreateContainer('StaticBox', label='New unit', orient=wx.VERTICAL, proportion=0, flag=wx.EXPAND|wx.TOP, border=5)  
            dlg.view.AddChoice(ctn_new_unit, proportion=0, flag=wx.EXPAND|wx.TOP, border=5, widget_name='new_unit', options=UNITS_OPTIONS)     
            #    
            dlg.view.SetSize((300, 330))
            answer = dlg.view.ShowModal()
            #
            if answer == wx.ID_OK:
                results = dlg.get_results()  
                new_unit_name = results.get('new_unit')
                new_data = UOM.convert(obj.data, obj.unit, new_unit_name)
                obj._data = new_data
                obj.unit = new_unit_name            
                UIM = UIManager()
                controller = UIM.get(self._controller_uid)
                controller.reload_object(obj.uid)                 
        except Exception:
            pass
        finally:
            UIM.remove(dlg.uid)