示例#1
0
    def resumeButtonPressed(self,button):
        self.resumeAction.setEnabled(False)
        selected_row_return = self.selectedRow()
        if selected_row_return != None:
            gid = self.download_table.item(selected_row_return , 8 ).text()
            download_status = self.download_table.item(selected_row_return , 1).text()
 
                
            if download_status == "paused" :
                answer = download.downloadUnpause(gid)
                if answer == 'None':
                    notifySend("Aria2 did not respond!","Try agian!",10000,'warning' , systemtray = self.system_tray_icon )



            else:
                new_download = DownloadLink(gid)
                self.threadPool.append(new_download)
                self.threadPool[len(self.threadPool) - 1].start()
                sleep(1)
                self.progressBarOpen(gid)




        else:
            self.statusbar.showMessage("Please select an item first!")
示例#2
0
    def resumeButtonPressed(self,button):
        selected_row_return = self.selectedRow()
        if selected_row_return != None:
            gid = self.download_table.item(selected_row_return , 8 ).text()
            download_status = self.download_table.item(selected_row_return , 1).text()
 
                
            if download_status == "paused" :
                answer = download.downloadUnpause(gid)
                if answer == 'None':
                    notifySend("Aria2 did not respond!","Try agian!",10000,'warning' )



            else:
                new_download = DownloadLink(gid)
                self.threadPool.append(new_download)
                self.threadPool[len(self.threadPool) - 1].start()
                sleep(1)
                self.progressBarOpen(gid)



        else:
            self.statusbar.showMessage("Please select an item first!")
示例#3
0
 def stopPushButtonPressed(self, button):
     answer = download.downloadStop(self.gid)
     if answer == 'None':
         notifySend("Aria2 did not respond!",
                    "Try agian!",
                    10000,
                    'critical',
                    systemtray=self.parent.system_tray_icon)
示例#4
0
 def pausePushButtonPressed(self, button):
     if self.status == "downloading":
         answer = download.downloadPause(self.gid)
         if answer == 'None':
             notifySend("Aria2 did not respond!",
                        "Try agian!",
                        10000,
                        'critical',
                        systemtray=self.parent.system_tray_icon)
示例#5
0
 def resumePushButtonPressed(self, button):
     if self.status == "paused":
         answer = download.downloadUnpause(self.gid)
         if answer == 'None':
             notifySend("Aria2 did not respond!",
                        "Try agian!",
                        10000,
                        'warning',
                        systemtray=self.parent.system_tray_icon)
示例#6
0
 def startAriaMessage(self,message):
     global aria_startup_answer
     if message == 'yes':
         sleep (2)
         self.statusbar.showMessage('Ready...')
         aria_startup_answer = 'ready'
     else:
         self.statusbar.showMessage('Error...')
         notifySend('Persepolis can not connect to Aria2' , 'Restart Persepolis' ,10000,'critical' , systemtray = self.system_tray_icon )
示例#7
0
 def startAriaMessage(self,message):
     global aria_startup_answer
     if message == 'yes':
         sleep (2)
         self.statusbar.showMessage('Ready...')
         aria_startup_answer = 'ready'
     else:
         self.statusbar.showMessage('Error...')
         notifySend('Persepolis can not connect to Aria2' , 'Restart Persepolis' ,10000,'critical' )
示例#8
0
    def pauseButtonPressed(self,button):
        selected_row_return = self.selectedRow()
        if selected_row_return != None:
            gid = self.download_table.item(selected_row_return , 8 ).text()
            answer = download.downloadPause(gid)
            if answer == 'None':
                notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' )

        else:
            self.statusbar.showMessage("Please select an item first!")
        sleep(1)
示例#9
0
 def openDefaultDownloadFolder(self,menu):
     f = Open(setting_file)
     setting_file_lines = f.readlines()
     f.close()
     setting_dict_str = str(setting_file_lines[0].strip())
     setting_dict = ast.literal_eval(setting_dict_str) 
     download_path = setting_dict ['download_path']
     if os.path.isdir(download_path):
         os.system("xdg-open '" + download_path + "'" )
     else:
         notifySend(str(download_path) ,'Not Found' , 5000 , 'warning' , systemtray = self.system_tray_icon )
