Python wx 模块,ICON_INFORMATION 实例源码

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

项目: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(SMS_FILE_PATH)
                i = 1
                for key in self.itemDataMap.keys()[:]:   # Make a copy of key table!!
                    if not dlg.Update(i):
                        break
                    self.writeSMSEntry(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
项目:tindieorderprintout    作者:limpkin    | 项目源码 | 文件源码
def do_input(Class, parent, title, fields, data):
        dlg = Class(parent, -1, title, size=(350, 200),
                         style=wx.DEFAULT_DIALOG_STYLE, # & ~wx.CLOSE_BOX,
                        fields=fields, data=data
                         )
        dlg.CenterOnScreen()
        while 1:
            val = dlg.ShowModal()
            if val == wx.ID_OK:
                values = {}
                for field in fields:
                    try:
                        values[field] = eval(dlg.textctrls[field].GetValue())
                    except Exception, e:
                        msg = wx.MessageDialog(parent, unicode(e),
                               "Error in field %s" % field,
                               wx.OK | wx.ICON_INFORMATION
                               )
                        msg.ShowModal()
                        msg.Destroy()
                        break
                else:
                    return dict([(field, values[field]) for field in fields])
            else:
                return None
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def afterTest(self, earlyStop):
        if not earlyStop:
            self.saveCap()
            ca = np.mean(np.diag(self.confusion))/self.nTestTrial
            confusion = np.round(100*self.confusion/self.nTestTrial)

            resultText = (('Test Selection CA: %f\n' % ca) +
                          ('Confusion Matrix:\n' + str(confusion) + '\n') +
                          ('Choices: ' + str(self.choices)))

            wx.MessageBox(message=resultText,
                          caption='Testing Complete',
                          style=wx.OK | wx.ICON_INFORMATION)

            self.saveResultText(resultText)
        else:
            self.pieMenu.zeroBars(refresh=False)
            self.pieMenu.clearAllHighlights()
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def list_fs_ctrls_click(self, e):
        print("this is supposed to fswebcam -d v4l2:/dev/video0 --list-controls on the pi")
        target_ip = self.tb_ip.GetValue()
        target_user = self.tb_user.GetValue()
        target_pass = self.tb_pass.GetValue()
        try:
            ssh.connect(target_ip, username=target_user, password=target_pass, timeout=3)
            print "Connected to " + target_ip
            found_login = True
            cam_choice = self.cam_select_cb.GetValue()
            cam_cmd = "fswebcam -d v4l2:" + cam_choice + " --list-controls"
            print("---Doing: " + cam_cmd)
            stdin, stdout, stderr = ssh.exec_command(cam_cmd)
            cam_output = stderr.read().strip()
            print "Camera output; " + cam_output
            ssh.close()
        except Exception as e:
            print("Some form of problem; " + str(e))
            ssh.close()
        if not cam_output == None:
            msg_text = 'Camera located and interorgated; copy-paste a controll name from the following into the settings text box \n \n'
            msg_text += str(cam_output)
            wx.MessageBox(msg_text, 'Info', wx.OK | wx.ICON_INFORMATION)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def cat_script(self, e):
        #opens an ssh pipe and runs a cat command to get the text of the script
        target_ip = pi_link_pnl.target_ip
        target_user = pi_link_pnl.target_user
        target_pass = pi_link_pnl.target_pass
        script_path = self.cron_path_combo.GetValue()
        script_name = self.cron_script_cb.GetValue()
        script_to_ask = script_path + script_name
        try:
        #    ssh.connect(target_ip, username=target_user, password=target_pass, timeout=3)
            print "Connected to " + target_ip
            print("running; cat " + str(script_to_ask))
            stdin, stdout, stderr = ssh.exec_command("cat " + str(script_to_ask))
            script_text = stdout.read().strip()
            error_text = stderr.read().strip()
            if not error_text == '':
                msg_text =  'Error reading script \n\n'
                msg_text += str(error_text)
            else:
                msg_text = script_to_ask + '\n\n'
                msg_text += str(script_text)
            wx.MessageBox(msg_text, 'Info', wx.OK | wx.ICON_INFORMATION)
        except Exception as e:
            print("oh bother, this seems wrong... " + str(e))
项目:Supplicant    作者:mayuko2012    | 项目源码 | 文件源码
def run(self):
         self.timeToQuit.wait(10)
         while True:
            if self.timeToQuit.isSet():
                self.sock.close()
                break
            else:
                breathe = packet.generate_breathe(self.mac, self.ip, self.session, self.index)
                status = connect.breathe(self.sock, breathe, self.hosts)
                if status == 0:
                    self.sock.close()
                    wx.MessageBox(u"?????????????",u"??!!",wx.OK | wx.ICON_INFORMATION,self)
                    sys.exit()
                    break
                else:
                    self.index += 3
                    self.timeToQuit.wait(self.messageDelay)
项目:request2doc    作者:kongxinchi    | 项目源码 | 文件源码
def on_transform_button_click(self, event):
        slice_startswith = self.slice_text.GetValue()
        template_path = self.get_template_path()
        response_body = self.GetParent().get_response_content()

        try:
            handler = Request2Doc()
            handler.set_slice_startswith(slice_startswith)
            handler.set_response_body(response_body)

            if not handler.get_response_data():
                return wx.MessageDialog(None, u'Response body is not legal format', u"Information", wx.OK | wx.ICON_INFORMATION).ShowModal()

            self.GetParent().set_document_content(handler.render_string(template_path))

        except Exception, e:
            return wx.MessageDialog(None, traceback.format_exc(), u"Exception", wx.OK | wx.ICON_ERROR).ShowModal()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def update_check(parent):
    """Check for updates using the GitHub API

    Args:
        parent (wx.Window): The parent window (for the message dialog)

    Returns:
        None
    """
    r = requests.get('https://api.github.com/repos/10se1ucgo/pyjam/releases/latest')

    if not r.ok:
        return

    new = r.json()['tag_name']

    try:
        if StrictVersion(__version__) < StrictVersion(new.lstrip('v')):
            info = wx.MessageDialog(parent, message="pyjam {v} is now available!\nGo to download page?".format(v=new),
                                    caption="pyjam Update", style=wx.OK | wx.CANCEL | wx.ICON_INFORMATION)
            if info.ShowModal() == wx.ID_OK:
                webbrowser.open_new_tab(r.json()['html_url'])
            info.Destroy()
    except ValueError:
        pass
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_coll_HelpMenu_Items(self, parent):
        AppendMenu(parent, help='', id=wx.ID_HELP,
                   kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1')
        # AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
        #      kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
        # AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
        #      kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')

        def handler(event):
            return wx.MessageBox(
                version.GetCommunityHelpMsg(),
                _(u'Community support'),
                wx.OK | wx.ICON_INFORMATION)

        id = wx.NewId()
        parent.Append(help='', id=id, kind=wx.ITEM_NORMAL, text=_(u'Community support'))
        self.Bind(wx.EVT_MENU, handler, id=id)

        AppendMenu(parent, help='', id=wx.ID_ABOUT,
                   kind=wx.ITEM_NORMAL, text=_(u'About'))
        self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP)
        # self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS)
        self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def OnGenerateProgramMenu(self, event):
        dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Controler.GetProgramFilePath(),  _("ST files (*.st)|*.st|All files|*.*"), wx.SAVE | wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            message_text = ""
            header, icon = _("Done"), wx.ICON_INFORMATION
            if os.path.isdir(os.path.dirname(filepath)):
                program, errors, warnings = self.Controler.GenerateProgram(filepath)
                message_text += "".join([_("warning: %s\n") % warning for warning in warnings])
                if len(errors) > 0:
                    message_text += "".join([_("error: %s\n") % error for error in errors])
                    message_text += _("Can't generate program to file %s!") % filepath
                    header, icon = _("Error"), wx.ICON_ERROR
                else:
                    message_text += _("Program was successfully generated!")
            else:
                message_text += _("\"%s\" is not a valid folder!") % os.path.dirname(filepath)
                header, icon = _("Error"), wx.ICON_ERROR
            message = wx.MessageDialog(self, message_text, header, wx.OK | icon)
            message.ShowModal()
            message.Destroy()
        dialog.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_button_email_passwd(self,event):# Button save email and password
        email=self.text_ctrl_email.Value
        passwd=self.text_ctrl_email_passwd.Value

        if not self.V.validate_email(email)[0]:
            msg="Invalid Email"
            dlg = wx.MessageDialog(self, msg, 'Error',wx.OK | wx.ICON_ERROR)                  
            dlg.ShowModal()
            dlg.Destroy()
            return 0
        self.DB.Set_SMS_Sender_Mail(email)
        self.DB.Set_SMS_Sender_Mail_Password(passwd)
        msg="Successfully Saved"
        dlg = wx.MessageDialog(self, msg, 'Success',wx.OK | wx.ICON_INFORMATION)                  
        dlg.ShowModal()
        dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def Login_Check(self,user,password):

        print "login check"

        passw=self.EN.Encrypt_Password(self.Secret_Key+password)
        query="SELECT PASSWORD FROM USER WHERE USER='%s' AND PASSWORD='%s'" %(user,passw)  
        #self.DB.cur.execute(query,(user,self.Secret_Key+password,))
        self.DB.cur.execute(query)
        #self.DB.con.commit()

        row=self.DB.cur.fetchone()


        if row:


            return True
        else:
            dlg = wx.MessageDialog(self.parent, 'Incorrect Password', '',wx.OK | wx.ICON_INFORMATION)                  
            dlg.ShowModal()
            dlg.Destroy()

            return False
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_save(self, event):  # wxGlade: institution.<event_handler>
        try:
            self.DB.Set_School_Name(self.text_ctrl_name.Value) 
            self.DB.Set_School_Code(self.text_ctrl_code.Value)   

            self.DB.Set_School_Email(self.text_ctrl_email.Value)       
            self.DB.Set_School_Contact(self.text_ctrl_phone.Value)
            self.DB.Set_School_DEO(self.text_ctrl_deo.Value)
            dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
        except:
            dlg = wx.MessageDialog(self, 'Could not save some values', '',wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()




        self.Close(True)
        event.Skip()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def send_sms(self):


        print "sending",self.NO_MOBILE_LIST

        if  self.NO_MOBILE_LIST:



            msg="The following Student(s) got no valid mobile numbers. Go to Student Profile to add/edit mobile numbers\n"

            no=0

            for pupil in self.NO_MOBILE_LIST:
                no+=1
                msg+=str(no)+".  "+str(pupil)+"\n"

            #app = wx.PySimpleApp(0)

            dlg = wx.MessageDialog(None, msg,"No Mobile Number",wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def Failed_Report(self):

        if len(self.Failed_List)==0:
            msg="All Students Passed"
        else:
            msg="The following Student(s) detained\n"
            no=0
            for pupil in self.Failed_List:
                no+=1
                msg+=str(no)+".  "+str(pupil)+"\n"

        #app = wx.PySimpleApp(0)

        dlg = wx.MessageDialog(None, msg,str(self.class_)+self.div,wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def OnSave(self, event):  # wxGlade: MyFrame2.<event_handler>
        CE=[self.ce_1,self.ce_2,self.ce_3,self.ce_4,self.ce_5,self.ce_6,self.ce_7,self.ce_8,self.ce_9,self.ce_10,self.ce_11,self.ce_12,self.ce_13]
        TE=[self.te_1,self.te_2,self.te_3,self.te_4,self.te_5,self.te_6,self.te_7,self.te_8,self.te_9,self.te_10,self.te_11,self.te_12,self.te_13]


        try:
            for i in range(13):
                if self.YEAR=='Select' or self.STD=='Select':
                    break
                else:
                    index=i#in deb oper Get_CE_CE() index for work exp starts at 12
                    if i>=10:
                        index+=2

                    self.DB.Set_CE_TE(self.YEAR,self.STD,index,CE[i].Value,TE[i].Value)
            dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
        except:
            dlg = wx.MessageDialog(self, 'Error! Could not Save', '',wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()

        event.Skip()
项目:kicad-action-plugins    作者:easyw    | 项目源码 | 文件源码
def Run( self ):
        fileName = GetBoard().GetFileName()
        if len(fileName)==0:
            wx.LogMessage("a board needs to be saved/loaded!")
        else:
            dirpath = os.path.abspath(os.path.expanduser(fileName))
            path, fname = os.path.split(dirpath)
            ext = os.path.splitext(os.path.basename(fileName))[1]
            name = os.path.splitext(os.path.basename(fileName))[0]

            LogMsg="reading from "+ dirpath
            out_filename=path+os.sep+name+".dxf"
            LogMsg+="writing to "+out_filename
            content=[]
            txtFile = open(fileName,"r")
            content = txtFile.readlines()
            content.append(" ")
            txtFile.close()

            #wx.MessageDialog(None, 'This is a message box. ONLY TEST!', 'Test', wx.OK | wx.ICON_INFORMATION).ShowModal()
            #wx.MessageDialog(None, 'This is a message box. ONLY TEST!', content, wx.OK | wx.ICON_INFORMATION).ShowModal()
            #found_selected=False
            #board = pcbnew.GetBoard()

            dlg=wx.MessageBox( 'Only SAVED board file will be exported to DXF file', 'Confirm',  wx.OK | wx.CANCEL | wx.ICON_INFORMATION )
            if dlg == wx.OK:
                if os.path.isfile(out_filename):
                    dlg=wx.MessageBox( 'Overwrite DXF file?', 'Confirm', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION )
                    if dlg == wx.YES:
                        export_dxf(content, out_filename)
                else:
                    export_dxf(content, out_filename)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def Error(self, dialog):
        wx.MessageBox(dialog , 'Info', 
            wx.OK | wx.ICON_INFORMATION)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def OnHelp(self, event):
        wx.MessageBox("A program to perform quasi-harmonic calculations based on the pyqha module",
        "Help Contents", wx.OK | wx.ICON_INFORMATION, self)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def OnAbout(self, event):
        wx.MessageBox("pyqhaGUI: a program to perform quasi-harmonic calculations",
        "About pyQHA", wx.OK | wx.ICON_INFORMATION, self)
项目: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 menuHelpHelp(self, event):
        """Show help dialog"""
        dlg = wx.MessageDialog(self, 'Not Yet Implimented!', 'ToDo',
                             wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def menuHelpAbout(self, event):
        """Show about pySIM dialog"""
        dlg = wx.MessageDialog(self, self.aboutPySIM, 'About pySIM',
                             wx.OK | wx.ICON_INFORMATION)
        #~ ovr = html_module.HtmlWindow(dlg, -1, size=(400, 400))
        #~ ovr.SetPage(self.aboutPySIMhtml)
        dlg.ShowModal()
        dlg.Destroy()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def connectReader(self):
        if not self.getReaderName():
            self.selectNewReader()
        if self.getReaderName():
            res = self.openSession(self.getReaderName())
            if res == 0:
                self.state = SIM_STATE_CONNECTED
                self.gatherInfo()
            else:
                #~ print "Blah blah"
                dlg = wx.MessageDialog(self, 'Unable to connect to reader: %s' % self.getReaderName(), 'Reader error', 
                                     wx.OK | wx.ICON_INFORMATION) 
                dlg.ShowModal() 
                dlg.Destroy()
                self.readerName = ""
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, messageString, titleString="pySIM", style=wx.OK | wx.ICON_INFORMATION, pos=wx.DefaultPosition):
        wx.MessageDialog.__init__(self, parent, messageString, titleString, style, pos)
        self.SetBackgroundColour(backgroundColour)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, messageString, titleString="pySIM", style=wx.OK | wx.ICON_INFORMATION):
        wxskinMessageDialog.__init__(self, parent, messageString, titleString, style)
        self.ShowModal() 
        self.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainTDENet(self, segs):
        trainData = [seg.data for seg in segs]

        convs = ((25,7),) # first session
        maxIter = 400

        nHidden = None
        poolSize = 1
        poolMethod = 'average'

        self.stand = ml.ClassSegStandardizer(trainData)
        trainDataStd = self.stand.apply(trainData)

        dialog = wx.ProgressDialog('Training Classifier',
                                   'Featurizing', maximum=maxIter+2,
                                   style=wx.PD_ELAPSED_TIME | wx.PD_SMOOTH)

        def progressCB(optable, iteration, *args, **kwargs):
            dialog.Update(iteration, 'Iteration: %d/%d' % (iteration, maxIter))

        self.classifier = ml.CNA(trainDataStd, convs=convs, nHidden=nHidden, maxIter=maxIter,
                                 optimFunc=ml.optim.scg, accuracy=0.0, precision=0.0,
                                 poolSize=poolSize, poolMethod=poolMethod,
                                 verbose=False, callback=progressCB)

        trainCA = self.classifier.ca(trainDataStd)
        trainConfusion = np.round(100*self.classifier.confusion(trainDataStd))

        dialog.Destroy()

        resultText = (('Final Training CA: %f\n' % trainCA) +
                      ('Confusion Matrix:\n' + str(trainConfusion) + '\n') +
                      ('Choices: ' + str(self.choices)))

        wx.MessageBox(message=resultText,
                      caption='Training Completed!',
                      style=wx.OK | wx.ICON_INFORMATION)

        self.saveResultText(resultText)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainConvNet(self, segs):
        trainData = [seg.data for seg in segs]

        #convs = ((16,9), (8,9))
        #maxIter = 400 # 49
        convs = ((8,3), (8,3), (8,3))
        maxIter = 1000

        nHidden = None
        poolSize = 1
        poolMethod = 'average'

        self.stand = ml.ClassSegStandardizer(trainData)
        trainDataStd = self.stand.apply(trainData)

        dialog = wx.ProgressDialog('Training Classifier',
                                   'Featurizing', maximum=maxIter+2,
                                   style=wx.PD_ELAPSED_TIME | wx.PD_SMOOTH)

        def progressCB(optable, iteration, *args, **kwargs):
            dialog.Update(iteration, 'Iteration: %d/%d' % (iteration, maxIter))

        self.classifier = ml.CNA(trainDataStd, convs=convs, nHidden=nHidden, maxIter=maxIter,
                                 optimFunc=ml.optim.scg, accuracy=0.0, precision=0.0,
                                 poolSize=poolSize, poolMethod=poolMethod,
                                 verbose=False, callback=progressCB)

        trainCA = self.classifier.ca(trainDataStd)
        trainConfusion = np.round(100*self.classifier.confusion(trainDataStd))

        dialog.Destroy()

        resultText = (('Final Training CA: %f\n' % trainCA) +
                      ('Confusion Matrix:\n' + str(trainConfusion) + '\n') +
                      ('Choices: ' + str(self.choices)))

        wx.MessageBox(message=resultText,
                      caption='Training Completed!',
                      style=wx.OK | wx.ICON_INFORMATION)

        self.saveResultText(resultText)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainKNN(self, classData, dialog, metric):
        ks = np.arange(1,10)

        trainAUC = np.zeros(ks.shape)
        validAUC = np.zeros(ks.shape)

        partitionGenerator = ml.part.classRandomSubSample(classData,
                self.trainFrac, self.nFold)

        for fold, trainData, validData in partitionGenerator:
            dialog.Update(fold, 'Validation Fold: %d' % fold)

            for i, k in enumerate(ks):
                classifier = ml.KNN(trainData, k=k, distMetric=metric)

                trainAUC[i] += classifier.auc(trainData)
                validAUC[i] += classifier.auc(validData)

        dialog.Update(self.nFold, 'Training Final Classifier')

        trainAUC /= self.nFold
        validAUC /= self.nFold

        print 'train AUC: ', trainAUC
        print 'valid AUC: ', validAUC

        bestK = ks[np.argmax(validAUC)]
        print 'best K: ', bestK

        self.classifier = ml.KNN(classData, k=bestK, distMetric=metric)

        finalAUC = self.classifier.auc(classData)

        dialog.Destroy()

        wx.MessageBox(message=('Best K: %d\n' % bestK) + \
            ('Mean Validation AUC: %f\n' % np.max(validAUC)) +
            ('Final Training AUC: %f' % finalAUC),
            caption='Training Completed!', style=wx.OK | wx.ICON_INFORMATION)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def trainKNN(self, classData, dialog, metric):
        ks = np.arange(1,10)

        trainAUC = np.zeros(ks.shape)
        validAUC = np.zeros(ks.shape)

        partitionGenerator = ml.part.classRandomSubSample(classData,
                self.trainFrac, self.nFold)

        for fold, trainData, validData in partitionGenerator:
            dialog.Update(fold, 'Validation Fold: %d' % fold)

            for i, k in enumerate(ks):
                classifier = ml.KNN(trainData, k=k, distMetric=metric)

                trainAUC[i] += classifier.auc(trainData)
                validAUC[i] += classifier.auc(validData)

        dialog.Update(self.nFold, 'Training Final Classifier')

        trainAUC /= self.nFold
        validAUC /= self.nFold

        print 'train AUC: ', trainAUC
        print 'valid AUC: ', validAUC

        bestK = ks[np.argmax(validAUC)]
        print 'best K: ', bestK

        self.classifier = ml.KNN(classData, k=bestK, distMetric=metric)

        finalAUC = self.classifier.auc(classData)

        dialog.Destroy()

        wx.MessageBox(message=('Best K: %d\n' % bestK) + \
            ('Mean Validation AUC: %f\n' % np.max(validAUC)) +
            ('Final Training AUC: %f' % finalAUC),
            caption='Training Completed!', style=wx.OK | wx.ICON_INFORMATION)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def afterTest(self, earlyStop):
        if not earlyStop:
            self.saveCap()
            ca = np.mean(np.diag(self.confusion))/self.nTestTrial
            wx.MessageBox(('Test CA: %f\n' % ca) +
                           'Confusion Matrix:\n' + str(self.confusion/self.nTestTrial),
                           'Testing Complete', wx.OK | wx.ICON_INFORMATION)
项目:PancakeViewer    作者:forensicmatt    | 项目源码 | 文件源码
def OnDropFiles(self, x, y, filenames):
        wx.MessageBox(
            u"Items Added:\n{}".format("\n".join(filenames)), #message
            u'Evidence Dropped', #title
            wx.OK | wx.ICON_INFORMATION
        )
        for filename in filenames:
            self.window.EnumerateSource(
                filename
            )

        pass
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def ok_click(self, e):
        # check for changes to cron
        if self.cron_lamp_on.GetLabel() == "not found" or self.cron_lamp_off.GetLabel() == "not found":
            mbox = wx.MessageDialog(None, "Add new job to cron?", "Are you sure?", wx.YES_NO|wx.ICON_QUESTION)
            sure = mbox.ShowModal()
            if sure == wx.ID_YES:
                if self.cron_lamp_on.GetLabel() == "not found":
                    cron_task = "/home/pi/Pigrow/scripts/switches/" + "lamp_on.py"
                    MainApp.cron_info_pannel.add_to_onetime_list("new", "True", self.new_on_string_text.GetLabel(), cron_task)
                if self.cron_lamp_off.GetLabel() == "not found":
                    cron_task = "/home/pi/Pigrow/scripts/switches/" + "lamp_off.py"
                    MainApp.cron_info_pannel.add_to_onetime_list("new", "True", self.new_off_string_text.GetLabel(), cron_task)
                    MainApp.cron_info_pannel.update_cron_click("e")
        elif not self.new_on_string_text.GetLabel() == self.cron_lamp_on.GetLabel() or not self.new_off_string_text.GetLabel() == self.cron_lamp_off.GetLabel():
            print(":" + self.new_on_string_text.GetLabel() + ":")
            print(":" + self.cron_lamp_on.GetLabel() + ":")
            mbox = wx.MessageDialog(None, "Update cron timing?", "Are you sure?", wx.YES_NO|wx.ICON_QUESTION)
            sure = mbox.ShowModal()
            result_on = 'done'  # these are for cases when only one is changed
            result_off = 'done' # if it attempts to update cron and fails it'll change to an error message
            if sure == wx.ID_YES:
                if not self.new_on_string_text.GetLabel() == self.cron_lamp_on.GetLabel():
                    result_on = self.change_cron_trigger("lamp_on.py", self.new_on_string_text.GetLabel())
                if not self.new_off_string_text.GetLabel() == self.cron_lamp_off.GetLabel():
                    result_off = self.change_cron_trigger("lamp_off.py", self.new_off_string_text.GetLabel())
                if result_on != "done" or result_off != "done":
                    wx.MessageBox('Cron update error, edit lamp switches in the cron pannel', 'Info', wx.OK | wx.ICON_INFORMATION)
                else:
                    MainApp.cron_info_pannel.update_cron_click("e")

        # check for changes to settings file

        time_lamp_on = str(self.on_hour_spin.GetValue()) + ":" + str(self.on_min_spin.GetValue())
        time_lamp_off = str(self.off_hour_spin.GetValue()) + ":" + str(self.off_min_spin.GetValue())
        if not MainApp.config_ctrl_pannel.config_dict["time_lamp_on"] == time_lamp_on or not MainApp.config_ctrl_pannel.config_dict["time_lamp_off"] == time_lamp_off:
            MainApp.config_ctrl_pannel.config_dict["time_lamp_on"] = time_lamp_on
            MainApp.config_ctrl_pannel.config_dict["time_lamp_off"] = time_lamp_off
            MainApp.config_ctrl_pannel.update_setting_click("e")
            MainApp.config_ctrl_pannel.update_config_click("e")
        self.Destroy()
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def set_new_gpio_link(self, e):
        #get data from combo boxes.
        unused_gpio = self.list_unused_gpio(self.list_used_gpio())
        config_ctrl_pnl.device_new = self.devices_combo.GetValue()
        config_ctrl_pnl.gpio_new = self.gpio_tc.GetValue()
        config_ctrl_pnl.wiring_new = self.wiring_combo.GetValue()
        #check to see if info is valid and closes if it is
        should_close = True
        # check if device is set
        if config_ctrl_pnl.device_new == "":
            wx.MessageBox('Select a device to link from the list', 'Error', wx.OK | wx.ICON_INFORMATION)
            should_close = False
        #check if gpio number is valid
        if not config_ctrl_pnl.gpio_new == config_ctrl_pnl.gpio_toedit or config_ctrl_pnl.gpio_toedit == "":
            if not config_ctrl_pnl.gpio_new in unused_gpio and should_close == True:
                wx.MessageBox('Select a valid and unused gpio pin', 'Error', wx.OK | wx.ICON_INFORMATION)
                config_ctrl_pnl.gpio_new = self.gpio_tc.SetValue("")
                should_close = False
        # check if wiring direction is set to a valid setting
        if not config_ctrl_pnl.wiring_new == "low" and should_close == True:
            if not config_ctrl_pnl.wiring_new == "high":
                wx.MessageBox("No wiring direction set, \nIf you don't know guess and change it if the device turns on when it should be off", 'Error', wx.OK | wx.ICON_INFORMATION)
                should_close = False
        # if box should be closed then close it
        if should_close == True:
            #checks to see if changes have been made and updates ui if so
            if not config_ctrl_pnl.device_new == config_ctrl_pnl.device_toedit:
                config_ctrl_pnl.currently_new = 'unlinked'
            else:
                if not config_ctrl_pnl.gpio_new == config_ctrl_pnl.gpio_toedit:
                    config_ctrl_pnl.currently_new = 'unlinked'
                else:
                    if not config_ctrl_pnl.wiring_new == config_ctrl_pnl.wiring_toedit:
                        config_ctrl_pnl.currently_new = 'unlinked'
                    else:
                        config_ctrl_pnl.currently_new = config_ctrl_pnl.currently_toedit
            self.Destroy()
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def show_help(self, e):
        script_path = self.cron_path_combo.GetValue()
        script_name = self.cron_script_cb.GetValue()
        helpfile = self.get_help_text(str(script_path + script_name))
        msg_text =  script_name + ' \n \n'
        msg_text += str(helpfile)
        wx.MessageBox(msg_text, 'Info', wx.OK | wx.ICON_INFORMATION)
项目:Supplicant    作者:mayuko2012    | 项目源码 | 文件源码
def OnAbout(self, event):
        wx.MessageBox(u"????????\n??????????hack?????????",u"??", wx.OK | wx.ICON_INFORMATION, self)
项目:request2doc    作者:kongxinchi    | 项目源码 | 文件源码
def on_request_transform_button_click(self, event):
        url = self.url_text.GetValue()
        method = self.method_choice.GetStringSelection()
        params_value = self.post_params_text.GetValue()
        headers_value = self.headers_text.GetValue()
        slice_startswith = self.slice_text.GetValue()
        template_path = self.get_template_path()

        request_forms = {k: v[0] for k, v in urlparse.parse_qs(params_value).items()}
        headers = headers_value.split('\n')
        handler = Request2Doc(url, method, request_forms)
        if slice_startswith:
            handler.set_slice_startswith(slice_startswith)
        if headers:
            handler.set_headers(headers)

        try:
            if not handler.validate():
                return wx.MessageDialog(None, handler.error_message(), u"Info", wx.OK | wx.ICON_INFORMATION).ShowModal()

            handler.request()

            if not handler.get_response_data():
                return wx.MessageDialog(None, u'Response body is not legal format', u"Information", wx.OK | wx.ICON_INFORMATION).ShowModal()

            res = handler.render_string(template_path)
            self.GetParent().set_response_content(json.dumps(handler.get_response_data(), indent=2))
            self.GetParent().set_document_content(res)

        except Exception, e:
            return wx.MessageDialog(None, traceback.format_exc(), u"Exception", wx.OK | wx.ICON_ERROR).ShowModal()
项目:robotframework-ride-tortoisesvn    作者:ukostas    | 项目源码 | 文件源码
def create_callable(self, name, action):
        def callable(event):
            # check if this is for whole project or file/directory
            if 'item' in name.lower():  # for one single item - file/directory
                if not self.datafile:
                    return
                full_cmd = action.format(path=self.datafile.source)
            else:  # for whole project - root file/directory
                full_cmd = action.format(path=self.model.suite.source)
            # RideLogMessage(name + " clicked: " + fullCmd).publish()
            if full_cmd.lower().startswith('http'):
                wx.LaunchDefaultBrowser(full_cmd)
            else:
                try:
                    subprocess.Popen(full_cmd)
                except OSError as error:
                    s = "This is the error we got trying to execute {executor_name} executable file:\n" \
                        "\"{error}\"\n\n" \
                        "Probably this file in not in your PATH. Try to reinstall {executor_name}.\n" \
                        "Do you want to open download page?".format(error=error.strerror, executor_name=self.MENU_NAME)
                    dlg = wx.MessageDialog(parent=self.frame, caption="Hmm, something went wrong...", message=s,
                                           style=wx.YES_NO | wx.CENTER | wx.ICON_INFORMATION)
                    if dlg.ShowModal() == wx.ID_YES:
                        wx.LaunchDefaultBrowser(self.SVN_INSTALLATION_URL)
                    dlg.Destroy()

        return callable
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def update_check_done(self, result):
        # Update check function ended
        r = result.get()
        self.checking_updates = False
        if isinstance(r, basestring):
            # Error returned
            self.updates_available = False
            if self.upd_error_count < 2 and not self.show_no_updates:
                # only display update errors on automatic check after the third error in a row
                self.upd_error_count += 1
            else:
                error_str = _(u"Could not load updates:") + "\n" + r
                self.ShowBalloon(title=_(u'Update Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                # reset update error counter
                self.upd_error_count = 0
        elif r:
            self.upd_error_count = 0
            action_dict = {'update': _(u'UPD:') + '\t',
                           'install': _(u'NEW:') + '\t',
                           'remove': _(u'REM:') + '\t',
                           'downgrade': _(u'DOW:') + '\t'}
            # Updates Found
            self.updates_available = True
            text = ''
            for action, name, version in r:
                text += action_dict[action] + name + ', v. ' + version + '\n'
            self.ShowBalloon(title=_(u"Update(s) available:"), text=text, msec=20*1000, flags=wx.ICON_INFORMATION)
        else:
            # No Updates Found
            self.upd_error_count = 0
            self.updates_available = False
            if self.show_no_updates:
                self.ShowBalloon(title=_(u"No Updates"), text=" ", msec=20 * 1000, flags=wx.ICON_INFORMATION)
                self.show_no_updates = False
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def update_check_done(self, result):
        # Update check function ended
        r = result.get()
        self.checking_updates = False
        if isinstance(r, basestring):
            # Error returned
            self.updates_available = False
            if self.upd_error_count < 2 and not self.show_no_updates:
                # only display update errors on automatic check after the third error in a row
                self.upd_error_count += 1
            else:
                error_str = _(u"Could not load updates:") + "\n" + r
                self.ShowBalloon(title=_(u'Update Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                # reset update error counter
                self.upd_error_count = 0
        elif r:
            self.upd_error_count = 0
            action_dict = {'update': _(u'UPD:') + '\t',
                           'install': _(u'NEW:') + '\t',
                           'remove': _(u'REM:') + '\t',
                           'downgrade': _(u'DOW:') + '\t'}
            # Updates Found
            self.updates_available = True
            text = ''
            for action, name, version in r:
                text += action_dict[action] + name + ', v. ' + version + '\n'
            self.ShowBalloon(title=_(u"Update(s) available:"), text=text, msec=20*1000, flags=wx.ICON_INFORMATION)
        else:
            # No Updates Found
            self.upd_error_count = 0
            self.updates_available = False
            if self.show_no_updates:
                self.ShowBalloon(title=_(u"No Updates"), text=" ", msec=5*1000, flags=wx.ICON_INFORMATION)
                self.show_no_updates = False
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def save(self):
        stream = StreamWrite.from_file(self._filename, Endianness.BIG)
        levels_not_saved = 0

        for level_index, level in enumerate(self._levels):
            if level.modified:

                if not level.can_save():
                    levels_not_saved += 1
                    continue

                # Write entities first.
                level.write_entities(stream)

                # Save level data.
                if level_index == 0:
                    level.save(stream)
                else:
                    filename = 'L{}-{}'.format(self._world_index + 1, level_index + 1)
                    game_dir = os.path.dirname(self._filename)
                    filename = os.path.join(game_dir, filename)

                    level_stream = StreamWrite.from_file(filename, Endianness.BIG)

                    if self._world_index == 2 and level_index == 1:
                        offset = 19620
                    else:
                        offset = 0
                    level.save(level_stream, offset)
                    level_stream.write_to_file(filename)

                # Save level header.
                stream.seek(self._level_offsets[level_index])
                level.save_header(stream)
                level.modified = False

        stream.write_to_file(self._filename)

        if levels_not_saved:
            wx.MessageBox('{} level(s) could not be saved.'.format(levels_not_saved), 'Levels not saved', wx.ICON_INFORMATION | wx.OK)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def Add_Clicked(self,event):
        if (self.Validate_Roll_No(self.text_ctrl_1.Value)) and (self.Validate_Adm_No(self.text_ctrl_2.Value)) and (self.Validate_Name(self.text_ctrl_3.Value)):

            try:
                student_id,t1_id,t2_id,t3_id=self.DB.Add_Student(self.text_ctrl_1.Value,self.text_ctrl_2.Value,self.text_ctrl_3.Value,self.Parent.YEAR,self.Parent.CLASS,self.Parent.DIV)
                #term,div_id,subject_index,student_id="All"

                student_id="All"
                if self.Parent.TERM_INDEX==0:
                    term="1"
                    t_id=t1_id
                elif self.Parent.TERM_INDEX==1:
                    term="2"
                    t_id=t2_id
                elif self.Parent.TERM_INDEX==2:
                    term="3"
                    t_id=t3_id

                if self.Parent.SUBJECT=="Select":
                    ROW=[False,student_id,self.text_ctrl_2.Value,self.text_ctrl_3.Value,t_id,self.text_ctrl_1.Value,0,0,0,0]
                div_id=self.DB.Get_Div_Id(self.Parent.YEAR,self.Parent.CLASS,self.Parent.DIV)    

                self.DB.Score_and_Roll(term,div_id,self.Parent.SUBJECT_INDEX,student_id)
                dlg = wx.MessageDialog(self, 'Added Successfully', '',wx.OK | wx.ICON_INFORMATION)
                self.success=True
                self.STUDENT_INFO=[self.text_ctrl_1.Value,self.text_ctrl_2.Value,self.text_ctrl_3.Value]
                dlg.ShowModal()
                dlg.Destroy()
            except:
                dlg = wx.MessageDialog(self, 'Sorry, Could not Add', '',wx.OK | wx.ICON_ERROR)
                self.STUDENT_INFO=[]
                dlg.ShowModal()
                dlg.Destroy()


            self.Close()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def OnMenu_PerformanceReport(self,event):

        import subprocess

        if STD=='9' or STD=='10':

            #self.Sheet.Refresh()
            R=Report()

            R.SetTable_Style()

            R.PopulateTables(self.YEAR,self.CLASS,self.DIV,self.TERM_INDEX)
            R.Save()









        else:
            try:

                R=Report_8()

                R.SetTable_Style()

                R.PopulateTables(self.YEAR,self.CLASS,self.DIV,self.TERM_INDEX)
                R.Save()

            except:

                dlg = wx.MessageDialog(None, 'Error in File', '',wx.OK | wx.ICON_INFORMATION)                  
                dlg.ShowModal()
                dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_email(self,event):
        msg="This feature is not yet activated"
        dlg = wx.MessageDialog(self, msg, '',wx.OK | wx.ICON_INFORMATION)                  
        dlg.ShowModal()
        dlg.Destroy()
        self.label_email.SetForegroundColour(self.label_fg_color)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def OnSave(self, event):  # wxGlade: working_days.<event_handler>
        t1=str(self.text_ctrl_1.Value)
        t2=str(self.text_ctrl_2.Value)
        t3=str(self.text_ctrl_3.Value)

        err=False
        if not self.text_ctrl_1.Value.isdigit() and not self.text_ctrl_1.Value=='':err=True;self.text_ctrl_1.Value=''
        if not self.text_ctrl_2.Value.isdigit() and not self.text_ctrl_2.Value=='':err=True;self.text_ctrl_2.Value=''
        if not self.text_ctrl_3.Value.isdigit() and not self.text_ctrl_3.Value=='':err=True;self.text_ctrl_3.Value=''
        if err:

            dlg = wx.MessageDialog(self, 'Working days should be a digit', '',wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return 0

        try:
            self.DB.Set_Working_Days(self.YEAR,'1',self.text_ctrl_1.Value)
            self.DB.Set_Working_Days(self.YEAR,'2',self.text_ctrl_2.Value)
            self.DB.Set_Working_Days(self.YEAR,'3',self.text_ctrl_3.Value)
            dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()

        except:
            dlg = wx.MessageDialog(self, 'Some error occured', '',wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()

        event.Skip()

# end of class working_days
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_save(self, event):  # wxGlade: secret_win.<event_handler>
        self.DB.Set_School_Name(self.text_ctrl_1.Value)
        self.DB.Set_School_Code(self.text_ctrl_2.Value)
        dlg = wx.MessageDialog(self, 'Done', '',wx.OK | wx.ICON_INFORMATION)                  
        dlg.ShowModal()
        dlg.Destroy()
        self.Close()
        event.Skip()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def OnOk(self, event):  # wxGlade: Institution.<event_handler>

        '''if self.text_ctrl_1.Value=='admin' and self.text_ctrl_2.Value=='admin':


            self.DB.Set_School_Name(self.text_ctrl_3.Value)      


        elif  self.text_ctrl_1.Value=='theadmin' and self.text_ctrl_2.Value=='theadmin':
           self.DB.Set_School_Code(self.text_ctrl_3.Value)   

        else:
        '''
        try:
            self.DB.Set_School_Name(self.text_ctrl_5.Value) 
            self.DB.Set_School_Code(self.text_ctrl_6.Value)   

            self.DB.Set_School_Email(self.text_ctrl_1.Value)       
            self.DB.Set_School_Contact(self.text_ctrl_2.Value)
            self.DB.Set_School_DEO(self.text_ctrl_3.Value)
            dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
        except:
            dlg = wx.MessageDialog(self, 'Could not save some values', '',wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()




        self.Close(True)
        event.Skip()