示例#1
0
def save_options(file_name):
    """
        Saves the options into a YAML file after performing some conversions from types like QtCore.QRect to list, ...
    """
    data = options.copy()

    # main window bounding rectangle, convert from QRect to list
    rect = data[constants.Opt.MAINWINDOW_BOUNDS.name]
    data[constants.Opt.MAINWINDOW_BOUNDS.name] = [rect.x(), rect.y(), rect.width(), rect.height()]

    # write to file
    write_as_yaml(file_name, data)
示例#2
0
def save_options(file_name):
    """
        Saves the options into a YAML file after performing some conversions from types like QtCore.QRect to list, ...
    """
    data = options.copy()

    # main window bounding rectangle, convert from QRect to list
    rect = data[c.O.MW_BOUNDS.name]
    data[c.O.MW_BOUNDS.name] = [
        rect.x(), rect.y(), rect.width(),
        rect.height()
    ]

    # write to file
    write_as_yaml(file_name, data)
示例#3
0
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>

import os
os.chdir('..')

from lib import utils as u
from base import constants as c

"""
    Generates the playlist of the soundtrack (file names and titles displayed
    in the game). Phonon cannot read metadata under Windows sometimes, see:
    http://stackoverflow.com/questions/23288557/phonon-cant-get-meta-data-of-audio-files-in-python
"""

# create the playlist, a list of (filename, title)
playlist = [['01 Imperialism Theme.ogg', 'Imperialism Theme']]
playlist.append(['02 Silent Ashes.ogg', 'Silent Ashes'])

# write
print('write to {}'.format(c.Soundtrack_Playlist))
u.write_as_yaml(c.Soundtrack_Playlist, playlist)
示例#4
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>

"""
Generate the default scenario client configuration file.
"""

import os
os.chdir('..')

from lib import utils
from base import constants

config = {
    constants.ClientConfiguration.OVERVIEW_WIDTH: 300
}

# save
file = constants.SCENARIO_CLIENT_STANDARD_FILE
print('write to {}'.format(file))
utils.write_as_yaml(file, config)
# Copyright (C) 2014-16 Trilarion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>
"""
Generate the default scenario client configuration file.
"""

import os
os.chdir('..')

from lib import utils
from base import constants

config = {constants.ClientConfiguration.OVERVIEW_WIDTH: 300}

# save
file = constants.SCENARIO_CLIENT_STANDARD_FILE
print(('write to {}'.format(file)))
utils.write_as_yaml(file, config)
示例#6
0
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>

import os
os.chdir('..')

from lib import utils as u
from base import constants as c

"""
    Generates the playlist of the soundtrack (file names and titles displayed
    in the game). Phonon cannot read metadata under Windows sometimes, see:
    http://stackoverflow.com/questions/23288557/phonon-cant-get-meta-data-of-audio-files-in-python
"""

# create the playlist, a list of (filename, title)
playlist = [['01 Imperialism Theme.ogg', 'Imperialism Theme']]
playlist.append(['02 Silent Ashes.ogg', 'Silent Ashes'])

# write
print('write to {}'.format(c.SOUNDTRACK_INFO_FILE))
u.write_as_yaml(c.SOUNDTRACK_INFO_FILE, playlist)
    'overlay': 'start.overlay.window.left.png',
    'offset': [127, 397],
    'label': 'Help'
}

# game lobby
map['lobby'] = {
    'overlay': 'start.overlay.throne.png',
    'offset': [421, 459],
    'label': 'Game Lobby'
}

# editor
map['editor'] = {
    'overlay': 'start.overlay.map.png',
    'offset': [821, 60],
    'label': 'Scenario Editor'
}

# options
map['options'] = {
    'overlay': 'start.overlay.fireplace.png',
    'offset': [832, 505],
    'label': 'Preferences'
}

# write
file_name = os.path.join(c.GRAPHICS_UI_FOLDER, 'start.overlay.info')
print(('write to {}'.format(file_name)))
u.write_as_yaml(file_name, map)
    'overlay': 'start.overlay.window.left.png',
    'offset': [127, 397],
    'label': 'Help'
}

# game lobby
map['lobby'] = {
    'overlay': 'start.overlay.throne.png',
    'offset': [421, 459],
    'label': 'Game Lobby'
}

# editor
map['editor'] = {
    'overlay': 'start.overlay.map.png',
    'offset': [821, 60],
    'label': 'Scenario Editor'
}

# options
map['options'] = {
    'overlay': 'start.overlay.fireplace.png',
    'offset': [832, 505],
    'label': 'Preferences'
}

# write
file_name = os.path.join(c.GRAPHICS_UI_FOLDER, 'start.overlay.info')
print('write to {}'.format(file_name))
u.write_as_yaml(file_name, map)
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

import os
os.chdir('..')

from lib import utils as u
from base import constants as c

"""
    Generates the default options.
"""

rules = {}

terrain_names = {
    0: 'Sea',
    1: 'Plain',
    2: 'Hills',
    3: 'Mountains',
    4: 'Tundra',
    5: 'Swamp',
    6: 'Desert'
}
rules['terrain.names'] = terrain_names

# save
file = c.Scenario_Ruleset_Standard_File
print('write to {}'.format(file))
u.write_as_yaml(file, rules)
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

import os
os.chdir('..')

from lib import utils as u
from base import constants as c

"""
    Generates the default options.
"""

rules = {}

terrain_names = {
    0: 'Sea',
    1: 'Plain',
    2: 'Hills',
    3: 'Mountains',
    4: 'Tundra',
    5: 'Swamp',
    6: 'Desert'
}
rules['terrain.names'] = terrain_names

# save
file = c.SCENARIO_RULESET_STANDARD_FILE
print('write to {}'.format(file))
u.write_as_yaml(file, rules)
示例#11
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>

"""
Generate the default rules.
"""

import os
os.chdir('..')

from lib import utils
from base import constants

rules = {}

# terrain names
terrain_names = {
    0: 'Sea',
    1: 'Plain',
    2: 'Hills',
    3: 'Mountains',
    4: 'Tundra',
    5: 'Swamp',
    6: 'Desert'
}
rules['terrain.names'] = terrain_names

# save
file = constants.SCENARIO_RULESET_STANDARD_FILE
print('write to {}'.format(file))
utils.write_as_yaml(file, rules)
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>
"""
Generate the default rules.
"""

import os
os.chdir('..')

from lib import utils
from base import constants

rules = {}

# terrain names
terrain_names = {
    0: 'Sea',
    1: 'Plain',
    2: 'Hills',
    3: 'Mountains',
    4: 'Tundra',
    5: 'Swamp',
    6: 'Desert'
}
rules['terrain.names'] = terrain_names

# save
file = constants.SCENARIO_RULESET_STANDARD_FILE
print(('write to {}'.format(file)))
utils.write_as_yaml(file, rules)
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>

import os
os.chdir('..')

from lib import utils as u
from base import constants as c
"""
    Generates the playlist of the soundtrack (file names and titles displayed
    in the game). Phonon cannot read metadata under Windows sometimes, see:
    http://stackoverflow.com/questions/23288557/phonon-cant-get-meta-data-of-audio-files-in-python
"""

# create the playlist, a list of (filename, title)
playlist = [['01 Imperialism Theme.ogg', 'Imperialism Theme']]
playlist.append(['02 Silent Ashes.ogg', 'Silent Ashes'])

# write
print('write to {}'.format(c.SOUNDTRACK_INFO_FILE))
u.write_as_yaml(c.SOUNDTRACK_INFO_FILE, playlist)