def __init__(self):
     
     # Init theme datas.
     self.__init_data()
     argv = ""
     for theme in theme_manager.get_user_themes() + theme_manager.get_system_themes():
         argv += theme.get_name() + ";"
     self.module_frame = ModuleFrame(self.config_file, argv)
     
     # Init slider.
     self.slider = HSlider()
 
     self.all_page = MainBox()
 
     # Add widgets in slider.
     self.all_page.set_size_request(PAGE_WIDTH, PAGE_HEIGHT)
     
     # Connect events.
     event_manager.add_callback("add-local-wallpapers", self.add_local_wallpappers)
     
     # Connect widgets.
     self.module_frame.add(self.slider)
     self.module_frame.connect("realize", lambda w: self.slider.set_to_page(self.all_page))
     self.module_frame.module_message_handler = self.message_handler
     self.module_frame.run()        
    def __init_themes(self):
        print "user start"
        user_themes = theme_manager.get_user_themes()
        if user_themes:
            self.add_themes(user_themes)

        for item in self.items:
            if theme_manager.is_current_theme(item.theme):
                self.__single_click_item = item
                self.set_highlight(self.__single_click_item)
                break
        print "user end"
    def message_handler(self, *message):
        (message_type, message_content) = message
        if message_type == "click_crumb":
            (crumb_index, crumb_label) = message_content
                
        elif message_type == "show_again":
            self.module_frame.send_module_info()

        elif message_type == "switch-theme":
            theme = None

            for item in theme_manager.get_user_themes() + theme_manager.get_system_themes():
                if item.get_name() == message_content:
                    theme = item
                    break

            if theme:
                print "DEBUG", theme
                event_manager.emit("theme-detail", theme)

        elif message_type == "exit":
            self.module_frame.exit()