示例#10
0
 def stopPushButtonPressed(self, button):
     answer = download.downloadStop(self.gid)
     #if aria2 did not respond , then this function is checking for aria2 availability , and if aria2 disconnected then aria2Disconnected is executed
     if answer == 'None':
         version_answer = download.aria2Version()
         if version_answer == 'did not respond':
             self.parent.aria2Disconnected()
             notifySend("Aria2 disconnected!",
                        "Persepolis is trying to connect!be patient!",
                        10000,
                        'warning',
                        systemtray=self.parent.system_tray_icon)
示例#11
0
    def pauseButtonPressed(self,button):
        self.pauseAction.setEnabled(False)
        selected_row_return = self.selectedRow()
        if selected_row_return != None:
            gid = self.download_table.item(selected_row_return , 8 ).text()
            answer = download.downloadPause(gid)
            if answer == 'None':
                notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' , systemtray = self.system_tray_icon )

        else:
            self.statusbar.showMessage("Please select an item first!")
        sleep(1)
示例#12
0
 def openFile(self,menu):
     selected_row_return = self.selectedRow()
     if selected_row_return != None:
         gid = self.download_table.item(selected_row_return , 8 ).text()
         download_status = self.download_table.item(selected_row_return , 1).text()
         if download_status == 'complete':
             add_link_dictionary_str = self.download_table.item(selected_row_return , 9).text() 
             add_link_dictionary = ast.literal_eval(add_link_dictionary_str) 
             if 'file_path' in add_link_dictionary:
                 file_path = add_link_dictionary['file_path']
                 if os.path.isfile(file_path):
                     os.system("xdg-open '" + file_path  + "' &" )
                 else:
                     notifySend(str(file_path) ,'Not Found' , 5000 , 'warning' , systemtray = self.system_tray_icon )
示例#13
0
    def pauseAllDownloads(self,menu):
#get active gid of downloads from aria
        active_gids = download.activeDownloads()
#check that if gid is in download_list_file_active
        f = Open(download_list_file_active)
        download_list_file_active_lines = f.readlines()
        f.close()
        for i in range(len(download_list_file_active_lines)):
            download_list_file_active_lines[i] = download_list_file_active_lines[i].strip()

        for gid in active_gids :
            if gid in download_list_file_active_lines :
                answer = download.downloadPause(gid)
                if answer == 'None':
                    notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' )

                sleep(0.3)
示例#14
0
    def stopAllDownloads(self,menu):
        active_gids = []
        for i in range(self.download_table.rowCount()):
            try:
                row_status = self.download_table.item(i , 1).text()
                if row_status == 'downloading' or row_status == 'paused' or row_status == 'waiting':
                    row_gid = self.download_table.item(i , 8).text()
                    active_gids.append(row_gid)
            except :
                pass
        for gid in active_gids:
            answer = download.downloadStop(gid)
            if answer == 'None':
                notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' , systemtray = self.system_tray_icon )


            sleep(0.3)
示例#15
0
    def pauseAllDownloads(self,menu):
#get active gid of downloads from aria
        active_gids = download.activeDownloads()
#check that if gid is in download_list_file_active
        f = Open(download_list_file_active)
        download_list_file_active_lines = f.readlines()
        f.close()
        for i in range(len(download_list_file_active_lines)):
            download_list_file_active_lines[i] = download_list_file_active_lines[i].strip()

        for gid in active_gids :
            if gid in download_list_file_active_lines :
                answer = download.downloadPause(gid)
                if answer == 'None':
                    notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' , systemtray = self.system_tray_icon )

                sleep(0.3)
