Python PyQt5.QtCore.pyqtSlot() Examples
The following are 30
code examples of PyQt5.QtCore.pyqtSlot().
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: qt_compat.py From twitter-stock-recommendation with MIT License | 32 votes |
def _setup_pyqt5(): global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName if QT_API == QT_API_PYQT5: from PyQt5 import QtCore, QtGui, QtWidgets __version__ = QtCore.PYQT_VERSION_STR QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot QtCore.Property = QtCore.pyqtProperty elif QT_API == QT_API_PYSIDE2: from PySide2 import QtCore, QtGui, QtWidgets, __version__ else: raise ValueError("Unexpected value for the 'backend.qt5' rcparam") _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName def is_pyqt5(): return True
Example #2
Source File: FlameProfiler.py From Uranium with GNU Lesser General Public License v3.0 | 6 votes |
def pyqtSlot(*args, **kwargs) -> Callable[..., Any]: """Drop in replacement for PyQt5's pyqtSlot decorator which records profiling information. See the PyQt5 documentation for information about pyqtSlot. """ if enabled(): def wrapIt(function): @functools.wraps(function) def wrapped(*args2, **kwargs2): if isRecordingProfile(): with profileCall("[SLOT] "+ function.__qualname__): return function(*args2, **kwargs2) else: return function(*args2, **kwargs2) return pyqt5PyqtSlot(*args, **kwargs)(wrapped) return wrapIt else: def dontWrapIt(function): return pyqt5PyqtSlot(*args, **kwargs)(function) return dontWrapIt
Example #3
Source File: qt_loaders.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def import_pyqt5(): """ Import PyQt5 ImportErrors rasied within this function are non-recoverable """ from PyQt5 import QtCore, QtSvg, QtWidgets, QtGui, QtPrintSupport import sip # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # Join QtGui and QtWidgets for Qt4 compatibility. QtGuiCompat = types.ModuleType('QtGuiCompat') QtGuiCompat.__dict__.update(QtGui.__dict__) QtGuiCompat.__dict__.update(QtWidgets.__dict__) QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) api = QT_API_PYQT5 return QtCore, QtGuiCompat, QtSvg, api
Example #4
Source File: ListModel.py From Uranium with GNU Lesser General Public License v3.0 | 6 votes |
def rowCount(self, parent = None) -> int: """This function is necessary because it is abstract in QAbstractListModel. Under the hood, Qt will call this function when it needs to know how many items are in the model. This pyqtSlot will not be linked to the itemsChanged signal, so please use the normal count() function instead. """ return self.count
Example #5
Source File: spool.py From kite with GNU General Public License v3.0 | 6 votes |
def progressStarted(self, args): if self.progress.isVisible(): return nargs = len(args) text = args[0] maximum = 0 if nargs < 2 else args[1] progress_func = None if nargs < 3 else args[2] self.progress.setWindowTitle('Processing...') self.progress.setLabelText(text) self.progress.setMaximum(maximum) self.progress.setValue(0) @QtCore.pyqtSlot() def updateProgress(): if progress_func: self.progress.setValue(progress_func()) self.progress_timer = QtCore.QTimer() self.progress_timer.timeout.connect(updateProgress) self.progress_timer.start(250) self.progress.show()
Example #6
Source File: marker.py From PyPipboyApp with GNU General Public License v3.0 | 6 votes |
def _markerContextMenuEvent_(self, event): menu = QtWidgets.QMenu(self.view) self._fillMarkerContextMenu_(event, menu) if self.labelItem and not self.labelAlwaysVisible: @QtCore.pyqtSlot(bool) def _toggleStickyLabel(value): if self.uid != None: settingPath = 'globalmapwidget/stickylabels2/' if (value): self.widget._app.settings.setValue(settingPath+self.uid, int(value)) else: self.widget._app.settings.beginGroup(settingPath); self.widget._app.settings.remove(self.uid); self.widget._app.settings.endGroup(); self.setStickyLabel(value) ftaction = menu.addAction('Sticky Label') ftaction.toggled.connect(_toggleStickyLabel) ftaction.setCheckable(True) ftaction.setChecked(self.stickyLabel) menu.exec(event.screenPos())
Example #7
Source File: JsSignals.py From PyQt with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): super(WebEngineView, self).__init__(*args, **kwargs) self.initSettings() self.channel = QWebChannel(self) # 把自身对象传递进去 self.channel.registerObject('Bridge', self) # 设置交互接口 self.page().setWebChannel(self.channel) # START #####以下代码可能是在5.6 QWebEngineView刚出来时的bug,必须在每次加载页面的时候手动注入 #### 也有可能是跳转页面后就失效了,需要手动注入,有没有修复具体未测试 # self.page().loadStarted.connect(self.onLoadStart) # self._script = open('Data/qwebchannel.js', 'rb').read().decode() # def onLoadStart(self): # self.page().runJavaScript(self._script) # END ########################### # 注意pyqtSlot用于把该函数暴露给js可以调用
Example #8
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 6 votes |
def _fillMarkerContextMenu_(self, event, menu): @QtCore.pyqtSlot(bool) def _markAsCollected(value): if self.itemFormID != None: collectedcollectablesSettingsPath =\ self.widget.characterDataManager.playerDataPath + self.widget.characterDataManager.collectedcollectablesuffix index = self.widget._app.settings.value(collectedcollectablesSettingsPath, None) if index == None: index = [] tmp = str(int(self.itemFormID,16)) if (value): if tmp not in index: index = list(set(index)) # remove duplicates index.append(tmp) self.widget._app.settings.setValue(collectedcollectablesSettingsPath, index) else: if tmp in index: index = list(set(index)) # remove duplicates index.remove(tmp) self.widget._app.settings.setValue(collectedcollectablesSettingsPath, index) self.setCollected(value) ftaction = menu.addAction('Mark as Collected') ftaction.triggered.connect(_markAsCollected) ftaction.setCheckable(True) ftaction.setChecked(self.collected)
Example #9
Source File: pac.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def _js_slot(*args): """Wrap a methods as a JavaScript function. Register a PACContext method as a JavaScript function, and catch exceptions returning them as JavaScript Error objects. Args: args: Types of method arguments. Return: Wrapped method. """ def _decorator(method): @functools.wraps(method) def new_method(self, *args, **kwargs): """Call the underlying function.""" try: return method(self, *args, **kwargs) except: e = str(sys.exc_info()[0]) log.network.exception("PAC evaluation error") # pylint: disable=protected-access return self._error_con.callAsConstructor([e]) # pylint: enable=protected-access deco = pyqtSlot(*args, result=QJSValue) # type: ignore[arg-type] return deco(new_method) return _decorator
Example #10
Source File: Qt.py From uExport with zlib License | 5 votes |
def _pyqt5(): import PyQt5.Qt from PyQt5 import QtCore, QtWidgets, uic _remap(QtCore, "Signal", QtCore.pyqtSignal) _remap(QtCore, "Slot", QtCore.pyqtSlot) _remap(QtCore, "Property", QtCore.pyqtProperty) _add(PyQt5, "__binding__", PyQt5.__name__) _add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname)) _add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: ( QtCore.QCoreApplication(context, sourceText, disambiguation, n))) _add(PyQt5, "setSectionResizeMode", QtWidgets.QHeaderView.setSectionResizeMode) _maintain_backwards_compatibility(PyQt5) return PyQt5
Example #11
Source File: mpv_qtwidget_opengl.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
def on_update(self, ctx=None): # HELP: maybeUpdate 中的部分逻辑需要在主线程中执行, # 而 QMetaObject.invokeMethod 似乎正好可以达到这个目标。 # 我们将 maybe_update 标记为 pyqtSlot,这样才能正确的 invoke。 QMetaObject.invokeMethod(self, 'maybe_update')
Example #12
Source File: mpv.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
def on_update(self, ctx=None): # HELP: maybeUpdate 中的部分逻辑需要在主线程中执行, # 而 QMetaObject.invokeMethod 似乎正好可以达到这个目标。 # 我们将 maybe_update 标记为 pyqtSlot,这样才能正确的 invoke。 QMetaObject.invokeMethod(self, 'maybe_update')
Example #13
Source File: qt_loaders.py From pySINDy with MIT License | 5 votes |
def import_pyqt5(): """ Import PyQt5 ImportErrors rasied within this function are non-recoverable """ from PyQt5 import QtCore, QtSvg, QtWidgets, QtGui, QtPrintSupport import sip # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # Join QtGui and QtWidgets for Qt4 compatibility. QtGuiCompat = types.ModuleType('QtGuiCompat') QtGuiCompat.__dict__.update(QtGui.__dict__) QtGuiCompat.__dict__.update(QtWidgets.__dict__) QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) api = QT_API_PYQT5 return QtCore, QtGuiCompat, QtSvg, api
Example #14
Source File: qt_loaders.py From pySINDy with MIT License | 5 votes |
def import_pyqt4(version=2): """ Import PyQt4 Parameters ---------- version : 1, 2, or None Which QString/QVariant API to use. Set to None to use the system default ImportErrors rasied within this function are non-recoverable """ # The new-style string API (version=2) automatically # converts QStrings to Unicode Python strings. Also, automatically unpacks # QVariants to their underlying objects. import sip if version is not None: sip.setapi('QString', version) sip.setapi('QVariant', version) from PyQt4 import QtGui, QtCore, QtSvg if not check_version(QtCore.PYQT_VERSION_STR, '4.7'): raise ImportError("QtConsole requires PyQt4 >= 4.7, found %s" % QtCore.PYQT_VERSION_STR) # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # query for the API version (in case version == None) version = sip.getapi('QString') api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT return QtCore, QtGui, QtSvg, api
Example #15
Source File: proxy.py From guppy-proxy with MIT License | 5 votes |
def clean_thread(tid): @pyqtSlot() def clean(): del ProxyThread.threads[tid] return clean
Example #16
Source File: JsSignals.py From PyQt with GNU General Public License v3.0 | 5 votes |
def _exposeInterface(self): """向Js暴露调用本地方法接口 """ self.page().mainFrame().addToJavaScriptWindowObject('Bridge', self) # 注意pyqtSlot用于把该函数暴露给js可以调用
Example #17
Source File: model_bind.py From corrscope with BSD 2-Clause "Simplified" License | 5 votes |
def model_setter(value_type: type) -> Callable[..., None]: @pyqtSlot(value_type) def set_model(self: BoundWidget, value): assert isinstance(value, value_type) try: self.pmodel[self.path] = value except CorrError: self.setPalette(self.error_palette) else: BoundWidget.set_model(self, value) self.setPalette(self.default_palette) return set_model
Example #18
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 5 votes |
def _fillMarkerContextMenu_(self, event, menu): if self.pipValue: @QtCore.pyqtSlot() def _removeCustomMarker(): self.datamanager.rpcRemoveCustomMarker() menu.addAction('Remove Marker', _removeCustomMarker)
Example #19
Source File: spool.py From kite with GNU General Public License v3.0 | 5 votes |
def addTimeSlider(self): stack = self.model.getScene() self.time_slider = QRangeSlider(self) self.time_slider.setMaximumHeight(50) slider_tmin = math.ceil(stack.tmin) slider_tmax = math.floor(stack.tmax) def datetime_formatter(value): return datetime.fromtimestamp(value).strftime('%Y-%m-%d') self.time_slider.setMin(slider_tmin) self.time_slider.setMax(slider_tmax) self.time_slider.setRange(slider_tmin, slider_tmax) self.time_slider.setFormatter(datetime_formatter) @QtCore.pyqtSlot(int) def changeTimeRange(): tmin, tmax = self.time_slider.getRange() stack.set_time_range(tmin, tmax) self.time_slider.startValueChanged.connect(changeTimeRange) self.time_slider.endValueChanged.connect(changeTimeRange) self.dock_time_slider = QtGui.QDockWidget( 'Displacement time series - range control', self) self.dock_time_slider.setWidget(self.time_slider) self.dock_time_slider.setFeatures( QtWidgets.QDockWidget.DockWidgetMovable) self.dock_time_slider.setAllowedAreas( QtCore.Qt.BottomDockWidgetArea | QtCore.Qt.TopDockWidgetArea) self.addDockWidget( QtCore.Qt.BottomDockWidgetArea, self.dock_time_slider)
Example #20
Source File: __init__.py From asyncqt with BSD 2-Clause "Simplified" License | 5 votes |
def asyncSlot(*args): """Make a Qt async slot run on asyncio loop.""" def outer_decorator(fn): @Slot(*args) @functools.wraps(fn) def wrapper(*args, **kwargs): return asyncio.ensure_future(fn(*args, **kwargs)) return wrapper return outer_decorator
Example #21
Source File: qt_loaders.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def import_pyqt4(version=2): """ Import PyQt4 Parameters ---------- version : 1, 2, or None Which QString/QVariant API to use. Set to None to use the system default ImportErrors rasied within this function are non-recoverable """ # The new-style string API (version=2) automatically # converts QStrings to Unicode Python strings. Also, automatically unpacks # QVariants to their underlying objects. import sip if version is not None: sip.setapi('QString', version) sip.setapi('QVariant', version) from PyQt4 import QtGui, QtCore, QtSvg if not check_version(QtCore.PYQT_VERSION_STR, '4.7'): raise ImportError("QtConsole requires PyQt4 >= 4.7, found %s" % QtCore.PYQT_VERSION_STR) # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # query for the API version (in case version == None) version = sip.getapi('QString') api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT return QtCore, QtGui, QtSvg, api
Example #22
Source File: qt_loaders.py From PyDev.Debugger with Eclipse Public License 1.0 | 5 votes |
def import_pyqt5(): """ Import PyQt5 ImportErrors raised within this function are non-recoverable """ from PyQt5 import QtGui, QtCore, QtSvg # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot return QtCore, QtGui, QtSvg, QT_API_PYQT5
Example #23
Source File: qt_loaders.py From PyDev.Debugger with Eclipse Public License 1.0 | 5 votes |
def import_pyqt4(version=2): """ Import PyQt4 Parameters ---------- version : 1, 2, or None Which QString/QVariant API to use. Set to None to use the system default ImportErrors raised within this function are non-recoverable """ # The new-style string API (version=2) automatically # converts QStrings to Unicode Python strings. Also, automatically unpacks # QVariants to their underlying objects. import sip if version is not None: sip.setapi('QString', version) sip.setapi('QVariant', version) from PyQt4 import QtGui, QtCore, QtSvg if not check_version(QtCore.PYQT_VERSION_STR, '4.7'): raise ImportError("IPython requires PyQt4 >= 4.7, found %s" % QtCore.PYQT_VERSION_STR) # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # query for the API version (in case version == None) version = sip.getapi('QString') api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT return QtCore, QtGui, QtSvg, api
Example #24
Source File: Qt.py From CNCGToolKit with MIT License | 4 votes |
def _pyqt5(): import PyQt5.Qt from PyQt5 import QtCore, QtWidgets, uic _remap(QtCore, "Signal", QtCore.pyqtSignal) _remap(QtCore, "Slot", QtCore.pyqtSlot) _remap(QtCore, "Property", QtCore.pyqtProperty) _add(PyQt5, "__binding__", PyQt5.__name__) _add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname)) _add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: ( QtCore.QCoreApplication(context, sourceText, disambiguation, n))) _add(PyQt5, "setSectionResizeMode", QtWidgets.QHeaderView.setSectionResizeMode) _maintain_backwards_compatibility(PyQt5) return PyQt5
Example #25
Source File: Qt.py From pyblish-maya with GNU Lesser General Public License v3.0 | 4 votes |
def _pyqt5(): import PyQt5.Qt from PyQt5 import QtCore, QtWidgets, uic _remap(QtCore, "Signal", QtCore.pyqtSignal) _remap(QtCore, "Slot", QtCore.pyqtSlot) _remap(QtCore, "Property", QtCore.pyqtProperty) _add(QtCompat, "__binding__", PyQt5.__name__) _add(QtCompat, "__binding_version__", PyQt5.QtCore.PYQT_VERSION_STR) _add(QtCompat, "__qt_version__", PyQt5.QtCore.QT_VERSION_STR) _add(QtCompat, "load_ui", lambda fname: uic.loadUi(fname)) _add(QtCompat, "translate", QtCore.QCoreApplication.translate) _add(QtCompat, "setSectionResizeMode", QtWidgets.QHeaderView.setSectionResizeMode) _maintain_backwards_compatibility(PyQt5) return PyQt5
Example #26
Source File: Qt.py From pipeline with MIT License | 4 votes |
def _pyqt5(): import PyQt5.Qt from PyQt5 import QtCore, QtWidgets, uic _remap(QtCore, "Signal", QtCore.pyqtSignal) _remap(QtCore, "Slot", QtCore.pyqtSlot) _remap(QtCore, "Property", QtCore.pyqtProperty) _add(PyQt5, "__binding__", PyQt5.__name__) _add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname)) _add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: ( QtCore.QCoreApplication(context, sourceText, disambiguation, n))) _add(PyQt5, "setSectionResizeMode", QtWidgets.QHeaderView.setSectionResizeMode) _maintain_backwards_compatibility(PyQt5) return PyQt5
Example #27
Source File: videoslider.py From vidcutter with GNU General Public License v3.0 | 4 votes |
def initThumbs(self) -> None: framesize = self.parent.videoService.framesize() thumbsize = QSize( VideoService.config.thumbnails['TIMELINE'].height() * (framesize.width() / framesize.height()), VideoService.config.thumbnails['TIMELINE'].height()) positions, frametimes = [], [] thumbs = int(math.ceil((self.rect().width() - (self.offset * 2)) / thumbsize.width())) for pos in range(thumbs): val = QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), (thumbsize.width() * pos) - self.offset, self.rect().width() - (self.offset * 2)) positions.append(val) positions[0] = 1000 [frametimes.append(self.parent.delta2QTime(msec).toString(self.parent.timeformat)) for msec in positions] class ThumbWorker(QObject): completed = pyqtSignal(list) def __init__(self, settings: QSettings, media: str, times: list, size: QSize): super(ThumbWorker, self).__init__() self.settings = settings self.media = media self.times = times self.size = size @pyqtSlot() def generate(self): frames = list() [ frames.append(VideoService.captureFrame(self.settings, self.media, frame, self.size)) for frame in self.times ] self.completed.emit(frames) self.thumbsThread = QThread(self) self.thumbsWorker = ThumbWorker(self.parent.settings, self.parent.currentMedia, frametimes, thumbsize) self.thumbsWorker.moveToThread(self.thumbsThread) self.thumbsThread.started.connect(self.parent.sliderWidget.setLoader) self.thumbsThread.started.connect(self.thumbsWorker.generate) self.thumbsThread.finished.connect(self.thumbsThread.deleteLater, Qt.DirectConnection) self.thumbsWorker.completed.connect(self.buildTimeline) self.thumbsWorker.completed.connect(self.thumbsWorker.deleteLater, Qt.DirectConnection) self.thumbsWorker.completed.connect(self.thumbsThread.quit, Qt.DirectConnection) self.thumbsThread.start()
Example #28
Source File: i18nCatalogProxy.py From Uranium with GNU Lesser General Public License v3.0 | 4 votes |
def _wrapFunction(self, engine, this_object, function): """Wrap a function in a bit of a javascript to re-trigger a method call on signal emit. This slightly magical method wraps a Python method exposed to QML in a JavaScript closure with the same signature as the Python method. This allows the closure to be exposed as a QML property instead of a QML slot. Using a property for this allows us to add a notify signal to re-trigger the method execution. Due to the way notify signals are handled by QML, re-triggering the method only needs a signal emit. :param engine: :type{QQmlEngine} The QML engine to use to evaluate JavaScript. :param this_object: :type{QObject} The object to call the function on. :param function: :type{Function} The function to call. Should be marked as pyqtSlot. :return: :type{QJSValue} A JavaScript closure that when called calls the wrapper Python method. :note Currently, only functions taking a fixed list of positional arguments are supported. :todo Move this to a more generic place so more things can use it. """ # JavaScript code that wraps the Python method call in a closure wrap_js = """(function(this_object) {{ return function({args}) {{ return this_object.{function}({args}) }} }})""" # Get the function name and argument list. function_name = function.__name__ function_args = inspect.getfullargspec(function)[0] if function_args[0] == "self": function_args = function_args[1:] # Drop "self" from argument list # Replace arguments and function name with the proper values. wrapped_function = wrap_js.format(function = function_name, args = ", ".join(function_args)) # Wrap the "this" object in a QML JSValue object. this_jsvalue = engine.newQObject(this_object) # Use the QML engine to evaluate the wrapped JS, then call that to retrieve the closure. result = engine.evaluate(wrapped_function).call([this_jsvalue]) # Finally, return the resulting function. return result
Example #29
Source File: qt_compat.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def _setup_pyqt5(): global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName if QT_API == QT_API_PYQT5: from PyQt5 import QtCore, QtGui, QtWidgets __version__ = QtCore.PYQT_VERSION_STR QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot QtCore.Property = QtCore.pyqtProperty elif QT_API == QT_API_PYSIDE2: from PySide2 import QtCore, QtGui, QtWidgets, __version__ else: raise ValueError("Unexpected value for the 'backend.qt5' rcparam") _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName def is_pyqt5(): return True
Example #30
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 4 votes |
def _fillMarkerContextMenu_(self, event, menu): if self.pipValue: @QtCore.pyqtSlot() def _fastTravel(): if QtWidgets.QMessageBox.question(self.view, 'Fast Travel', 'Do you want to travel to ' + self.label + '?') == QtWidgets.QMessageBox.Yes: self.datamanager.rpcFastTravel(self.pipValue) menu.addAction('Fast Travel', _fastTravel) @QtCore.pyqtSlot() def _addMarkerNote(): if(self.uid == None): self.widget._logger.warn('marker has no uid, cannot create note') return notestr = self.note noteDlg = EditNoteDialog() noteDlg.txtNote.setText(notestr) noteDlg.lblLocation.setText(self.pipValue.child('Name').value()) noteDlg.chkCharacterOnly.setText(noteDlg.chkCharacterOnly.text() + '(' +self.widget.characterDataManager.pipPlayerName +')') ok = noteDlg.exec_() notestr = noteDlg.txtNote.text() thisCharOnly = noteDlg.chkCharacterOnly.isChecked() noteDlg.show() if (ok != 0): noteSettingPath = 'globalmapwidget/locationmarkernotes/' if thisCharOnly: noteSettingPath = self.widget.characterDataManager.playerDataPath + '/locationmarkernotes/' if (len(notestr) > 0): self.widget._app.settings.setValue(noteSettingPath+self.uid, notestr) self.setNote(notestr, True) self.widget._app.settings.setValue('globalmapwidget/stickylabels2/'+self.uid, int(True)) self.setStickyLabel(True, True) else: self.widget._app.settings.beginGroup(noteSettingPath); self.widget._app.settings.remove(self.uid); self.widget._app.settings.endGroup(); self.setNote(notestr, True) self.widget._app.settings.beginGroup('globalmapwidget/stickylabels2/'); self.widget._app.settings.remove(self.uid); self.widget._app.settings.endGroup(); self.setStickyLabel(False, True) menu.addAction('Add\Edit Note', _addMarkerNote) if self.pipValue.child('WorkshopOwned'): @QtCore.pyqtSlot() def _showArtilleryRange(): self.showArtilleryRange(self.artilleryRangeCircle == None) action = menu.addAction('Artillery Range', _showArtilleryRange) action.setCheckable(True) action.setChecked(self.artilleryRangeCircle != None)