def __init__(
        self,
        dashboard,
        connector=None
    ):  #maybe import some kinds(report,task,connection,Throttled,Service)
        """
        Load timeline for every report(sent or unsent), test successful or failed (website or service)
        task (done or not), Throttled details(different charts)
        """

        gtk.VBox.__init__(self)

        self.connector = connector
        self.dashboard = dashboard

        self.base = TimeLineBase(self.connector,
                                 self.dashboard)  #Maybe add some items

        self.__create_widgets()
        self.__packed_widgets()
        self.__connect_widgets()
 def __init__(self,dashboard,connector=None): #maybe import some kinds(report,task,connection,Throttled,Service)
     """
     Load timeline for every report(sent or unsent), test successful or failed (website or service)
     task (done or not), Throttled details(different charts)
     """ 
     
     gtk.VBox.__init__(self)
     
     self.connector = connector
     self.dashboard = dashboard
     
     self.base = TimeLineBase(self.connector,self.dashboard)    #Maybe add some items
     
     self.__create_widgets()
     self.__packed_widgets()
     self.__connect_widgets()
class TLHoder(gtk.VBox):
    
    def __init__(self,dashboard,connector=None): #maybe import some kinds(report,task,connection,Throttled,Service)
        """
        Load timeline for every report(sent or unsent), test successful or failed (website or service)
        task (done or not), Throttled details(different charts)
        """ 
        
        gtk.VBox.__init__(self)
        
        self.connector = connector
        self.dashboard = dashboard
        
        self.base = TimeLineBase(self.connector,self.dashboard)    #Maybe add some items
        
        self.__create_widgets()
        self.__packed_widgets()
        self.__connect_widgets()
        
    def __create_widgets(self):
        """
        """
        # startup data
        line_filter, start, evts = self.base.grab_data()
        xlabel = self.base.xlabel
        glabel = self.base.title_by_graphmode()
        dlabel = self.base.descr_by_graphmode()
        
        #Box
        self.box = HIGVBox()
        
        #graph
        self.graph_box = gtk.HBox()
        self.graph = InteractiveGraph(evts, start, x_label=xlabel,
            y_label=_('Number of events'), graph_label=glabel,
            descr_label=dlabel, vdiv_labels=self.base.labels,
            line_filter=line_filter, connector=self.connector)
        
        #graph toolbar
        self.graphtb = TimeLineGraphToolbar(self.graph, self.connector,
                                            self.base.graph_mode,self.base.graph_kind,
                                            self.base)
        
        #TODO: Add Display Bar in the further
    
    def __packed_widgets(self):
        """
        """
        self.graph_box.add(self.graph)
        
        self.box._pack_noexpand_nofill(self.graphtb)
        self.box._pack_expand_fill(self.graph_box)
        
        self.add(self.box)
                
        self.show_all()
        
    def __connect_widgets(self):
        """
        Handle the connector signals
        """
        self.connector.connect('data_update',self._update_graph)
        #TODO: we should add signals for the changes of left treeview
    
    def _update_graph(self,obj,*args):
        """
        New graph data arrived
        """    
        line_filter, start, evts, labels, xlabel, glabel, dlabel = args
        
        # new graph data
        self.graph.start_pts_data = start
        self.graph.graph_data = evts
        
        # find new max value
        self.graph.find_max_value()
        
        # update graph labels
        self.graph.xlabel = xlabel
        self.graph.graph_label = glabel
        self.graph.descr_label = dlabel
        self.graph.vdiv_labels = labels
        
        # do graph animation with new data
        self.graph.do_animation()                                        
class TLHoder(gtk.VBox):
    def __init__(
        self,
        dashboard,
        connector=None
    ):  #maybe import some kinds(report,task,connection,Throttled,Service)
        """
        Load timeline for every report(sent or unsent), test successful or failed (website or service)
        task (done or not), Throttled details(different charts)
        """

        gtk.VBox.__init__(self)

        self.connector = connector
        self.dashboard = dashboard

        self.base = TimeLineBase(self.connector,
                                 self.dashboard)  #Maybe add some items

        self.__create_widgets()
        self.__packed_widgets()
        self.__connect_widgets()

    def __create_widgets(self):
        """
        """
        # startup data
        line_filter, start, evts = self.base.grab_data()
        xlabel = self.base.xlabel
        glabel = self.base.title_by_graphmode()
        dlabel = self.base.descr_by_graphmode()

        #Box
        self.box = HIGVBox()

        #graph
        self.graph_box = gtk.HBox()
        self.graph = InteractiveGraph(evts,
                                      start,
                                      x_label=xlabel,
                                      y_label=_('Number of events'),
                                      graph_label=glabel,
                                      descr_label=dlabel,
                                      vdiv_labels=self.base.labels,
                                      line_filter=line_filter,
                                      connector=self.connector)

        #graph toolbar
        self.graphtb = TimeLineGraphToolbar(self.graph, self.connector,
                                            self.base.graph_mode,
                                            self.base.graph_kind, self.base)

        #TODO: Add Display Bar in the further

    def __packed_widgets(self):
        """
        """
        self.graph_box.add(self.graph)

        self.box._pack_noexpand_nofill(self.graphtb)
        self.box._pack_expand_fill(self.graph_box)

        self.add(self.box)

        self.show_all()

    def __connect_widgets(self):
        """
        Handle the connector signals
        """
        self.connector.connect('data_update', self._update_graph)
        #TODO: we should add signals for the changes of left treeview

    def _update_graph(self, obj, *args):
        """
        New graph data arrived
        """
        line_filter, start, evts, labels, xlabel, glabel, dlabel = args

        # new graph data
        self.graph.start_pts_data = start
        self.graph.graph_data = evts

        # find new max value
        self.graph.find_max_value()

        # update graph labels
        self.graph.xlabel = xlabel
        self.graph.graph_label = glabel
        self.graph.descr_label = dlabel
        self.graph.vdiv_labels = labels

        # do graph animation with new data
        self.graph.do_animation()