コード例 #1
0
ファイル: playlist.py プロジェクト: Openlights/firemix
    def __init__(self, app):
        self._app = app

        self._playlist = []
        self._shuffle_list = []
        self.active_preset = None
        self.next_preset = None
        self._playlist_data = None

        self._loader = PatternLoader(self)
        self.available_pattern_classes = self._loader.all_patterns()

        self.last_active_preset = self._app.settings.get("last-preset", None)
        self.active_preset = None
        self.next_preset = None
        self._shuffle = self._app.settings['mixer']['shuffle']
        self._shuffle_list = []

        self.name = app.args.playlist
        if self.name is None:
            self.name = self._app.settings.get("mixer").get("last_playlist", None)
        if self.name is None or self.name == "":
            self.filetype = "playlist"
            self.filename = ""
            self.initialized = False
        else:
            filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"]))
            JSONDict.__init__(self, 'playlist', filepath, True)

            self.open()
コード例 #2
0
ファイル: scene.py プロジェクト: bhitov/firemix
    def __init__(self, app):
        self._app = app
        self._name = app.args.scene
        self._filepath = os.path.join(os.getcwd(), "data", "scenes", "".join([self._name, ".json"]))
        JSONDict.__init__(self, 'scene', self._filepath, False)

        self._fixtures = None
        self._fixture_dict = {}
        self._fixture_hierarchy = None
        self._colliding_fixtures_cache = {}
        self._pixel_neighbors_cache = {}
        self._pixel_locations_cache = {}
        self._pixel_distance_cache = {}
        self._intersection_points = None
        self._all_pixels = None
        self._all_pixel_locations = None

        log.info("Warming up scene caches...")
        fh = self.fixture_hierarchy()
        for strand in fh:
            for fixture in fh[strand]:
                self.get_colliding_fixtures(strand, fixture)
                for pixel in range(self.fixture(strand, fixture).pixels):
                    neighbors = self.get_pixel_neighbors((strand, fixture, pixel))
                    self.get_pixel_location((strand, fixture, pixel))
                    for neighbor in neighbors:
                        self.get_pixel_distance((strand, fixture, pixel), neighbor)
        self.get_fixture_bounding_box()
        self.get_intersection_points()
        self.get_all_pixels()
        self.get_all_pixel_locations()
        log.info("Done")
コード例 #3
0
ファイル: playlist.py プロジェクト: yazici/firemix
    def __init__(self, app):
        self._app = app

        self._playlist = []
        self._shuffle_list = []
        self.active_preset = None
        self.next_preset = None
        self._playlist_data = None

        self._loader = PatternLoader(self)
        self.available_pattern_classes = self._loader.all_patterns()

        self.last_active_preset = self._app.settings.get("last-preset", None)
        self.active_preset = None
        self.next_preset = None
        self._shuffle = self._app.settings['mixer']['shuffle']
        self._shuffle_list = []

        self.name = app.args.playlist
        if self.name is None:
            self.name = self._app.settings.get("mixer").get(
                "last_playlist", None)
        if self.name is None or self.name == "":
            self.filetype = "playlist"
            self.filename = ""
            self.initialized = False
        else:
            filepath = os.path.join(os.getcwd(), "data", "playlists",
                                    "".join([self.name, ".json"]))
            JSONDict.__init__(self, 'playlist', filepath, True)

            self.open()
コード例 #4
0
 def save(self):
     self.data["name"] = self._instance_name
     self.data["classname"] = self.__class__.__name__
     self.data["file-version"] = 1
     self.data["params"] = {}
     for n, p in self._parameters.items():
         self.data["params"][n] = p.get_as_str()
     JSONDict.save(self)
コード例 #5
0
ファイル: playlist.py プロジェクト: tibbon/firemix
    def __init__(self, app):
        self._app = app
        self.name = app.args.playlist
        if self.name is None:
            self.name = self._app.settings.get("mixer").get("last_playlist", "default")
        filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"]))
        JSONDict.__init__(self, 'playlist', filepath, True)

        self.open()
コード例 #6
0
ファイル: playlist.py プロジェクト: meelymay/firemix
    def __init__(self, app, name, last_playlist_settings_key):
        self._app = app
        self._notifier = Playlist.Notifier()
        self._last_playlist_settings_key = last_playlist_settings_key
        self.name = name
        if self.name is None:
            self.name = self._app.settings.get("mixer").get(
                self.last_playlist_settings_key, "default")
        filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"]))
        JSONDict.__init__(self, 'playlist', filepath, True)

        self.open()
