Example #1
0
 def _changed_dbfile(self, val, oldval):
     stats.dbclose(restart=True)
     if not stats.dbcheck():
         QtGui.QMessageBox.warning(self, 'DB Version Mismatch', 'Database version mismatch.\nUpgrade database with -D switch.\n\nReverted to previous value.')
         conf.dbfile = oldval
         self.settings.setValue('files/dbfile', oldval)
         stats.dbclose(restart=True)
         stats.dbcheck()
     stats.dbopen()
Example #2
0
 def _changed_dbfile(self, val, oldval):
     stats.dbclose(restart=True)
     if not stats.dbcheck():
         QtGui.QMessageBox.warning(
             self, 'DB Version Mismatch',
             'Database version mismatch.\nUpgrade database with -D switch.\n\nReverted to previous value.'
         )
         conf.dbfile = oldval
         self.settings.setValue('files/dbfile', oldval)
         stats.dbclose(restart=True)
         stats.dbcheck()
     stats.dbopen()
Example #3
0
    def _changed_base_dir(self, val, oldval):
        if not os.path.exists(val):
            os.mkdir(val)

        stats.dbclose(restart=True)
        if not stats.dbcheck():
            QtGui.QMessageBox.warning(self, 'DB Version Mismatch', 'Database version mismatch.')
        stats.dbopen()

        import shutil
        #print 'ONV', oldval, conf.template, val
        scriptdir = os.path.dirname(os.path.abspath(__file__))
        robotsdir = os.path.join(scriptdir, 'robots')
        template = os.path.join(robotsdir, conf.template)
        shutil.copy(template, val)
        examples = os.path.join(robotsdir, 'examples')
        shutil.copytree(examples, os.path.join(val, 'examples'))
Example #4
0
    def _changed_base_dir(self, val, oldval):
        if not os.path.exists(val):
            os.mkdir(val)

        stats.dbclose(restart=True)
        if not stats.dbcheck():
            QtGui.QMessageBox.warning(self, 'DB Version Mismatch',
                                      'Database version mismatch.')
        stats.dbopen()

        import shutil
        #print 'ONV', oldval, conf.template, val
        scriptdir = os.path.dirname(os.path.abspath(__file__))
        robotsdir = os.path.join(scriptdir, 'robots')
        template = os.path.join(robotsdir, conf.template)
        shutil.copy(template, val)
        examples = os.path.join(robotsdir, 'examples')
        shutil.copytree(examples, os.path.join(val, 'examples'))
Example #5
0
def dbcheck():
    if not stats.dbcheck():
        print 'Run pytbotwar with -D switch to upgrade database.'
        print 'WARNING: This will delete your current database!'
        import sys
        sys.exit(0)
Example #6
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pybotwar.  If not, see <http://www.gnu.org/licenses/>.

import time

try:
    import conf
except ImportError:
    import util
    util.makeconf()

    import stats
    stats.dbcheck()

    raise SystemExit

import viewselect

if __name__ == '__main__':
    import sys
    import os

    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("-T",
                      "--testmode",
                      dest="testmode",
                      action="store_true",
Example #7
0
def dbcheck():
    if not stats.dbcheck():
        print 'Run TankAI with -D switch.'
        print 'WARNING: This will delete your current database!'
        import sys
        sys.exit(0)
Example #8
0
#!/usr/bin/env python
import time

try:
    import conf
except ImportError:
    import utilities
    utilities.makeconf()

    import stats
    stats.dbcheck()

    raise SystemExit

import selectvisual

if __name__ == '__main__':
    import sys
    import os

    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("-T", "--testmode", dest="testmode",
                    action="store_true", default=False,
                    help="run in test mode")
    parser.add_option("-t", "--tournament", dest="tournament",
                    action="store_true", default=False,
                    help="run a tournament")
    parser.add_option("-n", "--battles", dest="nbattles",
                    action="store", type='int', default=5,
                    help="number of battles in tournament")
Example #9
0
def dbcheck():
	if not stats.dbcheck():
		print 'Run pytbotwar with -D switch to upgrade database.'
		print 'WARNING: This will delete your current database!'
		import sys
		sys.exit(0)