示例#16
0
    def stopAllDownloads(self,menu):
        active_gids = []
        for i in range(self.download_table.rowCount()):
            try:
                row_status = self.download_table.item(i , 1).text()
                if row_status == 'downloading' or row_status == 'paused' or row_status == 'waiting':
                    row_gid = self.download_table.item(i , 8).text()
                    active_gids.append(row_gid)
            except :
                pass
        for gid in active_gids:
            answer = download.downloadStop(gid)
            if answer == 'None':
                notifySend("Aria2 did not respond!" , "Try agian!" , 10000 , 'critical' )


            sleep(0.3)
示例#17
0
 def pausePushButtonPressed(self, button):
     if self.status == "downloading":
         answer = download.downloadPause(self.gid)
         #if aria2 did not respond , then this function is checking for aria2 availability , and if aria2 disconnected then aria2Disconnected is executed
         if answer == 'None':
             version_answer = download.aria2Version()
             if version_answer == 'did not respond':
                 self.parent.aria2Disconnected()
                 download.downloadStop(self.gid)
                 notifySend("Aria2 disconnected!",
                            "Persepolis is trying to connect!be patient!",
                            10000,
                            'warning',
                            systemtray=self.parent.system_tray_icon)
             else:
                 notifySend("Aria2 did not respond!",
                            "Try agian!",
                            10000,
                            'critical',
                            systemtray=self.parent.system_tray_icon)
示例#18
0
    def deleteFile(self,menu):
        selected_row_return = self.selectedRow()
        global remove_flag
        remove_flag = 1
        while remove_flag != 2 :
            sleep(0.1)
#This section is checking the download status , if download was completed then download file is removing
        if selected_row_return != None:
            gid = self.download_table.item(selected_row_return , 8 ).text()
            download_status = self.download_table.item(selected_row_return , 1).text()
            if download_status == 'complete':
                add_link_dictionary_str = self.download_table.item(selected_row_return , 9).text() 
                add_link_dictionary = ast.literal_eval(add_link_dictionary_str) 
                if 'file_path' in add_link_dictionary:
                    file_path = add_link_dictionary['file_path']
                    if os.path.isfile(file_path):
                        os.system("rm '" + file_path  + "'" )
                    else:
                        notifySend(str(file_path) ,'Not Found' , 5000 , 'warning' , systemtray = self.system_tray_icon )
                    remove_flag = 3
                    self.removeButtonPressed(menu)
示例#19
0
    def callBack(self , add_link_dictionary):
        gid = self.gidGenerator()

        download_info_file_list = ['***','waiting','***','***','***','***','***','***',gid , add_link_dictionary]
        download_info_file = config_folder + "/download_info/" + gid
        os.system("touch " + download_info_file )
         
        writeList(download_info_file , download_info_file_list)
        
        self.download_table.insertRow(0)
        j = 0
        download_info_file_list[9] = str(download_info_file_list[9])
        for i in download_info_file_list :
            item = QTableWidgetItem(i)
            self.download_table.setItem(0,j,item)
            j = j + 1

        if self.selectAction.isChecked() == True:
            item = self.download_table.item(0 , 0)
            item.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
            item.setCheckState(QtCore.Qt.Unchecked)
 
        f = Open (download_list_file , "a")
        f.writelines(gid + "\n")
        f.close()


        f = Open (download_list_file_active , "a")
        f.writelines(gid + "\n")
        f.close()
        new_download = DownloadLink(gid)
        self.threadPool.append(new_download)
        self.threadPool[len(self.threadPool) - 1].start()
        self.progressBarOpen(gid) 
        if add_link_dictionary['start_hour'] == None :
            message = "Download Starts"
        else:
            message = "Download Scheduled"
        notifySend(message ,'' , 10000 , 'no', systemtray = self.system_tray_icon )