コード例 #7
0
    def save(self, save_all_presets=True):
        log.info("Saving playlist")
        playlist = []
        for preset in self._playlist:
            playlist.append(preset.slug())
            if save_all_presets:
                preset.save()
        self.data['playlist'] = playlist

        # Superclass write to file
        self._app.settings.get("mixer")["last_playlist"] = self.name
        JSONDict.save(self)
コード例 #8
0
    def save(self, save_all_presets=True):
        log.info("Saving playlist")
        playlist = []
        for preset in self._playlist:
            playlist.append(preset.slug())
            if save_all_presets:
                preset.save()
        self.data['playlist'] = playlist

        # Superclass write to file
        self._app.settings.get("mixer")["last_playlist"] = self.name
        JSONDict.save(self)
コード例 #9
0
    def __init__(self, app, slug=""):
        self._app = app
        self._ticks = 0
        self._elapsed_time = 0
        self._parameters = {}
        self._watches = {}
        self._instance_name = ""
        self._instance_slug = slug
        self.initialized = False
        self.disabled = False

        filepath = os.path.join(os.getcwd(), "data", "presets", "".join([slug, ".json"]))
        JSONDict.__init__(self, 'preset', filepath, True)

        self.open()
コード例 #10
0
ファイル: playlist.py プロジェクト: underwatercolor/firemix
 def save(self):
     log.info("Saving playlist")
     # Pack the current state into self.data
     self.data = {'file-type': 'playlist'}
     playlist = []
     for preset in self._playlist:
         playlist_entry = {'classname': preset.__class__.__name__,
                           'name': preset.get_name()}
         param_dict = {}
         for name, param in preset.get_parameters().iteritems():
             param_dict[name] = param.get()
         playlist_entry['params'] = param_dict
         playlist.append(playlist_entry)
     self.data['playlist'] = playlist
     # Superclass write to file
     JSONDict.save(self)
コード例 #11
0
ファイル: playlist.py プロジェクト: underwatercolor/firemix
    def __init__(self, app):
        self._app = app
        self._name = app.args.playlist
        self._filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self._name, ".json"]))
        JSONDict.__init__(self, 'playlist', self._filepath, True)

        self._loader = PresetLoader()
        self._preset_classes = self._loader.load()
        self._playlist_data = self.data.get('playlist', [])
        self._playlist = []

        self._active_index = 0
        self._next_index = 0
        self._shuffle = self._app.settings['mixer']['shuffle']
        self._shuffle_list = []

        self.generate_playlist()
コード例 #12
0
ファイル: scene.py プロジェクト: tobywaite/firemix
    def __init__(self, app):
        self._app = app
        self._name = app.args.scene
        self._filepath = os.path.join(os.getcwd(), "data", "scenes", "".join([self._name, ".json"]))
        JSONDict.__init__(self, 'scene', self._filepath, False)

        self._fixtures = None
        self._fixture_dict = {}
        self._fixture_hierarchy = None
        self._colliding_fixtures_cache = {}
        self._pixel_neighbors_cache = {}
        self._pixel_locations_cache = {}
        self._pixel_distance_cache = {}
        self._intersection_points = None
        self._all_pixels = None
        self._all_pixel_locations = None
        self._all_pixels_raw = None
コード例 #13
0
ファイル: playlist.py プロジェクト: meelymay/firemix
 def save(self):
     log.info("Saving playlist")
     # Pack the current state into self.data
     self.data = {'file-type': 'playlist'}
     playlist = []
     for preset in self._playlist:
         playlist_entry = {'classname': preset.__class__.__name__,
                           'name': preset.get_name()}
         param_dict = {}
         for name, param in preset.get_parameters().iteritems():
             param_dict[name] = param.get_as_str()
         playlist_entry['params'] = param_dict
         playlist.append(playlist_entry)
     self.data['playlist'] = playlist
     # Superclass write to file
     self._app.settings.get("mixer")[self._last_playlist_settings_key] = self.name
     JSONDict.save(self)
コード例 #14
0
ファイル: playlist.py プロジェクト: yazici/firemix
    def save(self, save_all_presets=True):
        if not self.initialized:
            return

        log.info("Saving playlist")
        playlist = []
        for preset in self._playlist:
            playlist.append(preset.slug())
            if save_all_presets:
                preset.save()
        self.data['playlist'] = playlist
        self.data["file-version"] = 2

        # Superclass write to file
        self._app.settings.get("mixer")["last_playlist"] = self.name
        self._app.settings["last-preset"] = self.active_preset.name()
        JSONDict.save(self)
