Exemple #1
0
 def __init__(self):
     super().__init__()
     anime_bk_pic_path = './source/pic/anime_bk.png'
     search_1_pic_path = './source/pic/next.png'
     search_2_pic_path = './source/pic/next_1.png'
     search_3_pic_path = './source/pic/next_2.png'
     hgzy_font_path = './source/font/HGZYT_CNKI.TTF'
     rem_ico_path = './source/pic/rem.png'
     self.pix = QPixmap(anime_bk_pic_path)
     self.resize(self.pix.width(),self.pix.height())
     self.pix = self.pix.scaled(int(self.pix.width()), int(self.pix.height()))
     self.setMask(self.pix.mask())
     screen = QDesktopWidget().screenGeometry()
     self.move((screen.width() - self.pix.width()) / 2, (screen.height() - self.pix.height()) / 2)
     self.setWindowFlags(Qt.FramelessWindowHint)  # | QtCore.Qt.WindowStaysOnTopHint
     self.setAttribute(Qt.WA_TranslucentBackground) # 窗口透明抗锯齿
     rem_icon = QIcon(QPixmap(rem_ico_path))
     self.setWindowIcon(rem_icon)
     self.m_DragPosition = None
     fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
     fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
     self.animelist = QDListWidget(self)
     self.animelist.setObjectName('AnimeListWidget')
     self.animelist.setGeometry(17,280,self.pix.width()-34,self.pix.height()-280-50)
     self.animelist.setStyleSheet('#AnimeListWidget{background:transparent;}')
     self.animelist.setFont(QFont(fontName,15,QFont.Light))
     self.animelist.setIconSize(QSize(100,100))
     self.InitData()
     ver = Version()
     self.version = QDLabel(self, ver.cur_link)
     self.version.setObjectName('VersionLabel')
     self.version.setGeometry(15, self.pix.height() - 75, 600, 100)
     self.version.setText('当前数据库版本号:' + ver.cur_version)
     if ver.judge_version():
         self.version.setToolTip('数据库为最新版本,无需更新')
     else:
         self.version.setToolTip('数据库版本已过期,请自行下载新数据库.(双击获取下载链接)')
     self.version.setFont(QFont(fontName,10,QFont.Light))
     self.search = QPushButton(self)
     self.search.setObjectName('Search')
     self.search.setStyleSheet("#Search{border-image: url(%s)}"
                               "#Search:hover{border-image: url(%s)}" 
                               "#Search:pressed{border-image: url(%s)}"
                               % (search_1_pic_path,search_2_pic_path,search_3_pic_path))
     self.search.setGeometry(self.pix.width()-self.search.width(),self.pix.height()-self.search.height()-10
                             ,self.search.width()-20,self.search.height())
     self.choose = Choose(self.x()+self.width(),self.y()+self.height())
     self.choose_show = False
     self.choose_info = {}
     self.search.clicked.connect(self.SearchBt)
     self.detail = Detail(self.x(),self.y())
     self.detail_show = False
     self.animelist.itemDoubleClicked.connect(self.DetailBt)
     self.animelist.installEventFilter(self)
     self.rightclick = Rightclick()
     self.animeshow = False
Exemple #2
0
 def __init__(self):
     super().__init__()
     follow_bk_pic_path = './source/pic/follow_bk.png'
     search_1_pic_path = './source/pic/next.png'
     search_2_pic_path = './source/pic/next_1.png'
     search_3_pic_path = './source/pic/next_2.png'
     hgzy_font_path = './source/font/HGZYT_CNKI.TTF'
     rem_ico_path = './source/pic/rem.png'
     self.pix = QPixmap(follow_bk_pic_path)
     self.resize(self.pix.width(), self.pix.height())
     self.pix = self.pix.scaled(int(self.pix.width()),
                                int(self.pix.height()))
     self.setMask(self.pix.mask())
     screen = QDesktopWidget().screenGeometry()
     self.move((screen.width() - self.pix.width()) / 2,
               (screen.height() - self.pix.height()) / 2)
     self.setWindowFlags(
         Qt.FramelessWindowHint)  # | QtCore.Qt.WindowStaysOnTopHint
     self.setAttribute(Qt.WA_TranslucentBackground)  # 窗口透明抗锯齿
     rem_icon = QIcon(QPixmap(rem_ico_path))
     self.setWindowIcon(rem_icon)
     self.m_DragPosition = None
     fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
     fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
     self.followlist = QDListWidget(self)
     self.followlist.setObjectName('FollowListWidget')
     self.followlist.setGeometry(17, 280,
                                 self.pix.width() - 34,
                                 self.pix.height() - 280 - 50)
     self.followlist.setStyleSheet(
         '#FollowListWidget{background:transparent;}')
     self.followlist.setFont(QFont(fontName, 15, QFont.Light))
     self.followlist.setIconSize(QSize(100, 100))
     self.ShowData()
     self.search = QPushButton(self)
     self.search.setObjectName('Search')
     self.search.setStyleSheet(
         "#Search{border-image: url(%s)}"
         "#Search:hover{border-image: url(%s)}"
         "#Search:pressed{border-image: url(%s)}" %
         (search_1_pic_path, search_2_pic_path, search_3_pic_path))
     self.search.setGeometry(self.pix.width() - self.search.width(),
                             self.pix.height() - self.search.height() - 10,
                             self.search.width() - 20, self.search.height())
     self.choose = Choose(self.x() + self.width(), self.y() + self.height())
     self.choose_show = False
     self.choose_info = {}
     self.search.clicked.connect(self.SearchBt)
     self.detail = Detail(self.x(), self.y())
     self.detail_show = False
     self.followlist.itemDoubleClicked.connect(self.DetailBt)
     self.followlist.installEventFilter(self)
     self.rightclick = FollowRightclick()
     self.followshow = False
