Exemplo n.º 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, ...

    :param file_name:
    """

    # write to file
    utils.write_as_yaml(file_name, options)
Exemplo n.º 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, ...

    :param file_name:
    """

    # write to file
    utils.write_as_yaml(file_name, options)
 def test_write_read(self):
     value = {"One": [2, 3, 'Four', None], 2: ("Cat", "Dog")}
     temp_file = 'temporary_file'
     if os.path.exists(temp_file):
         raise RuntimeError('temporary file already existing')
     utils.write_as_yaml(temp_file, value)
     copy = utils.read_as_yaml(temp_file)
     os.remove(temp_file)
     self.assertEqual(value, copy)
 def test_write_read(self):
     value = {
         "One": [2, 3, 'Four', None],
         2: ("Cat", "Dog")
     }
     temp_file = 'temporary_file'
     if os.path.exists(temp_file):
         raise RuntimeError('temporary file already existing')
     utils.write_as_yaml(temp_file, value)
     copy = utils.read_as_yaml(temp_file)
     os.remove(temp_file)
     self.assertEqual(value, copy)
        '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(constants.GRAPHICS_UI_FOLDER, 'start.overlay.info')
    print('write to {}'.format(file_name))
    utils.write_as_yaml(file_name, map)
# 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, sys

if __name__ == '__main__':

    # add source directory to path if needed
    source_directory = os.path.realpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), os.path.pardir, 'source'))
    if source_directory not in sys.path:
        sys.path.insert(0, source_directory)

    from imperialism_remake.lib import utils
    from imperialism_remake.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)
Exemplo n.º 7
0
if __name__ == '__main__':

    # add source directory to path if needed
    source_directory = os.path.realpath(
        os.path.join(os.path.abspath(os.path.dirname(__file__)),
                     os.path.pardir, 'source'))
    if source_directory not in sys.path:
        sys.path.insert(0, source_directory)

    from imperialism_remake.lib import utils
    from imperialism_remake.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)
# along with this program.  If not, see <http://www.gnu.org/licenses/>
"""
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
"""

import os, sys

if __name__ == '__main__':

    # add source directory to path if needed
    source_directory = os.path.realpath(
        os.path.join(os.path.abspath(os.path.dirname(__file__)),
                     os.path.pardir, 'source'))
    if source_directory not in sys.path:
        sys.path.insert(0, source_directory)

    from imperialism_remake.lib import utils
    from imperialism_remake.base import constants

    # 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(constants.SOUNDTRACK_INFO_FILE))
    utils.write_as_yaml(constants.SOUNDTRACK_INFO_FILE, playlist)
import os, sys

if __name__ == '__main__':

    # add source directory to path if needed
    source_directory = os.path.realpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), os.path.pardir, 'source'))
    if source_directory not in sys.path:
        sys.path.insert(0, source_directory)

    from imperialism_remake.lib import utils
    from imperialism_remake.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)