示例#20
0
    def callBack(self , add_link_dictionary):
        gid = self.gidGenerator()

        download_info_file_list = ['***','waiting','***','***','***','***','***','***',gid , str(add_link_dictionary)]
        download_info_file = config_folder + "/download_info/" + gid
        os.system("touch " + download_info_file )
        f = Open(download_info_file , "w")
        for i in range(10):
            f.writelines(download_info_file_list[i] + "\n")

        f.close()
        
        self.download_table.insertRow(0)
        j = 0
        for i in download_info_file_list :
            item = QTableWidgetItem(i)
            self.download_table.setItem(0,j,item)
            j = j + 1

        f = Open (download_list_file , "a")
        f.writelines(gid + "\n")
        f.close()


        f = Open (download_list_file_active , "a")
        f.writelines(gid + "\n")
        f.close()
        new_download = DownloadLink(gid)
        self.threadPool.append(new_download)
        self.threadPool[len(self.threadPool) - 1].start()
        self.progressBarOpen(gid) 
        if add_link_dictionary['start_hour'] == None :
            message = "Download Starts"
        else:
            message = "Download Scheduled"
        notifySend(message ,'' , 10000 , 'no')
示例#21
0
 def stopPushButtonPressed(self,button):
     answer = download.downloadStop(self.gid)
     if answer == 'None':
         notifySend("Aria2 did not respond!","Try agian!" , 10000 , 'critical' )
示例#22
0
 def pausePushButtonPressed(self,button):
     if self.status == "downloading":
         answer = download.downloadPause(self.gid)
         if answer == 'None':
             notifySend("Aria2 did not respond!","Try agian!" , 10000 , 'critical' )
示例#23
0
 def resumePushButtonPressed(self,button):
     if self.status == "paused":
         answer = download.downloadUnpause(self.gid)
         if answer == 'None':
             notifySend("Aria2 did not respond!","Try agian!",10000,'warning' )
示例#24
0
 def run(self):
     answer = download.downloadAria(self.gid)
     if answer == 'None':
         notifySend('Aria2 did not respond' , 'Try again' , 5000 , 'critical')
示例#25
0
    def checkDownloadInfo(self,gid):
        try:
#get download information from download_info_file according to gid and write them in download_table cells
            download_info_file = config_folder + "/download_info/" + gid
            f = Open(download_info_file)
            download_info_file_lines = f.readlines()
            f.close()
#finding row of this gid!
            for i in range(self.download_table.rowCount()):
                row_gid = self.download_table.item(i , 8).text()
                if gid == row_gid :
                    row = i 
                    break

            for i in range(10):
#remove gid of completed download from active downloads list file
                if i == 1 :
                    status = download_info_file_lines[i].strip()
                    status = str(status)
                    status_download_table = str(self.download_table.item(row , 1 ) . text())

                    if status == "complete":
                        f = Open(download_list_file_active)
                        download_list_file_active_lines = f.readlines()
                        f.close()
                        f = Open(download_list_file_active , "w")
                        for line in download_list_file_active_lines :
                            if line.strip() != gid :
                                f.writelines(line.strip() + "\n")
                        f.close()
                    
#update download_table cells
                item = QTableWidgetItem(download_info_file_lines[i].strip())
                self.download_table.setItem(row , i , item)
                self.download_table.viewport().update()
