Esempio n. 1
0
    def load_json(self, json_str):
        """
        Load project from JSON.

        :param json_str: JSON-formatted string representing a project.
        :return: Nothing
        """

        # project_list elements are tuples containing presentation name and file contents
        # The format is ["presentationname", ["file1", "file2", ...]"]
        project_list = json.loads(json_str)

        # create the real presentations by replacing file list with Presentation objects
        presentation_list = []
        for presentation_tuple in project_list:
            name = presentation_tuple[0]
            files = presentation_tuple[1]
            paths = []
            for file in files:
                path = fh.absolute_path(PathConstants.ABSOLUTE_MEDIA_FOLDER,
                                        file)
                paths.append(path)
            pres = Presentation(name)
            pres.presentation_filenames = paths
            presentation_list.append((name, pres))

        self.presentations = presentation_list
Esempio n. 2
0
 def test_binding_slave(self):
     with patch.object(MasterGUILayout, "notify", return_value=None) as notifier:
         self.mock_master.add_slave_connection(SlaveConnection(None))
         presentation = Presentation()
         presentation.presentation_filenames = ["aaaa"]
         self.mock_master.bind_slave_to_presentation(presentation, "localhost:8000")
         self.assertEqual(self.mock_master.slave_connections["localhost:8000"].presentation.presentation_filenames, ["aaaa"])
     self.layout.notify.assert_called_once_with(Notification.PRESENTING_DISABLED, False)