def callBack(self, keys): # do nothing if keys is empty if not (keys): return # check that if shortcut used before. if keys in self.shortcuts_list: self.msgBox = QMessageBox() self.msgBox.setText( QCoreApplication.translate( "setting_src_ui_tr", "<b><center>This shortcut has been used before!\ Use another one!</center></b>")) self.msgBox.setIcon(QMessageBox.Warning) reply = self.msgBox.exec_() # set new shortcut else: selected_row = self.shortcut_table.selectionModel().selectedRows( )[0].row() item = QTableWidgetItem(keys) # align center item.setTextAlignment(0x0004 | 0x0080) # insert item in shortcut_table self.shortcut_table.setItem(selected_row, 1, item) # set keys in shortcuts_list self.shortcuts_list[selected_row] = keys
def insertItem(self, index, data): """ insert at index a Row with data data """ self.table.setRowCount(index + 1) # Nummer item = QTableWidgetItem(str(index + 1)) item.setTextAlignment(Qt.AlignCenter) self.table.setItem(index, 0, item) self.table.setItem(index, 1, QTableWidgetItem(data[1])) self.table.setItem(index, 2, QTableWidgetItem(data[2])) self.table.setItem(index, 3, QTableWidgetItem(data[3])) return index + 1
def buscar(self): nome_buscado = self.entry_nome.text() data = self.db.busca(nome_buscado) self.limpar() self.status_signal.emit("Feito") for cliente in data: nome = QTableWidgetItem(cliente['nome']) numero = QTableWidgetItem(cliente['numero']) cpf = QTableWidgetItem(cliente['cpf']) endereco = QTableWidgetItem(cliente['endereco']) nome.setTextAlignment(Qt.AlignCenter) numero.setTextAlignment(Qt.AlignCenter) cpf.setTextAlignment(Qt.AlignCenter) endereco.setTextAlignment(Qt.AlignCenter) self.tabela_clientes.insertRow(self.clientes) self.tabela_clientes.setItem(self.clientes, 0, nome) self.tabela_clientes.setItem(self.clientes, 1, numero) self.tabela_clientes.setItem(self.clientes, 2, cpf) self.tabela_clientes.setItem(self.clientes, 3, endereco) self.clientes += 1
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) # dont_check_certificate_checkBox self.dont_check_certificate_checkBox.setChecked(False) # 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()
def __init__(self, parent, persepolis_setting): super().__init__(persepolis_setting) self.persepolis_setting = persepolis_setting self.parent = parent self.grandparent = parent.persepolis_main self.persepolis_setting.beginGroup('settings') # initialization self.tries_spinBox.setValue( int(self.persepolis_setting.value('max-tries'))) self.wait_spinBox.setValue( int(self.persepolis_setting.value('retry-wait'))) self.time_out_spinBox.setValue( int(self.persepolis_setting.value('timeout'))) self.connections_spinBox.setValue( int(self.persepolis_setting.value('connections'))) self.rpc_port_spinbox.setValue( int(self.persepolis_setting.value('rpc-port'))) if str(self.persepolis_setting.value( 'dont-check-certificate')) == 'yes': self.dont_check_certificate_checkBox.setChecked(True) else: self.dont_check_certificate_checkBox.setChecked(False) # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # wait_queue wait_queue_list = self.persepolis_setting.value('wait-queue') try: q_time = QTime(int(wait_queue_list[0]), int(wait_queue_list[1])) except: q_time = QTime(0, 0) self.wait_queue_time.setTime(q_time) # change aria2 path self.aria2_path_pushButton.clicked.connect(self.changeAria2Path) self.aria2_path_checkBox.toggled.connect(self.ariaCheckBoxToggled) aria2_path = self.persepolis_setting.value('settings/aria2_path') self.aria2_path_lineEdit.setEnabled(False) if aria2_path != None: self.aria2_path_checkBox.setChecked(True) self.aria2_path_lineEdit.setText(str(aria2_path)) self.ariaCheckBoxToggled('aria2') if os_type in OS.UNIX_LIKE: for widget in self.aria2_path_checkBox, self.aria2_path_lineEdit, self.aria2_path_pushButton: widget.hide() # save_as_tab self.download_folder_lineEdit.setText( str(self.persepolis_setting.value('download_path'))) self.temp_download_lineEdit.setText( str(self.persepolis_setting.value('download_path_temp'))) # subfolder if str(self.persepolis_setting.value('subfolder')) == 'yes': self.subfolder_checkBox.setChecked(True) else: self.subfolder_checkBox.setChecked(False) # notifications_tab self.volume_label.setText( 'Volume : ' + str(self.persepolis_setting.value('sound-volume'))) self.volume_dial.setValue( int(self.persepolis_setting.value('sound-volume'))) # set style # find available styles(It's depends on operating system and desktop environments). available_styles = QStyleFactory.keys() for style in available_styles: # 'bb10dark', 'GTK', 'gtk' styles may cause to crashing! Eliminate them! style_black_list = ['bb10dark', 'bb10bright', 'GTK', 'gtk', 'gtk2'] if style not in style_black_list: self.style_comboBox.addItem(style) # System >> for system default style # when user select System for style section, the default system style is using. self.style_comboBox.addItem('System') current_style_index = self.style_comboBox.findText( str(self.persepolis_setting.value('style'))) if current_style_index != -1: self.style_comboBox.setCurrentIndex(current_style_index) # available language available_language = [ 'en_US', 'fa_IR', 'ar', 'zh_CN', 'fr_FR', 'pl_PL', 'nl_NL', 'pt_BR', 'es_ES', 'hu', 'tr', 'tr_TR' ] for lang in available_language: self.lang_comboBox.addItem(str(QLocale(lang).nativeLanguageName()), lang) current_locale = self.lang_comboBox.findData( str(self.persepolis_setting.value('locale'))) self.lang_comboBox.setCurrentIndex(current_locale) self.current_icon = self.persepolis_setting.value('icons') # icon size size = ['128', '64', '48', '32', '24', '16'] self.icons_size_comboBox.addItems(size) current_icons_size_index = self.icons_size_comboBox.findText( str(self.persepolis_setting.value('toolbar_icon_size'))) self.icons_size_comboBox.setCurrentIndex(current_icons_size_index) # call setDarkLightIcon if index is changed self.icons_size_comboBox.currentIndexChanged.connect( self.setDarkLightIcon) # set notification notifications = ['Native notification', 'QT notification'] self.notification_comboBox.addItems(notifications) current_notification_index = self.notification_comboBox.findText( str(self.persepolis_setting.value('notification'))) self.notification_comboBox.setCurrentIndex(current_notification_index) # set font font_setting = QFont() font_setting.setFamily(str(self.persepolis_setting.value('font'))) self.fontComboBox.setCurrentFont(font_setting) self.font_size_spinBox.setValue( int(self.persepolis_setting.value('font-size'))) # sound frame self.sound_frame.setEnabled(False) self.enable_notifications_checkBox.toggled.connect(self.soundFrame) if str(self.persepolis_setting.value('sound')) == 'yes': self.enable_notifications_checkBox.setChecked(True) else: self.enable_notifications_checkBox.setChecked(False) # connect folder buttons self.download_folder_lineEdit.setEnabled(False) self.download_folder_pushButton.clicked.connect( self.downloadFolderPushButtonClicked) self.temp_download_lineEdit.setEnabled(False) self.temp_download_pushButton.clicked.connect( self.tempDownloadPushButtonClicked) # dial self.volume_dial.setNotchesVisible(True) self.volume_dial.valueChanged.connect(self.dialChanged) # start_persepolis_if_browser_executed_checkBox if str(self.persepolis_setting.value('browser-persepolis')) == 'yes': self.start_persepolis_if_browser_executed_checkBox.setChecked(True) else: self.start_persepolis_if_browser_executed_checkBox.setChecked( False) # hide window if str(self.persepolis_setting.value('hide-window')) == 'yes': self.hide_window_checkBox.setChecked(True) else: self.hide_window_checkBox.setChecked(False) # tray icon if str(self.persepolis_setting.value('tray-icon')) == 'yes': self.enable_system_tray_checkBox.setChecked(True) else: self.enable_notifications_checkBox.setChecked(False) # show_menubar if str(self.persepolis_setting.value('show-menubar')) == 'yes': self.show_menubar_checkbox.setChecked(True) else: self.show_menubar_checkbox.setChecked(False) if platform.system() == 'Darwin': self.show_menubar_checkbox.setChecked(True) self.show_menubar_checkbox.hide() # show_sidepanel if str(self.persepolis_setting.value('show-sidepanel')) == 'yes': self.show_sidepanel_checkbox.setChecked(True) else: self.show_sidepanel_checkbox.setChecked(False) # show ProgressWindow if str(self.persepolis_setting.value('show-progress')) == 'yes': self.show_progress_window_checkbox.setChecked(True) else: self.show_progress_window_checkbox.setChecked(False) # after download dialog if str(self.persepolis_setting.value('after-dialog')) == 'yes': self.after_download_checkBox.setChecked(True) else: self.after_download_checkBox.setChecked(False) # run persepolis at startup checkBox if str(self.persepolis_setting.value('startup')) == 'yes': self.startup_checkbox.setChecked(True) else: self.startup_checkbox.setChecked(False) # font_checkBox if str(self.persepolis_setting.value('custom-font')) == 'yes': self.font_checkBox.setChecked(True) else: self.font_checkBox.setChecked(False) self.fontCheckBoxState(self.font_checkBox) # keep_awake_checkBox if str(self.persepolis_setting.value('awake')) == 'yes': self.keep_awake_checkBox.setChecked(True) else: self.keep_awake_checkBox.setChecked(False) # columns_tab if str(self.persepolis_setting.value('column0')) == 'yes': self.column0_checkBox.setChecked(True) else: self.column0_checkBox.setChecked(False) if str(self.persepolis_setting.value('column1')) == 'yes': self.column1_checkBox.setChecked(True) else: self.column1_checkBox.setChecked(False) if str(self.persepolis_setting.value('column2')) == 'yes': self.column2_checkBox.setChecked(True) else: self.column2_checkBox.setChecked(False) if str(self.persepolis_setting.value('column3')) == 'yes': self.column3_checkBox.setChecked(True) else: self.column3_checkBox.setChecked(False) if str(self.persepolis_setting.value('column4')) == 'yes': self.column4_checkBox.setChecked(True) else: self.column4_checkBox.setChecked(False) if str(self.persepolis_setting.value('column5')) == 'yes': self.column5_checkBox.setChecked(True) else: self.column5_checkBox.setChecked(False) if str(self.persepolis_setting.value('column6')) == 'yes': self.column6_checkBox.setChecked(True) else: self.column6_checkBox.setChecked(False) if str(self.persepolis_setting.value('column7')) == 'yes': self.column7_checkBox.setChecked(True) else: self.column7_checkBox.setChecked(False) if str(self.persepolis_setting.value('column10')) == 'yes': self.column10_checkBox.setChecked(True) else: self.column10_checkBox.setChecked(False) if str(self.persepolis_setting.value('column11')) == 'yes': self.column11_checkBox.setChecked(True) else: self.column11_checkBox.setChecked(False) if str(self.persepolis_setting.value('column12')) == 'yes': self.column12_checkBox.setChecked(True) else: self.column12_checkBox.setChecked(False) # video_finder try: # Integer casting may raise exception. self.max_links_spinBox.setValue( int(persepolis_setting.value('video_finder/max_links', 3))) except: pass # shortcuts self.qshortcuts_list = [ self.parent.exitAction_shortcut, self.parent.minimizeAction_shortcut, self.parent.removeSelectedAction_shortcut, self.parent.deleteSelectedAction_shortcut, self.parent.moveUpSelectedAction_shortcut, self.parent.moveDownSelectedAction_shortcut, self.parent.addlinkAction_shortcut, self.parent.videoFinderAddLinkAction_shortcut, self.parent.addtextfileAction_shortcut ] self.shortcuts_list = [ self.parent.exitAction_shortcut.key().toString(), self.parent.minimizeAction_shortcut.key().toString(), self.parent.removeSelectedAction_shortcut.key().toString(), self.parent.deleteSelectedAction_shortcut.key().toString(), self.parent.moveUpSelectedAction_shortcut.key().toString(), self.parent.moveDownSelectedAction_shortcut.key().toString(), self.parent.addlinkAction_shortcut.key().toString(), self.parent.videoFinderAddLinkAction_shortcut.key().toString(), self.parent.addtextfileAction_shortcut.key().toString() ] # 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 # If user doubleclicks on a row, then run showCaptureKeyboardWindow method self.shortcut_table.itemDoubleClicked.connect( self.showCaptureKeyboardWindow) # ok cancel default button self.cancel_pushButton.clicked.connect(self.close) self.defaults_pushButton.clicked.connect( self.defaultsPushButtonPressed) self.ok_pushButton.clicked.connect(self.okPushButtonPressed) # font_checkBox connect self.font_checkBox.stateChanged.connect(self.fontCheckBoxState) # saving initial value of self.persepolis_setting in self.first_key_value_dict # at the end! in the okPushButtonPressed method, first_key_value_dict will compared with second_key_value_dict. # if any thing changed , then a message box notify user about "some changes take effect after restarting persepolis". self.first_key_value_dict = {} for member in self.persepolis_setting.allKeys(): self.first_key_value_dict[member] = str( self.persepolis_setting.value(member)) # if style_comboBox is changed, self.styleComboBoxChanged is called. self.style_comboBox.currentIndexChanged.connect( self.styleComboBoxChanged) self.styleComboBoxChanged() self.color_comboBox.currentIndexChanged.connect(self.setDarkLightIcon) self.persepolis_setting.endGroup() # setting window size and position size = self.persepolis_setting.value('PreferencesWindow/size', QSize(578, 565)) position = self.persepolis_setting.value('PreferencesWindow/position', QPoint(300, 300)) self.resize(size) self.move(position)
def __init__(self, persepolis_setting): super().__init__() icon = QIcon() self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle( QCoreApplication.translate("setting_ui_tr", 'Preferences')) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) global icons icons = ':/' + str( self.persepolis_setting.value('settings/icons')) + '/' # main layout window_verticalLayout = QVBoxLayout(self) # setting_tabWidget self.setting_tabWidget = QTabWidget(self) # download_options_tab self.download_options_tab = QWidget() download_options_tab_verticalLayout = QVBoxLayout( self.download_options_tab) download_options_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # tries tries_horizontalLayout = QHBoxLayout() self.tries_label = QLabel(self.download_options_tab) tries_horizontalLayout.addWidget(self.tries_label) self.tries_spinBox = QSpinBox(self.download_options_tab) self.tries_spinBox.setMinimum(1) tries_horizontalLayout.addWidget(self.tries_spinBox) download_options_tab_verticalLayout.addLayout(tries_horizontalLayout) # wait wait_horizontalLayout = QHBoxLayout() self.wait_label = QLabel(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_label) self.wait_spinBox = QSpinBox(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_spinBox) download_options_tab_verticalLayout.addLayout(wait_horizontalLayout) # time_out time_out_horizontalLayout = QHBoxLayout() self.time_out_label = QLabel(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_label) self.time_out_spinBox = QSpinBox(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_spinBox) download_options_tab_verticalLayout.addLayout( time_out_horizontalLayout) # connections connections_horizontalLayout = QHBoxLayout() self.connections_label = QLabel(self.download_options_tab) connections_horizontalLayout.addWidget(self.connections_label) self.connections_spinBox = QSpinBox(self.download_options_tab) self.connections_spinBox.setMinimum(1) self.connections_spinBox.setMaximum(16) connections_horizontalLayout.addWidget(self.connections_spinBox) download_options_tab_verticalLayout.addLayout( connections_horizontalLayout) # rpc_port self.rpc_port_label = QLabel(self.download_options_tab) self.rpc_horizontalLayout = QHBoxLayout() self.rpc_horizontalLayout.addWidget(self.rpc_port_label) self.rpc_port_spinbox = QSpinBox(self.download_options_tab) self.rpc_port_spinbox.setMinimum(1024) self.rpc_port_spinbox.setMaximum(65535) self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox) download_options_tab_verticalLayout.addLayout( self.rpc_horizontalLayout) # wait_queue wait_queue_horizontalLayout = QHBoxLayout() self.wait_queue_label = QLabel(self.download_options_tab) wait_queue_horizontalLayout.addWidget(self.wait_queue_label) self.wait_queue_time = MyQDateTimeEdit(self.download_options_tab) self.wait_queue_time.setDisplayFormat('H:mm') wait_queue_horizontalLayout.addWidget(self.wait_queue_time) download_options_tab_verticalLayout.addLayout( wait_queue_horizontalLayout) # don't check certificate checkBox self.dont_check_certificate_checkBox = QCheckBox( self.download_options_tab) download_options_tab_verticalLayout.addWidget( self.dont_check_certificate_checkBox) # change aria2 path aria2_path_verticalLayout = QVBoxLayout() self.aria2_path_checkBox = QCheckBox(self.download_options_tab) aria2_path_verticalLayout.addWidget(self.aria2_path_checkBox) aria2_path_horizontalLayout = QHBoxLayout() self.aria2_path_lineEdit = QLineEdit(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_lineEdit) self.aria2_path_pushButton = QPushButton(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_pushButton) aria2_path_verticalLayout.addLayout(aria2_path_horizontalLayout) download_options_tab_verticalLayout.addLayout( aria2_path_verticalLayout) download_options_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.download_options_tab, "") # save_as_tab self.save_as_tab = QWidget() save_as_tab_verticalLayout = QVBoxLayout(self.save_as_tab) save_as_tab_verticalLayout.setContentsMargins(20, 30, 0, 0) # download_folder self.download_folder_horizontalLayout = QHBoxLayout() self.download_folder_label = QLabel(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_label) self.download_folder_lineEdit = QLineEdit(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_lineEdit) self.download_folder_pushButton = QPushButton(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_pushButton) save_as_tab_verticalLayout.addLayout( self.download_folder_horizontalLayout) # temp_download_folder self.temp_horizontalLayout = QHBoxLayout() self.temp_download_label = QLabel(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_label) self.temp_download_lineEdit = QLineEdit(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit) self.temp_download_pushButton = QPushButton(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_pushButton) save_as_tab_verticalLayout.addLayout(self.temp_horizontalLayout) # create subfolder self.subfolder_checkBox = QCheckBox(self.save_as_tab) save_as_tab_verticalLayout.addWidget(self.subfolder_checkBox) save_as_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.save_as_tab, "") # notifications_tab self.notifications_tab = QWidget() notification_tab_verticalLayout = QVBoxLayout(self.notifications_tab) notification_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) self.enable_notifications_checkBox = QCheckBox(self.notifications_tab) notification_tab_verticalLayout.addWidget( self.enable_notifications_checkBox) self.sound_frame = QFrame(self.notifications_tab) self.sound_frame.setFrameShape(QFrame.StyledPanel) self.sound_frame.setFrameShadow(QFrame.Raised) verticalLayout = QVBoxLayout(self.sound_frame) self.volume_label = QLabel(self.sound_frame) verticalLayout.addWidget(self.volume_label) self.volume_dial = QDial(self.sound_frame) self.volume_dial.setProperty("value", 100) verticalLayout.addWidget(self.volume_dial) notification_tab_verticalLayout.addWidget(self.sound_frame) # message_notification message_notification_horizontalLayout = QHBoxLayout() self.notification_label = QLabel(self.notifications_tab) message_notification_horizontalLayout.addWidget( self.notification_label) self.notification_comboBox = QComboBox(self.notifications_tab) message_notification_horizontalLayout.addWidget( self.notification_comboBox) notification_tab_verticalLayout.addLayout( message_notification_horizontalLayout) notification_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.notifications_tab, "") # style_tab self.style_tab = QWidget() style_tab_verticalLayout = QVBoxLayout(self.style_tab) style_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # style style_horizontalLayout = QHBoxLayout() self.style_label = QLabel(self.style_tab) style_horizontalLayout.addWidget(self.style_label) self.style_comboBox = QComboBox(self.style_tab) style_horizontalLayout.addWidget(self.style_comboBox) style_tab_verticalLayout.addLayout(style_horizontalLayout) # language language_horizontalLayout = QHBoxLayout() self.lang_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.lang_label) self.lang_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.lang_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) language_horizontalLayout = QHBoxLayout() self.lang_label.setText( QCoreApplication.translate("setting_ui_tr", "Language: ")) # color scheme self.color_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.color_label) self.color_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.color_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) # icons icons_horizontalLayout = QHBoxLayout() self.icon_label = QLabel(self.style_tab) icons_horizontalLayout.addWidget(self.icon_label) self.icon_comboBox = QComboBox(self.style_tab) icons_horizontalLayout.addWidget(self.icon_comboBox) style_tab_verticalLayout.addLayout(icons_horizontalLayout) self.icons_size_horizontalLayout = QHBoxLayout() self.icons_size_label = QLabel(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_label) self.icons_size_comboBox = QComboBox(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_comboBox) style_tab_verticalLayout.addLayout(self.icons_size_horizontalLayout) # font font_horizontalLayout = QHBoxLayout() self.font_checkBox = QCheckBox(self.style_tab) font_horizontalLayout.addWidget(self.font_checkBox) self.fontComboBox = QFontComboBox(self.style_tab) font_horizontalLayout.addWidget(self.fontComboBox) self.font_size_label = QLabel(self.style_tab) font_horizontalLayout.addWidget(self.font_size_label) self.font_size_spinBox = QSpinBox(self.style_tab) self.font_size_spinBox.setMinimum(1) font_horizontalLayout.addWidget(self.font_size_spinBox) style_tab_verticalLayout.addLayout(font_horizontalLayout) self.setting_tabWidget.addTab(self.style_tab, "") window_verticalLayout.addWidget(self.setting_tabWidget) # start persepolis in system tray if browser executed self.start_persepolis_if_browser_executed_checkBox = QCheckBox( self.style_tab) style_tab_verticalLayout.addWidget( self.start_persepolis_if_browser_executed_checkBox) # hide window if close button clicked self.hide_window_checkBox = QCheckBox(self.style_tab) style_tab_verticalLayout.addWidget(self.hide_window_checkBox) # Enable system tray icon self.enable_system_tray_checkBox = QCheckBox(self.style_tab) style_tab_verticalLayout.addWidget(self.enable_system_tray_checkBox) # after_download dialog self.after_download_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.after_download_checkBox) # show_menubar_checkbox self.show_menubar_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_menubar_checkbox) # show_sidepanel_checkbox self.show_sidepanel_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_sidepanel_checkbox) # hide progress window self.show_progress_window_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_progress_window_checkbox) # add persepolis to startup self.startup_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.startup_checkbox) # keep system awake self.keep_awake_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.keep_awake_checkBox) style_tab_verticalLayout.addStretch(1) # columns_tab self.columns_tab = QWidget() columns_tab_verticalLayout = QVBoxLayout(self.columns_tab) columns_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # creating checkBox for columns self.show_column_label = QLabel() self.column0_checkBox = QCheckBox() self.column1_checkBox = QCheckBox() self.column2_checkBox = QCheckBox() self.column3_checkBox = QCheckBox() self.column4_checkBox = QCheckBox() self.column5_checkBox = QCheckBox() self.column6_checkBox = QCheckBox() self.column7_checkBox = QCheckBox() self.column10_checkBox = QCheckBox() self.column11_checkBox = QCheckBox() self.column12_checkBox = QCheckBox() columns_tab_verticalLayout.addWidget(self.show_column_label) columns_tab_verticalLayout.addWidget(self.column0_checkBox) columns_tab_verticalLayout.addWidget(self.column1_checkBox) columns_tab_verticalLayout.addWidget(self.column2_checkBox) columns_tab_verticalLayout.addWidget(self.column3_checkBox) columns_tab_verticalLayout.addWidget(self.column4_checkBox) columns_tab_verticalLayout.addWidget(self.column5_checkBox) columns_tab_verticalLayout.addWidget(self.column6_checkBox) columns_tab_verticalLayout.addWidget(self.column7_checkBox) columns_tab_verticalLayout.addWidget(self.column10_checkBox) columns_tab_verticalLayout.addWidget(self.column11_checkBox) columns_tab_verticalLayout.addWidget(self.column12_checkBox) columns_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.columns_tab, '') # video_finder_tab self.video_finder_tab = QWidget() video_finder_layout = QVBoxLayout(self.video_finder_tab) video_finder_layout.setContentsMargins(21, 21, 0, 0) video_finder_tab_verticalLayout = QVBoxLayout() max_links_horizontalLayout = QHBoxLayout() # max_links_label self.max_links_label = QLabel(self.video_finder_tab) max_links_horizontalLayout.addWidget(self.max_links_label) # max_links_spinBox self.max_links_spinBox = QSpinBox(self.video_finder_tab) self.max_links_spinBox.setMinimum(1) self.max_links_spinBox.setMaximum(16) max_links_horizontalLayout.addWidget(self.max_links_spinBox) video_finder_tab_verticalLayout.addLayout(max_links_horizontalLayout) self.video_finder_dl_path_horizontalLayout = QHBoxLayout() self.video_finder_frame = QFrame(self.video_finder_tab) self.video_finder_frame.setLayout(video_finder_tab_verticalLayout) video_finder_tab_verticalLayout.addStretch(1) video_finder_layout.addWidget(self.video_finder_frame) self.setting_tabWidget.addTab(self.video_finder_tab, "") # shortcut tab self.shortcut_tab = QWidget() shortcut_tab_verticalLayout = QVBoxLayout(self.shortcut_tab) shortcut_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # shortcut_table self.shortcut_table = QTableWidget(self) self.shortcut_table.setColumnCount(2) self.shortcut_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.shortcut_table.setSelectionMode(QAbstractItemView.SingleSelection) self.shortcut_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.shortcut_table.verticalHeader().hide() shortcut_table_header = [ QCoreApplication.translate("setting_ui_tr", 'Action'), QCoreApplication.translate("setting_ui_tr", 'Shortcut') ] self.shortcut_table.setHorizontalHeaderLabels(shortcut_table_header) shortcut_tab_verticalLayout.addWidget(self.shortcut_table) self.setting_tabWidget.addTab( self.shortcut_tab, QCoreApplication.translate("setting_ui_tr", "Shortcuts")) # Actions actions_list = [ QCoreApplication.translate('setting_ui_tr', 'Quit'), QCoreApplication.translate('setting_ui_tr', 'Minimize to System Tray'), QCoreApplication.translate('setting_ui_tr', 'Remove Download Items'), QCoreApplication.translate('setting_ui_tr', 'Delete Download Items'), QCoreApplication.translate('setting_ui_tr', 'Move Selected Items Up'), QCoreApplication.translate('setting_ui_tr', 'Move Selected Items Down'), QCoreApplication.translate('setting_ui_tr', 'Add New Download Link'), QCoreApplication.translate('setting_ui_tr', 'Add New Video Link'), QCoreApplication.translate('setting_ui_tr', 'Import Links from Text File') ] # add actions to the shortcut_table j = 0 for action in actions_list: item = QTableWidgetItem(str(action)) # align center item.setTextAlignment(0x0004 | 0x0080) # insert item in shortcut_table self.shortcut_table.insertRow(j) self.shortcut_table.setItem(j, 0, item) j = j + 1 self.shortcut_table.resizeColumnsToContents() # window buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) self.defaults_pushButton = QPushButton(self) buttons_horizontalLayout.addWidget(self.defaults_pushButton) self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # set style_tab for default self.setting_tabWidget.setCurrentIndex(3) # labels and translations self.setWindowTitle( QCoreApplication.translate("setting_ui_tr", "Preferences")) self.tries_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>" )) self.tries_label.setText( QCoreApplication.translate("setting_ui_tr", "Number of tries: ")) self.tries_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>" )) self.wait_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>" )) self.wait_label.setText( QCoreApplication.translate( "setting_ui_tr", "Wait period between retries (seconds): ")) self.wait_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>" )) self.time_out_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>" )) self.time_out_label.setText( QCoreApplication.translate("setting_ui_tr", "Timeout (seconds): ")) self.time_out_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>" )) self.connections_label.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>" )) self.connections_label.setText( QCoreApplication.translate("setting_ui_tr", "Number of connections: ")) self.connections_spinBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>" )) self.rpc_port_label.setText( QCoreApplication.translate("setting_ui_tr", "RPC port number: ")) self.rpc_port_spinbox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>" )) self.wait_queue_label.setText( QCoreApplication.translate( "setting_ui_tr", 'Wait period between each download in queue:')) self.dont_check_certificate_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Don't use certificate to verify the peers")) self.dont_check_certificate_checkBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>This option avoids SSL/TLS handshake failure. But use it at your own risk!</p></body></html>" )) self.aria2_path_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Change Aria2 default path')) self.aria2_path_pushButton.setText( QCoreApplication.translate("setting_ui_tr", 'Change')) aria2_path_tooltip = QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Attention: Wrong path may cause problems! Do it carefully or don't change default setting!</p></body></html>" ) self.aria2_path_checkBox.setToolTip(aria2_path_tooltip) self.aria2_path_lineEdit.setToolTip(aria2_path_tooltip) self.aria2_path_pushButton.setToolTip(aria2_path_tooltip) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.download_options_tab), QCoreApplication.translate("setting_ui_tr", "Download Options")) self.download_folder_label.setText( QCoreApplication.translate("setting_ui_tr", "Download folder: ")) self.download_folder_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Change")) self.temp_download_label.setText( QCoreApplication.translate("setting_ui_tr", "Temporary download folder: ")) self.temp_download_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Change")) self.subfolder_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Create subfolders for Music,Videos, ... in default download folder" )) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.save_as_tab), QCoreApplication.translate("setting_ui_tr", "Save As")) self.enable_notifications_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Enable Notification Sounds")) self.volume_label.setText( QCoreApplication.translate("setting_ui_tr", "Volume: ")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.notifications_tab), QCoreApplication.translate("setting_ui_tr", "Notifications")) self.style_label.setText( QCoreApplication.translate("setting_ui_tr", "Style: ")) self.color_label.setText( QCoreApplication.translate("setting_ui_tr", "Color scheme: ")) self.icon_label.setText( QCoreApplication.translate("setting_ui_tr", "Icons: ")) self.icons_size_label.setText( QCoreApplication.translate("setting_ui_tr", "Toolbar icons size: ")) self.notification_label.setText( QCoreApplication.translate("setting_ui_tr", "Notification type: ")) self.font_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Font: ")) self.font_size_label.setText( QCoreApplication.translate("setting_ui_tr", "Size: ")) self.hide_window_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Hide main window if close button clicked.")) self.hide_window_checkBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>This feature may not work in your operating system.</p></body></html>" )) self.start_persepolis_if_browser_executed_checkBox.setText( QCoreApplication.translate( 'setting_ui_tr', 'If browser is opened, start Persepolis in system tray')) self.enable_system_tray_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Enable system tray icon")) self.after_download_checkBox.setText( QCoreApplication.translate( "setting_ui_tr", "Show download complete dialog when download is finished")) self.show_menubar_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show menubar")) self.show_sidepanel_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show side panel")) self.show_progress_window_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show download progress window")) self.startup_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Run Persepolis at startup")) self.keep_awake_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Keep system awake!")) self.keep_awake_checkBox.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>This option will prevent the system from going to sleep.\ It is necessary if your power manager is suspending the system automatically. </p></body></html>" )) self.wait_queue_time.setToolTip( QCoreApplication.translate( "setting_ui_tr", "<html><head/><body><p>Format HH:MM</p></body></html>")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.style_tab), QCoreApplication.translate("setting_ui_tr", "Preferences")) # columns_tab self.show_column_label.setText( QCoreApplication.translate("setting_ui_tr", 'Show these columns:')) self.column0_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'File Name')) self.column1_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Status')) self.column2_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Size')) self.column3_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Downloaded')) self.column4_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Percentage')) self.column5_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Connections')) self.column6_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Transfer Rate')) self.column7_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Estimated Time Left')) self.column10_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'First Try Date')) self.column11_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Last Try Date')) self.column12_checkBox.setText( QCoreApplication.translate("setting_ui_tr", 'Category')) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.columns_tab), QCoreApplication.translate("setting_ui_tr", "Columns Customization")) # Video Finder options tab self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.video_finder_tab), QCoreApplication.translate("setting_ui_tr", "Video Finder Options")) self.max_links_label.setText( QCoreApplication.translate( "setting_ui_tr", 'Maximum number of links to capture:<br/>' '<small>(If browser sends multiple video links at a time)</small>' )) # window buttons self.defaults_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Defaults")) self.cancel_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Cancel")) self.ok_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "OK"))