#update progresswindow
            try :
            
                member_number = self.progress_window_list_dict[gid]
                progress_window = self.progress_window_list[member_number]
                #link
                add_link_dictionary_str = str(download_info_file_lines[9].strip())
                add_link_dictionary = ast.literal_eval(add_link_dictionary_str) 
                link = "<b>Link</b> : " +  str(add_link_dictionary ['link'])
                progress_window.link_label.setText(link)
                progress_window.setToolTip(link)

                #Save as
                final_download_path = add_link_dictionary['final_download_path']
                if final_download_path == None :
                    final_download_path = str(add_link_dictionary['download_path'])
                        
                save_as = "<b>Save as</b> : " + final_download_path + "/" + str(download_info_file_lines[0].strip())
                progress_window.save_label.setText(save_as)
                file_name = str(download_info_file_lines[0].strip())
                if file_name != "***":
                    progress_window.setWindowTitle(file_name ) 

                #status
                progress_window.status = download_info_file_lines[1].strip()
                status = "<b>status</b> : " + progress_window.status 
                progress_window.status_label.setText(status)
                if progress_window.status == "downloading":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(True)
                elif progress_window.status == "paused":
                    progress_window.resume_pushButton.setEnabled(True)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "waiting":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(False)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "scheduled":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "stopped" or progress_window.status == "error" or progress_window.status == "complete" :
                    progress_window.close()
                    self.progress_window_list[member_number] = []
                    del self.progress_window_list_dict[gid]
                    if progress_window.status == "complete":
                        notifySend("Download Complete" ,str(download_info_file_lines[0])  , 10000 , 'ok' )
                    elif progress_window.status == "stopped":
                        notifySend("Download Stopped" , str(download_info_file_lines[0]) , 10000 , 'no')

                    elif progress_window.status == "error":
                        notifySend("Download Error" , str(download_info_file_lines[0]) , 10000 , 'fail')
               
                        add_link_dictionary['start_hour'] = None
                        add_link_dictionary['start_minute'] = None
                        add_link_dictionary['end_hour'] = None
                        add_link_dictionary['end_minute'] = None
                        add_link_dictionary['after_download'] = 'None'

                        f = Open(download_info_file , "w")
                        for i in range(10):
                            if i == 9 :
                                f.writelines(str(add_link_dictionary) + "\n")
                            else:
                                f.writelines(download_info_file_lines[i].strip() + "\n")

                        f.close()
                    
                    if os.path.isfile('/tmp/persepolis/shutdown/' + gid ) == True and progress_window.status != 'stopped':
                        answer = download.shutDown()
                        if answer == 'error':
                            os.system('killall aria2c')
                        f = Open('/tmp/persepolis/shutdown/' + gid , 'w')
                        f.writelines('shutdown')
                        f.close()
                    elif os.path.isfile('/tmp/persepolis/shutdown/' + gid ) == True and progress_window.status == 'stopped':
                        f = Open('/tmp/persepolis/shutdown/' + gid , 'w')
                        f.writelines('canceled')
                        f.close()



             
                #downloaded
                downloaded = "<b>Downloaded</b> : " + str(download_info_file_lines[3].strip()) + "/" + str(download_info_file_lines[2].strip())
                progress_window.downloaded_label.setText(downloaded)

                #Transfer rate
                rate = "<b>Transfer rate</b> : " + str(download_info_file_lines[6].strip())
                progress_window.rate_label.setText(rate)

                #Estimate time left
                estimate_time_left = "<b>Estimate time left</b> : " + str(download_info_file_lines[7].strip()) 
                progress_window.time_label.setText(estimate_time_left)

                #Connections
                connections = "<b>Connections</b> : " + str(download_info_file_lines[5].strip())
                progress_window.connections_label.setText(connections)


                #progressbar
                value = download_info_file_lines[4].strip()
                value = value[:-1]
                progress_window.download_progressBar.setValue(int(value))
            except :
                pass
        except:
            pass
示例#26
0
    def deleteSelected(self,menu):
        global remove_flag
        remove_flag = 1
        while remove_flag != 2 :
            sleep(0.1)

        gid_list = []
        for row in range(self.download_table.rowCount()):
            status = self.download_table.item(row , 1).text() 
            item = self.download_table.item(row , 0)
            if (item.checkState() == 2) and (status == 'complete' or status == 'error' or status == 'stopped' ):
                gid = self.download_table.item(row , 8 ).text()
                gid_list.append(gid)


        for gid in gid_list:        
            for i in range(self.download_table.rowCount()):
                row_gid = self.download_table.item(i , 8).text()
                if gid == row_gid :
                    row = i 
                    break
            file_name = self.download_table.item(row , 0).text()
            add_link_dictionary_str = self.download_table.item(row , 9).text() 
            add_link_dictionary = ast.literal_eval(add_link_dictionary_str) 


            sleep(0.5)
            self.download_table.removeRow(row)
#remove gid of download from download list file
            f = Open(download_list_file)
            download_list_file_lines = f.readlines()
            f.close()
            f = Open(download_list_file , "w")
            for i in download_list_file_lines:
                if i.strip() != gid:
                    f.writelines(i.strip() + "\n")
            f.close()
