def __init__(self, source_node, source_channel, sink_node, sink_channel, enabled=True, properties=None, parent=None): QObject.__init__(self, parent) self.source_node = source_node if isinstance(source_channel, str): source_channel = source_node.output_channel(source_channel) elif source_channel not in source_node.output_channels(): raise ValueError("%r not in in nodes output channels." \ % source_channel) self.source_channel = source_channel self.sink_node = sink_node if isinstance(sink_channel, str): sink_channel = sink_node.input_channel(sink_channel) elif sink_channel not in sink_node.input_channels(): raise ValueError("%r not in in nodes input channels." \ % source_channel) self.sink_channel = sink_channel if not compatible_channels(source_channel, sink_channel): raise IncompatibleChannelTypeError( "Cannot connect %r to %r" % (source_channel.type, sink_channel.type) ) self.__enabled = enabled self.__dynamic_enabled = False self.__state = SchemeLink.NoState self.__tool_tip = "" self.properties = properties or {}
def __init__(self, parent=None, minimum=0, maximum=0, text="", value=0): QObject.__init__(self, parent) self._minimum = minimum self._maximum = max(maximum, minimum) self._text = text self._value = value
def __init__(self, parent_widget, parent_component): QObject.__init__(self) OWComponent.__init__(self, widget=parent_widget) box = gui.widgetBox(parent_component, orientation=Qt.Horizontal) self.page_limit = gui.radioButtons( box, self, 'items_per_page', [str(val) for val in ItemsPerPage.values()], orientation=Qt.Horizontal, callback=self.on_limit_changed, label=self.PAGE_LIMIT_LABEL, ) self.page_left_btn = QToolButton() self.page_left_btn.setStyleSheet('QToolButton {border: none;}') self.page_left_btn.setArrowType(Qt.LeftArrow) self.page_left_btn.pressed.connect(self.left_btn_pressed) self.offset_label = gui.label(None, self, str(self.current_page), labelWidth=15) self.offset_label.setAlignment(Qt.AlignCenter) self.page_right_btn = QToolButton() self.page_right_btn.setStyleSheet('QToolButton {border: none;}') self.page_right_btn.setArrowType(Qt.RightArrow) self.page_right_btn.pressed.connect(self.right_btn_pressed) parent_widget.pagination_availability.connect(self._handle_paginate_buttons) box.layout().addStretch(1) box.layout().addWidget(self.page_left_btn) box.layout().addWidget(self.offset_label) box.layout().addWidget(self.page_right_btn)
def __init__(self, widget, parent=None): QObject.__init__(self) gui.OWComponent.__init__(self, widget) self.view_box = MapViewBox(self) self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent, background="w") self.plot_widget.hideAxis("left") self.plot_widget.hideAxis("bottom") self.plot_widget.getPlotItem().buttonsHidden = True self.plot_widget.setAntialiasing(True) self.plot_widget.sizeHint = lambda: QSize(500, 500) self.master = widget # type: OWChoropleth self._create_drag_tooltip(self.plot_widget.scene()) self.choropleth_items = [] # type: List[ChoroplethItem] self.n_ids = 0 self.selection = None # np.ndarray self.palette = None self.color_legend = self._create_legend(((1, 1), (1, 1))) self.update_legend_visibility() self._tooltip_delegate = HelpEventDelegate(self.help_event) self.plot_widget.scene().installEventFilter(self._tooltip_delegate)
def __init__(self, parent=None): QObject.__init__(self, parent) self.__scheme = None self.__signal_manager = None self.__widgets = [] self.__initstate_for_node = {} self.__creation_policy = WidgetManager.Normal #: a queue of all nodes whose widgets are scheduled for #: creation/initialization self.__init_queue = deque() # type: Deque[SchemeNode] #: Timer for scheduling widget initialization self.__init_timer = QTimer(self, interval=0, singleShot=True) self.__init_timer.timeout.connect(self.__create_delayed) #: A mapping of SchemeNode -> OWWidget (note: a mapping is only added #: after the widget is actually created) self.__widget_for_node = {} #: a mapping of OWWidget -> SchemeNode self.__node_for_widget = {} # Widgets that were 'removed' from the scheme but were at # the time in an input update loop and could not be deleted # immediately self.__delay_delete = set() #: Deleted/removed during creation/initialization. self.__delete_after_create = [] #: processing state flags for all widgets (including the ones #: in __delay_delete). #: Note: widgets which have not yet been created do not have an entry self.__widget_processing_state = {} # Tracks the widget in the update loop by the SignalManager self.__updating_widget = None
def __init__(self, obj, propertyName, parent=None): QObject.__init__(self, parent) self.obj = obj self.propertyName = propertyName self.obj.destroyed.connect(self._on_destroyed) self._source = None
def __init__(self): QObject.__init__(self) self._name = '' self._scope = [] self._settings = {} self._daq = None self._sigin = 0 self._sigout = 0 self._scope_time = 1 self._tc = 0 self._freq = 0 self._rate = 0 try: port, apilevel = self._discover() self.server = ziPython.ziDAQServer('localhost', port, apilevel) self.server.connect() msg = self._load_settings() self.server.set(self._settings['server']) self.server.sync() self._get_config() self._daq = self.server.dataAcquisitionModule() self.last_action = 'Lockin found, %s' % (msg) except Exception as e: self.last_action = str(e)
def __init__(self, parent_widget, parent_component): QObject.__init__(self) OWComponent.__init__(self, widget=parent_widget) box = gui.widgetBox(parent_component, self.BOX_TITLE, margin=3) gui.checkBox(box, self, 'quantile_norm', self.QUANTILE_NORM_LABEL, callback=self.options_changed.emit) gui.checkBox(box, self, 'log_norm', self.LOG_NORM_LABEL, callback=self.options_changed.emit) gui.checkBox(box, self, 'z_score_norm', self.Z_SCORE_LABEL, callback=self.on_z_score_selected) self.z_score_axis_btn = gui.radioButtons( gui.indentedBox(box), self, 'z_score_axis', btnLabels=['columns', 'rows'], callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.z_score_axis_btn.setHidden(not bool(self.z_score_norm)) gui.checkBox( box, self, 'quantile_transform', self.QUANTILE_TRANSFORM_LABEL, callback=self.on_quantile_transform_selected, ) self.quantile_transform_axis_btn = gui.radioButtons( gui.indentedBox(box), self, 'quantile_transform_axis', btnLabels=['columns', 'rows'], callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.quantile_transform_dist_btn = gui.radioButtons( gui.indentedBox(box), self, 'quantile_transform_dist', btnLabels=QuantileTransformDist.values(), callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.quantile_transform_axis_btn.setHidden( not bool(self.quantile_transform)) self.quantile_transform_dist_btn.setHidden( not bool(self.quantile_transform))
def __init__(self, parent=None, threadPool=None): QObject.__init__(self, parent) if threadPool is None: threadPool = QThreadPool.globalInstance() self._threadPool = threadPool self._depot_thread = None self._futures = [] self._shutdown = False self._state_lock = threading.Lock()
def __init__(self, qpart): QObject.__init__(self, qpart) self._request_info = {} self.ready = False self._qpart = qpart self._widget = CompletionWidget(self._qpart, self._qpart.parent()) self._opened_automatically = True self._complete()
def __init__(self, parent=None, defaults=(), path=None, store=None): QObject.__init__(self, parent) if store is None: store = QSettings() path = path = (path or "").rstrip("/") self.__path = path self.__defaults = dict([(slot.key, slot) for slot in defaults]) self.__store = store
def __init__(self, parent=None): QObject.__init__(self, parent) self.__splitter = None self.__widget = None self.__updateOnShow = True # Need __update on next show event self.__animationEnabled = True self.__size = -1 self.__expanded = False self.__animation = QPropertyAnimation(self, b"size_", self, duration=200) self.__action = QAction("toogle-expanded", self, checkable=True) self.__action.triggered[bool].connect(self.setExpanded)
def __init__(self, document, parent=None, deleteOnEnd=True): QObject.__init__(self, parent) self.document = document self.scene = document.scene() self.scheme = document.scheme() self.deleteOnEnd = deleteOnEnd self.cancelOnEsc = False self.__finished = False self.__canceled = False self.__cancelReason = self.NoReason
def __init__(self, port=None): QObject.__init__(self) # Communication port must be provided or initialization will fail if port == None: raise ComError try: self.com = serial.Serial(timeout=0, baudrate=115200) self.com.port = port self.last_action = 'Port opened.' except serial.SerialException: self.last_action = 'Serial port already open.' Device.num_devices += 1
def __init__(self, scatter_widget, parent=None, view_box=ViewBox): QObject.__init__(self) gui.OWComponent.__init__(self, scatter_widget) self.subset_is_shown = False self.view_box = view_box(self) self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent, background="w") self.plot_widget.hideAxis("left") self.plot_widget.hideAxis("bottom") self.plot_widget.getPlotItem().buttonsHidden = True self.plot_widget.setAntialiasing(True) self.plot_widget.sizeHint = lambda: QSize(500, 500) self.density_img = None self.scatterplot_item = None self.scatterplot_item_sel = None self.labels = [] self.master = scatter_widget self._create_drag_tooltip(self.plot_widget.scene()) self.selection = None # np.ndarray self.n_valid = 0 self.n_shown = 0 self.sample_size = None self.sample_indices = None self.palette = None self.shape_legend = self._create_legend(((1, 0), (1, 0))) self.color_legend = self._create_legend(((1, 1), (1, 1))) self.update_legend_visibility() self.scale = None # DiscretizedScale self._too_many_labels = False # self.setMouseTracking(True) # self.grabGesture(QPinchGesture) # self.grabGesture(QPanGesture) self.update_grid_visibility() self._tooltip_delegate = EventDelegate(self.help_event) self.plot_widget.scene().installEventFilter(self._tooltip_delegate) self.view_box.sigTransformChanged.connect(self.update_density) self.view_box.sigRangeChangedManually.connect(self.update_labels) self.timer = None
def __init__(self, parent=None, title=None, description=None, env={}): QObject.__init__(self, parent) self.__title = title or "" "Workflow title (empty string by default)." self.__description = description or "" "Workflow description (empty string by default)." self.__annotations = [] self.__nodes = [] self.__links = [] self.__env = dict(env)
def __init__(self, parent=None): QObject.__init__(self, parent) assert QThread.currentThread() is QApplication.instance().thread() netmanager = self._NETMANAGER_REF and self._NETMANAGER_REF() if netmanager is None: netmanager = QNetworkAccessManager() cache = QNetworkDiskCache() cache.setCacheDirectory( os.path.join(data_dir(), "geo", __name__ + ".GeoMap.Cache")) netmanager.setCache(cache) ImageLoader._NETMANAGER_REF = weakref.ref(netmanager) self._netmanager = netmanager
def __init__(self, qpart): QObject.__init__(self) self._qpart = qpart self._mode = Normal(self, qpart) self._qpart.selectionChanged.connect(self._onSelectionChanged) self._qpart.document().modificationChanged.connect( self._onModificationChanged) self._processingKeyPress = False self.updateIndication() self.lastEditCmdFunc = None
def __init__(self, parent=None): QObject.__init__(self, parent) assert QThread.currentThread() is QApplication.instance().thread() netmanager = self._NETMANAGER_REF and self._NETMANAGER_REF() if netmanager is None: netmanager = QNetworkAccessManager() cache = QNetworkDiskCache() cache.setCacheDirectory( os.path.join(settings.widget_settings_dir(), __name__ + ".ImageLoader.Cache") ) netmanager.setCache(cache) ImageLoader._NETMANAGER_REF = weakref.ref(netmanager) self._netmanager = netmanager
def __init__(self, description, title=None, position=None, properties=None, parent=None): QObject.__init__(self, parent) self.description = description if title is None: title = description.name self.__title = title self.__position = position or (0, 0) self.__progress = -1 self.__processing_state = 0 self.__status_message = "" self.__state_messages = {} self.properties = properties or {}
def __init__(self, scheme): assert scheme QObject.__init__(self, scheme) self._input_queue = [] # mapping a node to it's current outputs # {node: {channel: {id: signal_value}}} self._node_outputs = {} self.__state = SignalManager.Running self.__runtime_state = SignalManager.Waiting # A flag indicating if UpdateRequest event should be rescheduled self.__reschedule = False self.__update_timer = QTimer(self, interval=100, singleShot=True) self.__update_timer.timeout.connect(self.__process_next)
def __init__(self, scheme): assert(scheme) QObject.__init__(self, scheme) self._input_queue = [] # mapping a node to it's current outputs # {node: {channel: {id: signal_value}}} self._node_outputs = {} self.__state = SignalManager.Running self.__runtime_state = SignalManager.Waiting # A flag indicating if UpdateRequest event should be rescheduled self.__reschedule = False self.__update_timer = QTimer(self, interval=100, singleShot=True) self.__update_timer.timeout.connect(self.__process_next)
def __init__(self, other_or_parent=None, parent=None): if isinstance(other_or_parent, QObject) and parent is None: parent, other_or_parent = other_or_parent, None QObject.__init__(self, parent) WidgetRegistry.__init__(self, other_or_parent) # Should the QStandardItemModel be subclassed? self.__item_model = QStandardItemModel(self) for i, desc in enumerate(self.categories()): cat_item = self._cat_desc_to_std_item(desc) self.__item_model.insertRow(i, cat_item) for j, wdesc in enumerate(self.widgets(desc.name)): widget_item = self._widget_desc_to_std_item(wdesc, desc) cat_item.insertRow(j, widget_item)
def __init__(self, master): QObject.__init__(self) OWComponent.__init__(self, master) self.view = gui.TableView(wordWrap=True, editTriggers=gui.TableView.NoEditTriggers) header = self.view.horizontalHeader() header.setSectionResizeMode(QHeaderView.ResizeToContents) header.setDefaultAlignment(Qt.AlignCenter) header.setStretchLastSection(False) header.setContextMenuPolicy(Qt.CustomContextMenu) header.customContextMenuRequested.connect(self.show_column_chooser) self.model = QStandardItemModel(master) self.model.setHorizontalHeaderLabels(["Method"]) self.view.setModel(self.model) self.view.setItemDelegate(self.ItemDelegate())
def __init__(self, expression, globals={}, locals={}, parent=None): QObject.__init__(self, parent) self.ast = ast.parse(expression, mode="eval") self.code = compile(self.ast, "<unknown>", "eval") self.expression = expression self.globals = dict(globals) self.locals = dict(locals) self._sources = {} names = self.code.co_names for name in names: v = locals.get(name, globals.get(name)) if isinstance(v, AbstractBoundProperty): self._sources[name] = v v.changed.connect(self.notifyChanged) v.destroyed.connect(self._on_destroyed)
def __init__(self, parent=None, title=None, description=None, env={}, **kwargs): QObject.__init__(self, parent, **kwargs) self.__title = title or "" "Workflow title (empty string by default)." self.__description = description or "" "Workflow description (empty string by default)." self.__annotations = [] self.__nodes = [] self.__links = [] self.__loop_flags = Scheme.NoLoops self.__env = dict(env)
def __init__(self, parent=None): QObject.__init__(self, parent) self.__scheme = None self.__signal_manager = None self.__widgets = [] self.__initstate_for_node = {} self.__creation_policy = WidgetManager.Normal #: a queue of all nodes whose widgets are scheduled for #: creation/initialization self.__init_queue = deque() # type: Deque[SchemeNode] #: Timer for scheduling widget initialization self.__init_timer = QTimer(self, interval=0, singleShot=True) self.__init_timer.timeout.connect(self.__create_delayed) #: A mapping of SchemeNode -> OWWidget (note: a mapping is only added #: after the widget is actually created) self.__widget_for_node = {} #: a mapping of OWWidget -> SchemeNode self.__node_for_widget = {} # Widgets that were 'removed' from the scheme but were at # the time in an input update loop and could not be deleted # immediately self.__delay_delete = set() #: processing state flags for all widgets (including the ones #: in __delay_delete). #: Note: widgets which have not yet been created do not have an entry self.__widget_processing_state = {} # Tracks the widget in the update loop by the SignalManager self.__updating_widget = None # Widgets float above other windows self.__float_widgets_on_top = False if hasattr(qApp, "applicationStateChanged"): # disables/enables widget floating when app (de)activates # available in Qt >= 5.2 def reapply_float_on_top(): self.set_float_widgets_on_top(self.__float_widgets_on_top) qApp.applicationStateChanged.connect(reapply_float_on_top)
def __init__(self, parent_widget, parent_component): QObject.__init__(self) OWComponent.__init__(self, widget=parent_widget) box = gui.widgetBox(parent_component, margin=0) self.filter_full_text = gui.lineEdit( box, self, 'filter_by_full_text', label=self.FILTER_FULL_TEXT_LABEL, callback=self.on_filter_full_text_changed, ) self.toggle_animation = QParallelAnimationGroup() self.toggle_button = QToolButton() self.toggle_button.setCheckable(True) self.toggle_button.setChecked(False) self.toggle_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.toggle_button.setArrowType(Qt.RightArrow) self.toggle_button.setText(self.TOGGLE_BTN_LABEL) self.toggle_button.setStyleSheet('QToolButton {border: none; padding-top: 5px; }') self.toggle_button.setIconSize(QSize(15, 15)) self.toggle_button.pressed.connect(self.on_toggle) self.collapsible_components = QScrollArea() self.collapsible_components.setMaximumHeight(0) self.collapsible_components.setMinimumHeight(0) self.collapsible_components.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.collapsible_components.setFrameShape(QFrame.NoFrame) box = gui.widgetBox(parent_component, margin=0) box.layout().addWidget(self.toggle_button) box.layout().addWidget(self.collapsible_components) self.toggle_animation.addAnimation(QPropertyAnimation(box, b"minimumHeight")) self.toggle_animation.addAnimation(QPropertyAnimation(box, b"maximumHeight")) self.toggle_animation.addAnimation(QPropertyAnimation(self.collapsible_components, b"maximumHeight")) layout = QHBoxLayout() left_box = gui.widgetBox(None, self, margin=0, flat=True) mid_box = gui.widgetBox(None, self, margin=0, flat=True) right_box = gui.widgetBox(None, self, margin=0, flat=True) self.filter_name = gui.lineEdit( left_box, self, 'filter_by_name', label=self.FILTER_NAME_LABEL, callback=self.on_filter_changed, addSpace=5 ) self.filter_contrib = gui.lineEdit( mid_box, self, 'filter_by_contrib', label=self.FILTER_CONTRIB_LABEL, callback=self.on_filter_changed, addSpace=5, ) self.filter_owner = gui.lineEdit( right_box, self, 'filter_by_owner', label=self.FILTER_OWNER_LABEL, callback=self.on_filter_changed, addSpace=5, ) self.filter_modified = gui.comboBox( left_box, self, 'filter_by_modified', label=self.FILTER_MODIFIED_LABEL, callback=self.on_filter_changed, items=FilterByDateModified.labels(), ) self.sorting = gui.comboBox( mid_box, self, 'sort_by', label=self.SORTING_LABEL, callback=self.on_filter_changed, items=SortBy.labels() ) gui.rubber(left_box) gui.rubber(mid_box) gui.rubber(right_box) layout.addWidget(left_box) layout.addWidget(mid_box) layout.addWidget(right_box) self.collapsible_components.setLayout(layout) collapsed_height = box.layout().sizeHint().height() - self.collapsible_components.maximumHeight() content_height = layout.sizeHint().height() for i in range(self.toggle_animation.animationCount()): animation = self.toggle_animation.animationAt(i) animation.setDuration(100) animation.setStartValue(collapsed_height) animation.setEndValue(collapsed_height + content_height) content_animation = self.toggle_animation.animationAt(self.toggle_animation.animationCount() - 1) content_animation.setDuration(100) content_animation.setStartValue(0) content_animation.setEndValue(content_height)
def __init__(self, parent=None, submitPolicy=Default): QObject.__init__(self, parent) self._bindings = defaultdict(list) self._modified = set() self.__submitPolicy = submitPolicy
def __init__(self, parent=None, stream=None, **kwargs): QObject.__init__(self, parent, **kwargs) self._stream = stream
def __init__(self, parent=None): QObject.__init__(self, parent) self.__view = None
def __init__(self, parent=None): QObject.__init__(self, parent) self._pos = None self._index = None
def __init__(self, parent=None, steps=[]): QObject.__init__(self, parent) self.__interupt = False self.__queue = deque(steps) self.pip = PipInstaller() self.conda = CondaInstaller()
def __init__(self, parent=None, registry=None, cached_descriptions=None): QObject.__init__(self, parent) WidgetDiscovery.__init__(self, registry, cached_descriptions)
def __init__(self, parent): QObject.__init__(self, parent) self.selection = []
def __init__(self, parent=None): QObject.__init__(self, parent)
def __init__(self, parent=None, **kwargs): QObject.__init__(self, parent, **kwargs) self.button = None self.buttonDownObj = None self.buttonDownPos = None
def __init__(self, parent=None): QObject.__init__(self, parent) self._registry = None self._initialized = False self._providers = {}
def __init__(self, parent, redirect): QObject.__init__(self, parent) self.redirect = redirect self._delay = False
def __init__(self, parent=None, steps=[], user_install=False): QObject.__init__(self, parent) self.__interupt = False self.__queue = deque(steps) self.__user_install = user_install
def __init__(self, parent=None, steps=[], user_install=False): QObject.__init__(self, parent) self.__interupt = False self.__queue = deque(steps) self.pip = PipInstaller(user_install) self.conda = CondaInstaller()
def __init__(self, parent=None): QObject.__init__(self, parent) self.button_down = None self.button = None self.button_down_pos = None
def __init__(self, future, parent=None): QObject.__init__(self, parent) self._future = future self._future._watchers.append(self._stateChanged)
def __init__(self, parent=None, function=None): QObject.__init__(self, parent) self.function = function self._future = Future()