def save_app_state(self):
     """
     App state saved.
     
     The channels in the default category is exported to a JSON File.
     This file is used to restore channels which have been there in the app
     while it was closed.
     """
     exporter = JSON_Exporter()
     path = file_util.find_file(__file__,
                                "../../data/channels/saved_channels")
     if path != '':
         exporter.to_JSON(path, Channel_Store.ALL.get_channels(),
                          Channel_Encoder)
    def _export(self, widget, data=None):
        """
        Create A JSON Exporter.

        Get the file path from the TextField in Export Box.

        Export channel data to specified path.
        """

        exporter = JSON_Exporter()
        path = self.box.text_entry.get_text()
        if path != '':
            exporter.to_JSON(path, Channel_Store.ALL.get_channels(),
                             Channel_Encoder)
            self.box.export_box.destroy()
 def save_app_state(self):
     
     """
     App state saved.
     
     The channels in the default category is exported to a JSON File.
     This file is used to restore channels which have been there in the app
     while it was closed.
     """
     exporter  = JSON_Exporter()
     path = file_util.find_file(__file__,
                                "../../data/channels/saved_channels")
     if path != '':
         exporter.to_JSON(path
                         ,Channel_Store.ALL.get_channels()
                         ,Channel_Encoder)
    def _export(self,widget,data=None):

        """
        Create A JSON Exporter.

        Get the file path from the TextField in Export Box.

        Export channel data to specified path.
        """

        exporter  = JSON_Exporter()
        path = self.box.text_entry.get_text()
        if path != '':
            exporter.to_JSON(path
                            ,Channel_Store.ALL.get_channels()
                            ,Channel_Encoder)
            self.box.export_box.destroy()
    def export_sample_monitor(self):
        """
       Exports  a monitor channel runinng on local machine. For that first we
       get monitor channel configuration data from channel store.
       After that the monitor data is exported to file in JSON format using
       JSON Exporter and Channel Encoder.
       """

        ## Data to export
        exported_data = channel_store.get_monitor_data()

        ## monitor channel
        monitor_channel = Channel(exported_data["monitor"])

        ## path where channel data is exported.
        path = file_util.find_file(
            __file__, "../../data/channels/to_import_sample_data.p2psp")

        ## JSON Exporter
        exporter = JSON_Exporter()
        exporter.to_JSON(path, {"monitor": monitor_channel}, Channel_Encoder)
    def export_sample_monitor(self):

       """
       Exports  a monitor channel runinng on local machine. For that first we
       get monitor channel configuration data from channel store.
       After that the monitor data is exported to file in JSON format using
       JSON Exporter and Channel Encoder.
       """

       ## Data to export
       exported_data = channel_store.get_monitor_data()

       ## monitor channel
       monitor_channel = Channel(exported_data["monitor"])

       ## path where channel data is exported.
       path = file_util.find_file(__file__,
                                   "../../data/channels/to_import_sample_data.p2psp")

       ## JSON Exporter
       exporter  = JSON_Exporter()
       exporter.to_JSON(path,{"monitor":monitor_channel},Channel_Encoder)