#remove gid of download from active download list file
            f = Open(download_list_file_active)
            download_list_file_active_lines = f.readlines()
            f.close()
            f = Open(download_list_file_active , "w")
            for i in download_list_file_active_lines:
                if i.strip() != gid:
                    f.writelines(i.strip() + "\n")
            f.close()


#remove download_info_file
            download_info_file = download_info_folder + "/" + gid
            f = Open(download_info_file)
            f.close()
            f.remove()

#remove file of download form download temp folder
            if file_name != '***' and status != 'complete' :
                file_name_path = temp_download_folder + "/" +  str(file_name)
                os.system('rm "' + str(file_name_path) +'"')
                file_name_aria = file_name_path + str('.aria2')
                os.system('rm "' + str(file_name_aria) +'"')

#remove download file
            if status == 'complete':
                if 'file_path' in add_link_dictionary:
                    file_path = add_link_dictionary['file_path']
                    if os.path.isfile(file_path):
                        os.system("rm '" + file_path  + "'" )
                    else:
                        notifySend(str(file_path) ,'Not Found' , 5000 , 'warning' , systemtray = self.system_tray_icon )

        remove_flag = 0
示例#27
0
 def run(self):
     answer = download.downloadAria(self.gid)
     if answer == 'None':
         notifySend('Aria2 did not respond' , 'Try again' , 5000 , 'critical' , systemtray = self.system_tray_icon )
示例#28
0
    def checkDownloadInfo(self,gid):
        try:

#get download information from download_info_file according to gid and write them in download_table cells
            download_info_file = config_folder + "/download_info/" + gid
            download_info_file_list = readList(download_info_file)
            download_info_file_list_string = readList(download_info_file ,'string')
#finding row of this gid!
            for i in range(self.download_table.rowCount()):
                row_gid = self.download_table.item(i , 8).text()
                if gid == row_gid :
                    row = i 
                    break

            for i in range(10):
#check flag of download!
#It's showing that selection mode is active or not!
                if i == 0 :
                    flag = int(self.download_table.item(row , i).flags())

#remove gid of completed download from active downloads list file
                elif i == 1 :
                    status = str(download_info_file_list[i])
                    status_download_table = str(self.download_table.item(row , 1 ) . text())
                    if status == "complete":
                        f = Open(download_list_file_active)
                        download_list_file_active_lines = f.readlines()
                        f.close()
                        f = Open(download_list_file_active , "w")
                        for line in download_list_file_active_lines :
                            if line.strip() != gid :
                                f.writelines(line.strip() + "\n")
                        f.close()
                    
#update download_table cells
                item = QTableWidgetItem(download_info_file_list_string[i])
#48 means that item is checkable and enabled
                if i == 0 and flag == 48:
                    item.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
                    if self.download_table.item(row , i).checkState() == 2:
                        item.setCheckState(QtCore.Qt.Checked)
                    else:
                        item.setCheckState(QtCore.Qt.Unchecked)


                self.download_table.setItem(row , i , item)
                self.download_table.viewport().update()
#update progresswindow
            try :

#finding progress_window for gid            
                member_number = self.progress_window_list_dict[gid]
                progress_window = self.progress_window_list[member_number]
                #link
                add_link_dictionary = download_info_file_list[9]
                link = "<b>Link</b> : " +  str(add_link_dictionary ['link'])
                progress_window.link_label.setText(link)
                progress_window.link_label.setToolTip(link)

                #Save as
                final_download_path = add_link_dictionary['final_download_path']
                if final_download_path == None :
                    final_download_path = str(add_link_dictionary['download_path'])
                        
                save_as = "<b>Save as</b> : " + final_download_path + "/" + str(download_info_file_list[0])
                progress_window.save_label.setText(save_as)
                progress_window.save_label.setToolTip(save_as)

                #status
                progress_window.status = download_info_file_list[1]
                status = "<b>Status</b> : " + progress_window.status 
                progress_window.status_label.setText(status)
                if progress_window.status == "downloading":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(True)
                elif progress_window.status == "paused":
                    progress_window.resume_pushButton.setEnabled(True)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "waiting":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "scheduled":
                    progress_window.resume_pushButton.setEnabled(False)
                    progress_window.stop_pushButton.setEnabled(True)
                    progress_window.pause_pushButton.setEnabled(False)
                elif progress_window.status == "stopped" or progress_window.status == "error" or progress_window.status == "complete" :
