Python wx.NO_DEFAULT Examples

The following are 16 code examples of wx.NO_DEFAULT(). 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: 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 #3
Source File: __init__.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def verify_connect(self, con_info):
		if self.is_connected() or self.connecting:
			gui.messageBox(_("NVDA Remote is already connected. Disconnect before opening a new connection."), _("NVDA Remote Already Connected"), wx.OK|wx.ICON_WARNING)
			return
		self.connecting = True
		server_addr = con_info.get_address()
		key = con_info.key
		if con_info.mode == 'master':
			message = _("Do you wish to control the machine on server {server} with key {key}?").format(server=server_addr, key=key)
		elif con_info.mode == 'slave':
			message = _("Do you wish to allow this machine to be controlled on server {server} with key {key}?").format(server=server_addr, key=key)
		if gui.messageBox(message, _("NVDA Remote Connection Request"), wx.YES|wx.NO|wx.NO_DEFAULT|wx.ICON_WARNING) != wx.YES:
			self.connecting = False
			return
		if con_info.mode == 'master':
			self.connect_as_master((con_info.hostname, con_info.port), key=key)
		elif con_info.mode == 'slave':
			self.connect_as_slave((con_info.hostname, con_info.port), key=key)
		self.connecting = False 
Example #4
Source File: PluginItem.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def AskDelete(self):
        actionItemCls = self.document.ActionItem

        def SearchFunc(obj):
            if obj.__class__ == actionItemCls:
                if obj.executable and obj.executable.plugin == self.executable:
                    return True
            return None

        if self.root.Traverse(SearchFunc) is not None:
            eg.MessageBox(
                eg.text.General.deletePlugin,
                eg.APP_NAME,
                wx.NO_DEFAULT | wx.OK | wx.ICON_EXCLAMATION
            )
            return False
        if not TreeItem.AskDelete(self):
            return False
        return True 
Example #5
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 #6
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 #7
Source File: trelby.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def canBeClosed(self):
        if self.sp.isModified():
            if wx.MessageBox("The script has been modified. Are you sure\n"
                             "you want to discard the changes?", "Confirm",
                             wx.YES_NO | wx.NO_DEFAULT, mainFrame) == wx.NO:
                return False

        return True

    # page up (dir == -1) or page down (dir == 1) was pressed, handle it.
    # cs = CommandState. 
Example #8
Source File: trelby.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def OnCloseWindow(self, event):
        doExit = True
        if event.CanVeto() and self.isModifications():
            if wx.MessageBox("You have unsaved changes. Are\n"
                             "you sure you want to exit?", "Confirm",
                             wx.YES_NO | wx.NO_DEFAULT, self) == wx.NO:
                doExit = False

        if doExit:
            util.writeToFile(gd.stateFilename, gd.save(), self)
            util.removeTempFiles(misc.tmpPrefix)
            self.Destroy()
            myApp.ExitMainLoop()
        else:
            event.Veto() 
