def __init__(self, download_info_file_list, setting_file): super().__init__() self.download_info_file_list = download_info_file_list self.setting_file = setting_file #connecting buttons self.open_pushButtun.clicked.connect(self.openFile) self.open_folder_pushButtun.clicked.connect(self.openFolder) self.ok_pushButton.clicked.connect(self.okButtonPressed) #labels add_link_dictionary = self.download_info_file_list[9] final_download_path = add_link_dictionary['final_download_path'] save_as = final_download_path + "/" + str( self.download_info_file_list[0]) self.save_as_lineEdit.setText(save_as) self.save_as_lineEdit.setToolTip(save_as) link = str(add_link_dictionary['link']) self.link_lineEdit.setText(link) self.link_lineEdit.setToolTip(link) file_name = "<b>File name</b> : " + str( self.download_info_file_list[0]) self.file_name_label.setText(file_name) self.setWindowTitle(str(self.download_info_file_list[0])) size = "<b>Size</b> : " + str(download_info_file_list[2]) self.size_label.setText(size) #play notifications playNotification('notifications/ok.ogg')
def notifySend(message1, message2, time, sound, systemtray=None): if sound == 'ok': playNotification('notifications/ok.ogg') elif sound == 'fail': playNotification('notifications/fail.ogg') elif sound == 'warning': playNotification('notifications/you.ogg') elif sound == 'critical': playNotification('notifications/connection.ogg') 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) enable_notification = str(setting_dict['notification']) time = str(time) message1 = str(message1) message2 = str(message2) #using Qt notification or Native system notification if enable_notification == 'QT notification': systemtray.showMessage(message1, message2, 1, 10000) else: os.system( "notify-send --icon='persepolis' --app-name='Persepolis Download Manager' --expire-time='" + time + "' '" + message1 + "' \ '" + message2 + "' ")
def __init__(self, download_info_file_list, persepolis_setting): super().__init__(persepolis_setting) self.persepolis_setting = persepolis_setting self.download_info_file_list = download_info_file_list # connecting buttons self.open_pushButtun.clicked.connect(self.openFile) self.open_folder_pushButtun.clicked.connect(self.openFolder) self.ok_pushButton.clicked.connect(self.okButtonPressed) # labels add_link_dictionary = self.download_info_file_list[9] final_download_path = add_link_dictionary['final_download_path'] save_as = final_download_path + "/" + \ str(self.download_info_file_list[0]) self.save_as_lineEdit.setText(save_as) self.save_as_lineEdit.setToolTip(save_as) link = str(add_link_dictionary['link']) self.link_lineEdit.setText(link) self.link_lineEdit.setToolTip(link) file_name = "<b>File name</b> : " + \ str(self.download_info_file_list[0]) self.file_name_label.setText(file_name) self.setWindowTitle(str(self.download_info_file_list[0])) size = "<b>Size</b> : " + str(download_info_file_list[2]) self.size_label.setText(size) # play notifications playNotification('notifications/ok.ogg') # disabling link_lineEdit and save_as_lineEdit self.link_lineEdit.setEnabled(False) self.save_as_lineEdit.setEnabled(False) # setting window size and position size = self.persepolis_setting.value( 'AfterDownloadWindow/size', QSize(570, 290)) position = self.persepolis_setting.value( 'AfterDownloadWindow/position', QPoint(300, 300)) self.resize(size) self.move(position)
def notifySend(message1, message2, time, sound, systemtray=None): if sound == 'ok': playNotification('notifications/ok.ogg') elif sound == 'fail': playNotification('notifications/fail.ogg') elif sound == 'warning': playNotification('notifications/you.ogg') elif sound == 'critical': playNotification('notifications/connection.ogg') elif sound == 'queue': playNotification('notifications/queue.ogg') # load settings persepolis_setting = QSettings('persepolis_download_manager', 'persepolis') enable_notification = persepolis_setting.value('settings/notification') time = str(time) message1 = str(message1) message2 = str(message2) # using Qt notification or Native system notification if enable_notification == 'QT notification': systemtray.showMessage(message1, message2, 0, 10000) else: if os_type == 'Linux' or os_type == 'FreeBSD' or os_type == 'OpenBSD': os.system( "notify-send --icon='persepolis' --app-name='Persepolis Download Manager' --expire-time='" + time + "' '" + message1 + "' \ '" + message2 + "' ") elif os_type == 'Darwin': from mac_notification import notifyMac notifyMac("Persepolis Download Manager", message1, message2) elif os_type == 'Windows': systemtray.showMessage(message1, message2, 0, 10000)