python类ID_YES的实例源码

wxnsc.py 文件源码 项目:SameKeyProxy 作者: xzhou 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnDelete(self, ev=None):
      """
      Deleting selected items.
      """
      tree = self.treeCtrlItems
      itemsL = tree.GetSelections()
      namesL  = []
      deleteL = []
      for i in itemsL:
         # only items (ie. no groups)
         if tree.GetPyData(i) == 1:
            parent = tree.GetItemParent(i)
            parentName = tree.GetItemText(parent)
            name   = tree.GetItemText(i).split()[0] #only name
            namesL.append('%s.%s' % (parentName, name))
            deleteL.append(i)
      if namesL:     
         namesS = ',\n '.join(namesL)
         ret = show_message_dialog(self,
                         'Really delete following name(s)?:\n %s' % namesS,
                         '-- Confirm --', wx.YES|wx.NO|wx.ICON_QUESTION)
         if ret == wx.ID_YES:
            for name, i in zip(namesL,deleteL):
               if self.nsc_delete(name):
                  tree.Delete(i)
wxnsc.py 文件源码 项目:SameKeyProxy 作者: xzhou 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnDeleteGroup(self, ev=None):
      """
      Deleting selected groups.
      """
      tree = self.treeCtrlItems
      itemsL = tree.GetSelections()
      namesL  = []
      deleteL = []
      for i in itemsL:
          # only groups (ie. no items)
          if tree.GetPyData(i) == 0:             
             name   = tree.GetItemText(i)
             if name not in PROTECTED_GROUPS and tree.GetChildrenCount(i)==0:
                namesL.append(name)
                deleteL.append(i)
      if namesL:
         namesS = ',\n'.join(namesL)
         ret = show_message_dialog(self,
                           'Really delete following group(s)?:\n %s' % namesS,
                           '-- Confirm --', wx.YES|wx.NO|wx.ICON_QUESTION)
         if ret == wx.ID_YES:
            for name, i in zip(namesL, deleteL):
               if self.nsc_delete_group(name):
                  tree.Delete(i)
pySIMlastnum.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def OnPopupNew(self, event):
        p = PhonebookEditEntry(self, '', '', 1, self.nameLength)
        if p.ShowModal() == wx.ID_OK:
            name, number = p.getValues()
            pos = self.findFreePosition()
            if pos:
                try:
                    self.SIM.gotoFile(LND_FILE_PATH)
                    if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                        raise "Access conditions not met."
                    if self.writePhonebookEntry(pos, name, number) == wx.ID_YES:
                        self.itemDataMap[pos] = (name, number)
                        self.UpdateView()
                except:
                    pySIMmessage(self, "Unable to save: %s (%s)" % (name, number), "SIM card error")
            else:
                pySIMmessage(self, "Cannot save: %s (%s)\n\nNo free positions left on SIM card." % (name, number), "SIM card error")
        p.Destroy()
pySIMlastnum.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def OnPopupCopy(self, event):
        name = self.getColumnText(self.currentItem, 0)
        number = self.getColumnText(self.currentItem, 1)
        p = PhonebookEditEntry(self, name, number, 1, self.nameLength)
        if p.ShowModal() == wx.ID_OK:
            name, number = p.getValues()
            pos = self.findFreePosition()
            if pos:
                try:
                    self.SIM.gotoFile(LND_FILE_PATH)
                    if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                        raise "Access conditions not met."
                    if self.writePhonebookEntry(pos, name, number) == wx.ID_YES:
                        self.itemDataMap[pos] = (name, number)
                        self.UpdateView()
                except:
                    pySIMmessage(self, "Unable to save: %s (%s)" % (name, number), "SIM card error")
            else:
                pySIMmessage(self, "Cannot save: %s (%s)\n\nNo free positions left on SIM card." % (name, number), "SIM card error")
        p.Destroy()
pySIMlastnum.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnPopupEdit(self, event):
        name = self.getColumnText(self.currentItem, 0)
        number = self.getColumnText(self.currentItem, 1)
        p = PhonebookEditEntry(self, name, number, 1, self.nameLength)
        if p.ShowModal() == wx.ID_OK:
            name, number = p.getValues()
            pos = self.listCtrl.GetItemData(self.currentItem)
            try:
                self.SIM.gotoFile(LND_FILE_PATH)
                if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                    raise "Access conditions not met."
                if self.writePhonebookEntry(pos, name, number) == wx.ID_YES:
                    self.itemDataMap[pos] = (name, number)
                    self.UpdateView()
            except:
                pySIMmessage(self, "Unable to save: %s (%s)" % (name, number), "SIM card error")
        p.Destroy()
