python类ID_YES的实例源码

UI.py 文件源码 项目:AppAutoViewer 作者: RealLau 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def updateRecordModel(self, evt):
        global recordStatus
        if recordStatus == "?":
            dlg = wx.MessageDialog(self, u"1. ????????????????????;\n2. ???????????????????????;\n3. ??????????????", u"?????????", wx.YES_NO | wx.ICON_QUESTION)
            if dlg.ShowModal() == wx.ID_YES:
                recordStatus="?"
                global recordTimeDelay
                recordTimeDelay = int(self.recordTimeOut.GetValue())
                print("??????????", recordTimeDelay)
            dlg.Destroy() 
        else:
            recordStatus="?"
        self.Parent.updateRecordStatus(recordStatus)
TortoiseSVNPlugin.py 文件源码 项目:robotframework-ride-tortoisesvn 作者: ukostas 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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
wxglade_hmi.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _editWXGLADE(self):
        wxg_filename = self._getWXGLADEpath()
        open_wxglade = True
        if not self.GetCTRoot().CheckProjectPathPerm():
            dialog = wx.MessageDialog(self.GetCTRoot().AppFrame,
                                      _("You don't have write permissions.\nOpen wxGlade anyway ?"),
                                      _("Open wxGlade"),
                                      wx.YES_NO | wx.ICON_QUESTION)
            open_wxglade = dialog.ShowModal() == wx.ID_YES
            dialog.Destroy()
        if open_wxglade:
            if not os.path.exists(wxg_filename):
                hmi_name = self.BaseParams.getName()
                open(wxg_filename, "w").write("""<?xml version="1.0"?>
    <application path="" name="" class="" option="0" language="python" top_window="%(name)s" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
        <object class="%(class)s" name="%(name)s" base="EditFrame">
            <style>wxDEFAULT_FRAME_STYLE</style>
            <title>frame_1</title>
            <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer">
                <orient>wxVERTICAL</orient>
            <object class="sizerslot" />
        </object>
        </object>
    </application>
    """ % {"name": hmi_name, "class": "Class_%s" % hmi_name})
            if wx.Platform == '__WXMSW__':
                wxg_filename = "\"%s\"" % wxg_filename
            self.launch_wxglade([wxg_filename])
