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 setupAddAndScan(self):
        self.tab_add_scan = QtWidgets.QWidget()
        self.tab_add_scan.setEnabled(True)
        self.tab_add_scan.setAccessibleName("")
        self.tab_add_scan.setObjectName("tab_add_scan")
        
        self.hBox_add_scan_2 = QtWidgets.QHBoxLayout(self.tab_add_scan)
        self.hBox_add_scan_2.setObjectName("hBox_add_scan_2")
        self.vBox_add_scan_1 = QtWidgets.QVBoxLayout()
        self.vBox_add_scan_1.setObjectName("vBox_add_scan_1")
        self.hBox_add_scan_1 = QtWidgets.QHBoxLayout()
        self.hBox_add_scan_1.setObjectName("hBox_add_scan_1")
        
        self.line_add_url = QtWidgets.QLineEdit(self.tab_add_scan)
        self.line_add_url.setFixedSize(350,22)
        self.line_add_url.setObjectName("line_add_url")
        self.line_add_url.setText("Insert URL")
        self.hBox_add_scan_1.addWidget(self.line_add_url)
        
        self.btn_add_video = QtWidgets.QPushButton(self.tab_add_scan)
        self.btn_add_video.setToolTipDuration(1)
        self.btn_add_video.setObjectName("btn_add_video")
        self.btn_add_video.setText("Add Video")
        self.btn_add_video.setToolTip("Add a video to the database.")
        self.btn_add_video.clicked.connect(self.btn_add_video_press)
        self.hBox_add_scan_1.addWidget(self.btn_add_video)
        
        self.btn_add_channel = QtWidgets.QPushButton(self.tab_add_scan)
        self.btn_add_channel.setToolTipDuration(1)
        self.btn_add_channel.setObjectName("btn_add_channel")
        self.btn_add_channel.setText("Add Channel")
        self.btn_add_channel.setToolTip("Add a chanel to the database")
        self.btn_add_channel.clicked.connect(self.btn_add_channel_press)
        self.hBox_add_scan_1.addWidget(self.btn_add_channel)
        self.hBox_add_scan_1.addStretch()        
        self.vBox_add_scan_1.addLayout(self.hBox_add_scan_1)
        
        self.grid = QtWidgets.QGridLayout()
        self.vBox_recent_videos = QtWidgets.QVBoxLayout()
        self.lbl_recent_videos = QtWidgets.QLabel("Last Uploaded Videos", font=f_header)
        self.vBox_recent_videos.addWidget(self.lbl_recent_videos)                       
        self.recent_videos = dpr.get_sorted(df_videos, "Upload", 3)        
        self.recent_video_details = [videoDetails(self.recent_videos.iloc[x]) for x in range(len(self.recent_videos))]    
        for i in range(len(self.recent_video_details)):
            self.vBox_recent_videos.addLayout(self.recent_video_details[i])
        self.grid.addLayout(self.vBox_recent_videos, 0,0)
        
        self.vBox_add_scan_video_details = QtWidgets.QVBoxLayout()   
        self.vBox_add_scan_video_details.addStretch()       
        self.lbl_all_videos = QtWidgets.QLabel("Total Videos: " + str(dpr.get_num_items(df_videos)), font=f_preview)
        self.vBox_add_scan_video_details.addWidget(self.lbl_all_videos)        
        self.lbl_all_video_views = QtWidgets.QLabel("Total Video Views: " + str(dpr.get_latest_sum(r"video_views.csv")), font=f_preview)
        self.vBox_add_scan_video_details.addWidget(self.lbl_all_video_views)        
        self.lbl_all_likes_dislikes = QtWidgets.QLabel("Total Likes/Dislikes: " + str(dpr.get_latest_sum(r"video_likes.csv")) + "/" + str(dpr.get_latest_sum(r"video_dislikes.csv")), font=f_preview)
        self.vBox_add_scan_video_details.addWidget(self.lbl_all_likes_dislikes)        
        self.lbl_dur_total = QtWidgets.QLabel("Runtime of all Videos combined: " + str(dpr.get_dur_total()), font=f_preview)
        self.vBox_add_scan_video_details.addStretch()
        self.hBox_stretch_videos = QtWidgets.QHBoxLayout()   
        self.hBox_stretch_videos.addLayout(self.vBox_add_scan_video_details)
        self.hBox_stretch_videos.addStretch()
        self.grid.addLayout(self.hBox_stretch_videos, 0,1)

        self.vBox_recent_channels = QtWidgets.QVBoxLayout()
        self.lbl_recent_channels = QtWidgets.QLabel("Last Added Channels", font=f_header)
        self.vBox_recent_channels.addWidget(self.lbl_recent_channels)                
        self.recent_channels = dpr.get_sorted(df_channels, "Gathered", 3)        
        self.recent_channel_details = [channelDetails(self.recent_channels.iloc[x]) for x in range(len(self.recent_channels))]    
        for i in range(len(self.recent_channel_details)):
            self.vBox_recent_channels.addLayout(self.recent_channel_details[i])
        self.grid.addLayout(self.vBox_recent_channels, 1,0)

                                    
        self.vBox_add_scan_channel_details = QtWidgets.QVBoxLayout()
        self.vBox_add_scan_channel_details.addStretch()
        self.lbl_all_channels = QtWidgets.QLabel("Total Channels: " + str(dpr.get_num_items(df_channels)), font=f_preview)
        self.vBox_add_scan_channel_details.addWidget(self.lbl_all_channels)            
        self.lbl_all_subscribers = QtWidgets.QLabel("Total Subscribers: " + str(dpr.get_latest_sum(r"channel_subscribers.csv")), font=f_preview)
        self.vBox_add_scan_channel_details.addWidget(self.lbl_all_subscribers)       
        self.vBox_add_scan_channel_details.addStretch()        
        self.grid.addLayout(self.vBox_add_scan_channel_details, 1,1)
                
        self.vBox_add_scan_1.addLayout(self.grid)                     
        
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.vBox_add_scan_1.addItem(spacerItem)
        self.hBox_add_scan_2.addLayout(self.vBox_add_scan_1)