pySIMphonebook.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnPopupNew(self, event):
        p = PhonebookEditEntry(self, '', '', 1, self.nameLength)
        if p.ShowModal() == wx.ID_OK:
            name, number = p.getValues()
            pos = self.findFreePosition()
            if pos:
                try:
                    self.SIM.gotoFile(self.filepath)
                    if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                        raise "Access conditions not met."
                    if self.writePhonebookEntry(pos, name, number) == wx.ID_YES:
                        self.itemDataMap[pos] = (name, number)
                        self.UpdateView()
                except:
                    pySIMmessage(self, "Unable to save: %s (%s)" % (name, number), "SIM card error")
            else:
                pySIMmessage(self, "Cannot save: %s (%s)\n\nNo free positions left on SIM card." % (name, number), "SIM card error")
        p.Destroy()
pySIMphonebook.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnPopupEdit(self, event):
        name = self.getColumnText(self.currentItem, 0)
        number = self.getColumnText(self.currentItem, 1)
        p = PhonebookEditEntry(self, name, number, 1, self.nameLength)
        if p.ShowModal() == wx.ID_OK:
            name, number = p.getValues()
            pos = self.listCtrl.GetItemData(self.currentItem)
            try:
                self.SIM.gotoFile(self.filepath)
                if not self.SIM.checkAndVerifyCHV1(CHV_UPDATE):
                    raise "Access conditions not met."
                if self.writePhonebookEntry(pos, name, number) == wx.ID_YES:
                    self.itemDataMap[pos] = (name, number)
                    self.UpdateView()
            except:
                pySIMmessage(self, "Unable to save: %s (%s)" % (name, number), "SIM card error")
        p.Destroy()
