Python PyQt5.QtCore.QObject.__init__() Examples

The following are 30 code examples of PyQt5.QtCore.QObject.__init__(). 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.QObject , or try the search function .
Example #1
Source File: reqlist.py    From guppy-proxy with MIT License 7 votes vote down vote up
def __init__(self, client, repeater_widget=None, macro_widget=None, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        self.allow_save = False

        self.client = client
        self.repeater_widget = repeater_widget
        self.macro_widget = macro_widget
        self.query = []
        self.req_view_widget = None

        self.setLayout(QStackedLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        
        self.tableModel = ReqListModel(self.client)
        self.tableView = QTableView()
        self.tableView.setModel(self.tableModel)

        self.tableView.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().hide()
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        #self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.horizontalHeader().setStretchLastSection(True)
        
        self.tableView.selectionModel().selectionChanged.connect(self.on_select_change)
        self.tableModel.dataChanged.connect(self._paint_view)
        self.tableModel.rowsInserted.connect(self._on_rows_inserted)
        self.requestsChanged.connect(self.set_requests)
        self.requestsSelected.connect(self._updated_selected_request)
        
        self.selected_reqs = []
        
        self.layout().addWidget(self.tableView)
        self.layout().addWidget(QLabel("<b>Loading requests from data file...</b>")) 
Example #2
Source File: reqlist.py    From guppy-proxy with MIT License 7 votes vote down vote up
def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        layout = QHBoxLayout()
        confirm = QToolButton()
        confirm.setText("OK")
        confirm.setToolTip("Apply the entered filter")
        self.field_entry = get_field_entry()

        # stack containing widgets for string, k/v, date, daterange
        self.str_cmp_entry = StringCmpWidget()
        self.kv_cmp_entry = StringKVWidget()
        self.inv_entry = QCheckBox("inv")
        # date
        # daterange

        self.entry_layout = QStackedLayout()
        self.entry_layout.setContentsMargins(0, 0, 0, 0)
        self.current_entry = 0
        self.entry_layout.addWidget(self.str_cmp_entry)
        self.entry_layout.addWidget(self.kv_cmp_entry)
        # add date # 2
        # add daterange # 3

        confirm.clicked.connect(self.confirm_entry)
        self.str_cmp_entry.returnPressed.connect(self.confirm_entry)
        self.kv_cmp_entry.returnPressed.connect(self.confirm_entry)
        self.field_entry.currentIndexChanged.connect(self._display_value_widget)

        layout.addWidget(confirm)
        layout.addWidget(self.inv_entry)
        layout.addWidget(self.field_entry)
        layout.addLayout(self.entry_layout)

        self.setLayout(layout)
        self.setContentsMargins(0, 0, 0, 0)
        self._display_value_widget() 
Example #3
Source File: hw_common.py    From dash-masternode-tool with MIT License 6 votes vote down vote up
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 = '' 
Example #4
Source File: sockets.py    From IDArling with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #5
Source File: query.py    From dunya-desktop with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #6
Source File: qgis_interface.py    From DataPlotly with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #7
Source File: qgis_interface.py    From Hqgis with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #8
Source File: qgis_interface.py    From qgis-processing-r with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #9
Source File: PostProcessingPlugin.py    From Cura with GNU Lesser General Public License v3.0 6 votes vote down vote up
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. 
Example #10
Source File: reqlist.py    From guppy-proxy with MIT License 6 votes vote down vote up
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) 
Example #11
Source File: refnodesets_widget.py    From opcua-modeler with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #12
Source File: namespace_widget.py    From opcua-modeler with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #13
Source File: macros.py    From guppy-proxy with MIT License 6 votes vote down vote up
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) 
Example #14
Source File: DefinitionContainer.py    From Uranium with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 = "" 
Example #15
Source File: videoconsole.py    From vidcutter with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #16
Source File: qgis_interface.py    From raster-vision-qgis with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #17
Source File: reqlist.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        layout = QHBoxLayout()
        self.textEntry = QLineEdit()
        self.textEntry.returnPressed.connect(self.confirm_entry)
        self.textEntry.setToolTip("Enter the filter here and press return to apply it")
        layout.addWidget(self.textEntry)
        self.setLayout(layout)
        self.layout().setContentsMargins(0, 0, 0, 0) 
Example #18
Source File: sockets.py    From IDArling with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super(PacketEvent, self).__init__(PacketEvent.EVENT_TYPE) 
Example #19
Source File: macros.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, parent, filename='', resultSlot=None):
        QObject.__init__(self)
        self.fname = filename or None # filename we load from
        self.source = None
        self.parent = parent
        self.cached_args = {}
        self.load() 
Example #20
Source File: macros.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, parent, client, filename):
        InterceptMacro.__init__(self)
        QObject.__init__(self)
        self.fname = filename or None # name from the file
        self.source = None
        self.client = client
        self.parent = parent
        self.mclient = MacroClient(self.client)
        self.cached_args = {}
        self.used_args = {}

        if filename:
            self.load(filename) 
Example #21
Source File: macros.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, client):
        QObject.__init__(self)
        self._client = client 
Example #22
Source File: main.py    From vidpipe with GNU General Public License v3.0 5 votes vote down vote up
def __init__( self ):
        print( ">>>>>>>>>>>>>>>TODO: Restore the latest set of options??" )
        Ui_Dialog.__init__( self )
        QObject.__init__( self )

        self._filters = [
            BlurFilter(),
            SimpleMotionDetection(),
            ActivityFilter(),
            HistogramFilter(),
            BlockNumber(),
            EdgeDetector()
            ] 
Example #23
Source File: main.py    From vidpipe with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, caller, called, action = None ):
            QObject.__init__( self )
            self._caller = caller
            self._called = called
            self._action = action 
Example #24
Source File: mpl_qtquick2.py    From matplotlib_qtquick_playground with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        QAbstractListModel.__init__(self, parent)
        
        self._data_series = list()
        self._length_data = 0 
Example #25
Source File: sockets.py    From IDArling with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, logger, parent=None):
        QObject.__init__(self, parent)
        self._logger = logger
        self._socket = None
        self._connected = False
        self._accept_notifier = None 
Example #26
Source File: mpl_qtquick2.py    From matplotlib_qtquick_playground with MIT License 5 votes vote down vote up
def __init__(self, name, data, selected=False):
        self._name = name
        self._data = data
        self._selected = selected 
Example #27
Source File: videoconsole.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, name, level=logging.NOTSET):
        super(VideoLogger, self).__init__(name, level)
        self.pp = pprint.PrettyPrinter(indent=2, compact=False) 
Example #28
Source File: mpl_qtquick1.py    From matplotlib_qtquick_playground with MIT License 5 votes vote down vote up
def __init__(self, parent=None, data=None):
        QObject.__init__(self, parent)
        
        self._status_text = "Please load a data file"
        
        self._filename = ""
        self._x_from = 0
        self._x_to = 1
        self._legend = False
        
        # default dpi=80, so size = (480, 320)
        self._figure = None
        self.axes = None
        
        self._data = data 
Example #29
Source File: mpl_qtquick1.py    From matplotlib_qtquick_playground with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        QAbstractListModel.__init__(self, parent)
        
        self._data_series = list()
        self._length_data = 0 
Example #30
Source File: macros.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QObject.__init__(self, *args, **kwargs)
        self.msg = ""
        self.setLayout(QVBoxLayout())
        self.msgwidg = QPlainTextEdit()
        self.layout().addWidget(self.msgwidg)