コード例 #15
0
ファイル: playlist.py プロジェクト: Openlights/firemix
    def save(self, save_all_presets=True):
        if not self.initialized:
            return

        log.info("Saving playlist")
        playlist = []
        for preset in self._playlist:
            playlist.append(preset.slug())
            if save_all_presets:
                preset.save()
        self.data['playlist'] = playlist
        self.data["file-version"] = 2

        # Superclass write to file
        self._app.settings.get("mixer")["last_playlist"] = self.name
        self._app.settings["last-preset"] = self.active_preset.name()
        JSONDict.save(self)
コード例 #16
0
ファイル: scene.py プロジェクト: meelymay/firemix
    def __init__(self, app):
        self._app = app
        self._name = app.args.scene
        self._filepath = os.path.join(os.getcwd(), "data", "scenes",
                                      "".join([self._name, ".json"]))
        JSONDict.__init__(self, 'scene', self._filepath, False)

        self._fixtures = None
        self._fixture_dict = {}
        self._fixture_hierarchy = None
        self._colliding_fixtures_cache = {}
        self._pixel_neighbors_cache = {}
        self._pixel_locations_cache = {}
        self._pixel_distance_cache = {}
        self._intersection_points = None
        self._all_pixels = None
        self._all_pixel_locations = None
        self._all_pixels_raw = None
コード例 #17
0
    def __init__(self, app):
        self._app = app
        self._name = app.args.playlist
        self._filepath = os.path.join(os.getcwd(), "data", "playlists",
                                      "".join([self._name, ".json"]))
        JSONDict.__init__(self, 'playlist', self._filepath, True)

        self._loader = PresetLoader()
        self._preset_classes = self._loader.load()
        self._playlist_data = self.data.get('playlist', [])
        self._playlist = []

        self._active_index = 0
        self._next_index = 0
        self._shuffle = self._app.settings['mixer']['shuffle']
        self._shuffle_list = []

        self.generate_playlist()
コード例 #18
0
    def __init__(self, app):
        self._app = app

        self._playlist = []
        self._shuffle_list = []
        self.active_preset = None
        self.next_preset = None
        self._playlist_data = None

        self.name = app.args.playlist
        if self.name is None:
            self.name = self._app.settings.get("mixer").get("last_playlist", None)
        if self.name is None or self.name == "":
            self.filetype = "playlist"
            self.filename = ""
            self.initialized = False
        else:
            filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"]))
            JSONDict.__init__(self, 'playlist', filepath, True)

            self.open()
コード例 #19
0
    def __init__(self, app):
        self._app = app

        self._playlist = []
        self._shuffle_list = []
        self.active_preset = None
        self.next_preset = None
        self._playlist_data = None

        self.name = app.args.playlist
        if self.name is None:
            self.name = self._app.settings.get("mixer").get(
                "last_playlist", None)
        if self.name is None or self.name == "":
            self.filetype = "playlist"
            self.filename = ""
            self.initialized = False
        else:
            filepath = os.path.join(os.getcwd(), "data", "playlists",
                                    "".join([self.name, ".json"]))
            JSONDict.__init__(self, 'playlist', filepath, True)

            self.open()
コード例 #20
0
 def __init__(self):
     filepath = os.path.join(os.getcwd(), "data", "settings.json")
     JSONDict.__init__(self, 'settings', filepath, False)
コード例 #21
0
ファイル: settings.py プロジェクト: Openlights/firemix
 def save(self):
     JSONDict.save(self)
コード例 #22
0
 def save(self):
     JSONDict.save(self)
コード例 #23
0
 def __init__(self, app):
     filename = app.args.scene
     self._filename = os.path.join(os.getcwd(), "data", "scenes",
                                   "".join([filename, ".json"]))
     JSONDict.__init__(self, 'scene', self._filename, False)
     self.data["filepath"] = self._filename
コード例 #24
0
ファイル: scene_loader.py プロジェクト: bhitov/firemix
 def __init__(self, app):
     filename = app.args.scene
     self._filename = os.path.join(os.getcwd(), "data", "scenes", "".join([filename, ".json"]))
     JSONDict.__init__(self, 'scene', self._filename, False)
     self.data["filepath"] = self._filename
コード例 #25
0
ファイル: settings.py プロジェクト: Openlights/firemix
 def __init__(self):
     filepath = os.path.join(os.getcwd(), "data", "settings.json")
     JSONDict.__init__(self, 'settings', filepath, False)