def Enable(self):
     """
     All real actions involved in initializing the service should
     be defined here, not in the constructor.  This includes
     e.g. opening sockets, collecting data from directories, etc.
     """
     import wx
     from solipsis.services.profile.gui.EditorFrame import EditorFrame
     from solipsis.services.profile.gui.ViewerFrame import ViewerFrame
     from solipsis.services.profile.gui.FilterFrame import FilterFrame
     set_solipsis_dir(self.service_api.GetDirectory())
     # init windows
     main_window = self.service_api.GetMainWindow()
     options = {}
     options["standalone"] = False
     self.editor_frame = EditorFrame(options, main_window, -1, "",
                                       plugin=self)
     self.viewer_frame = ViewerFrame(options, main_window, -1, "",
                                       plugin=self)
     self.filter_frame = FilterFrame(options, main_window, -1, "",
                                       plugin=self)
     # Set up main GUI hooks
     menu = wx.Menu()
     for action, method in self.MAIN_ACTION.iteritems():
         item_id = wx.NewId()
         menu.Append(item_id, _(action))
         wx.EVT_MENU(main_window, item_id, method)
     self.service_api.SetMenu(self.GetTitle(), menu)
     # launch network
     self.network = NetworkManager()
     self.activate(True)
 def EnableBasic(self):
     """enable non graphic part"""
     set_solipsis_dir(self.service_api.GetDirectory())
     self.network = NetworkManager(self.host,
                                   random.randrange(7100, 7200),
                                   self.service_api)
     self.activate(True)
    def Enable(self):
        """
        All real actions involved in initializing the service should
        be defined here, not in the constructor.  This includes
        e.g. opening sockets, collecting data from directories, etc.
        """
        set_solipsis_dir(self.service_api.GetDirectory())
        # init windows
        main_window = self.service_api.GetMainWindow()
        # TODO: create dynamic option object (for standalone & display)
        options = {}
        options["standalone"] = False
        self.editor_frame = EditorFrame(options, main_window, -1, "", plugin=self)
        self.viewer_frame = ViewerFrame(options, main_window, -1, "", plugin=self)
        # Set up main GUI hooks
        menu = wx.Menu()
        for action, method in self.MAIN_ACTION.iteritems():
            item_id = wx.NewId()
            menu.Append(item_id, _(action))

            def _clicked(event):
                """call profile from main menu"""
                method()

            wx.EVT_MENU(main_window, item_id, _clicked)
        self.service_api.SetMenu(self.GetTitle(), menu)
        # launch network
        self.network = NetworkManager(self.host, random.randrange(7100, 7200), self.service_api)
        self.activate(True)
    def Enable(self):
        """
        All real actions involved in initializing the service should
        be defined here, not in the constructor.  This includes
        e.g. opening sockets, collecting data from directories, etc.
        """
        set_solipsis_dir(self.service_api.GetDirectory())
        # init windows
        main_window = self.service_api.GetMainWindow()
        options = {}
        options["standalone"] = False
        # profile_frame created at once since linked to facade & thus
        # needed for all actions (get_blog, get_files), even if not
        # displayed right at beginning
        self.profile_frame = ProfileFrame(options, main_window, -1, "", plugin=self)
        self.node_id = self.service_api.GetNode().pseudo
        # create views & doc
        self.facade.load_profile(os.path.join(PROFILE_DIR, PROFILE_FILE), self.profile_frame)
        self.facade.refresh_html_preview()
        # Set up main GUI hooks
        menu = wx.Menu()
        for action, method in self.MAIN_ACTION.iteritems():
            item_id = wx.NewId()
            menu.Append(item_id, _(action))

            def _clicked(event):
                """call profile from main menu"""
                method()

            wx.EVT_MENU(main_window, item_id, _clicked)
        self.service_api.SetMenu(self.GetTitle(), menu)
        # launch network
        self.network.start_listening()
 def EnableBasic(self):
     """enable non graphic part"""
     set_solipsis_dir(self.service_api.GetDirectory())
     # TODO: expose interface of facade to netClient
     self.facade.load_profile(os.path.join(PROFILE_DIR, PROFILE_FILE))
     # launch network
     self.network.start_listening()
 def EnableBasic(self):
     """enable non graphic part"""
     set_solipsis_dir(self.service_api.GetDirectory())
     self.network = NetworkManager()
     self.activate(True)