Esempio n. 1
0
    def __init__(self, channel):        
        QWidget.__init__(self)
        self.id = channel.name              
        self.setWindowIcon(QtGui.QIcon('app.png'))        
        self.setWindowTitle("Channel Details")           
        self.vBox_1 = QtWidgets.QVBoxLayout(self)  

        self.hBox_top = QtWidgets.QHBoxLayout() 
        self.lbl_header = QtWidgets.QLabel(channel["Title"], font=f_header)        
        self.hBox_top.addWidget(self.lbl_header)
        self.hBox_top.addStretch()
        
        self.btn_delete = QtWidgets.QPushButton("Delete Channel", self)
        self.btn_delete.clicked.connect(self.delete_channel)
        self.hBox_top.addWidget(self.btn_delete)
        
        self.vBox_1.addLayout(self.hBox_top)
        self.hBox_graphs = QtWidgets.QHBoxLayout()  
        if dpr.datafile_exists("channel_subscribers.csv") and dpr.datafile_exists("channels.csv"):
            self.gra_channel_subs = LineGraphCanvas(
                dpr.get_subs_ot(self.id),"Subscribers over Time")               
            self.hBox_graphs.addWidget(self.gra_channel_subs)            
            self.gra_channel_subs_growth = LineGraphCanvas(
                dpr.get_growth(dpr.get_subs_ot(self.id)),"Subscriber Growth over Time")         
            self.hBox_graphs.addWidget(self.gra_channel_subs_growth)            
            self.vBox_1.addLayout(self.hBox_graphs)
           
        self.hBox_details = QtWidgets.QHBoxLayout()                     
        self.channel_details = channelDetails(channel)           
        self.hBox_details.addLayout(self.channel_details)
        
        self.vBox_video_details = QtWidgets.QVBoxLayout() 
        self.lbl_video_header = QtWidgets.QLabel("Last Uploads", font=f_header)
        self.vBox_video_details.addWidget(self.lbl_video_header)
        self.videos = dpr.get_scanned_videos(self.id, df_videos) 
        self.recent_vids = dpr.get_sorted(self.videos, "Upload", 3)                           
        self.video_details = [videoDetails(self.recent_vids.iloc[x]) for x in range(len(self.recent_vids))]    
        for i in range(len(self.video_details)):
            self.vBox_video_details.addLayout(self.video_details[i])
            
        self.hBox_details.addLayout(self.vBox_video_details)           
        self.hBox_details.addStretch()       
        self.vBox_1.addLayout(self.hBox_details)       
        self.vBox_1.addStretch()
Esempio n. 2
0
 def __init__(self, video):        
     QWidget.__init__(self)        
     print(video.name)
     self.id = video.name            
     self.channel_id = dpr.get_channel_id(self.id)  
     self.setWindowIcon(QtGui.QIcon('app.png'))
     self.setWindowTitle("Video Details")                                     
     self.vBox_1 = QtWidgets.QVBoxLayout(self)   
     self.hBox_top = QtWidgets.QHBoxLayout() 
     self.lbl_header = QtWidgets.QLabel(video["Title"], font=f_header)        
     self.hBox_top.addWidget(self.lbl_header)
     self.hBox_top.addStretch()
     
     self.btn_delete = QtWidgets.QPushButton("Delete Video", self)
     self.btn_delete.clicked.connect(self.delete_video)
     self.hBox_top.addWidget(self.btn_delete)
     
     self.vBox_1.addLayout(self.hBox_top)
     self.hBox_graphs = QtWidgets.QHBoxLayout()         
     if dpr.datafile_exists("video_views.csv") and dpr.datafile_exists("videos.csv"):
         self.gra_video_views = LineGraphCanvas(
             dpr.get_views_ot(self.id),"Views over Time")               
         self.hBox_graphs.addWidget(self.gra_video_views)            
         self.gra_video_views_growth = LineGraphCanvas(
             dpr.get_growth(dpr.get_views_ot(self.id)),"Growth of Views over Time")         
         self.hBox_graphs.addWidget(self.gra_video_views_growth)            
         self.vBox_1.addLayout(self.hBox_graphs)                      
         
     self.hBox_details = QtWidgets.QHBoxLayout()             
     self.video_details = videoDetails(video)
     self.hBox_details.addLayout(self.video_details)
     self.channel_details = channelDetails(df_channels.loc[self.channel_id])           
     self.hBox_details.addLayout(self.channel_details)
     self.hBox_details.addStretch()
     self.vBox_1.addLayout(self.hBox_details)
     self.vBox_1.addStretch()