Example #9
Source File: add_i2c.py    From openplotter with GNU General Public License v2.0 5 votes vote down vote up
def onReset(self, e):
		dlg = wx.MessageDialog(None, _('If your sensors are not detected right, try resetting system or forcing name and address.\n\nDo you want to try auto detection again?'),_('Question'), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
		if dlg.ShowModal() == wx.ID_YES:
			try:
				os.remove(self.home + '/.pypilot/RTIMULib2.ini')
			except: pass
			self.detection()
		dlg.Destroy() 
Example #10
Source File: yamled.py    From report-ng with GNU General Public License v2.0 5 votes vote down vote up
def _File_Close(self):
        #if self.filename != None and self.file_changed:
        if self.file_changed:
            dlg = wx.MessageDialog(self, 'You have unsaved changes. Do you want to close the file anyway?', 'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
            if not dlg.ShowModal() == wx.ID_YES:
                return False
        while self.n:
            self.DeleteNode(self.n[0])
        self.menu_file_save_as.Enable(False)
        self.menu_file_close.Enable(False)
        self.filename = None
        self.file_changed = None
        self._title_update()
        return True 
Example #11
Source File: yamled.py    From report-ng with GNU General Public License v2.0 5 votes vote down vote up
def __OnClose(self, event):
        #if self.filename != None and self.file_changed:
        if self.file_changed:
            dlg = wx.MessageDialog(self, 'You have unsaved changes. Do you really want to quit?', 'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
            if dlg.ShowModal() == wx.ID_YES:
                self.Destroy()
            else:
                event.Veto()
        else:
            self.Destroy() 
Example #12
Source File: GoSyncController.py    From gosync with GNU General Public License v2.0 5 votes vote down vote up
def OnExit(self, event):
        dial = wx.MessageDialog(None, 'GoSync will stop syncing files until restarted.\nAre you sure to quit?\n',
                                'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
        res = dial.ShowModal()
        if res == wx.ID_YES:
            if self.sync_model.IsSyncEnabled() or self.sync_model.IsSyncRunning():
                self.sync_model.StopTheShow()
                self.sb.SetStatusText("Paused", 1)

            wx.CallAfter(self.Destroy) 
Example #13
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 5 votes vote down vote up
def on_page_closing(self, event):
        """Handle a tab closing event.

        If they are closing a special panel, we have to shut it down.
        If the tab has a miner running in it, we have to stop the miner
        before letting the tab be removed.
        """
        p = self.nb.GetPage(event.GetSelection())

        if p == self.console_panel:
            self.console_panel.on_close()
            self.console_panel = None
            event.Skip()
            return
        if p == self.summary_panel:
            self.summary_panel.on_close()
            self.summary_panel = None
            event.Skip()
            return

        if p.is_mining:
            result = self.message(
                _("Closing this miner will stop it. Continue?"),
                _("Close miner"),
                wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
            if result == wx.ID_NO:
                event.Veto()
                return
        p.on_close()
        event.Skip() # OK to close the tab now 
Example #14
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 5 votes vote down vote up
def create_solo_password(self, event):
        """Prompt the user for login credentials to the bitcoin client.

        These are required to connect to the client over JSON-RPC and are
        stored in 'bitcoin.conf'.
        """
        if sys.platform == 'win32':
            filename = os.path.join(os.getenv("APPDATA"), "Bitcoin", "bitcoin.conf")
        else: # Assume Linux for now TODO test
            filename = os.path.join(os.getenv('HOME'), ".bitcoin")
        if os.path.exists(filename):
            result = self.message(
                _("%s already exists. Overwrite?") % filename,
                _("bitcoin.conf already exists."),
                wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
            if result == wx.ID_NO:
                return

        dialog = SoloPasswordRequest(self, _('Enter password'))
        result = dialog.ShowModal()
        dialog.Destroy()
        if result == wx.ID_CANCEL:
            return

        with open(filename, "w") as f:
            f.write('\nrpcuser=%s\nrpcpassword=%s\nrpcallowip=*' % dialog.get_value())
            f.close()

        self.message(_("Wrote bitcoin config ok."), _("Success"), wx.OK) 
Example #15
Source File: IDBrowser.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnDeleteButton(self, evt):
        items = self.dvc.GetSelections()
        rows = [self.model.GetRow(item) for item in items]

        # Ask if user really wants to delete
        if wx.MessageBox(_('Are you sure to delete selected IDs?'),
                         _('Delete IDs'),
                         wx.YES_NO | wx.CENTRE | wx.NO_DEFAULT) != wx.YES:
            return

        self.model.DeleteRows(rows) 
Example #16
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 4 votes vote down vote up
def load_config(self, event=None):
        """Load JSON profile info from the config file."""
        self.parse_config()

        config_data = self.config_data
        executable = config_data.get('bitcoin_executable', None)
        if executable is not None:
            self.bitcoin_executable = executable
            
        blockchain_directory = config_data.get('blockchain_directory', None)
        if blockchain_directory is not None:
            self.blockchain_directory = blockchain_directory

        # Shut down any existing miners before they get clobbered
        if(any(p.is_mining for p in self.profile_panels)):
            result = self.message(
                _("Loading profiles will stop any currently running miners. Continue?"),
                _("Load profile"), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
            if result == wx.ID_NO:
                return
        for p in reversed(self.profile_panels):
            p.on_close()
            self.nb.DeletePage(self.nb.GetPageIndex(p))

        # If present, summary should be the leftmost tab on startup.
        if config_data.get('show_summary', False):
            self.show_summary()

        profile_data = config_data.get('profiles', [])
        for d in profile_data:
            self.add_profile(d)

        if not any(profile_data):
            self.add_profile() # Create a default one using defaults.ini

        if config_data.get('show_console', False):
            self.show_console()
            
        window_position = config_data.get('window_position')
        if window_position:
            self.SetRect(window_position)

        for p in self.profile_panels:
            if p.autostart:
                p.start_mining()