Python wx.YES_NO Examples

The following are 30 code examples of wx.YES_NO(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: gui.py    From IkaLog with Apache License 2.0 8 votes vote down vote up
def on_options_load_default(self, event):
        '''Resets the changes to the default, but not save them.'''
        r = wx.MessageDialog(
            None,
            _('IkaLog preferences will be reset to default. Continue?') + '\n' +
            _('The change will be updated when the apply button is pressed.'),
            _('Confirm'),
            wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION
        ).ShowModal()

        if r != wx.ID_YES:
            return

        self.engine.call_plugins('on_config_reset', debug=True)

    # 現在の設定値をYAMLファイルからインポート
    # 
Example #2
Source File: multiple_individuals_refinement_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def quitButton(self, event):
        """
        Quits the GUI
        """
        self.statusbar.SetStatusText("")
        dlg = wx.MessageDialog(
            None, "Are you sure?", "Quit!", wx.YES_NO | wx.ICON_WARNING
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print(
                "Closing... The refined labels are stored in a subdirectory under labeled-data. Use the function 'merge_datasets' to augment the training dataset, and then re-train a network using create_training_dataset followed by train_network!"
            )
            self.Destroy()
        else:
            self.save.Enable(True) 
Example #3
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def OnCloseProjectMenu(self, event):
        if self.NodeList:
            if self.NodeList.HasChanged():
                dialog = wx.MessageDialog(self, _("There are changes, do you want to save?"), _("Close Project"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
                answer = dialog.ShowModal()
                dialog.Destroy()
                if answer == wx.ID_YES:
                    result = self.NodeList.SaveProject()
                    if result:
                        message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                        message.ShowModal()
                        message.Destroy()
                elif answer == wx.ID_NO:
                    self.NodeList.ForceChanged(False)
            if not self.NodeList.HasChanged():
                self.Manager = None
                self.NodeList = None
                self.RefreshNetworkNodes()
                self.RefreshTitle()
                self.RefreshMainMenu()
        
        
#-------------------------------------------------------------------------------
#                             Refresh Functions
#------------------------------------------------------------------------------- 
Example #4
Source File: RTyyyy_main.py    From NXP-MCUBootUtility with Apache License 2.0 6 votes vote down vote up
def _wantToReuseAvailableCert( self, directReuseCert ):
        certAnswer = wx.NO
        if self.isCertificateGenerated(self.secureBootType):
            if not directReuseCert:
                msgText = ((uilang.kMsgLanguageContentDict['certGenInfo_reuseOldCert'][self.languageIndex]))
                certAnswer = wx.MessageBox(msgText, "Certificate Question", wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
                if certAnswer == wx.CANCEL:
                    return None
                elif certAnswer == wx.NO:
                    msgText = ((uilang.kMsgLanguageContentDict['certGenInfo_haveNewCert'][self.languageIndex]))
                    certAnswer = wx.MessageBox(msgText, "Certificate Question", wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
                    if certAnswer == wx.CANCEL:
                        return None
                    elif certAnswer == wx.YES:
                        certAnswer = wx.NO
                    else:
                        certAnswer = wx.YES
            else:
                certAnswer = wx.YES
        return (certAnswer == wx.YES) 
Example #5
Source File: commondialogs.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def OnImportEDSButton(self, event):
        dialog = wx.FileDialog(self,
                               _("Choose an EDS file"),
                               os.path.expanduser("~"),
                               "",
                               _("EDS files (*.eds)|*.eds|All files|*.*"),
                               wx.OPEN)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
        else:
            filepath = ""
        dialog.Destroy()
        if os.path.isfile(filepath):
            result, question = self.NodeList.ImportEDSFile(filepath)
            if result is not None and question:
                dialog = wx.MessageDialog(self, _("%s\nWould you like to replace it ?")%result, _("Question"), wx.YES_NO|wx.ICON_QUESTION)
                if dialog.ShowModal() == wx.ID_YES:
                    result, question = self.NodeList.ImportEDSFile(filepath, True)
                dialog.Destroy()
            if result is not None and not question:
                dialog = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                dialog.ShowModal()
                dialog.Destroy()
        self.RefreshEDSFile()
        event.Skip() 
Example #6
Source File: filmow_to_letterboxd.py    From filmow_to_letterboxd with MIT License 6 votes vote down vote up
def OnClose(self, event):
    if self.is_running:
      confirm_exit = wx.MessageDialog(
        self,
        'Tem certeza que quer parar o programa?',
        'Sair',
        wx.YES_NO | wx.ICON_QUESTION
      )

      if confirm_exit.ShowModal() == wx.ID_YES:
        self.Destroy()
        wx.Window.Destroy(self)
      else:
        confirm_exit.Destroy()
    else:
      event.Skip() 
Example #7
Source File: gui.py    From superpaper with MIT License 6 votes vote down vote up
def onDeleteProfile(self, event):
        """Deletes the currently selected profile after getting confirmation."""
        profname = self.tc_name.GetLineText(0)
        fname = os.path.join(PROFILES_PATH, profname + ".profile")
        file_exists = os.path.isfile(fname)
        if not file_exists:
            msg = "Selected profile is not saved."
            show_message_dialog(msg, "Error")
            return
        # Open confirmation dialog
        dlg = wx.MessageDialog(None,
                               "Do you want to delete profile: {}?".format(profname),
                               'Confirm Delete',
                               wx.YES_NO | wx.ICON_QUESTION)
        result = dlg.ShowModal()
        if result == wx.ID_YES and file_exists:
            os.remove(fname)
            self.update_choiceprofile()
            self.onCreateNewProfile(None)
        else:
            pass 
Example #8
Source File: flow.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def handle():
        if cv.UNDONE_JOB:
            if 'url' not in cv.UNDONE_JOB or 'quality' not in cv.UNDONE_JOB or 'features' not in cv.UNDONE_JOB:
                ConfigSettings.fail()
                FrameParser.handle()
            else:
                msg = '[Url]: %s\n[Title]: %s\n[Quality]: %s\n上一次任务尚未完成,是否继续任务?' \
                      % (cv.UNDONE_JOB['url'], cv.UNDONE_JOB.get('title'), cv.UNDONE_JOB['quality'])
                dlg = wx.MessageDialog(None, msg, '提示', wx.YES_NO | wx.ICON_INFORMATION)
                if dlg.ShowModal() == wx.ID_YES:
                    UndoneJob.do()
                else:
                    UndoneJob.skip()
                dlg.Destroy()
        else:
            FrameParser.handle() 
Example #9
Source File: xrced.py    From admin4 with Apache License 2.0 6 votes vote down vote up
def AskSave(self):
        if not (self.modified or panel.IsModified()): return True
        flags = wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL | wx.CENTRE
        dlg = wx.MessageDialog( self, 'File is modified. Save before exit?',
                               'Save before too late?', flags )
        say = dlg.ShowModal()
        dlg.Destroy()
        wx.Yield()
        if say == wx.ID_YES:
            self.OnSaveOrSaveAs(wx.CommandEvent(wx.ID_SAVE))
            # If save was successful, modified flag is unset
            if not self.modified: return True
        elif say == wx.ID_NO:
            self.SetModified(False)
            panel.SetModified(False)
            return True
        return False 
Example #10
Source File: flow.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def checkNode():
        dlm = nbdler.Manager()
        if not os.path.exists('node.exe') or os.path.exists('node.exe.nbdler'):
            dlg = wx.MessageDialog(None, u'该程序需要Nodejs.exe才能完成工作,是否要下载?', u'提示', wx.YES_NO | wx.ICON_INFORMATION)
            if dlg.ShowModal() != wx.ID_YES:
                return False
            dl = nbdler.open(urls=[TOOL_REQ_URL['node']],
                             max_conn=16, filename='node.exe')
            dlm.addHandler(dl)
            dlg = gui.DialogGetTool(gui.frame_downloader, u'正在下载 Nodejs v10.15.3', dl.getFileSize(), dlm)

            dlg.Bind(wx.EVT_TIMER, GetTool._process, dlg.timer)
            dlg.timer.Start(50, oneShot=False)
            dlm.run()
            msg = dlg.ShowModal()
            dlm.shutdown()
            dlg.Destroy()
            if msg == wx.ID_OK:
                return True
            else:
                return False
        else:
            return True 
Example #11
Source File: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def OnCloseMenu(self, event):
        answer = wx.ID_YES
        result = self.Manager.CloseCurrent()
        if not result:
            dialog = wx.MessageDialog(self, _("There are changes, do you want to save?"),  _("Close File"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
            answer = dialog.ShowModal()
            dialog.Destroy()
            if answer == wx.ID_YES:
                self.OnSaveMenu(event)
                if self.Manager.CurrentIsSaved():
                    self.Manager.CloseCurrent()
            elif answer == wx.ID_NO:
                self.Manager.CloseCurrent(True)
        if self.FileOpened.GetPageCount() > self.Manager.GetBufferNumber():
            current = self.FileOpened.GetSelection()
            self.FileOpened.DeletePage(current)
            if self.FileOpened.GetPageCount() > 0:
                self.FileOpened.SetSelection(min(current, self.FileOpened.GetPageCount() - 1))
            self.RefreshBufferState()
            self.RefreshMainMenu()
        

#-------------------------------------------------------------------------------
#                         Import and Export Functions
#------------------------------------------------------------------------------- 
Example #12
Source File: refinement.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % closest_dp.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data() 
Example #13
Source File: refinement.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def quitButton(self, event):
        """
        Quits the GUI
        """
        self.statusbar.SetStatusText("")
        dlg = wx.MessageDialog(
            None, "Are you sure?", "Quit!", wx.YES_NO | wx.ICON_WARNING
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print(
                "Closing... The refined labels are stored in a subdirectory under labeled-data. Use the function 'merge_datasets' to augment the training dataset, and then re-train a network using create_training_dataset followed by train_network!"
            )
            self.Destroy()
        else:
            self.save.Enable(True) 
Example #14
Source File: TreeItem.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def AskDelete(self):
        allItems = self.GetAllItems()
        if eg.config.confirmDelete:
            count = len(allItems) - 1
            if count > 0:
                mesg = eg.text.General.deleteManyQuestion % str(count)
            else:
                mesg = eg.text.General.deleteQuestion
            answer = eg.MessageBox(
                mesg,
                eg.APP_NAME,
                wx.NO_DEFAULT | wx.YES_NO | wx.ICON_EXCLAMATION
            )
            if answer == wx.ID_NO:
                return False
        dependants = self.GetDependantsOutside(allItems)
        if len(dependants) > 0:
            answer = eg.MessageBox(
                eg.text.General.deleteLinkedItems,
                eg.APP_NAME,
                wx.NO_DEFAULT | wx.YES_NO | wx.ICON_EXCLAMATION
            )
            return answer == wx.ID_YES
        return True 
Example #15
Source File: mainframe.py    From youtube-dl-gui with The Unlicense 6 votes vote down vote up
def _on_close(self, event):
        """Event handler for the wx.EVT_CLOSE event.

        This method is used when the user tries to close the program
        to save the options and make sure that the download & update
        processes are not running.

        """
        if self.opt_manager.options["confirm_exit"]:
            dlg = wx.MessageDialog(self, _("Are you sure you want to exit?"), _("Exit"), wx.YES_NO | wx.ICON_QUESTION)

            result = dlg.ShowModal() == wx.ID_YES
            dlg.Destroy()
        else:
            result = True

        if result:
            self.close() 
Example #16
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnDeleteButton(self, event):
        filepath = self.GetSelectedFilePath()
        if os.path.isfile(filepath):
            _folder, filename = os.path.split(filepath)

            dialog = wx.MessageDialog(self.ParentWindow,
                                      _("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.ModuleLibrary.LoadModules()
                wx.CallAfter(self.RefreshView)
        event.Skip() 
Example #17
Source File: FileManagementPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #18
Source File: ProjectController.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def CheckProjectPathPerm(self, dosave=True):
        if CheckPathPerm(self.ProjectPath):
            return True
        if self.AppFrame is not None:
            dialog = wx.MessageDialog(
                self.AppFrame,
                _('You must have permission to work on the project\nWork on a project copy ?'),
                _('Error'),
                wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
            answer = dialog.ShowModal()
            dialog.Destroy()
            if answer == wx.ID_YES:
                if self.SaveProjectAs():
                    self.AppFrame.RefreshTitle()
                    self.AppFrame.RefreshFileMenu()
                    self.AppFrame.RefreshPageTitles()
                    return True
        return False 
Example #19
Source File: trelby.py    From trelby with GNU General Public License v2.0 6 votes vote down vote up
def getExportable(self, action):
        if cfgGl.checkOnExport:
            line = self.sp.findError(0)[0]

            if line != -1:
                if wx.MessageBox(
                    "The script seems to contain errors.\n"
                    "Are you sure you want to %s it?" % action, "Confirm",
                     wx.YES_NO | wx.NO_DEFAULT, mainFrame) == wx.NO:

                    return None

        sp = self.sp
        if sp.cfg.pdfRemoveNotes:
            sp = copy.deepcopy(self.sp)
            sp.removeElementTypes({screenplay.NOTE : None}, False)

        sp.paginate()

        return sp 
Example #20
Source File: adm.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def ConfirmDelete(msg, hdr, force=False):
  if confirmDeletes or force:
    rc=wx.MessageBox(msg, hdr, wx.YES_NO|wx.ICON_EXCLAMATION|wx.YES_DEFAULT)
    return rc == wx.YES
  else:
    return True 
Example #21
Source File: main.py    From wxGlade with MIT License 5 votes vote down vote up
def check_autosaved(self):
        if not common.check_autosaved(None): return
        res = wx.MessageBox(
            _('There seems to be auto saved data from last wxGlade session: do you want to restore it?'),
            _('Auto save detected'), style=wx.ICON_QUESTION | wx.YES_NO)
        if res == wx.YES:
            filename = common.get_name_for_autosave()
            if self._open_app(filename, add_to_history=False):
                self.cur_dir = os.path.dirname(filename)
                common.root.saved = False
                common.root.filename = None
                self.user_message(_('Auto save loaded'))
        common.remove_autosaved() 
Example #22
Source File: WinUsb.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def ShowDownloadMessage(self):
        return wx.YES == wx.MessageBox(
            Text.downloadMsg % self.plugin.name,
            caption=Text.dialogCaption % self.plugin.name,
            style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP,
            parent=eg.document.frame
        ) 
Example #23
Source File: WinUsb.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def ShowRestartMessage(self):
        res = wx.MessageBox(
            Text.restartMsg,
            caption=eg.APP_NAME,
            style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP,
            parent=eg.document.frame
        )
        if res == wx.YES:
            eg.app.Restart() 
Example #24
Source File: Mailbox.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def Delete(self):
    if not 'x' in self.myrights and not 'c' in self.myrights:
      dlg=wx.MessageDialog(adm.GetCurrentFrame(), xlt("Add missing right and delete?"), xlt("Missing rights on mailbox %s") % self.name, wx.YES_NO|wx.NO_DEFAULT)
      if dlg.ShowModal() != wx.ID_YES:
        return False
      rc=self.GetConnection().SetAcl(self.mailboxPath, self.GetServer().user, self.myrights + 'xcd')
      if not rc:
        return False
       
    rc=self.GetConnection().DeleteMailbox(self.mailboxPath)
    return rc != None 
Example #25
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def timeout():
        dlg = wx.MessageDialog(gui.frame_parse, u'请求超时,是否重试?', u'错误', wx.YES_NO | wx.ICON_ERROR)
        if dlg.ShowModal() == wx.ID_YES:
            UndoneJob.do()
        else:
            UndoneJob.skip()
        dlg.Destroy() 
Example #26
Source File: gui.py    From atbswp with GNU General Public License v3.0 5 votes vote down vote up
def on_close_dialog(self, event):
        """Confirm exit."""
        dialog = wx.MessageDialog(self,
                                  message="Are you sure you want to quit?",
                                  caption="Confirm Exit",
                                  style=wx.YES_NO,
                                  pos=wx.DefaultPosition)
        response = dialog.ShowModal()

        if (response == wx.ID_YES):
            self.on_exit_app(event)
        else:
            event.StopPropagation() 
Example #27
Source File: DownloadManager.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def prompt_for_quit_for_new_version(self, version):
        d = wx.MessageBox(
            message=_(("%s is ready to install a new version (%s).  Do you "
                       "want to quit now so that the new version can be "
                       "installed?  If not, the new version will be installed "
                       "the next time you quit %s."
                       ) % (app_name, version, app_name)),
            caption=_("Install update now?"),
            style=wx.YES_NO|wx.YES_DEFAULT,
            parent=self.main_window
            )
        if d == wx.YES:
            self.quit(confirm_quit=False) 
Example #28
Source File: refine_labels.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def merge_dataset(self, event):
        dlg = wx.MessageDialog(
            None,
            "1. Make sure that you have refined all the labels before merging the dataset.\n\n2. If you merge the dataset, you need to re-create the training dataset before you start the training.\n\n3. Are you ready to merge the dataset?",
            "Warning",
            wx.YES_NO | wx.ICON_WARNING,
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            notebook = self.GetParent()
            notebook.SetSelection(4)
            deeplabcut.merge_datasets(self.config, forceiterate=None) 
Example #29
Source File: auxfun_drag_label.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def on_press(self, event):
        """
        Define the event for the button press!
        """
        if event.inaxes != self.point.axes:
            return
        if DraggablePoint.lock is not None:
            return
        contains, attrd = self.point.contains(event)
        if not contains:
            return
        if event.button == 1:
            """
            This button press corresponds to the left click
            """
            self.press = (self.point.center), event.xdata, event.ydata
            DraggablePoint.lock = self
            canvas = self.point.figure.canvas
            axes = self.point.axes
            self.point.set_animated(True)
            canvas.draw()
            self.background = canvas.copy_from_bbox(self.point.axes.bbox)
            axes.draw_artist(self.point)
            canvas.blit(axes.bbox)
        elif event.button == 2:
            """
            To remove a predicted label. Internally, the coordinates of the selected predicted label is replaced with nan. The user needs to right click for the event.After right
            click the data point is removed from the plot.
            """
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % self.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                self.delete_data() 
Example #30
Source File: frame_extraction_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def quitButton(self, event):
        """
        Quits the GUI
        """
        self.statusbar.SetStatusText("")
        dlg = wx.MessageDialog(
            None, "Are you sure?", "Quit!", wx.YES_NO | wx.ICON_WARNING
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print("Quitting for now!")
            self.Destroy()