#close progress_window if download status is stopped or completed or error
                    progress_window.close()
                    self.progress_window_list[member_number] = []
                    del self.progress_window_list_dict[gid]
                    if progress_window.status == "stopped":
                        notifySend("Download Stopped" , str(download_info_file_list[0]) , 10000 , 'no', systemtray = self.system_tray_icon )

                    elif progress_window.status == "error":
                        notifySend("Error - " + add_link_dictionary['error'] , str(download_info_file_list[0]) , 10000 , 'fail', systemtray = self.system_tray_icon )
               
                        add_link_dictionary['start_hour'] = None
                        add_link_dictionary['start_minute'] = None
                        add_link_dictionary['end_hour'] = None
                        add_link_dictionary['end_minute'] = None
                        add_link_dictionary['after_download'] = 'None'

                        for i in range(10):
                            if i == 9 :
                                download_info_file_list[i] = add_link_dictionary
                                
                        download_info_file_list[9] = add_link_dictionary 
                        writeList(download_info_file , download_info_file_list )


#this section is sending shutdown signal to the shutdown script(if user select shutdown for after download)
                    if os.path.isfile('/tmp/persepolis/shutdown/' + gid ) == True and progress_window.status != 'stopped':
                        answer = download.shutDown()
#KILL aria2c if didn't respond
                        if answer == 'error':
                            os.system('killall aria2c')
                        f = Open('/tmp/persepolis/shutdown/' + gid , 'w')
                        notifySend('Persepolis is shutting down','your system in 20 seconds' , 15000 ,'warning', systemtray = self.system_tray_icon )
                        f.writelines('shutdown')
                        f.close()
                    elif os.path.isfile('/tmp/persepolis/shutdown/' + gid ) == True and progress_window.status == 'stopped':
                        f = Open('/tmp/persepolis/shutdown/' + gid , 'w')
                        f.writelines('canceled')
                        f.close()

#showing download compelete dialog
#check user's Preferences
                    f = Open(setting_file)
                    setting_file_lines = f.readlines()
                    f.close()
                    setting_dict_str = str(setting_file_lines[0].strip())
                    setting_dict = ast.literal_eval(setting_dict_str) 
 
                    if progress_window.status == "complete" and setting_dict['after-dialog'] == 'yes' :
                        afterdownloadwindow = AfterDownloadWindow(download_info_file_list,setting_file)
                        self.afterdownload_list.append(afterdownloadwindow)
                        self.afterdownload_list[len(self.afterdownload_list) - 1].show()
                    elif progress_window.status == "complete" and setting_dict['after-dialog'] == 'no' :
                        notifySend("Download Complete" ,str(download_info_file_list[0])  , 10000 , 'ok' , systemtray = self.system_tray_icon )



             
                #downloaded
                downloaded = "<b>Downloaded</b> : " + str(download_info_file_list[3]) + "/" + str(download_info_file_list[2])
                progress_window.downloaded_label.setText(downloaded)

                #Transfer rate
                rate = "<b>Transfer rate</b> : " + str(download_info_file_list[6])
                progress_window.rate_label.setText(rate)

                #Estimate time left
                estimate_time_left = "<b>Estimate time left</b> : " + str(download_info_file_list[7]) 
                progress_window.time_label.setText(estimate_time_left)

                #Connections
                connections = "<b>Connections</b> : " + str(download_info_file_list[5])
                progress_window.connections_label.setText(connections)


                #progressbar
                value = download_info_file_list[4]
                file_name = str(download_info_file_list[0])
                if file_name != "***":
                    windows_title = '(' + str(value) + ')' +  str(file_name)
                    progress_window.setWindowTitle(windows_title) 

                value = value[:-1]
                progress_window.download_progressBar.setValue(int(value))



            except :
                pass

        except:
            pass