pySIMsms.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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
WPKG-GP-Client_phoenix.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def OnStartButton(self, e):
        if wpkg_running():
            dlg_msg = _(u"WPKG is currently running,\n"
                        u"please wait a few seconds and try again.")
            dlg = wx.MessageDialog(self, dlg_msg, app_name, wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        dlg_title = _(u"2. Warning")
        dlg_msg = _(u"Close all open programs!\n\nThe System could restart without further confirmation!\n\n" \
                    u"Continue?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            # Disable/enable buttons and disable Close Window option!
            self.startButton.Disable()
            self.abortButton.Enable()
            self.EnableCloseButton(enable=False)
            # Set Start Time
            self.wpkg_start_time = datetime.datetime.now()
            # Reset Log
            self.log = None
            startWorker(self.LongTaskDone, self.LongTask)
WPKG-GP-Client_phoenix.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnAbortButton(self, e):
        if not self.running:
            self.Close()
            return
        dlg_title = _(u"Cancel")
        dlg_msg = _(u"System update in progress!\n\n Canceling this Progress could result in installation issues.\n"
                    u"Cancel?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            if not self.running:
                # WPKG Process by this client has finished, no cancel possible
                return
            print 'Aborting WPKG Process' #TODO: MOVE TO DEBUG LOGGER
            self.shouldAbort = True
            msg = 'Cancel'
            try:
                pipeHandle = CreateFile("\\\\.\\pipe\\WPKG", GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None)
            except pywintypes.error, (n, f, e):
                print "Error when generating pipe handle: %s" % e #TODO: MOVE TO DEBUG LOGGER
                return 1

            SetNamedPipeHandleState(pipeHandle, PIPE_READMODE_MESSAGE, None, None)
            WriteFile(pipeHandle, msg)
WPKG-GP-Client.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnStartButton(self, e):
        if wpkg_running():
            dlg_msg = _(u"WPKG is currently running,\n"
                        u"please wait a few seconds and try again.")
            dlg = wx.MessageDialog(self, dlg_msg, app_name, wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        dlg_title = _(u"2. Warning")
        dlg_msg = _(u"Close all open programs!\n\nThe System could restart without further confirmation!\n\n" \
                    u"Continue?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            # Disable/enable buttons and disable Close Window option!
            self.startButton.Disable()
            self.abortButton.Enable()
            self.EnableCloseButton(enable=False)
            # Set Start Time
            self.wpkg_start_time = datetime.datetime.now()
            # Reset Log
            self.log = None
            startWorker(self.LongTaskDone, self.LongTask)
IDEFrame.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def CheckSaveBeforeClosing(self, title=_("Close Project")):
        """Function displaying an question dialog if project is not saved"

        :returns: False if closing cancelled.
        """
        if not self.Controler.ProjectIsSaved():
            dialog = wx.MessageDialog(self, _("There are changes, do you want to save?"), title, wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
            answer = dialog.ShowModal()
            dialog.Destroy()
            if answer == wx.ID_YES:
                self.SaveProject()
            elif answer == wx.ID_CANCEL:
                return False

        for idx in xrange(self.TabsOpened.GetPageCount()):
            window = self.TabsOpened.GetPage(idx)
            if not window.CheckSaveBeforeClosing():
                return False

        return True

    # -------------------------------------------------------------------------------
    #                            File Menu Functions
    # -------------------------------------------------------------------------------
FileManagementPanel.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnDeleteButton(self, event):
        filepath = self.ManagedDir.GetPath()
        if os.path.isfile(filepath):
            folder, filename = os.path.split(filepath)

            dialog = wx.MessageDialog(self,
                                      _("Do you really want to delete the file '%s'?") % filename,
                                      _("Delete File"),
                                      wx.YES_NO | wx.ICON_QUESTION)
            remove = dialog.ShowModal() == wx.ID_YES
            dialog.Destroy()

            if remove:
                os.remove(filepath)
                self.ManagedDir.RefreshTree()
        event.Skip()
FileManagementPanel.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def CopyFile(self, src, dst):
        if os.path.isfile(src):
            src_folder, src_filename = os.path.split(src)
            if os.path.isfile(dst):
                dst_folder, dst_filename = os.path.split(dst)
            else:
                dst_folder = dst

            dst_filepath = os.path.join(dst_folder, src_filename)
            if os.path.isfile(dst_filepath):
                dialog = wx.MessageDialog(
                    self,
                    _("The file '%s' already exist.\nDo you want to replace it?") % src_filename,
                    _("Replace File"), wx.YES_NO | wx.ICON_QUESTION)
                copy = dialog.ShowModal() == wx.ID_YES
                dialog.Destroy()
            else:
                copy = True

            if copy:
                shutil.copyfile(src, dst_filepath)
                return dst_filepath
        return None
lib.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnClose(self,event):



        if self.CHANGES_TO_BE_SAVED:
            dlg=wx.MessageDialog(self, "There are Unsaved Changes..Don't You Want to Save them?",'', wx.YES_NO|wx.YES_DEFAULT | wx.ICON_QUESTION)
            #dlg = wx.MessageDialog(None, )
            #dlg = wx.MessageDialog(None, "Don't You Want to Save Changes?", wx.NO_DEFAULT | wx.ICON_QUESTION)
            if dlg.ShowModal() == wx.ID_YES:

                self.Save_Clicked(None)
        self.Parent.IsGridChild=0
        self.Parent.Show()
        self.P=None
        self.DB=None
        event.Skip()
delete_students.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def on_proceed(self, event):  # wxGlade: promote.<event_handler>
        msg="Are sure you want to delete ?"
        dlg = wx.MessageDialog(self, msg,"Warning", wx.YES_NO | wx.ICON_QUESTION)
        result = dlg.ShowModal()# == wx.ID_YES
        if result==wx.ID_YES:


            try:
                self.delete()
                dlg = wx.MessageDialog(self, 'Successfully deleted students from this class', '',wx.OK | wx.ICON_INFORMATION)                  
                dlg.ShowModal()
                dlg.Destroy()
            except:
                dlg = wx.MessageDialog(self, 'Some error occured.Could not complete', '',wx.OK | wx.ICON_ERROR)                  
                dlg.ShowModal()
                dlg.Destroy()
            self.check_list_box_1.Check(0,False)
            self.button_proceed.Enable(False)
            self.load_students()
        event.Skip()
hostswitcher.py 文件源码 项目:hostswitcher 作者: fiefdx 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnDelete(self, evt):
        name = self.combo_box_1.GetValue()
        fpath = os.path.join(DataPath, name)
        if name != "default":
            msg_dialog = wx.MessageDialog(self,
                                          "Are you sure that you want to delete file \"%s\"" % name,
                                          "Delete \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
            msg_dialog.Centre(wx.BOTH)
            r = msg_dialog.ShowModal()
            if r == wx.ID_YES:
                if os.path.exists(fpath) and os.path.isfile(fpath):
                    os.remove(fpath)
                    index = self.combo_box_1.GetSelection()
                    self.combo_box_1.Delete(index)
                    self.combo_box_1.Select(0)
            msg_dialog.Destroy()
        else:
            msg_dialog = wx.MessageDialog(self,
                                          "\"%s\" can't be deleted.\nYou can edit it only." % name,
                                          "\"%s\" can't be deleted." % name, wx.OK | wx.ICON_ERROR)
            msg_dialog.Centre(wx.BOTH)
            msg_dialog.ShowModal()
            msg_dialog.Destroy()
hostswitcher.py 文件源码 项目:hostswitcher 作者: fiefdx 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def OnSet(self, evt):
        name = self.combo_box_1.GetValue()
        fpath = os.path.join(DataPath, name)
        msg_dialog = wx.MessageDialog(self,
                                      "Are you sure that you want to set file \"%s\" as current hosts" % name,
                                      "Set \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
        msg_dialog.Centre(wx.BOTH)
        r = msg_dialog.ShowModal()
        if r == wx.ID_YES:
            with open(fpath, "rb") as fp_src:
                with open("/etc/hosts", "wb") as fp_des:
                    fp_des.write(fp_src.read())
                    self.current = name
                    with open(CurrentHosts, "wb") as fp:
                        fp.write(name)
                    self.statusbar.SetStatusText("Current: %s" % self.current)
        msg_dialog.Destroy()
configurator.py 文件源码 项目:steam-vr-wheel 作者: mdovgialo 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def read_config(self):
        try:
            self.config = PadConfig()
        except ConfigException as e:
            msg = "Config error: {}. Load defaults?".format(e)
            dlg = wx.MessageDialog(self.pnl, msg, "Config Error", wx.YES_NO | wx.ICON_QUESTION)
            result = dlg.ShowModal() == wx.ID_YES
            dlg.Destroy()
            if result:
                self.config = PadConfig(load_defaults=True)
            else:
                sys.exit(1)
        for key, item in self._config_map.items():
            item.Set3StateValue(getattr(self.config, key))
EyePicker.py 文件源码 项目:nimo 作者: wolfram2012 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def onClose(self,event):
        dlg = wx.MessageDialog(self,message="Would you like to save the coordinates before exiting?",style = wx.YES_NO | wx.YES_DEFAULT)
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print "Saving..."
            self.onSave(event)
        else:
            print "Discarding changes..."

        # Pass this on to the default handler.
        event.Skip()
view.py 文件源码 项目:gopro-organizer 作者: angusmacdonald 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def OnChkCopyFile(self, event):
        if not event.IsChecked():
            dial = wx.MessageDialog(None, 
                'Are you sure? Disabling copy means that files are removed from their source location.', 'Disable copy?', 
                wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
            retCode = dial.ShowModal()

            if (retCode != wx.ID_YES):
                self.chkCopyFiles.SetValue(True)

            dial.Destroy()
gui.py 文件源码 项目:stopgo 作者: notklaatu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def WorkSpace(self,e ):
        '''
        Load in a project.
        '''

        logging.exception(self.clargs)
        dbfile = self.clargs['project']

        if not os.path.isfile(dbfile):
            dlg = wx.MessageDialog(self, 'Project not found. Browse for the file?', 
                '',wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)

            val = dlg.ShowModal()

            if val == wx.ID_YES:
                self.OpenFile(e,False)

            elif val == wx.ID_CANCEL:
                dlg.Destroy()
        else:
            self.OpenFile(False,dbfile)
            self.bplay.SetBitmapLabel(self.bplayicon)
            self.panel2.Refresh()

        #update timeline view
        self.Layout()
        self.panel3.SetFocus()
pySIMlastnum.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
pySIMphonebook.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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()
subpanel.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def OnExit(self,event):
        del self.GetParent().roidialog
        self.EndModal(wx.ID_YES)
        self.Destroy()
subpanel.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnExit(self,event):
        self.file.close()
        del self.GetParent().keydialog
        self.EndModal(wx.ID_YES)
        self.Destroy()
subpanel.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def OnCancel(self, event):
        self.EndModal(wx.ID_YES)
        self.Destroy()
supplicantdev.py 文件源码 项目:Supplicant 作者: mayuko2012 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def OnDisconnect(self, event):
        msgbox = wx.MessageDialog(None, "",u'???????',wx.YES_NO | wx.ICON_QUESTION)
        ret = msgbox.ShowModal()
        if (ret == wx.ID_YES):
            self.StopThreads()
            wx.MessageBox( u"??????",u'\n??????????')
            sys.exit()
supplicantdev.py 文件源码 项目:Supplicant 作者: mayuko2012 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def OnCloseWindow(self, event):
        msgbox = wx.MessageDialog(None, u"??????????????????",u'????????',wx.YES_NO | wx.ICON_QUESTION)
        ret = msgbox.ShowModal()
        if (ret == wx.ID_YES):
            self.StopThreads()
            time.sleep(0.5)
            sys.exit()


问题


面经


文章

微信
公众号

扫码关注公众号