Exemple #3
0
 def __init__(self):
     super().__init__()
     timeline_bk_path = './source/pic/timeline_bk.png'
     hgzy_font_path = './source/font/HGZYT_CNKI.TTF'
     rem_ico_path = './source/pic/rem.png'
     fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
     fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
     self.index = -1
     self.pix = QPixmap(timeline_bk_path)
     self.resize(self.pix.width(),self.pix.height())
     self.pix = self.pix.scaled(int(self.pix.width()),int(self.pix.height()))
     self.setMask(self.pix.mask())
     screen = QDesktopWidget().screenGeometry()
     self.move((screen.width() - self.pix.width()) / 2, (screen.height() - self.pix.height()) / 2)
     self.setAttribute(Qt.WA_TranslucentBackground)
     self.setWindowFlags(Qt.FramelessWindowHint)
     rem_icon = QIcon(QPixmap(rem_ico_path))
     self.setWindowIcon(rem_icon)
     self.m_DragPosition = None
     self.m_drag = False
     self.animelist = QListWidget(self)
     self.animelist.setObjectName('AnimeList')
     self.animelist.setStyleSheet('#AnimeList{background:transparent}')
     self.animelist.setGeometry(200,165,310,350)
     self.animelist.setFont(QFont(fontName,11,QFont.Light))
     self.detail = Detail(self.x()+50,self.y()-15)
     self.detail_show = False
     self.animelist.itemDoubleClicked.connect(self.DetailBt)
     self.TimeLabels_path = []
     self.TimeLabels_clicked_path = []
     self.weekanime = TimeLine().get_week_anime()
     for time in range(1,8):
         self.TimeLabels_path.append('./source/pic/week_day_%d.png' % time)
         self.TimeLabels_clicked_path.append('./source/pic/week_day_%d_clicked.png' % time)
     self.TimeLabels = []
     for time in range(7):
         self.TimeLabels.append(QDlabel(self))
     self.setTimeLabel()
     self.daylabel = QLabel(self)
     self.daylabel.setObjectName('DayLabel')
     self.daylabel.setGeometry(290,110,200,40)
     self.daylabel.setFont(QFont(fontName,13,QFont.Bold))
     self.setDaytext()
     self.timelineshow = False
