def defaultsPushButtonPressed(self, button): self.persepolis_setting.beginGroup('settings') self.setting_dict = returnDefaultSettings() self.tries_spinBox.setValue(int(self.setting_dict['max-tries'])) self.wait_spinBox.setValue(int(self.setting_dict['retry-wait'])) self.time_out_spinBox.setValue(int(self.setting_dict['timeout'])) self.connections_spinBox.setValue(int( self.setting_dict['connections'])) self.rpc_port_spinbox.setValue(int(self.setting_dict['rpc-port'])) self.aria2_path_lineEdit.setText('') self.aria2_path_checkBox.setChecked(False) # wait-queue wait_queue_list = self.setting_dict['wait-queue'] q_time = QTime(wait_queue_list[0], wait_queue_list[1]) self.wait_queue_time.setTime(q_time) # save_as_tab self.download_folder_lineEdit.setText( str(self.setting_dict['download_path'])) self.temp_download_lineEdit.setText( str(self.setting_dict['download_path_temp'])) self.subfolder_checkBox.setChecked(True) # notifications_tab self.volume_label.setText('Volume : ' + str(self.setting_dict['sound-volume'])) self.volume_dial.setValue(int(self.setting_dict['sound-volume'])) # set style current_style_index = self.style_comboBox.findText( str(self.setting_dict['style'])) self.style_comboBox.setCurrentIndex(current_style_index) # set language current_locale = self.lang_comboBox.findData( str(self.setting_dict['locale'])) self.lang_comboBox.setCurrentIndex(current_locale) # set color_scheme current_color_index = self.color_comboBox.findText( str(self.setting_dict['color-scheme'])) self.color_comboBox.setCurrentIndex(current_color_index) # set icons current_icons_index = self.icon_comboBox.findText( str(self.setting_dict['icons'])) self.icon_comboBox.setCurrentIndex(current_icons_index) # set icons size current_icons_size_index = self.icons_size_comboBox.findText( str(self.setting_dict['toolbar_icon_size'])) self.icons_size_comboBox.setCurrentIndex(current_icons_size_index) # set notification current_notification_index = self.notification_comboBox.findText( str(self.setting_dict['notification'])) self.notification_comboBox.setCurrentIndex(current_notification_index) # set font self.font_checkBox.setChecked(False) font_setting = QFont() font_setting.setFamily(str(self.setting_dict['font'])) self.fontComboBox.setCurrentFont(font_setting) self.font_size_spinBox.setValue(int(self.setting_dict['font-size'])) # sound frame self.enable_notifications_checkBox.setChecked(True) # start_persepolis_if_browser_executed_checkBox self.start_persepolis_if_browser_executed_checkBox.setChecked(True) # hide window self.hide_window_checkBox.setChecked(True) # tray icon self.enable_system_tray_checkBox.setChecked(True) # after_download_checkBox self.after_download_checkBox.setChecked(True) # hide menubar for linux if platform.system == 'Darwin': self.show_menubar_checkbox.setChecked(True) else: self.show_menubar_checkbox.setChecked(False) # show side panel self.show_sidepanel_checkbox.setChecked(True) # show progress window self.show_progress_window_checkbox.setChecked(True) # run persepolis at startup checkBox self.startup_checkbox.setChecked(False) # keep_awake_checkBox self.keep_awake_checkBox.setChecked(False) # columns_tab self.column0_checkBox.setChecked(True) self.column1_checkBox.setChecked(True) self.column2_checkBox.setChecked(True) self.column3_checkBox.setChecked(True) self.column4_checkBox.setChecked(True) self.column5_checkBox.setChecked(True) self.column6_checkBox.setChecked(True) self.column7_checkBox.setChecked(True) self.column10_checkBox.setChecked(True) self.column11_checkBox.setChecked(True) self.column12_checkBox.setChecked(True) # video finder self.max_links_spinBox.setValue(3) # shortcuts self.shortcuts_list = [ self.setting_dict['shortcuts/quit_shortcut'], self.setting_dict['shortcuts/hide_window_shortcut'], self.setting_dict['shortcuts/remove_shortcut'], self.setting_dict['shortcuts/delete_shortcut'], self.setting_dict['shortcuts/move_up_selection_shortcut'], self.setting_dict['shortcuts/move_down_selection_shortcut'], self.setting_dict['shortcuts/add_new_download_shortcut'], self.setting_dict['shortcuts/video_finder_shortcut'], self.setting_dict['shortcuts/import_text_shortcut'] ] # add shortcuts to the shortcut_table j = 0 for shortcut in self.shortcuts_list: item = QTableWidgetItem(shortcut) # align center item.setTextAlignment(0x0004 | 0x0080) # insert item in shortcut_table self.shortcut_table.setItem(j, 1, item) j = j + 1 self.persepolis_setting.endGroup()
# delete old links plugins_db.deleteOldLinks() # close connections plugins_db.closeConnections() # import persepolis_setting # persepolis is using QSettings for saving windows size and windows # position and program settings. persepolis_setting = QSettings('persepolis_download_manager', 'persepolis') persepolis_setting.beginGroup('settings') default_setting_dict = returnDefaultSettings() # this loop is checking values in persepolis_setting . if value is not # valid then value replaced by default_setting_dict value for key in default_setting_dict.keys(): setting_value = persepolis_setting.value(key, default_setting_dict[key]) persepolis_setting.setValue(key, setting_value) # download files is downloading in temporary folder(download_path_temp) and then they will be moved to user download folder(download_path) after completion. # Check that mount point is available of not! if not(os.path.exists(persepolis_setting.value('download_path_temp'))): persepolis_setting.setValue('download_path_temp', default_setting_dict['download_path_temp']) if not(os.path.exists(persepolis_setting.value('download_path'))): persepolis_setting.setValue('download_path', default_setting_dict['download_path'])
# delete old links plugins_db.deleteOldLinks() # close connections plugins_db.closeConnections() # import persepolis_setting # persepolis is using QSettings for saving windows size and windows # position and program settings. persepolis_setting = QSettings('persepolis_download_manager', 'persepolis') persepolis_setting.beginGroup('settings') default_setting_dict = returnDefaultSettings() # this loop is checking values in persepolis_setting . if value is not # valid then value replaced by default_setting_dict value for key in default_setting_dict.keys(): setting_value = persepolis_setting.value(key, default_setting_dict[key]) persepolis_setting.setValue(key, setting_value) # download files is downloading in temporary folder(download_path_temp) and then they will be moved to user download folder(download_path) after completion. # Check that mount point is available of not! if not(os.path.exists(persepolis_setting.value('download_path_temp'))): persepolis_setting.setValue('download_path_temp', default_setting_dict['download_path_temp']) if not(os.path.exists(persepolis_setting.value('download_path'))): persepolis_setting.setValue('download_path', default_setting_dict['download_path'])
def defaultsPushButtonPressed(self, button): self.persepolis_setting.beginGroup('settings') self.setting_dict = returnDefaultSettings() self.tries_spinBox.setValue(int(self.setting_dict['max-tries'])) self.wait_spinBox.setValue(int(self.setting_dict['retry-wait'])) self.time_out_spinBox.setValue(int(self.setting_dict['timeout'])) self.connections_spinBox.setValue( int(self.setting_dict['connections'])) self.rpc_port_spinbox.setValue(int(self.setting_dict['rpc-port'])) self.aria2_path_lineEdit.setText('') self.aria2_path_checkBox.setChecked(False) # wait-queue wait_queue_list = self.setting_dict['wait-queue'] q_time = QTime(wait_queue_list[0], wait_queue_list[1]) self.wait_queue_time.setTime(q_time) # save_as_tab self.download_folder_lineEdit.setText( str(self.setting_dict['download_path'])) self.temp_download_lineEdit.setText( str(self.setting_dict['download_path_temp'])) self.subfolder_checkBox.setChecked(True) # notifications_tab self.volume_label.setText( 'Volume : ' + str(self.setting_dict['sound-volume'])) self.volume_dial.setValue(int(self.setting_dict['sound-volume'])) # set style current_style_index = self.style_comboBox.findText( str(self.setting_dict['style'])) self.style_comboBox.setCurrentIndex(current_style_index) # set language current_locale = self.lang_comboBox.findData( str(self.setting_dict['locale'])) self.lang_comboBox.setCurrentIndex(current_locale) # set color_scheme current_color_index = self.color_comboBox.findText( str(self.setting_dict['color-scheme'])) self.color_comboBox.setCurrentIndex(current_color_index) # set icons current_icons_index = self.icon_comboBox.findText( str(self.setting_dict['icons'])) self.icon_comboBox.setCurrentIndex(current_icons_index) # set icons size current_icons_size_index = self.icons_size_comboBox.findText( str(self.setting_dict['toolbar_icon_size'])) self.icons_size_comboBox.setCurrentIndex(current_icons_size_index) # set notification current_notification_index = self.notification_comboBox.findText( str(self.setting_dict['notification'])) self.notification_comboBox.setCurrentIndex(current_notification_index) # set font self.font_checkBox.setChecked(False) font_setting = QFont() font_setting.setFamily(str(self.setting_dict['font'])) self.fontComboBox.setCurrentFont(font_setting) self.font_size_spinBox.setValue(int(self.setting_dict['font-size'])) # sound frame self.enable_notifications_checkBox.setChecked(True) # tray icon self.enable_system_tray_checkBox.setChecked(True) # after_download_checkBox self.after_download_checkBox.setChecked(True) # hide menubar for linux if platform.system == 'Darwin': self.show_menubar_checkbox.setChecked(True) else: self.show_menubar_checkbox.setChecked(False) # show side panel self.show_sidepanel_checkbox.setChecked(True) # show progress window self.show_progress_window_checkbox.setChecked(True) # run persepolis at startup checkBox self.startup_checkbox.setChecked(False) # keep_awake_checkBox self.keep_awake_checkBox.setChecked(False) # columns_tab self.column0_checkBox.setChecked(True) self.column1_checkBox.setChecked(True) self.column2_checkBox.setChecked(True) self.column3_checkBox.setChecked(True) self.column4_checkBox.setChecked(True) self.column5_checkBox.setChecked(True) self.column6_checkBox.setChecked(True) self.column7_checkBox.setChecked(True) self.column10_checkBox.setChecked(True) self.column11_checkBox.setChecked(True) self.column12_checkBox.setChecked(True) # video finder self.enable_video_finder_checkbox.setChecked(True) self.hide_no_audio_checkbox.setChecked(True) self.hide_no_video_checkbox.setChecked(True) self.max_links_spinBox.setValue(3) self.persepolis_setting.endGroup()