def __init__(self, parent=None): super().__init__(parent) self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Classifier Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Neighbors") gui.spin(box, self, "n_neighbors", 1, 100, label="Number of neighbors") box = gui.widgetBox(box, "Metric") box.setFlat(True) gui.comboBox(box, self, "metric_index", items=["Euclidean", "Manhattan", "Maximal", "Mahalanobis"]) self.metrics = ["euclidean", "manhattan", "chebyshev", "mahalanobis"] gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.setMinimumWidth(250) layout = self.layout() self.layout().setSizeConstraint(layout.SetFixedSize) self.apply()
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Options") box = gui.radioButtons(box, self, "reg_type", callback=self._reg_type_changed) gui.appendRadioButton(box, "Ordinary linear regression") gui.appendRadioButton(box, "Ridge regression") ibox = gui.indentedBox(box) gui.doubleSpin(ibox, self, "ridgealpha", 0.0, 1000.0, label="alpha:") self.ridge_box = ibox gui.appendRadioButton(box, "Lasso regression") ibox = gui.indentedBox(box) gui.doubleSpin(ibox, self, "lassoalpha", 0.0, 1000.0, label="alpha") self.lasso_box = ibox gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.ridge_box.setEnabled(self.reg_type == self.Ridge) self.lasso_box.setEnabled(self.reg_type == self.Lasso) self.apply()
def __init__(self): super().__init__() self.data = None self.learner = None self.preprocessor = None self.classifier = None gui.lineEdit(self.controlArea, self, 'model_name', box='Name', tooltip='The name will identify this model in other ' 'widgets') gui.comboBox(self.controlArea, self, "attribute_score", box='Feature selection', items=[name for name, _ in self.scores]) box = gui.widgetBox(self.controlArea, 'Pruning') gui.spin(box, self, "min_leaf", 1, 1000, label="Min. instances in leaves ", checked="limit_min_leaf") gui.spin(box, self, "min_internal", 1, 1000, label="Stop splitting nodes with less instances than ", checked="limit_min_internal") gui.spin(box, self, "max_depth", 1, 1000, label="Limit the depth to ", checked="limit_depth") self.btn_apply = gui.button(self.controlArea, self, "&Apply", callback=self.set_learner, disabled=0, default=True) gui.rubber(self.controlArea) self.resize(100, 100) self.set_learner()
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, self.tr("Name")) gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, box=True) gui.comboBox(box, self, "penalty_type", label="Regularization type: ", items=self.penalty_types, orientation="horizontal", addSpace=4) gui.widgetLabel(box, "Strength:") box2 = gui.widgetBox(gui.indentedBox(box), orientation="horizontal") gui.widgetLabel(box2, "Weak").setStyleSheet("margin-top:6px") gui.hSlider(box2, self, "C_index", minValue=0, maxValue=len(self.C_s) - 1, callback=self.set_c, createLabel=False) gui.widgetLabel(box2, "Strong").setStyleSheet("margin-top:6px") box2 = gui.widgetBox(box, orientation="horizontal") box2.layout().setAlignment(Qt.AlignCenter) self.c_label = gui.widgetLabel(box2) box = gui.widgetBox(self.controlArea, orientation="horizontal", margin=0) box.layout().addWidget(self.report_button) gui.button(box, self, "&Apply", callback=self.apply, default=True) self.set_c() self.apply()
def __init__(self): super().__init__() self.data = None self.db = None box = gui.widgetBox(self.controlArea, "Parameters") gui.spin(box, self, "min_samples", 1, 100, 1, callback=self._invalidate, label="Core point neighbors") gui.doubleSpin(box, self, "eps", 0.1, 0.9, 0.1, callback=self._invalidate, label="Neighborhood distance") box = gui.widgetBox(self.controlArea, self.tr("Distance Metric")) gui.comboBox(box, self, "metric_idx", items=list(zip(*self.METRICS))[0], callback=self._invalidate) box = gui.widgetBox(self.controlArea, "Output") gui.comboBox(box, self, "place_cluster_ids", label="Append cluster id as ", orientation="horizontal", callback=self.send_data, items=self.OUTPUT_METHODS) gui.lineEdit(box, self, "output_name", label="Name: ", orientation="horizontal", callback=self.send_data) gui.auto_commit(self.controlArea, self, "auto_run", "Run", checkbox_label="Run after any change ", orientation="horizontal") gui.rubber(self.controlArea) self.controlArea.setMinimumWidth(self.controlArea.sizeHint().width()) self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize)
def __init__(self): super().__init__() self.preprocessors = None self.data = None box = gui.widgetBox(self.controlArea, "Learner/Model Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Neighbors") gui.spin(box, self, "n_neighbors", 1, 100, label="Number of neighbors") box = gui.widgetBox(box, "Metric") box.setFlat(True) box.layout().setContentsMargins(0, 0, 0, 0) gui.comboBox(box, self, "metric_index", items=["Euclidean", "Manhattan", "Maximal", "Mahalanobis"]) self.metrics = ["euclidean", "manhattan", "chebyshev", "mahalanobis"] gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.controlArea.layout().addWidget(self.report_button) layout = self.layout() self.layout().setSizeConstraint(layout.SetFixedSize) self.apply()
def _create_layout(self): info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') def send_relation(item): data = item.data(QtCore.Qt.UserRole) self.send(Output.RELATION, Relation(data)) self.table = SimpleTableWidget(info, callback=send_relation) self.controlArea.layout().addStretch(1) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) gui.hSlider(self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): super().__init__() self.data = None self.file_att = None # attribute with image file names self.origin = None # origin of image files box = gui.widgetBox(self.controlArea, "Info") self.info_a = gui.widgetLabel(box, "No data on input.") self.info_b = gui.widgetLabel(box, "") box = gui.widgetBox(self.controlArea, "Server Token") gui.lineEdit(box, self, "token", "Token: ", controlWidth=250, orientation=Qt.Horizontal, enterPlaceholder=True, callback=self.token_name_changed) gui.button( box, self, "Get Token", callback=self.open_server_token_page, autoDefault=False ) self.controlArea.setMinimumWidth(self.controlArea.sizeHint().width()) self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize) self.commit_box = gui.auto_commit( self.controlArea, self, "auto_commit", label="Commit", checkbox_label="Commit on change" ) self.commit_box.setEnabled(False) self.profiler = ImageProfiler(token=self.token) if self.token: self.profiler.set_token(self.token) self.set_info()
def _create_layout(self): self.mainArea.layout().addWidget(self.graphview) info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') class TableView(gui.TableView): def __init__(self, parent=None, **kwargs): super().__init__(parent, **kwargs) self._parent = parent self.bold_font = self.BoldFontDelegate(self) # member because PyQt sometimes unrefs too early self.setItemDelegateForColumn(2, self.bold_font) self.setItemDelegateForColumn(4, self.bold_font) self.horizontalHeader().setVisible(False) def selectionChanged(self, selected, deselected): super().selectionChanged(selected, deselected) if not selected: assert len(deselected) > 0 relation = None else: assert len(selected) == 1 data = self._parent.tablemodel[selected[0].top()][0] relation = Relation(data) self._parent.send(Output.RELATION, relation) model = self.tablemodel = PyTableModel(parent=self) table = self.table = TableView(self, selectionMode=TableView.SingleSelection) table.setModel(model) info.layout().addWidget(self.table) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name:', orientation='horizontal', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) slider = gui.hSlider( self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) slider.setTracking(False) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) self.slider_rank.setTracking(False) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Regularization") box = gui.radioButtons( box, self, "reg_type", btnLabels=["No regularization", "Ridge regression", "Lasso regression"], callback=self._reg_type_changed) gui.separator(box) self.alpha_box = box2 = gui.widgetBox(box, margin=0) gui.widgetLabel(box2, "Regularization strength") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.widgetBox(box, orientation="horizontal") box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.auto_commit(self.controlArea, self, "autosend", "Apply", checkbox_label="Apply on every change") self.layout().setSizeConstraint(QLayout.SetFixedSize) self.alpha_slider.setEnabled(self.reg_type != self.OLS) self.commit()
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Classifier Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Neighbors") gui.spin(box, self, "n_neighbors", 1, 100, label="Number of neighbors", alignment=Qt.AlignRight) gui.comboBox(box, self, "metric_index", label="Metric", orientation="horizontal", items=[i.capitalize() for i in self.metrics]) gui.comboBox(box, self, "weight_type", label='Weight', orientation="horizontal", items=[i.capitalize() for i in self.weights]) g = QHBoxLayout() self.controlArea.layout().addLayout(g) apply = gui.button(None, self, "Apply", callback=self.apply, default=True) g.layout().addWidget(self.report_button) g.layout().addWidget(apply) self.apply()
def __init__(self): super().__init__() box0 = gui.widgetBox(self.controlArea, " ",orientation="horizontal") #widget buttons: compute, set defaults, help gui.button(box0, self, "Compute", callback=self.compute) gui.button(box0, self, "Defaults", callback=self.defaults) gui.button(box0, self, "Help", callback=self.help1) self.process_showers() box = gui.widgetBox(self.controlArea, " ",orientation="vertical") idx = -1 #widget index 0 idx += 1 box1 = gui.widgetBox(box) gui.lineEdit(box1, self, "energyMin", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator()) self.show_at(self.unitFlags()[idx], box1) #widget index 1 idx += 1 box1 = gui.widgetBox(box) gui.lineEdit(box1, self, "energyMax", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator()) self.show_at(self.unitFlags()[idx], box1) self.process_showers() gui.rubber(self.controlArea)
def __init__(self): super().__init__() gui.lineEdit(self.controlArea, self, "number", "Enter a number", box="Number", callback=self.number_changed, valueType=int, validator=QIntValidator()) self.number_changed()
def __init__(self, parent=None): super().__init__(parent) self.data = None box = gui.widgetBox(self.controlArea, "Learner Name") gui.lineEdit(box, self, "learner_name") gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.apply()
def __init__(self): super().__init__(self) self.data = None gui.lineEdit(gui.widgetBox(self.controlArea, self.tr("Name")), self, "learner_name") gui.rubber(self.controlArea) gui.button(self.controlArea, self, self.tr("&Apply"), callback=self.apply)
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Regularization", orientation="horizontal") gui.radioButtons( box, self, "reg_type", btnLabels=["No regularization", "Ridge regression (L2)", "Lasso regression (L1)", "Elastic net regression"], callback=self._reg_type_changed) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.widgetBox(box, margin=0) gui.widgetLabel(box2, "Regularization strength") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.widgetBox(box2, orientation="horizontal") box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.widgetBox(box2, margin=0) gui.widgetLabel(box4, "Elastic net mixing") box5 = gui.widgetBox(box4, orientation="horizontal") gui.widgetLabel(box5, "L1") self.l1_ratio_slider = gui.hSlider( box5, self, "l1_ratio", minValue=0.01, maxValue=1, intOnly=False, ticks=0.1, createLabel=False, step=0.01, callback=self._l1_ratio_changed) gui.widgetLabel(box5, "L2") box5 = gui.widgetBox(box4, orientation="horizontal") box5.layout().setAlignment(Qt.AlignCenter) self.l1_ratio_label = gui.widgetLabel(box5, "") self._set_l1_ratio_label() auto_commit = gui.auto_commit( self.controlArea, self, "autosend", "Apply", auto_label="Apply on change") gui.separator(box, 20) auto_commit.layout().addWidget(self.report_button) self.report_button.setMinimumWidth(150) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.alpha_slider.setEnabled(self.reg_type != self.OLS) self.l1_ratio_slider.setEnabled(self.reg_type == self.Elastic) self.commit()
def __init__(self): self.tree = QTreeWidget(self.mainArea, columnCount=2, allColumnsShowFocus=True, alternatingRowColors=True, selectionMode=QTreeWidget.ExtendedSelection, uniformRowHeights=True) self.tree.setHeaderLabels(["Itemsets", "Support", "%"]) self.tree.header().setStretchLastSection(True) self.tree.itemSelectionChanged.connect(self.selectionChanged) self.mainArea.layout().addWidget(self.tree) box = gui.widgetBox(self.controlArea, "Info") self.nItemsets = self.nSelectedExamples = self.nSelectedItemsets = '' gui.label(box, self, "Number of itemsets: %(nItemsets)s") gui.label(box, self, "Selected itemsets: %(nSelectedItemsets)s") gui.label(box, self, "Selected examples: %(nSelectedExamples)s") hbox = gui.widgetBox(box, orientation='horizontal') gui.button(hbox, self, "Expand all", callback=self.tree.expandAll) gui.button(hbox, self, "Collapse all", callback=self.tree.collapseAll) box = gui.widgetBox(self.controlArea, 'Find itemsets') gui.hSlider(box, self, 'minSupport', minValue=1, maxValue=100, label='Minimal support:', labelFormat="%d%%", callback=lambda: self.find_itemsets()) gui.hSlider(box, self, 'maxItemsets', minValue=10000, maxValue=100000, step=10000, label='Max. number of itemsets:', labelFormat="%d", callback=lambda: self.find_itemsets()) gui.checkBox(box, self, 'filterSearch', label='Apply below filters in search', tooltip='If checked, the itemsets are filtered according ' 'to below filter conditions already in the search ' 'phase. \nIf unchecked, the only filters applied ' 'during search are the ones above, ' 'and the itemsets are \nfiltered afterwards only for ' 'display, i.e. only the matching itemsets are shown.') self.button = gui.auto_commit( box, self, 'autoFind', 'Find itemsets', commit=self.find_itemsets) box = gui.widgetBox(self.controlArea, 'Filter itemsets') gui.lineEdit(box, self, 'filterKeywords', 'Contains:', callback=self.filter_change, orientation='horizontal', tooltip='A comma or space-separated list of regular ' 'expressions.') hbox = gui.widgetBox(box, orientation='horizontal') gui.spin(hbox, self, 'filterMinItems', 1, 998, label='Min. items:', callback=self.filter_change) gui.spin(hbox, self, 'filterMaxItems', 2, 999, label='Max. items:', callback=self.filter_change) gui.rubber(hbox) gui.rubber(self.controlArea) gui.auto_commit(self.controlArea, self, 'autoSend', 'Send selection') self.filter_change()
def _setup_layout(self): gui.lineEdit(self.controlArea, self, "learner_name", box="Name") self._add_type_box() self._add_kernel_box() self._add_optimization_box() box = gui.widgetBox(self.controlArea, True, orientation="horizontal") box.layout().addWidget(self.report_button) gui.separator(box, 20) gui.button(box, self, "&Apply", callback=self.apply, default=True)
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preprocessors = None gui.lineEdit( gui.widgetBox(self.controlArea, "Learner/Classifier Name"), self, "learner_name" ) gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.apply()
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner Name") gui.lineEdit(box, self, "learner_name") gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.controlArea.layout().addWidget(self.report_button) self.apply()
def _create_layout(self): self.mainArea.layout().addWidget(self.graphview) info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') def send_relation(selected, deselected): if not selected: assert len(deselected) > 0 relation = None else: assert len(selected) == 1 data = self.table.rowData(selected[0].top()) relation = Relation(data) self.send(Output.RELATION, relation) self.table = gui.TableWidget(info, select_rows=True) self.table.selectionChanged = send_relation self.table.setColumnFilter(bold_item, (1, 3)) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name:', orientation='horizontal', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) slider = gui.hSlider( self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) slider.setTracking(False) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) self.slider_rank.setTracking(False) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): super().__init__() # GUI gui.lineEdit(gui.widgetBox(self.controlArea, self.tr("Name")), self, "learner_name") gui.rubber(self.controlArea) gui.button(self.controlArea, self, self.tr("&Apply"), callback=self.apply) self.data = None self.preprocessors = None self.initialize()
def add_main_layout(self): box = gui.vBox(self.controlArea, "Network") self.hidden_layers_edit = gui.lineEdit( box, self, "hidden_layers_input", label="Neurons per hidden layer:", orientation=Qt.Horizontal, callback=self.settings_changed, tooltip="A list of integers defining neurons. Length of list " "defines the number of layers. E.g. 4, 2, 2, 3.", placeholderText="e.g. 100,") self.activation_combo = gui.comboBox( box, self, "activation_index", orientation=Qt.Horizontal, label="Activation:", items=[i for i in self.act_lbl], callback=self.settings_changed) self.solver_combo = gui.comboBox( box, self, "solver_index", orientation=Qt.Horizontal, label="Solver:", items=[i for i in self.solv_lbl], callback=self.settings_changed) self.alpha_spin = gui.doubleSpin( box, self, "alpha", 1e-5, 1.0, 1e-2, label="Alpha:", decimals=5, alignment=Qt.AlignRight, callback=self.settings_changed, controlWidth=80) self.max_iter_spin = gui.spin( box, self, "max_iterations", 10, 10000, step=10, label="Max iterations:", orientation=Qt.Horizontal, alignment=Qt.AlignRight, callback=self.settings_changed, controlWidth=80)
def __init__(self): super().__init__() gui.label(self.controlArea, self, "from pandas:") self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.allSQLSelectWidgets.append(self) # set default settings self.domain = None self.recentConnections = list() self.recentConnections.append("(none)") self.queryFile = None self.query = "" self.lastQuery = None if self.lastQuery is not None: self.query = self.lastQuery sources = pyodbc.dataSources() dsns = list(sources.keys()) dsns.sort() for dsn in dsns: self.recentConnections.append("DSN={dsn}".format(dsn=dsn)) self.connectString = self.recentConnections[0] self.connectBox = gui.widgetBox(self.controlArea, "Database") self.connectLineEdit = gui.lineEdit(self.connectBox, self, "connectString", callback=None) self.connectCombo = gui.comboBox( self.connectBox, self, "connectString", items=self.recentConnections, valueType=str, sendSelectedValue=True ) self.button = gui.button(self.connectBox, self, "connect", callback=self.connectDB, disabled=0) # query self.splitCanvas = QSplitter(QtCore.Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(self.splitCanvas) self.textBox = gui.widgetBox(self, "HiveQL") self.splitCanvas.addWidget(self.textBox) self.queryTextEdit = QPlainTextEdit(self.query, self) self.textBox.layout().addWidget(self.queryTextEdit) self.selectBox = gui.widgetBox(self.controlArea, "Select statement") # self.selectSubmitBox = QHGroupBox("", self.selectBox) # self.queryTextEdit.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)) # self.queryTextEdit.setMinimumWidth(300) # self.connect(self.queryTextEdit, SIGNAL('returnPressed()'), self.executeQuery) gui.button(self.selectBox, self, "Open...", callback=self.openScript) gui.button(self.selectBox, self, "Save...", callback=self.saveScript) self.selectBox.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) gui.button(self.selectBox, self, "format SQL!", callback=self.format_sql, disabled=0) gui.button(self.selectBox, self, "execute!", callback=self.executeQuery, disabled=0) self.domainBox = gui.widgetBox(self.controlArea, "Domain") self.domainLabel = gui.label(self.domainBox, self, "") # info self.infoBox = gui.widgetBox(self.controlArea, "Info") self.info = [] self.info.append(gui.label(self.infoBox, self, "No data loaded.")) self.info.append(gui.label(self.infoBox, self, "")) self.resize(300, 300) self.cnxn = None
def __init__(self, parent): super().__init__() self.parent = parent self.credentials = None form = QtGui.QFormLayout() form.setMargin(5) self.key_edit = gui.lineEdit(self, self, 'key_input', controlWidth=400) form.addRow('Key:', self.key_edit) self.secret_edit = gui.lineEdit(self, self, 'secret_input', controlWidth=400) form.addRow('Secret:', self.secret_edit) self.controlArea.layout().addLayout(form) self.submit_button = gui.button(self.controlArea, self, "OK", self.accept) self.load_credentials()
def add_textual(contents): le = gui.lineEdit(box, self, None) if contents: le.setText(contents) le.setAlignment(QtCore.Qt.AlignRight) le.editingFinished.connect(self.conditions_changed) return le
def __init__(self): super().__init__() self.data = None """The LazyTable that will be send.""" # GUI: as simple as possible for now box = gui.widgetBox(self.controlArea, "SAMP Info") self.infoa = gui.widgetLabel(widget=box, label='SAMP status unknown.') box_input_catalog = gui.widgetBox(box, orientation=0) self.input_catalog_text = gui.widgetLabel(widget=box_input_catalog , label='Catalog') self.input_catalog = gui.lineEdit(widget=box_input_catalog , master=self, value='catalog_of_interest') #self.resize(100,50) self.button_disconnect = gui.button(self.controlArea, self, "&Disconnect", callback=self.disconnect_samp, default=False) self.button_connect = gui.button(self.controlArea, self, "&Connect", callback=self.connect_samp, default=False) self.button_disconnect.setHidden(True) #gui.button(self.controlArea, self, "&Pull Rows", callback=self.pull_rows, default=False) gui.button(self.controlArea, self, "&Set Table", callback=self.we_have_a_new_table, default=False) # Create a SAMP client and connect to HUB. # Do not make the client in __init__ because this does not allow # the client to disconnect and reconnect again. self.samp_client = None self.connect_samp()
def __init__(self): super().__init__() self.data = None box = gui.radioButtons( self.controlArea, self, "feature_type", box="Feature names", callback=lambda: self.apply()) button = gui.appendRadioButton(box, "Generic") edit = gui.lineEdit( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_name", placeholderText="Type a prefix ...", toolTip="Custom feature name") edit.editingFinished.connect(self._apply_editing) self.meta_button = gui.appendRadioButton(box, "From meta attribute:") self.feature_model = DomainModel( order=DomainModel.METAS, valid_types=StringVariable, alphabetical=True) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_names_column", callback=self._feature_combo_changed, model=self.feature_model) self.apply_button = gui.auto_commit( self.controlArea, self, "auto_apply", "&Apply", box=False, commit=self.apply) self.apply_button.button.setAutoDefault(False) self.set_controls()
def __init__(self): super().__init__() self.cap = None self.snapshot_flash = 0 self.IMAGE_DIR = tempfile.mkdtemp(prefix='Orange-WebcamCapture-') self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) box = self.controlArea image = self.imageLabel = QLabel( margin=0, alignment=Qt.AlignCenter, sizePolicy=QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)) box.layout().addWidget(image, 100) self.name_edit = line_edit = gui.lineEdit( box, self, 'image_title', 'Title:', orientation=Qt.Horizontal) line_edit.setPlaceholderText(self.DEFAULT_TITLE) hbox = gui.hBox(box) gui.checkBox(hbox, self, 'avatar_filter', 'Avatar filter') button = self.capture_button = QPushButton('Capture', self, clicked=self.capture_image) hbox.layout().addWidget(button, 1000) box.layout().addWidget(hbox) timer = QTimer(self, interval=40) timer.timeout.connect(self.update_webcam_image) timer.start()
def __init__(self): super().__init__() self.data = None self.groups = None self.CVSettings = (self.stratified, self.numberOfFolds) infoBox = gui.widgetBox(self.controlArea, "Information") self.dataInfoLabel = gui.widgetLabel(infoBox, 'No data on input.') self.outputInfoLabel = gui.widgetLabel(infoBox, ' ') optionsBox = gui.widgetBox(self.controlArea, "Options") le = gui.lineEdit(optionsBox, self, "randomSeed", "Random seed: ", orientation=0, controlWidth=60, validator=QtGui.QIntValidator()) s = le.sizeHint().height() - 2 b = gui.toolButton(le.box, self, width=s, height=s, callback=lambda: le.setText("")) b.setIcon(b.style().standardIcon(b.style().SP_DialogCancelButton)) gui.rubber(le.box) gui.checkBox(optionsBox, self, "stratified", "Stratified, if possible") sampling = gui.radioButtons( self.controlArea, self, "samplingType", box="Sampling type", addSpace=True) gui.appendRadioButton(sampling, "Random Sampling:") indRndSmpl = gui.indentedBox(sampling) sizeType = gui.radioButtons( indRndSmpl, self, "sampleSizeType", callback=lambda: self.chooseSampling(0)) gui.appendRadioButton(sizeType, "Sample size:", insertInto=indRndSmpl) self.sampleSizeSpin = gui.spin( gui.indentedBox(indRndSmpl), self, "sampleSizeNumber", 1, 1000000000, callback=[lambda: self.chooseSampling(0), lambda: self.chooseSizeType(0)]) gui.appendRadioButton(sizeType, "Sample proportions:", insertInto=indRndSmpl) gui.hSlider(gui.indentedBox(indRndSmpl), self, "sampleSizePercentage", minValue=1, maxValue=100, ticks=10, labelFormat="%d%%", callback=[lambda: self.chooseSampling(0), lambda: self.chooseSizeType(1)]) gui.appendRadioButton(sampling, "Cross Validation:") crossValidIndent = gui.indentedBox(sampling) gui.spin( crossValidIndent, self, "numberOfFolds", 2, 100, label="Number of folds:", callback=[self.updateSelectedFoldSpin, lambda: self.chooseSampling(1)]) self.selectedFoldSpin = gui.spin( crossValidIndent, self, "selectedFold", 1, 100, label="Selected fold:", callback=[self.updateSelectedFoldSpin, lambda: self.chooseSampling(1)]) gui.button(self.controlArea, self, "Sample Data", callback=self.sendData)
def _setup_control_area(self): settings_box = gui.widgetBox(self.controlArea, "参数设置:") appid = gui.lineEdit( settings_box, self, "APPID", "输入 APPID", valueType=str, ) appid.setEchoMode(QLineEdit.Password) appkey = gui.lineEdit( settings_box, self, "APPKEY", "输入 APPKEY", valueType=str, ) appkey.setEchoMode(QLineEdit.Password)
def __init__(self): super().__init__() self.data = None self.label_box = gui.lineEdit(self.controlArea, self, "label", box="Text", callback=self.commit)
def add_textual(contents): le = gui.lineEdit(box, self, None, sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) if contents: le.setText(contents) le.setAlignment(Qt.AlignRight) le.editingFinished.connect(self.conditions_changed) return le
def text_line(): def set_search_string_timer(): self.searchStringTimer.stop() self.searchStringTimer.start(300) return gui.lineEdit( gui.hBox(vbox), self, "mark_text", label="Text: ", orientation=Qt.Horizontal, minimumWidth=50, callback=set_search_string_timer, callbackOnType=True).box
def add_main_layout(self): box = gui.vBox(self.controlArea, "Network") self.hidden_layers_edit = gui.lineEdit( box, self, "hidden_layers_input", label="Neurons per hidden layer:", orientation=Qt.Horizontal, callback=self.settings_changed, tooltip="A list of integers defining neurons. Length of list " "defines the number of layers. E.g. 4, 2, 2, 3.", placeholderText="e.g. 100,", ) self.activation_combo = gui.comboBox( box, self, "activation_index", orientation=Qt.Horizontal, label="Activation:", items=[i for i in self.act_lbl], callback=self.settings_changed, ) self.solver_combo = gui.comboBox( box, self, "solver_index", orientation=Qt.Horizontal, label="Solver:", items=[i for i in self.solv_lbl], callback=self.settings_changed, ) self.alpha_spin = gui.doubleSpin( box, self, "alpha", 1e-5, 1.0, 1e-2, label="Alpha:", decimals=5, alignment=Qt.AlignRight, callback=self.settings_changed, controlWidth=80, ) self.max_iter_spin = gui.spin( box, self, "max_iterations", 10, 300, step=10, label="Max iterations:", orientation=Qt.Horizontal, alignment=Qt.AlignRight, callback=self.settings_changed, controlWidth=80, )
def add_learner_name_widget(self): self.name_line_edit = gui.lineEdit( self.controlArea, self, 'learner_name', box='名称', tooltip='The name will identify this model in other widgets', orientation=Qt.Horizontal, callback=self.learner_name_changed)
def _init_ui(self): # implement your user interface here (for setting hyperparameters) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Hyperparameter") gui.separator(self.controlArea) gui.lineEdit(box, self, 'n_quantiles', label='Number of quantiles to be computed. (IntVariable)', callback=None) gui.comboBox(box, self, "output_distribution", label='Marginal distribution for the transformed data.', items=['uniform', 'normal'], ) gui.checkBox(box, self, "ignore_implicit_zeros", label='Discard sparse matrices.', callback=None) gui.lineEdit(box, self, 'subsample', label='Maximum number of samples used to estimate the quantiles. (IntVariable)', callback=None) gui.lineEdit(box, self, 'random_state', label='Seed used by the random number generator. (Int or None)', callback=None) # use_semantic_types = Setting(False) gui.checkBox(box, self, "use_semantic_types", label='Mannally select columns if active.', callback=None) # use_columns = Setting(()) gui.lineEdit(box, self, "use_columns_buf", label='Column index to use when use_semantic_types is activated. Tuple, e.g. (0,1,2)', validator=None, callback=self._use_columns_callback) # exclude_columns = Setting(()) gui.lineEdit(box, self, "exclude_columns_buf", label='Column index to exclude when use_semantic_types is activated. Tuple, e.g. (0,1,2)', validator=None, callback=self._exclude_columns_callback) # return_result = Setting(['append', 'replace', 'new']) gui.comboBox(box, self, "return_result", sendSelectedValue=True, label='Output results.', items=['new', 'append', 'replace'], ) # add_index_columns = Setting(False) gui.checkBox(box, self, "add_index_columns", label='Keep index in the outputs.', callback=None) # error_on_no_input = Setting(True) gui.checkBox(box, self, "error_on_no_input", label='Error on no input.', callback=None) # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute', # 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute']) gui.comboBox(box, self, "return_semantic_type", sendSelectedValue=True, label='Semantic type attach with results.', items=['https://metadata.datadrivendiscovery.org/types/Attribute', 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'], ) # Only for test gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter) gui.auto_apply(box, self, "autosend", box=False) self.data = None self.info.set_input_summary(self.info.NoInput) self.info.set_output_summary(self.info.NoOutput)
def __init__(self): super().__init__() self.controlArea.setMinimumWidth(400) gui.comboBox(self.controlArea, self, 'format', items=OWDataFrameReader.FORMAT_LIST, label='File format', sendSelectedValue=True) file_browser_box = gui.hBox(self.controlArea, 'File path') gui.lineEdit(file_browser_box, self, 'file_path', orientation=QtCore.Qt.Horizontal) gui.toolButton(file_browser_box, self, 'Browse...', callback=self.browse_file) gui.button(self.controlArea, self, 'Apply', callback=self.apply)
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Regularization") box = gui.radioButtons(box, self, "reg_type", btnLabels=[ "No regularization", "Ridge regression", "Lasso regression" ], callback=self._reg_type_changed) gui.separator(box) self.alpha_box = box2 = gui.widgetBox(box, margin=0) gui.widgetLabel(box2, "Regularization strength") self.alpha_slider = gui.hSlider(box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.widgetBox(box, orientation="horizontal") box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.auto_commit(self.controlArea, self, "autosend", "Apply", checkbox_label="Apply on every change") self.layout().setSizeConstraint(QLayout.SetFixedSize) self.alpha_slider.setEnabled(self.reg_type != self.OLS) self.commit()
def _init_ui(self): # implement your user interface here (for setting hyperparameters) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Hyperparameter") gui.separator(self.controlArea) gui.lineEdit( box, self, "rule", label='rule', #valueType=string, callback=None) gui.auto_apply(box, self, "autosend", box=False) self.data = None self.info.set_input_summary(self.info.NoInput) self.info.set_output_summary(self.info.NoOutput)
def _init_ui(self): # implement your user interface here (for setting hyperparameters) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Hyperparameter") gui.separator(self.controlArea) gui.checkBox(box, self, "with_mean", label='endog', callback=None) gui.checkBox(box, self, "with_std", label='optimized', callback=None) # use_semantic_types = Setting(False) gui.checkBox(box, self, "use_semantic_types", label='Mannally select columns if active.', callback=None) # use_columns = Setting(()) gui.lineEdit(box, self, "use_columns_buf", label='Column index to use when use_semantic_types is activated. Tuple, e.g. (0,1,2)', validator=None, callback=self._use_columns_callback) # exclude_columns = Setting(()) gui.lineEdit(box, self, "exclude_columns_buf", label='Column index to exclude when use_semantic_types is activated. Tuple, e.g. (0,1,2)', validator=None, callback=self._exclude_columns_callback) # return_result = Setting(['append', 'replace', 'new']) gui.comboBox(box, self, "return_result", sendSelectedValue=True, label='Output results.', items=['new', 'append', 'replace'], ) # add_index_columns = Setting(False) gui.checkBox(box, self, "add_index_columns", label='Keep index in the outputs.', callback=None) # error_on_no_input = Setting(True) gui.checkBox(box, self, "error_on_no_input", label='Error on no input.', callback=None) # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute', # 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute']) gui.comboBox(box, self, "return_semantic_type", sendSelectedValue=True, label='Semantic type attach with results.', items=['https://metadata.datadrivendiscovery.org/types/Attribute', 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'], ) # Only for test gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter) gui.auto_apply(box, self, "autosend", box=False) self.data = None self.info.set_input_summary(self.info.NoInput) self.info.set_output_summary(self.info.NoOutput)
def lineEditFloatOrNone(widget, master, value, **kwargs): kwargs["validator"] = FloatOrEmptyValidator(master) kwargs["valueType"] = floatornone le = gui.lineEdit(widget, master, value, **kwargs) if value: val = getdeepattr(master, value) if val is None: le.setText("") else: le.setText(str(val)) return le
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, self.tr("Name")) gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, self.tr("Regularization")) form = QtGui.QFormLayout() form.setContentsMargins(0, 0, 0, 0) box.layout().addLayout(form) buttonbox = gui.radioButtonsInBox(box, self, "penalty_type", btnLabels=("L1", "L2"), orientation="horizontal") form.addRow(self.tr("Penalty type:"), buttonbox) spin = gui.doubleSpin(box, self, "C", 0.0, 1024.0, step=0.0001) form.addRow("Reg (C):", spin) box = gui.widgetBox(self.controlArea, "Numerical Tolerance") gui.doubleSpin(box, self, "tol", 1e-7, 1e-3, 5e-7) gui.button(self.controlArea, self, "&Apply", callback=self.apply, default=True) self.setSizePolicy( QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)) self.setMinimumWidth(250) self.apply()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.data = None # type: Orange.data.Table self.idvar_model = itemmodels.VariableListModel(parent=self) self.item_var_name = "Item" self.value_var_name = "Rating" box = gui.widgetBox(self.controlArea, "Info") self.info_text = gui.widgetLabel(box, "No data") box = gui.widgetBox(self.controlArea, "Id var") self.var_cb = gui.comboBox(box, self, "idvar", callback=self._invalidate) self.var_cb.setMinimumContentsLength(16) self.var_cb.setModel(self.idvar_model) gui.lineEdit(self.controlArea, self, "item_var_name", box="Item name", callback=self._invalidate) gui.lineEdit(self.controlArea, self, "value_var_name", box="Value name", callback=self._invalidate)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.data: Optional[Table] = None self._output_desc: Optional[Dict[str, str]] = None box = gui.widgetBox(self.controlArea, "唯一行标识符") self.idvar_model = itemmodels.VariableListModel( [None], placeholder="行号") self.var_cb = gui.comboBox( box, self, "idvar", model=self.idvar_model, callback=self._invalidate, minimumContentsLength=16, tooltip="包含标识符(如客户的 ID)的列") box = gui.widgetBox(self.controlArea, "筛选") gui.checkBox( box, self, "only_numeric", "忽略非数值特征", callback=self._invalidate) gui.checkBox( box, self, "exclude_zeros", "排除0值", callback=self._invalidate, tooltip="除了缺失值之外,还要省略值为0的行") form = QFormLayout() gui.widgetBox( self.controlArea, "生成特征的名称", orientation=form) form.addRow("项目:", gui.lineEdit( None, self, "item_var_name", callback=self._invalidate, placeholderText=DEFAULT_ITEM_NAME, styleSheet="padding-left: 3px")) form.addRow("值:", gui.lineEdit( None, self, "value_var_name", callback=self._invalidate, placeholderText=DEFAULT_VALUE_NAME, styleSheet="padding-left: 3px")) gui.auto_apply(self.controlArea, self)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.data: Optional[Table] = None self._output_desc: Optional[Dict[str, str]] = None box = gui.widgetBox(self.controlArea, "Unique Row Identifier") self.idvar_model = itemmodels.VariableListModel( [None], placeholder="Row number") self.var_cb = gui.comboBox( box, self, "idvar", model=self.idvar_model, callback=self._invalidate, minimumContentsLength=16, tooltip="A column with identifier, like customer's id") box = gui.widgetBox(self.controlArea, "Filter") gui.checkBox( box, self, "only_numeric", "Ignore non-numeric features", callback=self._invalidate) gui.checkBox( box, self, "exclude_zeros", "Exclude zero values", callback=self._invalidate, tooltip="Besides missing values, also omit items with zero values") form = QFormLayout() gui.widgetBox( self.controlArea, "Names for generated features", orientation=form) form.addRow("Item:", gui.lineEdit( None, self, "item_var_name", callback=self._invalidate, placeholderText=DEFAULT_ITEM_NAME, styleSheet="padding-left: 3px")) form.addRow("Value:", gui.lineEdit( None, self, "value_var_name", callback=self._invalidate, placeholderText=DEFAULT_VALUE_NAME, styleSheet="padding-left: 3px")) gui.auto_apply(self.controlArea, self)
def _init_gui(self): printt("Init {} gui".format(__class__)) log.info("Init {} gui".format(__class__)) # conection parameters box self.box_parameters = gui.widgetBox(self.controlArea, "Client parameters") # host gui.lineEdit(self.box_parameters, self, "host", "Enter host", callback=self.host_changed, valueType=str) # iot_client gui.lineEdit(self.box_parameters, self, "iot_client", "Enter Iot Client", callback=self.iot_client_changed, valueType=str) # iot_client_token gui.lineEdit(self.box_parameters, self, "iot_client_token", "Enter Iot Client Token", callback=self.iot_client_token_changed, valueType=str) gui.auto_commit(self.controlArea, self, "auto_commit", "Send Client")
def setup_filter_area(self): h_layout = QHBoxLayout() h_layout.setSpacing(100) h_widget = widgetBox(self.mainArea, orientation=h_layout) spin( h_widget, self, 'min_count', 0, 100, label='Count', tooltip='Minimum genes count', checked='use_min_count', callback=self.filter_data_view, callbackOnReturn=True, checkCallback=self.filter_data_view, ) doubleSpin( h_widget, self, 'max_p_value', 0.0, 1.0, 0.0001, label='p-value', tooltip='Maximum p-value of the enrichment score', checked='use_p_value', callback=self.filter_data_view, callbackOnReturn=True, checkCallback=self.filter_data_view, ) doubleSpin( h_widget, self, 'max_fdr', 0.0, 1.0, 0.0001, label='FDR', tooltip='Maximum false discovery rate', checked='use_max_fdr', callback=self.filter_data_view, callbackOnReturn=True, checkCallback=self.filter_data_view, ) self.line_edit_filter = lineEdit(h_widget, self, 'search_pattern') self.line_edit_filter.setPlaceholderText('Filter gene sets ...') self.line_edit_filter.textChanged.connect(self.filter_data_view)
def __init__(self): super().__init__() self.corpus = None self.strings_attrs = [] self.profiler = TweetProfiler( token=self.token, on_server_down=self.Error.server_down, on_invalid_token=self.Error.invalid_token, on_too_little_credit=self.Error.no_credit, ) # Info box self.n_documents = '' self.credit = 0 box = gui.widgetBox(self.controlArea, "Info") gui.label(box, self, 'Documents: %(n_documents)s') gui.label(box, self, 'Credits: %(credit)s') # Settings self.controlArea.layout().addWidget(self.generate_grid_layout()) # Server token box = gui.vBox(self.controlArea, 'Server Token') gui.lineEdit(box, self, 'token', callback=self.token_changed, controlWidth=300) gui.button(box, self, 'Get Token', callback=self.get_new_token) # Auto commit buttons_layout = QtGui.QHBoxLayout() buttons_layout.addWidget(self.report_button) buttons_layout.addSpacing(15) buttons_layout.addWidget( gui.auto_commit(None, self, 'auto_commit', 'Commit', box=False)) self.controlArea.layout().addLayout(buttons_layout) self.refresh_token_info()
def __init__(self, parent): super().__init__() self.parent = parent self.api = None form = QFormLayout() form.setContentsMargins(5, 5, 5, 5) self.key_edit = gui.lineEdit(self, self, 'key_input', controlWidth=350) form.addRow('Key:', self.key_edit) self.controlArea.layout().addLayout(form) self.submit_button = gui.button(self.controlArea, self, 'OK', self.accept) self.load_credentials()
def __init__(self, parent): super().__init__() self.parent = parent self.api = None form = QFormLayout() form.setContentsMargins(5, 5, 5, 5) self.host_edit = gui.lineEdit(self, self, 'host_input', controlWidth=150) self.user_edit = gui.lineEdit(self, self, 'user_input', controlWidth=150) self.passwd_edit = gui.lineEdit(self, self, 'passwd_input', controlWidth=150) self.passwd_edit.setEchoMode(QLineEdit.Password) tokenbox = gui.vBox(self) self.submit_button = gui.button(tokenbox, self, 'request new token', self.accept, width=100) self.token_edit = gui.lineEdit(tokenbox, self, 'token_input', controlWidth=200) form.addRow('Host:', self.host_edit) form.addRow('username:'******'password:', self.passwd_edit) form.addRow(tokenbox) self.controlArea.layout().addLayout(form) self.load_credentials()
def __init__(self, parent): super().__init__() self.parent = parent self.credentials = None form = QFormLayout() form.setContentsMargins(5, 5, 5, 5) self.key_edit = gui.lineEdit(self, self, "key_input", controlWidth=400) form.addRow("Key:", self.key_edit) self.secret_edit = gui.lineEdit(self, self, "secret_input", controlWidth=400) form.addRow("Secret:", self.secret_edit) self.controlArea.layout().addLayout(form) self.submit_button = gui.button(self.controlArea, self, "OK", self.accept) self.load_credentials()
def __init__(self): super().__init__() self.file_edit = gui.lineEdit(None, self, "file_name") self.btn_file = gui.button(None, self, "☰", callback=self.get_file, autoDefault=False) self.buttonsArea.layout().addWidget(self.btn_file) self.buttonsArea.layout().addWidget(self.file_edit) self.buttonsArea.layout().setSpacing(4) self.buttonsArea.layout().addSpacing(4) self.buttonsArea.setMinimumWidth(400) if self.file_name is not "": self.send("File", self.file_name)
def __init__(self): super().__init__() self.data = None box = gui.vBox(self.controlArea, box=True) self.variable_model = DomainModel(order=DomainModel.MIXED, valid_types=(ContinuousVariable, )) var_list = gui.listView( box, self, "variables", model=self.variable_model, callback=lambda: self.commit() # pylint: disable=W0108 ) var_list.setSelectionMode(var_list.ExtendedSelection) combo = gui.comboBox( box, self, "operation", label="Operator: ", orientation=Qt.Horizontal, items=list(self.Operations), sendSelectedValue=True, callback=lambda: self.commit() # pylint: disable=W0108 ) combo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) gui.lineEdit( box, self, "var_name", label="Variable name: ", orientation=Qt.Horizontal, callback=lambda: self.commit() # pylint: disable=W0108 ) gui.auto_apply(self.controlArea, self)
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Classifier Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Neighbors") gui.spin(box, self, "n_neighbors", 1, 100, label="Number of neighbors") box = gui.widgetBox(box, "Metric") box.setFlat(True) gui.comboBox(box, self, "metric_index", items=["Euclidean", "Manhattan", "Maximal", "Mahalanobis"]) self.metrics = ["euclidean", "manhattan", "chebyshev", "mahalanobis"] gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.apply()
def __init__(self): super().__init__() box0 = gui.widgetBox(self.controlArea, " ", orientation="horizontal") #widget buttons: compute, set defaults, help gui.button(box0, self, "Compute", callback=self.compute) gui.button(box0, self, "Defaults", callback=self.defaults) gui.button(box0, self, "Help", callback=self.help1) self.process_showers() box = gui.widgetBox(self.controlArea, " ", orientation="vertical") idx = -1 #widget index 0 idx += 1 box1 = gui.widgetBox(box) gui.lineEdit(box1, self, "energyMin", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator()) self.show_at(self.unitFlags()[idx], box1) #widget index 1 idx += 1 box1 = gui.widgetBox(box) gui.lineEdit(box1, self, "energyMax", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator()) self.show_at(self.unitFlags()[idx], box1) self.process_showers() gui.rubber(self.controlArea)
def render_layout(self): self.name_line_edit = gui.lineEdit( self.controlArea, self, 'setting_agent_name', box='Name', tooltip='The name will identify this model in other widgets', orientation=Qt.Horizontal, callback=self.settings_changed) self.render_custom_layout() self.render_auto_apply_layout()
def __init__(self): super().__init__() self.corpus = None # Corpus self.n_documents = '' # Info on docs self.n_matching = '' # Info on docs matching the word self.n_tokens = '' # Info on tokens self.n_types = '' # Info on types (unique tokens) # Info attributes info_box = gui.widgetBox(self.controlArea, 'Info') gui.label(info_box, self, 'Documents: %(n_documents)s') gui.label(info_box, self, 'Tokens: %(n_tokens)s') gui.label(info_box, self, 'Types: %(n_types)s') gui.label(info_box, self, 'Matching: %(n_matching)s') # Width parameter gui.spin(self.controlArea, self, 'context_width', 3, 10, box=True, label="Number of words:", callback=self.set_width) gui.rubber(self.controlArea) # Search c_box = gui.widgetBox(self.mainArea, orientation="vertical") self.input = gui.lineEdit( c_box, self, 'word', orientation=Qt.Horizontal, sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed), label='Query:', callback=self.set_word, callbackOnType=True) self.input.setFocus() # Concordances view self.conc_view = QTableView() self.model = ConcordanceModel() self.conc_view.setModel(self.model) self.conc_view.setWordWrap(False) self.conc_view.setSelectionBehavior(QTableView.SelectRows) self.conc_view.setSelectionModel(DocumentSelectionModel(self.model)) self.conc_view.setItemDelegate(HorizontalGridDelegate()) # connect selectionChanged to self.commit(), which will be # updated by gui.auto_commit() self.conc_view.selectionModel().selectionChanged.connect(lambda: self.commit()) self.conc_view.horizontalHeader().hide() self.conc_view.setShowGrid(False) self.mainArea.layout().addWidget(self.conc_view) self.set_width() # Auto-commit box gui.auto_commit(self.controlArea, self, 'autocommit', 'Commit', 'Auto commit is on')
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, self.tr("Name")) gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, box=True) gui.comboBox(box, self, "penalty_type", label="Regularization type: ", items=("Lasso (L1)", "Ridge (L2)"), orientation="horizontal", addSpace=4) gui.widgetLabel(box, "Strength:") box2 = gui.widgetBox(gui.indentedBox(box), orientation="horizontal") gui.widgetLabel(box2, "Weak").setStyleSheet("margin-top:6px") gui.hSlider(box2, self, "C_index", minValue=0, maxValue=len(self.C_s) - 1, callback=self.set_c, createLabel=False) gui.widgetLabel(box2, "Strong").setStyleSheet("margin-top:6px") box2 = gui.widgetBox(box, orientation="horizontal") box2.layout().setAlignment(Qt.AlignCenter) self.c_label = gui.widgetLabel(box2) gui.button(self.controlArea, self, "&Apply", callback=self.apply, default=True) self.set_c() self.apply()