本文整理匯總了Python中PyQt5.QtCore.QObject.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python QObject.__init__方法的具體用法?Python QObject.__init__怎麽用?Python QObject.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtCore.QObject
的用法示例。
在下文中一共展示了QObject.__init__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, canvas):
"""Constructor
:param canvas:
"""
QObject.__init__(self)
self.canvas = canvas
# Set up slots so we can mimic the behaviour of QGIS when layers
# are added.
LOGGER.debug('Initialising canvas...')
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers)
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer)
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers)
# For processing module
self.destCrs = None
示例2: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, parent=None):
QThread.__init__(self, parent)
self.stopped = False
self.mid = None
self.uid = None
self.fid = None
self.cmbid = None
self.ambid = None
self.iid = None
self.parent = self.parent()
self.fetching_completed.connect(self.parent.work_received)
self.combobox_results.connect(self.parent.change_combobox_backgrounds)
self.progress_number.connect(self.parent.set_progress_number)
self.query_completed.connect(self.parent.query_finished)
示例3: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self,
get_hw_client_function: Callable[[], object],
hw_connect_function: Callable[[object], None],
hw_disconnect_function: Callable[[], None],
app_config: object,
dashd_intf: object):
QObject.__init__(self)
self.__locks = {} # key: hw_client, value: EnhRLock
self.__app_config = app_config
self.__dashd_intf = dashd_intf
self.__get_hw_client_function = get_hw_client_function
self.__hw_connect_function: Callable = hw_connect_function
self.__hw_disconnect_function: Callable = hw_disconnect_function
self.__base_bip32_path: str = ''
self.__base_public_key: bytes = ''
self.__hd_tree_ident: str = ''
示例4: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, parent = None) -> None:
QObject.__init__(self, parent)
Extension.__init__(self)
self.setMenuName(i18n_catalog.i18nc("@item:inmenu", "Post Processing"))
self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Modify G-Code"), self.showPopup)
self._view = None
# Loaded scripts are all scripts that can be used
self._loaded_scripts = {} # type: Dict[str, Type[Script]]
self._script_labels = {} # type: Dict[str, str]
# Script list contains instances of scripts in loaded_scripts.
# There can be duplicates, which will be executed in sequence.
self._script_list = [] # type: List[Script]
self._selected_script_index = -1
self._global_container_stack = Application.getInstance().getGlobalContainerStack()
if self._global_container_stack:
self._global_container_stack.metaDataChanged.connect(self._restoreScriptInforFromMetadata)
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self.execute)
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged) # When the current printer changes, update the list of scripts.
CuraApplication.getInstance().mainWindowChanged.connect(self._createView) # When the main window is created, create the view so that we can display the post-processing icon if necessary.
示例5: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, view):
QObject.__init__(self, view)
self.view = view
self.model = QStandardItemModel()
self.view.setModel(self.model)
self.nodesets = []
self.server_mgr = None
self.view.header().setSectionResizeMode(1)
addNodeSetAction = QAction("Add Reference Node Set", self.model)
addNodeSetAction.triggered.connect(self.add_nodeset)
self.removeNodeSetAction = QAction("Remove Reference Node Set", self.model)
self.removeNodeSetAction.triggered.connect(self.remove_nodeset)
self.view.setContextMenuPolicy(Qt.CustomContextMenu)
self.view.customContextMenuRequested.connect(self.showContextMenu)
self._contextMenu = QMenu()
self._contextMenu.addAction(addNodeSetAction)
self._contextMenu.addAction(self.removeNodeSetAction)
示例6: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, view):
QObject.__init__(self, view)
self.view = view
self.model = QStandardItemModel()
self.view.setModel(self.model)
delegate = MyDelegate(self.view, self)
delegate.error.connect(self.error.emit)
self.view.setItemDelegate(delegate)
self.node = None
self.view.header().setSectionResizeMode(1)
self.addNamespaceAction = QAction("Add Namespace", self.model)
self.addNamespaceAction.triggered.connect(self.add_namespace)
self.removeNamespaceAction = QAction("Remove Namespace", self.model)
self.removeNamespaceAction.triggered.connect(self.remove_namespace)
self.view.setContextMenuPolicy(Qt.CustomContextMenu)
self.view.customContextMenuRequested.connect(self.showContextMenu)
self._contextMenu = QMenu()
self._contextMenu.addAction(self.addNamespaceAction)
self._contextMenu.addAction(self.removeNamespaceAction)
示例7: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, container_id: str, i18n_catalog: i18nCatalog = None, parent: QObject = None, *args, **kwargs) -> None:
"""Constructor
:param container_id: A unique, machine readable/writable ID for this container.
"""
super().__init__()
QQmlEngine.setObjectOwnership(self, QQmlEngine.CppOwnership)
self._metadata = {"id": container_id,
"name": container_id,
"container_type": DefinitionContainer,
"version": self.Version} # type: Dict[str, Any]
self._definitions = [] # type: List[SettingDefinition]
self._inherited_files = [] # type: List[str]
self._i18n_catalog = i18n_catalog # type: Optional[i18nCatalog]
self._definition_cache = {} # type: Dict[str, SettingDefinition]
self._path = ""
示例8: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint):
super(ConsoleWidget, self).__init__(parent, flags)
self.parent = parent
self.edit = VideoConsole(self)
buttons = QDialogButtonBox()
buttons.setCenterButtons(True)
clearButton = buttons.addButton('Clear', QDialogButtonBox.ResetRole)
clearButton.clicked.connect(self.edit.clear)
closeButton = buttons.addButton(QDialogButtonBox.Close)
closeButton.clicked.connect(self.close)
closeButton.setDefault(True)
layout = QVBoxLayout()
layout.addWidget(self.edit)
layout.addWidget(buttons)
self.setLayout(layout)
self.setWindowTitle('{0} Console'.format(qApp.applicationName()))
self.setWindowModality(Qt.NonModal)
示例9: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, client, *args, **kwargs):
self.client = client
QWidget.__init__(self, *args, **kwargs)
self.setLayout(QVBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
self.tab_widg = QTabWidget()
self.active_widg = ActiveMacroWidget(client)
self.active_ind = self.tab_widg.count()
self.tab_widg.addTab(self.active_widg, "Active")
self.int_widg = IntMacroWidget(client)
self.int_ind = self.tab_widg.count()
self.tab_widg.addTab(self.int_widg, "Intercepting")
self.warning_widg = QLabel("<h1>Warning! Macros may cause instability</h1><p>Macros load and run python files into the Guppy process. If you're not careful when you write them you may cause Guppy to crash. If an active macro ends up in an infinite loop you may need to force kill the application when you quit.</p><p><b>PROCEED WITH CAUTION</b></p>")
self.warning_widg.setWordWrap(True)
self.tab_widg.addTab(self.warning_widg, "Warning")
self.layout().addWidget(self.tab_widg)
示例10: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.str2_shown = False
self.str1 = StringCmpWidget()
self.str2 = StringCmpWidget()
self.str1.returnPressed.connect(self.returnPressed)
self.str2.returnPressed.connect(self.returnPressed)
self.toggle_button = QToolButton()
self.toggle_button.setText("+")
self.toggle_button.clicked.connect(self._show_hide_str2)
layout = QHBoxLayout()
layout.addWidget(self.str1)
layout.addWidget(self.str2)
layout.addWidget(self.toggle_button)
self.str2.setVisible(self.str2_shown)
self.setLayout(layout)
self.layout().setContentsMargins(0, 0, 0, 0)
示例11: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, canvas: QgsMapCanvas):
"""Constructor
:param canvas:
"""
QObject.__init__(self)
self.canvas = canvas
# Set up slots so we can mimic the behaviour of QGIS when layers
# are added.
LOGGER.debug('Initialising canvas...')
# noinspection PyArgumentList
QgsProject.instance().layersAdded.connect(self.addLayers)
# noinspection PyArgumentList
QgsProject.instance().layerWasAdded.connect(self.addLayer)
# noinspection PyArgumentList
QgsProject.instance().removeAll.connect(self.removeAllLayers)
# For processing module
self.destCrs = None
self.message_bar = QgsMessageBar()
示例12: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, logger, parent=None):
QObject.__init__(self, parent)
self._logger = logger
self._socket = None
self._server = parent and isinstance(parent, ServerSocket)
self._read_buffer = bytearray()
self._read_notifier = None
self._read_packet = None
self._write_buffer = bytearray()
self._write_cursor = 0
self._write_notifier = None
self._write_packet = None
self._connected = False
self._outgoing = collections.deque()
self._incoming = collections.deque()
示例13: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, ip, port):
QObject.__init__(self)
self.ip = ip
self.port = port
self.udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.udp_socket.settimeout(1)
self.signal = self.SIG_NORMAL
示例14: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, ip, port):
QObject.__init__(self)
self.ip = ip
self.port = port
self.tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.tcp_socket.settimeout(1)
self.signal = self.SIG_NORMAL
示例15: __init__
# 需要導入模塊: from PyQt5.QtCore import QObject [as 別名]
# 或者: from PyQt5.QtCore.QObject import __init__ [as 別名]
def __init__(self, docid, step, n_progress):
QObject.__init__(self)
self.docid = docid
self.step = step
self.n_progress = n_progress