Python PyQt5.QtCore.QSettings() Examples
The following are 30
code examples of PyQt5.QtCore.QSettings().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore
, or try the search function
.
Example #1
Source File: angrysearch.py From ANGRYsearch with GNU General Public License v2.0 | 7 votes |
def __init__(self, parent=None): super().__init__() self.settings = Qc.QSettings(CONFIG_PATH, Qc.QSettings.IniFormat) self.setting_params = { 'angrysearch_lite': True, 'fts': True, 'typing_delay': False, 'darktheme': False, 'fm_path_doubleclick_selects': False, 'icon_theme': 'adwaita', 'file_manager': 'xdg-open', 'row_height': 0, 'number_of_results': 500, 'directories_excluded': [], 'conditional_mounts_for_autoupdate': [], 'notifications': True, 'regex_mode': False, 'close_on_execute': False } # FOR REGEX MODE, WHEN REGEX QUERY CAN BE RUN SO ONLY ONE ACCESS DB self.regex_query_ready = True self.read_settings() self.init_gui()
Example #2
Source File: conversationwidget.py From qhangups with GNU General Public License v3.0 | 6 votes |
def set_active(self): """Activate conversation tab""" settings = QtCore.QSettings() # Set the client as active if settings.value("send_client_active", True, type=bool): future = asyncio.async(self.client.set_active()) future.add_done_callback(lambda future: future.result()) # Mark the newest event as read if settings.value("send_read_state", True, type=bool): future = asyncio.async(self.conv.update_read_timestamp()) future.add_done_callback(lambda future: future.result()) self.num_unread_local = 0 self.set_title() self.messageTextEdit.setFocus()
Example #3
Source File: dialogs.py From artisan with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent = None, aw = None, title = "", content = ""): super(HelpDlg,self).__init__(parent, aw) self.setWindowTitle(title) self.setModal(False) settings = QSettings() if settings.contains("HelpGeometry"): self.restoreGeometry(settings.value("HelpGeometry")) phelp = QTextEdit() phelp.setHtml(content) phelp.setReadOnly(True) # connect the ArtisanDialog standard OK/Cancel buttons self.dialogbuttons.removeButton(self.dialogbuttons.button(QDialogButtonBox.Cancel)) self.dialogbuttons.accepted.connect(self.close) buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(self.dialogbuttons) hLayout = QVBoxLayout() hLayout.addWidget(phelp) hLayout.addLayout(buttonLayout) self.setLayout(hLayout) self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus()
Example #4
Source File: __main__.py From qhangups with GNU General Public License v3.0 | 6 votes |
def set_language(self): """Change language""" settings = QtCore.QSettings() language = settings.value("language") if not language: language = QtCore.QLocale.system().name().split("_")[0] lang_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "languages") lang_file = "qhangups_{}.qm".format(language) qt_lang_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) qt_lang_file = "qt_{}.qm".format(language) if os.path.isfile(os.path.join(lang_path, lang_file)): translator.load(lang_file, lang_path) qt_translator.load(qt_lang_file, qt_lang_path) else: translator.load("") qt_translator.load("")
Example #5
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 6 votes |
def closeEvent(self, _): self.disconnecting = True if self.ble is not None: try: self.ble.batteryChanged.disconnect() self.ble.weightChanged.disconnect() self.ble.deviceDisconnected.disconnect() except: pass try: self.ble.disconnectDevice() except: pass settings = QSettings() #save window geometry settings.setValue("RoastGeometry",self.saveGeometry()) # triggered via the cancel button
Example #6
Source File: workspace.py From eddy with GNU General Public License v3.0 | 6 votes |
def accept(self): """ Create Eddy workspace (if necessary). """ path = self.workspaceField.value() try: mkdir(path) except Exception as e: msgbox = QtWidgets.QMessageBox(self) msgbox.setDetailedText(format_exception(e)) msgbox.setIconPixmap(QtGui.QIcon(':/icons/48/ic_error_outline_black').pixmap(48)) msgbox.setStandardButtons(QtWidgets.QMessageBox.Close) msgbox.setText('{0} could not create the specified workspace: {1}!'.format(APPNAME, path)) msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy')) msgbox.setWindowTitle('Workspace setup failed!') msgbox.exec_() super().reject() else: settings = QtCore.QSettings(ORGANIZATION, APPNAME) settings.setValue('workspace/home', path) settings.sync() super().accept()
Example #7
Source File: phases.py From artisan with GNU General Public License v3.0 | 6 votes |
def cancel(self): self.aw.qmc.phases = list(self.phases) self.aw.qmc.phasesbuttonflag = bool(self.org_phasesbuttonflag) self.aw.qmc.phasesfromBackgroundflag = bool(self.org_fromBackgroundflag) self.aw.qmc.watermarksflag = bool(self.org_watermarksflag) self.aw.qmc.phasesLCDflag = bool(self.org_phasesLCDflag) self.aw.qmc.autoDRYflag = bool(self.org_autoDRYflag) self.aw.qmc.autoFCsFlag = bool(self.org_autoFCsFlag) self.aw.qmc.phasesLCDmode_l = list(self.org_phasesLCDmode_l) self.aw.qmc.phasesLCDmode_all = list(self.org_phasesLCDmode_all) self.aw.qmc.redraw(recomputeAllDeltas=False) self.savePhasesSettings() #save window position (only; not size!) settings = QSettings() settings.setValue("PhasesPosition",self.frameGeometry().topLeft()) self.reject()
Example #8
Source File: phases.py From artisan with GNU General Public License v3.0 | 6 votes |
def updatephases(self): self.aw.qmc.phases[0] = self.startdry.value() self.aw.qmc.phases[1] = self.enddry.value() self.aw.qmc.phases[2] = self.endmid.value() self.aw.qmc.phases[3] = self.endfinish.value() if self.pushbuttonflag.isChecked(): self.aw.qmc.phasesbuttonflag = True else: self.aw.qmc.phasesbuttonflag = False self.aw.qmc.redraw(recomputeAllDeltas=False) self.savePhasesSettings() #save window position (only; not size!) settings = QSettings() settings.setValue("PhasesPosition",self.frameGeometry().topLeft()) self.accept()
Example #9
Source File: toggle_column_mixin.py From PFramer with GNU General Public License v3.0 | 6 votes |
def read_view_settings(self, key, settings=None, reset=False): """ Reads the persistent program settings :param reset: If True, the program resets to its default settings :returns: True if the header state was restored, otherwise returns False """ logger.debug("Reading view settings for: {}".format(key)) header_restored = False if not reset: if settings is None: settings = QtCore.QSettings() horizontal_header = self._horizontal_header() header_restored = horizontal_header.restoreState(settings.value(key)) # update actions for col, action in enumerate(horizontal_header.actions()): is_checked = not horizontal_header.isSectionHidden(col) action.setChecked(is_checked) return header_restored
Example #10
Source File: plugin.py From qgis-versioning with GNU General Public License v2.0 | 6 votes |
def selectDatabase(self): dlg = QDialog() dlg.setWindowTitle('Choose the database') layout = QVBoxLayout(dlg) button_box = QDialogButtonBox(dlg) button_box.setStandardButtons( QDialogButtonBox.Cancel | QDialogButtonBox.Ok) button_box.accepted.connect(dlg.accept) button_box.rejected.connect(dlg.reject) connectionBox = QComboBox(dlg) qs = QSettings() qs.beginGroup(CONN) connections = qs.childGroups() connectionBox.addItems(connections) qs.endGroup() layout.addWidget(connectionBox) layout.addWidget(button_box) if not dlg.exec_(): return None return connectionBox.currentText()
Example #11
Source File: plugin.py From qgis-versioning with GNU General Public License v2.0 | 6 votes |
def get_conn_from_settings(self, dbname): """Retruns a connection info and data from a dbname saved in QgsSettings""" qs = QSettings() conn_dict = {} qs.beginGroup(CONN + '/' + dbname) pg_conn_info = None if qs.value('service') : conn_dict['service'] = qs.value('service') pg_conn_info = "service={}".format(conn_dict['service']) else: conn_dict['database'] = qs.value('database', dbname) conn_dict['username'] = qs.value('username', "postgres") print("username={}".format(conn_dict['username'])) conn_dict['host'] = qs.value('host', "127.0.0.1") conn_dict['port'] = qs.value('port', "5432") conn_dict['password'] = qs.value('password', '') pg_conn_info = "dbname='{}' user='{}' host='{}' port='{}' password='{}'".format( conn_dict['database'], conn_dict['username'], conn_dict['host'], conn_dict['port'], conn_dict['password']) return (pg_conn_info, conn_dict)
Example #12
Source File: __init__.py From eddy with GNU General Public License v3.0 | 6 votes |
def setUp(self): """ Initialize test case environment. """ # ACQUIRE LOCK AND FLUSH STREAMS testcase_lock.acquire() sys.stderr.flush() sys.stdout.flush() # MAKE SURE TO USE CORRECT SETTINGS settings = QtCore.QSettings(ORGANIZATION, APPNAME) settings.setValue('workspace/home', WORKSPACE) settings.setValue('update/check_on_startup', False) settings.sync() # MAKE SURE THE WORKSPACE DIRECTORY EXISTS mkdir(expandPath(WORKSPACE)) # MAKE SURE TO HAVE A CLEAN TEST ENVIRONMENT rmdir('@tests/.tests/') mkdir('@tests/.tests/') # INITIALIZED VARIABLES self.eddy = None self.project = None self.session = None
Example #13
Source File: citytranslate.py From meteo-qt with GNU General Public License v3.0 | 6 votes |
def __init__(self, city, cities_list, parent=None): super(CityTranslate, self).__init__(parent) self.city = city self.settings = QSettings() self.trans_cities_dict = cities_list self.layout = QVBoxLayout() self.buttonLayout = QHBoxLayout() self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.Ok | QDialogButtonBox.Cancel ) self.buttonBox.rejected.connect(self.reject) self.buttonBox.accepted.connect(self.accept) self.buttonLayout.addWidget(self.buttonBox) self.untranslate_city_label = QLabel(self.find_city_key(self.city)) self.translate_line = QLineEdit(self.city) self.translate_line.selectAll() self.translate_line.setMinimumWidth(300) self.status_layout = QHBoxLayout() self.status_label = QLabel() self.status_layout.addWidget(self.status_label) self.panel = QGridLayout() self.panel.addWidget(self.untranslate_city_label, 0, 0) self.panel.addWidget(self.translate_line, 1, 0) self.layout.addLayout(self.panel) self.layout.addLayout(self.status_layout) self.layout.addLayout(self.buttonLayout) self.setLayout(self.layout) self.setWindowTitle(QCoreApplication.translate('Window title', 'City translation', 'City translation dialogue'))
Example #14
Source File: session.py From eddy with GNU General Public License v3.0 | 6 votes |
def doCheckForUpdate(self): """ Execute the update check routine. """ channel = Channel.Beta # SHOW PROGRESS BAR progressBar = self.widget('progress_bar') progressBar.setToolTip('Checking for updates...') progressBar.setVisible(True) # RUN THE UPDATE CHECK WORKER IN A THREAD try: settings = QtCore.QSettings(ORGANIZATION, APPNAME) channel = Channel.valueOf(settings.value('update/channel', channel, str)) except TypeError: pass finally: worker = UpdateCheckWorker(channel, VERSION) connect(worker.sgnNoUpdateAvailable, self.onNoUpdateAvailable) connect(worker.sgnNoUpdateDataAvailable, self.onNoUpdateDataAvailable) connect(worker.sgnUpdateAvailable, self.onUpdateAvailable) self.startThread('updateCheck', worker)
Example #15
Source File: mainWindow.py From pychemqt with GNU General Public License v3.0 | 6 votes |
def closeEvent(self, event=None): if self.okToContinue(): for tab in range(self.centralwidget.count()): centralwidget = self.centralwidget.widget(tab) scene = centralwidget.subWindowList()[0].widget().scene() scene.clearSelection() settings = QtCore.QSettings() if self.filename: filename = QtCore.QVariant(self.filename) else: filename = QtCore.QVariant() settings.setValue("LastFile", filename) if self.recentFiles: recentFiles = QtCore.QVariant(self.recentFiles) else: recentFiles = QtCore.QVariant() settings.setValue("RecentFiles", recentFiles) settings.setValue("Geometry", QtCore.QVariant(self.saveGeometry())) settings.setValue("MainWindow/State", QtCore.QVariant(self.saveState())) self.close() else: event.ignore()
Example #16
Source File: imageViewer.py From CvStudio with MIT License | 5 votes |
def readSettings(self): """Read application settings.""" settings = QtCore.QSettings() pos = settings.value('pos', QtCore.QPoint(200, 200)) size = settings.value('size', QtCore.QSize(400, 400)) self.move(pos) self.resize(size) if settings.contains('windowgeometry'): self.restoreGeometry(settings.value('windowgeometry')) if settings.contains('windowstate'): self.restoreState(settings.value('windowstate'))
Example #17
Source File: gui.py From superboucle with GNU General Public License v3.0 | 5 votes |
def closeEvent(self, event): device_settings = QSettings('superboucle', 'devices') device_settings.setValue('devices', [pickle.dumps(x.mapping) for x in self.devices]) self.settings.setValue('playlist', self.playlist) self.settings.setValue('paths_used', self.paths_used) self.settings.setValue('auto_connect', self.auto_connect)
Example #18
Source File: imageViewer.py From CvStudio with MIT License | 5 votes |
def main(): """Test app to run from command line. **Usage**:: python26 imageviewer.py imagefilename """ COMPANY = "TPWorks" DOMAIN = "dummy-tpworks.com" APPNAME = "Image Viewer Test" app = QApplication(sys.argv) imageFilename = r"D:\images\00a8b82f9944ae6c.jpg" # app.arguments()[-1] if not os.path.exists(imageFilename): print('File "%s" does not exist.' % imageFilename) return pixmap = QtGui.QPixmap(imageFilename) if (not pixmap or pixmap.width() == 0 or pixmap.height == 0): print('File "%s" is not an image file that Qt can open.' % imageFilename) return QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat) app.setOrganizationName(COMPANY) app.setOrganizationDomain(DOMAIN) app.setApplicationName(APPNAME) app.setWindowIcon(QtGui.QIcon(":/icon.png")) mainWin = MainWindow(pixmap) mainWin.setWindowTitle(APPNAME) mainWin.readSettings() mainWin.show() sys.exit(app.exec_())
Example #19
Source File: phases.py From artisan with GNU General Public License v3.0 | 5 votes |
def savePhasesSettings(self): if not self.aw.qmc.phasesbuttonflag: settings = QSettings() #save phases settings.setValue("Phases",self.aw.qmc.phases)
Example #20
Source File: uaclient.py From opcua-client-gui with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.settings = QSettings() self.client = None self._connected = False self._datachange_sub = None self._event_sub = None self._subs_dc = {} self._subs_ev = {} self.security_mode = None self.security_policy = None self.certificate_path = None self.private_key_path = None
Example #21
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def save(self): """ Save the current session state. """ settings = QtCore.QSettings(ORGANIZATION, APPNAME) settings.setValue('session/geometry', self.saveGeometry()) settings.setValue('session/state', self.saveState()) settings.sync()
Example #22
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def onSessionReady(self): """ Executed when the session is initialized. """ ## CONNECT PROJECT SPECIFIC SIGNALS connect(self.project.sgnDiagramRemoved, self.mdi.onDiagramRemoved) ## CHECK FOR UPDATES ON STARTUP settings = QtCore.QSettings(ORGANIZATION, APPNAME) if settings.value('update/check_on_startup', True, bool): action = self.action('check_for_updates') action.trigger()
Example #23
Source File: dialogs.py From artisan with GNU General Public License v3.0 | 5 votes |
def closeEvent(self, _): settings = QSettings() #save window geometry settings.setValue("HelpGeometry",self.saveGeometry())
Example #24
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def doToggleGrid(self): """ Toggle snap to grid setting and viewport display. """ settings = QtCore.QSettings(ORGANIZATION, APPNAME) settings.setValue('diagram/grid', self.action('toggle_grid').isChecked()) settings.sync() for subwindow in self.mdi.subWindowList(): subwindow.view.setGridSize(Diagram.GridSize) viewport = subwindow.view.viewport() viewport.update()
Example #25
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def doOpen(self): """ Open a project in a new session. """ settings = QtCore.QSettings(ORGANIZATION, APPNAME) workspace = settings.value('workspace/home', WORKSPACE, str) dialog = QtWidgets.QFileDialog(self) dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptOpen) dialog.setDirectory(expandPath(workspace)) dialog.setFileMode(QtWidgets.QFileDialog.Directory) dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True) dialog.setViewMode(QtWidgets.QFileDialog.Detail) if dialog.exec_() == QtWidgets.QFileDialog.Accepted: self.app.sgnCreateSession.emit(expandPath(first(dialog.selectedFiles())))
Example #26
Source File: autosave.py From artisan with GNU General Public License v3.0 | 5 votes |
def closeEvent(self, _): self.closeHelp() settings = QSettings() #save window geometry settings.setValue("autosaveGeometry",self.saveGeometry())
Example #27
Source File: sampling.py From artisan with GNU General Public License v3.0 | 5 votes |
def ok(self): self.aw.qmc.flagKeepON = bool(self.keepOnFlag.isChecked()) self.aw.qmc.flagOpenCompleted = bool(self.openCompletedFlag.isChecked()) self.aw.qmc.delay = int(self.interval.value()*1000.) if self.aw.qmc.delay < self.aw.qmc.default_delay: QMessageBox.warning(self.aw,QApplication.translate("Message", "Warning",None),QApplication.translate("Message", "A tight sampling interval might lead to instability on some machines. We suggest a minimum of 3s.",None)) #save window position (only; not size!) settings = QSettings() settings.setValue("SamplingPosition",self.frameGeometry().topLeft()) self.accept()
Example #28
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def initState(self): """ Configure application state by reading the preferences file. """ settings = QtCore.QSettings(ORGANIZATION, APPNAME) self.restoreGeometry(settings.value('session/geometry', QtCore.QByteArray(), QtCore.QByteArray)) self.restoreState(settings.value('session/state', QtCore.QByteArray(), QtCore.QByteArray)) self.action('toggle_grid').setChecked(settings.value('diagram/grid', False, bool))
Example #29
Source File: settings.py From lector with GNU General Public License v2.0 | 5 votes |
def set(name, value): """ Set setting """ settings = QSettings("Davide Setti", "Lector") settings.setValue(name, QVariant(value))
Example #30
Source File: pid_dialogs.py From artisan with GNU General Public License v3.0 | 5 votes |
def closeEvent(self,_): #save window position (only; not size!) settings = QSettings() settings.setValue("PIDPosition",self.frameGeometry().topLeft()) self.accept() ############################################################################ ######################## FUJI PX PID CONTROL DIALOG ######################## ############################################################################ # common code for all Fuji PXxx subclasses