Exemple #4
0
class AnimeIndexWindow(QWidget):

    def __init__(self):
        super().__init__()
        anime_bk_pic_path = './source/pic/anime_bk.png'
        search_1_pic_path = './source/pic/next.png'
        search_2_pic_path = './source/pic/next_1.png'
        search_3_pic_path = './source/pic/next_2.png'
        hgzy_font_path = './source/font/HGZYT_CNKI.TTF'
        rem_ico_path = './source/pic/rem.png'
        self.pix = QPixmap(anime_bk_pic_path)
        self.resize(self.pix.width(),self.pix.height())
        self.pix = self.pix.scaled(int(self.pix.width()), int(self.pix.height()))
        self.setMask(self.pix.mask())
        screen = QDesktopWidget().screenGeometry()
        self.move((screen.width() - self.pix.width()) / 2, (screen.height() - self.pix.height()) / 2)
        self.setWindowFlags(Qt.FramelessWindowHint)  # | QtCore.Qt.WindowStaysOnTopHint
        self.setAttribute(Qt.WA_TranslucentBackground) # 窗口透明抗锯齿
        rem_icon = QIcon(QPixmap(rem_ico_path))
        self.setWindowIcon(rem_icon)
        self.m_DragPosition = None
        fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
        fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
        self.animelist = QDListWidget(self)
        self.animelist.setObjectName('AnimeListWidget')
        self.animelist.setGeometry(17,280,self.pix.width()-34,self.pix.height()-280-50)
        self.animelist.setStyleSheet('#AnimeListWidget{background:transparent;}')
        self.animelist.setFont(QFont(fontName,15,QFont.Light))
        self.animelist.setIconSize(QSize(100,100))
        self.InitData()
        ver = Version()
        self.version = QDLabel(self, ver.cur_link)
        self.version.setObjectName('VersionLabel')
        self.version.setGeometry(15, self.pix.height() - 75, 600, 100)
        self.version.setText('当前数据库版本号:' + ver.cur_version)
        if ver.judge_version():
            self.version.setToolTip('数据库为最新版本,无需更新')
        else:
            self.version.setToolTip('数据库版本已过期,请自行下载新数据库.(双击获取下载链接)')
        self.version.setFont(QFont(fontName,10,QFont.Light))
        self.search = QPushButton(self)
        self.search.setObjectName('Search')
        self.search.setStyleSheet("#Search{border-image: url(%s)}"
                                  "#Search:hover{border-image: url(%s)}" 
                                  "#Search:pressed{border-image: url(%s)}"
                                  % (search_1_pic_path,search_2_pic_path,search_3_pic_path))
        self.search.setGeometry(self.pix.width()-self.search.width(),self.pix.height()-self.search.height()-10
                                ,self.search.width()-20,self.search.height())
        self.choose = Choose(self.x()+self.width(),self.y()+self.height())
        self.choose_show = False
        self.choose_info = {}
        self.search.clicked.connect(self.SearchBt)
        self.detail = Detail(self.x(),self.y())
        self.detail_show = False
        self.animelist.itemDoubleClicked.connect(self.DetailBt)
        self.animelist.installEventFilter(self)
        self.rightclick = Rightclick()
        self.animeshow = False

    def paintEvent(self, event):
        paint = QPainter(self)
        paint.drawPixmap(0,0,self.pix.width(),self.pix.height(),self.pix)

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = event.globalPos() - self.pos()
            if self.choose_show == True:
                self.choose.raise_()
            if self.detail_show == True:
                self.detail.raise_()
            event.accept()
        elif event.button() == Qt.RightButton:
            if self.detail_show == True:
                self.detail.close()
                self.detail_show = False
            if self.choose_show == True:
                self.choose.close()
                self.choose_show = False
            self.hide()
            self.animeshow = False
            event.accept()

    def mouseMoveEvent(self, event):
        if Qt.LeftButton and self.m_drag:
            self.move(event.globalPos() - self.m_DragPosition)
            self.choose.move(self.x() + self.width(), self.y()+self.height()-self.choose.pix.height())
            self.detail.move(self.x()-self.detail.pix.width(),self.y())
            event.accept()

    def mouseReleaseEvent(self, event):
        self.m_drag = False

    def closeEvent(self, event):
        self.detail.close()
        self.detail_show = False
        self.choose.close()
        self.choose_show = False
        self.animeshow = False

    def InitData(self):
        dbsql = AnimeData()
        self.infos = dbsql.SqliteInfoSelect()
        self.animelist.clear()
        if self.infos:
            for info in self.infos:
                self.animelist.addItem(QListWidgetItem(QIcon('./source/pic/bili.png'), info[0]))

    def ChooseData(self):
        self.choose_info = {}
        title = self.choose.titletext.text()
        if title != '':
            self.choose_info['title'] = title
        order = self.choose.ordertext.text()
        if order != '':
            self.choose_info['order'] = int(order)
        index_show = ''
        index_season = self.choose.animecombo_season.currentText()
        index_year = self.choose.timetext.text()
        if index_year != '':
            index_show += index_year + '年'
        if index_season != '不筛选':
            index_show += index_season
        if index_show != '':
            self.choose_info['index_show'] = index_show
        novip = self.choose.animevip.checkState()
        if novip == 1:
            self.choose_info['vip'] = 1
        elif novip == 2:
            self.choose_info['vip'] = 0
        finish = self.choose.animefinish.checkState()
        if finish == 1:
            self.choose_info['finish'] = 0
        elif finish == 2:
            self.choose_info['finish'] = 1
        tags = []
        for i in range(3):
            tag = self.choose.animetags[i].currentText()
            if tag != '不筛选':
                tags.append(tag)
        if tags != []:
            self.choose_info['tag'] = tags

    def ShowData(self):
        dbsql = AnimeData()
        self.infos = dbsql.SqliteInfoSearch(self.choose_info)
        self.animelist.clear()
        if self.infos:
            for info in self.infos:
                self.animelist.addItem(QListWidgetItem(QIcon('./source/pic/bili.png'), info[0]))
        else:
            self.InitData()

    def SearchBt(self):
        if self.choose_show == False:
            self.choose.show()
            self.choose_show = True
        else:
            self.choose.close()
            self.ChooseData()
            self.ShowData()
            self.choose_show = False

    def GetDetail(self,title):
        dbsql = AnimeData()
        infos = dbsql.SqliteInfoSearch({'title':title})
        resinfo = []
        if infos:
            for info in infos:
                resinfo.append(info[0])
                resinfo.append(info[1])
                resinfo.append(info[2])
                resinfo.append(info[3])
                resinfo.append(info[4])
                resinfo.append(info[5])
                resinfo.append(info[6])
                resinfo.append(info[7])
        return resinfo

    def DelDetail(self):
        self.detail.animetitle.setParent(None)
        self.detail.animeintro.setParent(None)
        self.detail.animetags.setParent(None)
        self.detail.animeorder.setParent(None)
        self.detail.animeindexshow.setParent(None)
        self.detail.animeindexshowtext.setParent(None)
        self.detail.animetagstext.setParent(None)
        self.detail.animeordertext.setParent(None)
        self.detail.animetitletext.setParent(None)
        self.detail.animetagstext.setParent(None)
        self.detail.pic_label.setParent(None)

    def DetailBt(self):
        if self.detail_show == False:
            info = self.GetDetail(self.animelist.currentItem().text())
            self.animelist.index = self.animelist.currentIndex()
            self.detail.setInfo(info)
            self.detail.show()
            self.detail_show = True
        elif self.detail_show == True and self.animelist.index != self.animelist.currentIndex():
            self.detail.close()
            self.DelDetail()
            info = self.GetDetail(self.animelist.currentItem().text())
            self.animelist.index = self.animelist.currentIndex()
            self.detail.setInfo(info)
            self.detail.show()
        else:
            self.detail.close()
            self.DelDetail()
            self.animelist.index = -1
            self.detail_show = False
