Esempio n. 1
0
          ' is needed to run the atlas generator.')
    sys.exit(1)

# TODO We can probably remove the type ignore in the next release of typeshed/mypy
#      See https://github.com/python/typeshed/commit/08ac3b7742f1fd55f801ac66d7517cf60aa471d6
# make sure os.path.getmtime returns ints
os.stat_float_times(False)  # type: ignore

# make this script work both when started inside development and in the uh root dir
if not os.path.exists('content'):
    os.chdir('..')
assert os.path.exists('content'), 'Content dir not found.'

sys.path.append('.')
from run_uh import init_environment  # isort:skip
init_environment(False)


class DummyFife:
    use_atlases = False


import horizons.globals  # isort:skip
horizons.globals.fife = DummyFife()  # type: ignore

from horizons.constants import PATHS  # isort:skip
from horizons.util.dbreader import DbReader  # isort:skip
from horizons.util.loaders.actionsetloader import ActionSetLoader  # isort:skip
from horizons.util.loaders.tilesetloader import TileSetLoader  # isort:skip

Esempio n. 2
0
	      ' is needed to run the atlas generator.')
	sys.exit(1)

# TODO We can probably remove the type ignore in the next release of typeshed/mypy
#      See https://github.com/python/typeshed/commit/08ac3b7742f1fd55f801ac66d7517cf60aa471d6
# make sure os.path.getmtime returns ints
os.stat_float_times(False) # type: ignore

# make this script work both when started inside development and in the uh root dir
if not os.path.exists('content'):
	os.chdir('..')
assert os.path.exists('content'), 'Content dir not found.'

sys.path.append('.')
from run_uh import init_environment # isort:skip
init_environment(False)

class DummyFife:
	use_atlases = False
import horizons.globals # isort:skip
horizons.globals.fife = DummyFife() # type: ignore

from horizons.constants import PATHS # isort:skip
from horizons.util.dbreader import DbReader # isort:skip
from horizons.util.loaders.actionsetloader import ActionSetLoader # isort:skip
from horizons.util.loaders.tilesetloader import TileSetLoader # isort:skip


class AtlasEntry(object):
	def __init__(self, x, y, width, height, last_modified):
		self.x = x
sys.path.append(".")
sys.path.append("./horizons")
sys.path.append("./horizons/util")

import gettext
gettext.install('', unicode=True)

try:
	import run_uh
except ImportError as e:
	print e.message
	print 'Please run from uh root dir'
	sys.exit(1)

from run_uh import init_environment
init_environment()

import horizons.main
from horizons.util.loaders.actionsetloader import ActionSetLoader
from horizons.constants import UNITS

global db, loader, query
db = horizons.main._create_main_db()
loader = ActionSetLoader()
query = 'SELECT action_set_id FROM action_set WHERE object_id = ?'

get_buildings = True
#get_buildings = False
get_units = True
#get_units = False
from collections import defaultdict

sys.path.append(".")
sys.path.append("./horizons")
sys.path.append("./horizons/util")

try:
	import run_uh
except ImportError as e:
	print(e.message)
	print('Please run from uh root dir')
	sys.exit(1)


from run_uh import init_environment
init_environment(True)

import horizons.main
from horizons.constants import UNITS, BUILDINGS, TIER
from horizons.scenario.actions import ACTIONS
from horizons.scenario.conditions import CONDITIONS

db = horizons.main._create_main_db()

# we also need to load entities to get access to the yaml data
from horizons.extscheduler import ExtScheduler
from horizons.component.storagecomponent import StorageComponent
from horizons.entities import Entities
from tests.dummy import Dummy
ExtScheduler.create_instance(Dummy()) # sometimes needed by entities in subsequent calls
Entities.load_buildings(db, load_now=True)
Esempio n. 5
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# 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 this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# ###################################################

import os
import sys

if __name__ == '__main__':
    #chdir to unknownhorizons root
    os.chdir(os.path.split(os.path.realpath(sys.argv[0]))[0])

    import gettext
    gettext.install('', unicode=True)  # necessary for init_environment
    from run_uh import init_environment, get_fife_path
    init_environment()

    os.chdir(get_fife_path() + '/tools/editor')
    #start editor
    args = [sys.executable, './run.py']
    os.execvp(args[0], args)
Esempio n. 6
0
from collections import defaultdict

sys.path.append(".")
sys.path.append("./horizons")
sys.path.append("./horizons/util")

try:
	import run_uh
except ImportError as e:
	print(e.message)
	print('Please run from uh root dir')
	sys.exit(1)


from run_uh import init_environment
init_environment(True)

import horizons.main
from horizons.constants import UNITS, BUILDINGS, TIER
from horizons.scenario.actions import ACTIONS
from horizons.scenario.conditions import CONDITIONS

db = horizons.main._create_main_db()

# we also need to load entities to get access to the yaml data
from horizons.extscheduler import ExtScheduler
from horizons.component.storagecomponent import StorageComponent
from horizons.entities import Entities
from tests.dummy import Dummy
ExtScheduler.create_instance(Dummy()) # sometimes needed by entities in subsequent calls
Entities.load_buildings(db, load_now=True)