def _save(self): settings = Settings() settings.remove('ProtocolHandlers') settings.beginGroup('ProtocalHandlers') for key, val in self._protocolHandlers.items(): settings.setValue(key, val) settings.endGroup()
def _saveSettings(self): settings = Settings() settings.beginGroup('HTML5Notifications') for enumType, name in self.s_settingList: grantedName = '%sGranted' % name deniedName = '%sDenied' % name settings.setValue(grantedName, self._granted[enumType]) settings.setValue(deniedName, self._denied[enumType]) settings.endGroup()
def loadSettings(self): settings = Settings() settings.beginGroup('Cookie-Settings') self._allowCookies = settings.value('allowCookies', True) self._filterThirdParty = settings.value('filterThirdPartyCookies', False) self._filterTrackingCookie = settings.value('filterTrackingCookie', False) self._whitelist = settings.value('whitelist', []) self._blacklist = settings.value('blacklist', []) settings.endGroup()
def _saveSettings(self): settings = Settings() settings.beginGroup('Bookmarks') settings.setValue('showOnlyIconsInToolbar', self._showOnlyIconsInToolbar) settings.setValue('showOnlyTextInToolbar', self._showOnlyTextInToolbar) settings.endGroup() self._saveBookmarks()
def _resetToDefaults(self): settings = Settings() settings.beginGroup('NavigationBar') settings.remove('Layout') settings.remove('ShowSearchBar') settings.endGroup() windows = gVar.app.windows() for window in windows: window.navigationBar()._loadSettings()
def closeEvent(self, event): ''' @param: event QCloseEvent ''' settings = Settings() settings.beginGroup('BrowsingLibrary') settings.setValue('size', self.size()) settings.setValue('historySize', self._historyManager.saveState()) settings.endGroup() event.accept()
def getSaveFileName(self, name, parent=None, caption='', dir_='', filter_='', selectedFilter='', options=QFileDialog.Options()): ''' @param: name QString @param: parent QWidget @param: caption QString @param: dir_ QString @param: filter_ QString @param: selectedFilter QString TODO: this is an output parameter @param: options QFileDialog::Options @return: QString ''' settings = Settings() settings.beginGroup('FileDialogPaths') lastDir = settings.value(name, '') fileName = self.getFileName(dir_) if not lastDir: lastDir = dir_ else: lastDir = pathjoin(lastDir, fileName) path, selectedFilter = QFileDialog.getSaveFileName(parent, caption, lastDir, filter_, selectedFilter, options) if path: settings.setValue(name, QFileInfo(path).absolutePath()) settings.endGroup() return path
def _saveSettings(self): settings = Settings() settings.beginGroup('HTML5Notifications') for enumType, name in HTML5PermissionsManager.s_settingList: grantedName = '%sGranted' % name deniedName = '%sDenied' % name settings.setValue(grantedName, self._granted[enumType]) settings.setValue(deniedName, self._denied[enumType]) settings.endGroup() gVar.app.html5PermissionsManager().loadSettings()
def _saveSettings(self): ids = [] for idx in range(self._ui.currentItems.count()): ids.append(self._ui.currentItems.item(idx).data(Qt.UserRole + 10)) settings = Settings() settings.beginGroup('NavigationBar') settings.setValue('Layout', ids) settings.setValue('ShowSearchBar', self._ui.showSearchBar.isChecked()) settings.endGroup() windows = gVar.app.windows() for window in windows: window.navigationBar()._loadSettings()
def saveSettings(self): sessionDir = QDir(DataPaths.path(DataPaths.Sessions)) settings = Settings() settings.beginGroup('Web-Browser-Settings') settings.setValue('lastActiveSessionPath', sessionDir.relativeFilePath(self._lastActiveSessionPath)) settings.endGroup()
def _loadSettings(self): settings = Settings() settings.beginGroup('AddressBar') self._progressStyle = settings.value('ProgressStyle', 0) customColor = settings.value('UseCustomProgressColor', False) if customColor: self._progressColor = settings.value( 'CustomProgressColor', self.palette().color(QPalette.Highlight)) else: self._progressColor = QColor() settings.endGroup()
def _loadSettings(self): settings = Settings() settings.beginGroup('HTML5Notifications') for enumType, name in HTML5PermissionsManager.s_settingList: grantedName = '%sGranted' % name deniedName = '%sDenied' % name self._granted[enumType] = settings.value(grantedName, []) self._denied[enumType] = settings.value(deniedName, []) settings.endGroup()
def _init(self): settings = Settings() settings.beginGroup('ProtocolHandlers') keys = settings.childKeys() for scheme in keys: url = settings.value(scheme, type=QUrl) self._protocolHandlers[scheme] = url self._registerHandler(scheme, url) settings.endGroup()
def save(self): currentItem = self._ui.listWidget.currentItem() if not currentItem: return settings = Settings() settings.beginGroup('Themes') settings.setValue('activeTheme', currentItem.data(Qt.UserRole)) settings.endGroup()
def loadSettings(self): settings = Settings() settings.beginGroup('Bookmarks') self._showOnlyIconsInToolbar = settings.value('showOnlyIconsInToolbar', False, type=bool) self._showOnlyTextInToolbar = settings.value('showOnlyTextInToolbar', False, type=bool) settings.endGroup()
def closeEvent(self, event): ''' @param: event QCloseEvent ''' settings = Settings() settings.beginGroup('ClearPrivateData') settings.setValue('state', self._saveState()) settings.endGroup() event.accept()
def __init__(self, parent=None): super().__init__(parent) self._ui = uic.loadUi('mc/preferences/AcceptLanguage.ui', self) self.setAttribute(Qt.WA_DeleteOnClose) self._ui.listWidget.setLayoutDirection(Qt.LeftToRight) settings = Settings() settings.beginGroup('Language') # QStringList langs = settings.value('acceptLanguage', self.defaultLanguage(), type=list) settings.endGroup() for code in langs: loc = QLocale(code.replace('-', '_')) label = '' if loc.language() == QLocale.C: label = _('Personal [%s]') % code else: label = '%s/%s [%s]' % (loc.languageToString( loc.language()), loc.countryToString(loc.country()), code) self._ui.listWidget.addItem(label) self._ui.add.clicked.connect(self.addLanguage) self._ui.remove.clicked.connect(self.removeLanguage) self._ui.up.clicked.connect(self.upLanguage) self._ui.down.clicked.connect(self.downLanguage)
def loadSettings(self): settings = Settings() settings.beginGroup('Notifications') self._enabled = settings.value('Enabled', True) self._timeout = settings.value('Timeout', 6000) if const.OS_UNIX: # && !defined(DISABLE_DBUS) if settings.value('UseNativeDesktop', True): self._notifType = self.DesktopNative else: self._notifType = self.PopupWidget else: self._notifType = self.PopupWidget self._position = settings.value('Position', QPoint(10, 10), type=QPoint) settings.endGroup()
def saveLastPathForFileDialog(self, dialogName, path): ''' @params: QString ''' if not path: return settings = Settings() settings.beginGroup('LastFileDialogsPaths') settings.setValue('FileDialogs/' + dialogName, path) settings.endGroup()
def loadSettings(self): with self._mutex: settings = Settings() settings.beginGroup('Web-Browser-Settings') self._sendDNT = settings.value('DoNotTrack', False) settings.endGroup() self._usePerDomainUserAgent = gVar.app.userAgentManager().usePerDomainUserAgents() self._userAgentsList = gVar.app.userAgentManager().perDomainUserAgentsList()
def lastPathForFileDialog(self, dialogName, fallbackPath): settings = Settings() settings.beginGroup('LastFileDialogsPaths') path = settings.value('FileDialogs/' + dialogName) settings.endGroup() if not path: return fallbackPath return path
def loadSettings(self): settings = Settings() settings.beginGroup('Browser-Tabs-Settings') self._hideTabBarWithOneTab = settings.value('hideTabsWithOneTab', False) activateLastTab = settings.value('ActivateLastTabWhenCloseActual', False) self._showCloseOnInactive = settings.value('showCloseOnInactiveTabs', 0) settings.endGroup() self.setSelectionBehaviorOnRemove( activateLastTab and QTabBar.SelectPreviousTab or QTabBar.SelectRightTab) self.setVisible(not (self.count() <= 1 and self._hideTabBarWithOneTab)) self.setUpLayout()
def __init__(self, parent=None): super().__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) self._ui = uic.loadUi('mc/preferences/JsOptions.ui', self) if const.QTWEBENGINEWIDGETS_VERSION < const.QT_VERSION_CHECK(5, 10, 0): self._ui.jscanActivateWindow.setVisible(False) if const.QTWEBENGINEWIDGETS_VERSION < const.QT_VERSION_CHECK(5, 11, 0): self._ui.jscanPaste.setVisible(False) settings = Settings() settings.beginGroup('Web-Browser-Settings') self._ui.jscanOpenWindow.setChecked( settings.value('allowJavaScriptOpenWindow', False)) self._ui.jscanActivateWindow.setChecked( settings.value('allowJavaScriptActivationWindow', False)) self._ui.jscanAccessClipboard.setChecked( settings.value('allowJavaScriptAccessClipboard', True)) self._ui.jscanPaste.setChecked( settings.value('allowJavaScriptPaste', True)) settings.endGroup()
def canCloseTabs(cls, settingsKey, title, description): settings = Settings() ask = settings.value('Browser-Tabs-Settings/' + settingsKey, True, type=bool) if ask: dialog = CheckBoxDialog(QMessageBox.Yes | QMessageBox.No, gVar.app.activeWindow()) dialog.setDefaultButton(QMessageBox.No) dialog.setWindowTitle(title) dialog.setText(description) dialog.setCheckBoxText(_("Don't ask again")) dialog.setIcon(QMessageBox.Question) if dialog.exec_() != QMessageBox.Yes: return False if dialog.isChecked(): settings.setValue('Browser-Tabs-Settings/' + settingsKey, False) return True
def accept(self): langs = [] for idx in range(self._ui.listWidget.count()): t = self._ui.listWidget.item(idx).text() code = t[t.index('[') + 1:] code = code.replace(']', '') langs.append(code) settings = Settings() settings.beginGroup('Language') settings.setValue('acceptLanguage', langs) settings.endGroup() gVar.app.networkManager().loadSettings() self.close()
def __init__(self, parent=None): super().__init__(parent) self._ui = uic.loadUi('mc/other/ClearPrivateData.ui', self) self._ui.buttonBox.setFocus() self._ui.history.clicked.connect(self._historyClicked) self._ui.clear.clicked.connect(self._dialogAccepted) self._ui.optimizeDb.clicked.connect(self._optimizeDb) self._ui.editCookies.clicked.connect(self._showCookieManager) settings = Settings() settings.beginGroup('ClearPrivateData') self._restoreState(settings.value('state', QByteArray())) settings.endGroup()
def __init__(self, window, parent=None): ''' @param: window BrowserWindow @param: parent QWidget ''' super().__init__(parent) self._ui = uic.loadUi('mc/other/BrowsingLibrary.ui', self) self._historyManager = HistoryManager(window) # HistoryManager self._bookmarksManager = BookmarksManager(window) # BookmarksManager settings = Settings() settings.beginGroup('BrowsingLibrary') self.resize(settings.value('size', QSize(760, 470))) self._historyManager.restoreState( settings.value('historyState', QByteArray())) settings.endGroup() gVar.appTools.centerWidgetOnScreen(self) historyIcon = QIcon() historyIcon.addFile(':/icons/other/bighistory.svg', QSize(), QIcon.Normal) historyIcon.addFile(':/icons/other/bighistory-selected.svg', QSize(), QIcon.Selected) bookmarksIcon = QIcon() bookmarksIcon.addFile(':/icons/other/bigstar.svg', QSize(), QIcon.Normal) bookmarksIcon.addFile(':/icons/other/bigstar-selected.svg', QSize(), QIcon.Selected) self._ui.tabs.AddTab(self._historyManager, historyIcon, _('History')) self._ui.tabs.AddTab(self._bookmarksManager, bookmarksIcon, _('Bookmarks')) self._ui.tabs.SetMode(FancyTabWidget.Mode_LargeSidebar) self._ui.tabs.setFocus() m = QMenu() m.addAction(_('Import Bookmarks...'), self._importBookmarks) m.addAction(_('Export Bookmarks...'), self._exportBookmarks) self._ui.importExport.setMenu(m) self._ui.tabs.CurrentChanged.connect(self._ui.searchLine.clear) self._ui.searchLine.textChanged.connect(self._search) gVar.appTools.setWmClass('Browsing Library', self)
def loadSettings(self): sessionDir = QDir(DataPaths.path(DataPaths.Sessions)) settings = Settings() settings.beginGroup('Web-Browser-Settings') self._lastActiveSessionPath = settings.value('lastActiveSessionPath', self.defaultSessionPath()) settings.endGroup() if QDir.isRelativePath(self._lastActiveSessionPath): self._lastActiveSessionPath = sessionDir.absoluteFilePath(self._lastActiveSessionPath) # Fallback to default session if not RestoreManager.validateFile(self._lastActiveSessionPath): self._lastActiveSessionPath = self.defaultSessionPath()
def getExistingDirectory(self, name, parent=None, caption='', dir_='', options=QFileDialog.ShowDirsOnly): ''' @param: name QString @param: parent QWidget @param: caption QString @param: dir_ QString @param: options QFileDialog.Options @return: QString ''' settings = Settings() settings.beginGroup('FileDialogPaths') lastDir = settings.value(name, dir_) path = QFileDialog.getExistingDirectory(parent, caption, lastDir, options) if path: settings.setValue(name, QFileInfo(path).absolutePath()) settings.endGroup() return path
def focusInEvent(self, event): ''' @param: event QFocusEvent ''' if self._webView: stringUrl = self.convertUrlToText(self._webView.url()) # Text has been edited, let's show go button if stringUrl != self.text(): self._setGoIconVisible(True) self.clearTextFormat() super().focusInEvent(event) if self._window and Settings().value( 'Browser-View-Settings/instantBookmarksToolbar', type=bool): self._window.bookmarksToolbar().show()