config.py 1.77 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
import configparser
from datetime import datetime


class ConfigData:

    def __init__(self):
        config = configparser.ConfigParser(allow_no_value=True)
        config.read("config.ini")
        self.seed_value = config.getint("Simulator", "seedvalue")
        self.max_round = config.getint("Simulator", "max_round")
Ahmad Reza's avatar
Ahmad Reza committed
12
        self.particle_random_order = config.getboolean("Simulator", "particle_random_order")
13
14
15
        self.window_size_x = config.getint("Simulator", "window_size_x")
        self.window_size_y = config.getint("Simulator", "window_size_y")

Karol Actun's avatar
Karol Actun committed
16
17
18
19
20
21
22
23
        self.visualization = config.getint("Visualization", "visualization")
        try:
            self.gui = config.get("Visualization", "gui")
        except configparser.NoOptionError as noe:
            print("no gui found?")
            self.gui = "gui.py"


24
25
26
27
28
29
30
31
32
33
        self.size_x = config.getfloat("World", "size_x")
        self.size_y = config.getfloat("World", "size_y")
        self.border = config.getboolean("World", "border")
        self.max_particles = config.getint("World", "max_particles")

        self.memory_limitation = config.getboolean("Matter", "memory_limitation")
        self.particle_mm_size = config.getint("Matter", "particle_mm_size")
        self.tile_mm_size = config.getint("Matter", "tile_mm_size")
        self.marker_mm_size = config.getint("Matter", "marker_mm_size")

34
35
36
37
38
39
40
41
42
        try:
            self.scenario = config.get("File", "scenario")
        except configparser.NoOptionError as noe:
            self.scenario = "init_scenario.py"

        try:
            self.solution = config.get("File", "solution")
        except configparser.NoOptionError as noe:
            self.solution = "solution.py"
43

Karol Actun's avatar
Karol Actun committed
44

45
46
        self.local_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')[:-1]
        self.multiple_sim = 0