예제 #1
0
 def setUp(self):
     self.two_colors_map = Map.from_file("./test_maps/2color.json")
     self.four_colors_map = Map.from_file("./test_maps/4color.json")
     self.piece_country_map = Map.from_file(
         "./test_maps/2country_with_pieces.json")
     self.two_colors_map.calc_incident_countries()
     self.piece_country_map.calc_incident_countries()
     self.four_colors_map.calc_incident_countries()
     self.palette = Palette.from_json('palette.json')
예제 #2
0
    parser.add_argument("-p",
                        '--palette',
                        type=str,
                        default='palette.json',
                        help='Palette config file')
    parser.add_argument('--encoding',
                        type=str,
                        default='utf8',
                        help='Encoding for files')
    parser.add_argument('-e',
                        '--editor',
                        action='store_true',
                        help='Run map editor')
    return parser.parse_args()


if __name__ == '__main__':
    parser = create_parser()
    app = QtWidgets.QApplication(sys.argv)
    if parser.editor:
        editor = EditorWindow()
    else:
        try:
            loaded_map = Map.from_file(parser.map, parser.encoding)
        except IOError as e:
            print("error loading {} file\n{}".format(parser.map, e))
            exit(1)
        viz = Visualizer(loaded_map, Palette.from_json(parser.palette))

    sys.exit(app.exec_())