ProjectController.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def CheckNewProjectPath(self, old_project_path, new_project_path):
        if old_project_path == new_project_path:
            message = (_("Save path is the same as path of a project! \n"))
            dialog = wx.MessageDialog(self.AppFrame, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            return False
        else:
            plc_file = os.path.join(new_project_path, "plc.xml")
            if os.path.isfile(plc_file):
                message = (_("Selected directory already contains another project. Overwrite? \n"))
                dialog = wx.MessageDialog(self.AppFrame, message, _("Error"), wx.YES_NO | wx.ICON_ERROR)
                answer = dialog.ShowModal()
                return answer == wx.ID_YES
        return True
svgui.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _StartInkscape(self):
        svgfile = self._getSVGpath()
        open_inkscape = True
        if not self.GetCTRoot().CheckProjectPathPerm():
            dialog = wx.MessageDialog(self.GetCTRoot().AppFrame,
                                      _("You don't have write permissions.\nOpen Inkscape anyway ?"),
                                      _("Open Inkscape"),
                                      wx.YES_NO | wx.ICON_QUESTION)
            open_inkscape = dialog.ShowModal() == wx.ID_YES
            dialog.Destroy()
        if open_inkscape:
            if not os.path.isfile(svgfile):
                svgfile = None
            open_svg(svgfile)
IPy.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def yes_no(info, title="ImagePy Yes-No ?!"):
    dlg = wx.MessageDialog(curapp, info, title, wx.YES_NO | wx.CANCEL)
    rst = dlg.ShowModal()
    dlg.Destroy()
    dic = {wx.ID_YES:'yes', wx.ID_NO:'no', wx.ID_CANCEL:'cancel'}
    return dic[rst]
sampoorna_gui_old.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def on_finished(self, event):  # wxGlade: sampoorna_win.<event_handler>
        if self.button_finished.Label=="Abort":
            msg="Do you want to abort this operation?"
            dlg = wx.MessageDialog(self, msg,"Warning", wx.YES_NO | wx.ICON_QUESTION)
            result = dlg.ShowModal()# == wx.ID_YES
            if result==wx.ID_YES:


                self.thread.stop()
                self.Close()

            dlg.Destroy()
        else:
            self.Close()
        event.Skip()# end of class sampoorna_win
import_win.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def ok_clicked(self,event):

        msg='The spreadsheet must have data in 3 columns in the order of Roll No, Admission No, Name.'
        msg+=' It assumes first row carries headings and student data begins only from the second row.Do you want to proceed ?'
        dlg = wx.MessageDialog(self, msg,"Excel Format", wx.YES_NO | wx.ICON_QUESTION)
        result = dlg.ShowModal()# == wx.ID_YES
        if result==wx.ID_YES:


            self.I=import_excel_operations(self,self.YEAR,self.CLASS,self.DIV)
            self.I.do()
            dlg.Destroy()
        else:
            self.Close()
sampoorna_gui.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def on_finished(self, event):  # wxGlade: sampoorna_win.<event_handler>
        if self.button_finished.Label=="Abort":
            msg="Do you want to abort this operation?"
            dlg = wx.MessageDialog(self, msg,"Warning", wx.YES_NO | wx.ICON_QUESTION)
            result = dlg.ShowModal()# == wx.ID_YES
            if result==wx.ID_YES:


                self.thread.stop()
                self.Close()

            dlg.Destroy()
        else:
            self.Close()
        event.Skip()# end of class sampoorna_win
student_profile.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def db_delete(self):

        msg="The student "+self.text_ctrl_name.Value+", along with all data, will be deleted\nAre you sure you want to  continue?"
        dlg = wx.MessageDialog(self, msg,"Warning", wx.YES_NO | wx.ICON_QUESTION)
        result = dlg.ShowModal()# == wx.ID_YES
        if result==wx.ID_NO:
            return 0
        dlg.Destroy()

        try:
                self.DB.Remove_Student_Full(self.combo_box_adno.GetStringSelection())
                msg="Successfully Removed Student"
                icon=wx.ICON_INFORMATION
        except:
            msg="Failed to Remove the Student"
            icon=wx.ICON_ERROR

        dlg = wx.MessageDialog(self, msg, '',wx.OK | icon)                  
        dlg.ShowModal()
        dlg.Destroy()



        self.load_admission_no()
        self.clear_student_details()
        self.button_delete.Disable()
mzGUI_standalone.py 文件源码 项目:multiplierz 作者: BlaisProteomics 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def update(self, count):
        self.progressBar.Update(count)

        if self.progressBar.Update(count)[0] == 0:
            cancelMsg = wx.MessageDialog(None, "Are you sure you want to cancel?",'Continue?',wx.YES_NO | wx.ICON_QUESTION)
            cancelMsgAnswer = cancelMsg.ShowModal()
            if cancelMsgAnswer == wx.ID_YES:
                return False
            else:
                self.progressBar.Resume()

        return True
gripy_app.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def PreExit(self):
        msg = 'GriPy Application is preparing to terminate....'
        log.info(msg)
        print '\n', msg
        OM = ObjectManager(self)
        if OM.get_changed_flag():
            dial = wx.MessageDialog(self.GetTopWindow(), 
                                    'Do you want to save your project?', 
                                    'GriPy', 
                                    wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION
            )
            if dial.ShowModal() == wx.ID_YES:
                self.on_save()   
        #
        self.reset_ObjectManager()
        #
        app_UI_filename = self._gripy_app_state.get('app_UI_file')
        Interface.save_UI_application_data(app_UI_filename)

        user_UI_filename = self._gripy_app_state.get('user_UI_file')
        Interface.save_UI_user_data(user_UI_filename)

        # This time I choose not use the line below because there was a little
        # freeze on exiting (1-2 seconds). Then I opted delegate it do compiler.
        #UIM = UIManager()      
        #UIM.close()
        UIM = UIManager()  
        UIM.PreExit()

        # As indicated by https://forums.wxwidgets.org/viewtopic.php?t=32138        
        aui_manager = wx.aui.AuiManager.GetManager(self.GetTopWindow())
        aui_manager.UnInit()
record.py 文件源码 项目:TensorKart 作者: kevinhughes27 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def start_recording(self):
        # check that a dir has been specified
        if self.txt_outputDir.IsEmpty():

            msg = wx.MessageDialog(self, 'Specify the Output Directory', 'Error', wx.OK | wx.ICON_ERROR)
            msg.ShowModal() == wx.ID_YES
            msg.Destroy()

            self.recording = False

        else: # a directory was specified
            self.outputDir = self.txt_outputDir.GetValue()
            self.t = 0

            # check if path exists - ie may be saving over data
            if os.path.exists(self.outputDir):

                msg = wx.MessageDialog(self, 'Output Directory Exists - Overwrite Data?', 'Yes or No', wx.YES_NO | wx.ICON_QUESTION)
                result = msg.ShowModal() == wx.ID_YES
                msg.Destroy()

                # overwrite the data
                if result == True:

                    # delete the dir
                    shutil.rmtree(self.outputDir)

                    # re-make dir
                    os.mkdir(self.outputDir)

                # do not overwrite the data
                else: # result == False
                    self.recording = False
                    self.txt_outputDir.SetFocus()

            # no directory so make one
            else:
                os.mkdir(self.outputDir)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def update_cron_click(self, e):
        #make a text file of all the cron jobs
        cron_text = ''
        startup_num = cron_list_pnl.startup_cron.GetItemCount()
        for num in range(0, startup_num):
            cron_line = ''
            if cron_list_pnl.startup_cron.GetItemText(num, 1) == 'False':
                cron_line += '#'
            cron_line += '@reboot ' + cron_list_pnl.startup_cron.GetItemText(num, 3) # cron_task
            cron_line += ' ' + cron_list_pnl.startup_cron.GetItemText(num, 4) # cron_extra_args
            cron_line += ' ' + cron_list_pnl.startup_cron.GetItemText(num, 5) # cron_comment
            cron_text += cron_line + '\n'
        repeat_num = cron_list_pnl.repeat_cron.GetItemCount()
        for num in range(0, repeat_num):
            cron_line = ''
            if cron_list_pnl.repeat_cron.GetItemText(num, 1) == 'False':
                cron_line += '#'
            cron_line += cron_list_pnl.repeat_cron.GetItemText(num, 2).strip(' ')
            cron_line += ' ' + cron_list_pnl.repeat_cron.GetItemText(num, 3) # cron_task
            cron_line += ' ' + cron_list_pnl.repeat_cron.GetItemText(num, 4) # cron_extra_args
            cron_line += ' ' + cron_list_pnl.repeat_cron.GetItemText(num, 5) # cron_comment
            cron_text += cron_line + '\n'
        onetime_num = cron_list_pnl.timed_cron.GetItemCount()
        for num in range(0, onetime_num):
            cron_line = ''
            if cron_list_pnl.timed_cron.GetItemText(num, 1) == 'False':
                cron_line += '#'
            cron_line += cron_list_pnl.timed_cron.GetItemText(num, 2).strip(' ')
            cron_line += ' ' + cron_list_pnl.timed_cron.GetItemText(num, 3) # cron_task
            cron_line += ' ' + cron_list_pnl.timed_cron.GetItemText(num, 4) # cron_extra_args
            cron_line += ' ' + cron_list_pnl.timed_cron.GetItemText(num, 5) # cron_comment
            cron_text += cron_line + '\n'
        # ask the user if they're sure
        msg_text = "Update cron to; \n\n" + cron_text
        mbox = wx.MessageDialog(None, msg_text, "Are you sure?", wx.YES_NO|wx.ICON_QUESTION)
        sure = mbox.ShowModal()
        if sure == wx.ID_YES:
            print "Updating remote cron"
            # save cron text onto pigrow as text file then import into cron
            sftp = ssh.open_sftp()
            try:
                tempfolder = '/home/pi/Pigrow/temp'
                sftp.mkdir(tempfolder)
            except IOError:
                pass
            f = sftp.open(tempfolder + '/remotecron.txt', 'w')
            f.write(cron_text)
            f.close()
            try:
                stdin, stdout, stderr = ssh.exec_command("crontab " + tempfolder + '/remotecron.txt')
                responce = stdout.read()
                error = stderr.read()
                print responce, error
            except Exception as e:
                print("this ain't right, it just ain't right! " + str(e))
        else:
            print("Updating cron cancelled")
        mbox.Destroy()
        #refresh cron list
        self.read_cron_click("event")
WPKG-GP-Client_phoenix.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def on_upgrade(self, event):
        try:
            if self.wpkg_dialog.IsShown():
                # If dialog is opened already, raise window to top
                self.wpkg_dialog.Raise()
                return
        except AttributeError:
            # Dialog is not opened yet
            # Check if Reboot is Pending
            try:
                reboot_pending = ReadRebootPendingTime()
            except WindowsError:
                dlg_msg = _(u'Registry Error\n\nNo access to necessary registry key.')
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
            if reboot_pending and reboot_pending > self.bootup_time:
                dlg_msg = _(u"Reboot required!\n\n"
                           u"A reboot is required before the system\n"
                           u"can be updated again.\n"
                           u"Reboot now?")
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
                if dlg.ShowModal() == wx.ID_YES:
                    # Initiate Reboot
                    shutdown(1, time=5, msg=_(u"System will reboot now!"))
                    return
                else:
                    return
            elif reboot_pending:
                SetRebootPendingTime(reset=True)
            if update_method and update_interval:
                self.timer.Stop()
            self.wpkg_dialog = RunWPKGDialog(parent=self, title=_(u'System Update'))
            self.wpkg_dialog.ShowModal()
            if self.wpkg_dialog.shutdown_scheduled == True:
                # Shutdown Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
            if self.wpkg_dialog.reboot_scheduled == True:
                # Reboot Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
                self.reboot_scheduled = True
            self.wpkg_dialog.Destroy()
            if update_method and update_interval:
                self.timer.Start()
WPKG-GP-Client.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def on_upgrade(self, event):
        try:
            if self.wpkg_dialog.IsShown():
                # If dialog is opened already, raise window to top
                self.wpkg_dialog.Raise()
                return
        except AttributeError:
            # Dialog is not opened yet
            # Check if Reboot is Pending
            try:
                reboot_pending = ReadRebootPendingTime()
            except WindowsError:
                dlg_msg = _(u'Registry Error\n\nNo access to necessary registry key.')
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
            if reboot_pending and reboot_pending > self.bootup_time:
                dlg_msg = _(u"Reboot required!\n\n"
                           u"A reboot is required before the system\n"
                           u"can be updated again.\n"
                           u"Reboot now?")
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
                if dlg.ShowModal() == wx.ID_YES:
                    # Initiate Reboot
                    shutdown(1, time=5, msg=_(u"System will reboot now!"))
                    return
                else:
                    return
            elif reboot_pending:
                SetRebootPendingTime(reset=True)
            if update_method and update_interval:
                self.timer.Stop()
            self.wpkg_dialog = RunWPKGDialog(parent=self, title=_(u'System Update'))
            self.wpkg_dialog.ShowModal()
            if self.wpkg_dialog.shutdown_scheduled == True:
                # Shutdown Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
            if self.wpkg_dialog.reboot_scheduled == True:
                # Reboot Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
                self.reboot_scheduled = True
            self.wpkg_dialog.Destroy()
            if update_method and update_interval:
                self.timer.Start()
PouDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def OnOK(self, event):
        error = []
        pou_name = self.PouName.GetValue()
        if pou_name == "":
            error.append(_("POU Name"))
        if self.PouType.GetSelection() == -1:
            error.append(_("POU Type"))
        if self.Language.GetSelection() == -1:
            error.append(_("Language"))
        message = None
        question = False
        if len(error) > 0:
            text = ""
            for i, item in enumerate(error):
                if i == 0:
                    text += item
                elif i == len(error) - 1:
                    text += _(" and %s") % item
                else:
                    text += _(", %s") % item
            message = _("Form isn't complete. %s must be filled!") % text
        elif not TestIdentifier(pou_name):
            message = _("\"%s\" is not a valid identifier!") % pou_name
        elif pou_name.upper() in IEC_KEYWORDS:
            message = _("\"%s\" is a keyword. It can't be used!") % pou_name
        elif pou_name.upper() in self.PouNames:
            message = _("\"%s\" pou already exists!") % pou_name
        elif pou_name.upper() in self.PouElementNames:
            message = _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?") % pou_name
            question = True
        if message is not None:
            if question:
                dialog = wx.MessageDialog(self, message, _("Warning"), wx.YES_NO | wx.ICON_EXCLAMATION)
                result = dialog.ShowModal()
                dialog.Destroy()
                if result == wx.ID_YES:
                    self.EndModal(wx.ID_OK)
            else:
                dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
                dialog.ShowModal()
                dialog.Destroy()
        else:
            self.EndModal(wx.ID_OK)


问题


面经


文章

微信
公众号

扫码关注公众号