Exemple #5
0
class TimelineWindow(QWidget):

    def __init__(self):
        super().__init__()
        timeline_bk_path = './source/pic/timeline_bk.png'
        hgzy_font_path = './source/font/HGZYT_CNKI.TTF'
        rem_ico_path = './source/pic/rem.png'
        fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
        fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
        self.index = -1
        self.pix = QPixmap(timeline_bk_path)
        self.resize(self.pix.width(),self.pix.height())
        self.pix = self.pix.scaled(int(self.pix.width()),int(self.pix.height()))
        self.setMask(self.pix.mask())
        screen = QDesktopWidget().screenGeometry()
        self.move((screen.width() - self.pix.width()) / 2, (screen.height() - self.pix.height()) / 2)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setWindowFlags(Qt.FramelessWindowHint)
        rem_icon = QIcon(QPixmap(rem_ico_path))
        self.setWindowIcon(rem_icon)
        self.m_DragPosition = None
        self.m_drag = False
        self.animelist = QListWidget(self)
        self.animelist.setObjectName('AnimeList')
        self.animelist.setStyleSheet('#AnimeList{background:transparent}')
        self.animelist.setGeometry(200,165,310,350)
        self.animelist.setFont(QFont(fontName,11,QFont.Light))
        self.detail = Detail(self.x()+50,self.y()-15)
        self.detail_show = False
        self.animelist.itemDoubleClicked.connect(self.DetailBt)
        self.TimeLabels_path = []
        self.TimeLabels_clicked_path = []
        self.weekanime = TimeLine().get_week_anime()
        for time in range(1,8):
            self.TimeLabels_path.append('./source/pic/week_day_%d.png' % time)
            self.TimeLabels_clicked_path.append('./source/pic/week_day_%d_clicked.png' % time)
        self.TimeLabels = []
        for time in range(7):
            self.TimeLabels.append(QDlabel(self))
        self.setTimeLabel()
        self.daylabel = QLabel(self)
        self.daylabel.setObjectName('DayLabel')
        self.daylabel.setGeometry(290,110,200,40)
        self.daylabel.setFont(QFont(fontName,13,QFont.Bold))
        self.setDaytext()
        self.timelineshow = False

    def paintEvent(self, event):
        paint = QPainter(self)
        paint.drawPixmap(0,0,self.pix.width(),self.pix.height(),self.pix)

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = event.globalPos() - self.pos()
            if self.detail_show == True:
                self.detail.raise_()
            event.accept()
        elif event.button() == Qt.RightButton:
            if self.detail_show == True:
                self.detail.close()
                self.detail_show = False
            self.hide()
            self.timelineshow = False
            event.accept()

    def mouseMoveEvent(self, event):
        if Qt.LeftButton and self.m_drag:
            self.move(event.globalPos() - self.m_DragPosition)
            self.detail.move(self.x()+50 - self.detail.pix.width(),self.y()-15)
            event.accept()

    def mouseReleaseEvent(self, event):
        self.m_drag = False

    def closeEvent(self, event):
        self.detail.close()
        self.detail_show = False
        self.timelineshow = False

    def setTimeLabel(self):
        label_between = 60
        week_animes = self.weekanime
        start = week_animes[0]['day_of_week']-1
        for time in range(start,start+7):
            time_mod = time % 7
            self.TimeLabels[time_mod].setObjectName('DayLabel%d' % (time_mod+1))
            self.TimeLabels[time_mod].setStyleSheet('#DayLabel%d{border-image:url(%s)}' % (time_mod+1,self.TimeLabels_path[time_mod]))
            self.TimeLabels[time_mod].setGeometry(100,120 + label_between * (time-start),57,24)
        self.labelclick = week_animes[0]['day_of_week']
        self.TimeLabels[self.labelclick-1].setStyleSheet('#DayLabel%d{border-image:url(%s)}'
                                                         % (self.labelclick,self.TimeLabels_clicked_path[self.labelclick-1]))

    def setLabelClick(self, time_n):
        self.TimeLabels[self.labelclick-1].setStyleSheet(
            '#DayLabel%d{border-image:url(%s)}' % (self.labelclick, self.TimeLabels_path[self.labelclick-1]))
        self.TimeLabels[time_n].setStyleSheet('#DayLabel%d{border-image:url(%s)}'
                                                         % (time_n+1,self.TimeLabels_clicked_path[time_n]))

    def setDaytext(self):
        for animes in self.weekanime:
            if animes['day_of_week'] == self.labelclick:
                date = animes['date']
                day_of_week = self.labelclick
                self.animelist.clear()
                for anime in animes['seasons']:
                    item_text = ''
                    if anime['delay'] == 1:
                        item_text += anime['pub_time'] + ' ' + anime['delay_index'] + ' ' + anime['delay_reason'] + '\n' + anime['title']
                    else:
                        item_text += anime['pub_time'] + ' ' + anime['pub_index'] + '\n' + anime['title']
                    self.animelist.addItem(item_text)
                break
        week_day = ['周一','周二','周三','周四','周五','周六','周日']
        daytext = date + ' ' + week_day[day_of_week - 1]
        self.daylabel.setText(daytext)

    def GetDetail(self,title):
        dbsql = AnimeData()
        infos = dbsql.SqliteInfoSearch({'title':title})
        resinfo = []
        if infos:
            for info in infos:
                resinfo.append(info[0])
                resinfo.append(info[1])
                resinfo.append(info[2])
                resinfo.append(info[3])
                resinfo.append(info[4])
                resinfo.append(info[5])
                resinfo.append(info[6])
                resinfo.append(info[7])
        return resinfo

    def DelDetail(self):
        self.detail.animetitle.setParent(None)
        self.detail.animeintro.setParent(None)
        self.detail.animetags.setParent(None)
        self.detail.animeorder.setParent(None)
        self.detail.animeindexshow.setParent(None)
        self.detail.animeindexshowtext.setParent(None)
        self.detail.animetagstext.setParent(None)
        self.detail.animeordertext.setParent(None)
        self.detail.animetitletext.setParent(None)
        self.detail.animetagstext.setParent(None)
        self.detail.pic_label.setParent(None)

    def DetailBt(self):
        if self.detail_show == False:
            title = self.animelist.currentItem().text().split('\n')[1]
            info = self.GetDetail(title)
            self.detail.setInfo(info)
            self.index = self.animelist.currentIndex()
            self.detail.show()
            self.detail_show = True
        elif self.detail_show == True and self.index != self.animelist.currentIndex():
            self.detail.close()
            self.DelDetail()
            title = self.animelist.currentItem().text().split('\n')[1]
            info = self.GetDetail(title)
            self.index = self.animelist.currentIndex()
            self.detail.setInfo(info)
            self.detail.show()
        else:
            self.detail.close()
            self.DelDetail()
            self.index = -1
            self.detail_show = False