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()
def __init__(self, channel): QHBoxLayout.__init__(self) self.id = channel.name self.chan_thumbdata = dpr.get_thumb_data(self.id, "Channel") self.img_chan = QtGui.QPixmap() self.img_chan.loadFromData(self.chan_thumbdata) self.img_chan = self.img_chan.scaledToHeight(80) self.lbl_chan = QtWidgets.QLabel() self.lbl_chan.mouseReleaseEvent = self.goToChannel self.lbl_chan.setPixmap(self.img_chan) self.addWidget(self.lbl_chan) self.vBox_all = QtWidgets.QVBoxLayout() self.vBox_all.addStretch() self.lbl_name = QtWidgets.QLabel(channel["Title"], font=f_subheader) self.vBox_all.addWidget(self.lbl_name) self.hBox_top = QtWidgets.QHBoxLayout() self.vBox_subscribers = QtWidgets.QVBoxLayout() self.lbl_subscribers = QtWidgets.QLabel("Subscribers") self.vBox_subscribers.addWidget(self.lbl_subscribers) self.lbl_subscribers_val = QtWidgets.QLabel(str(channel["Subscribers"])) self.vBox_subscribers.addWidget(self.lbl_subscribers_val) self.hBox_top.addLayout(self.vBox_subscribers) self.vBox_views = QtWidgets.QVBoxLayout() self.lbl_views = QtWidgets.QLabel("Views") self.vBox_views.addWidget(self.lbl_views) self.lbl_views_val = QtWidgets.QLabel(str(channel["Views"])) self.vBox_views.addWidget(self.lbl_views_val) self.hBox_top.addLayout(self.vBox_views) self.vBox_num_vids = QtWidgets.QVBoxLayout() self.lbl_num_vids = QtWidgets.QLabel("# Videos") self.vBox_num_vids.addWidget(self.lbl_num_vids) self.lbl_num_vids_val = QtWidgets.QLabel(str(len(dpr.get_scanned_videos(self.id)))) self.vBox_num_vids.addWidget(self.lbl_num_vids_val) self.hBox_top.addLayout(self.vBox_num_vids) self.vBox_comments = QtWidgets.QVBoxLayout() self.lbl_comments = QtWidgets.QLabel("Comments") self.vBox_comments.addWidget(self.lbl_comments) self.lbl_comments_val = QtWidgets.QLabel(str(channel["Comments"])) self.vBox_comments.addWidget(self.lbl_comments_val) self.hBox_top.addLayout(self.vBox_comments) self.vBox_upload = QtWidgets.QVBoxLayout() self.lbl_upload = QtWidgets.QLabel("Upload") self.vBox_upload.addWidget(self.lbl_upload) self.lbl_upload_val = QtWidgets.QLabel(dpr.parse_date(channel["Upload"])) self.vBox_upload.addWidget(self.lbl_upload_val) self.hBox_top.addLayout(self.vBox_upload) self.vBox_gathered = QtWidgets.QVBoxLayout() self.lbl_gathered = QtWidgets.QLabel("Gathered") self.vBox_gathered.addWidget(self.lbl_gathered) self.lbl_gathered_val = QtWidgets.QLabel(dpr.parse_date(channel["Gathered"])) self.vBox_gathered.addWidget(self.lbl_gathered_val) self.hBox_top.addLayout(self.vBox_gathered) self.vBox_all.addLayout(self.hBox_top) self.vBox_all.addStretch() self.addLayout(self.vBox_all) self.addStretch()