def __init__(self, text, minValue, maxValue, defaultValue ): QWidget.__init__( self ) validator = QDoubleValidator(minValue, maxValue, 2, self ) mainLayout = QHBoxLayout( self ) checkBox = QCheckBox() checkBox.setFixedWidth( 115 ) checkBox.setText( text ) lineEdit = QLineEdit() lineEdit.setValidator( validator ) lineEdit.setText( str(defaultValue) ) slider = QSlider( QtCore.Qt.Horizontal ) slider.setMinimum( minValue*100 ) slider.setMaximum( maxValue*100 ) slider.setValue( defaultValue ) mainLayout.addWidget( checkBox ) mainLayout.addWidget( lineEdit ) mainLayout.addWidget( slider ) QtCore.QObject.connect( slider, QtCore.SIGNAL( 'valueChanged(int)' ), self.syncWidthLineEdit ) QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged(QString)' ), self.syncWidthSlider ) QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled ) self.checkBox = checkBox self.slider = slider self.lineEdit = lineEdit self.updateEnabled()
def createLayouts(self): """Put widgets into layouts, thus creating the widget""" mainLayout = QHBoxLayout() fieldsLayout = QVBoxLayout() pathLayout = QHBoxLayout() buttonLayout = QHBoxLayout() mainLayout.addStretch(10) fieldsLayout.addStretch(50) fieldsLayout.addWidget(self.linkLabel) fieldsLayout.addWidget(self.line) fieldsLayout.addWidget(self.localdirLabel) pathLayout.addWidget(self.localdirEdit) pathLayout.addWidget(self.browseButton) fieldsLayout.addLayout(pathLayout) buttonLayout.addStretch(50) buttonLayout.addWidget(self.syncButton, 50, Qt.AlignRight) fieldsLayout.addLayout(buttonLayout) fieldsLayout.addStretch(10) fieldsLayout.addWidget(self.statusLabel) fieldsLayout.addWidget(self.status) fieldsLayout.addStretch(80) mainLayout.addLayout(fieldsLayout, 60) mainLayout.addStretch(10) self.setLayout(mainLayout)
def __init__(self ): QWidget.__init__( self ) layout = QVBoxLayout( self ) label = QLabel() listWidget = QListWidget() listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection ) hLayout = QHBoxLayout() buttonLoad = QPushButton( "LOAD") buttonRemove = QPushButton( "REMOVE") hLayout.addWidget( buttonLoad ) hLayout.addWidget( buttonRemove ) layout.addWidget( label ) layout.addWidget( listWidget ) layout.addLayout( hLayout ) self.label = label self.listWidget = listWidget self.buttonLoad = buttonLoad self.buttonRemove = buttonRemove QtCore.QObject.connect( self.buttonLoad, QtCore.SIGNAL( 'clicked()' ), self.loadCommand ) QtCore.QObject.connect( self.buttonRemove, QtCore.SIGNAL( 'clicked()' ), self.removeCommand )
def __init__(self, title, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title sgCmds.makeFile( self.infoPath ) layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) layout.addWidget( groupBox ) baseLayout = QVBoxLayout() groupBox.setLayout( baseLayout ) listWidget = QListWidget() hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 ) b_addSelected = QPushButton( "Add Selected" ) b_clear = QPushButton( "Clear" ) hl_buttons.addWidget( b_addSelected ) hl_buttons.addWidget( b_clear ) baseLayout.addWidget( listWidget ) baseLayout.addLayout( hl_buttons ) self.listWidget = listWidget QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem ) QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected ) QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected ) self.otherWidget = None self.loadInfo()
def _putBody(self): self._centralWidget = QWidget() _hlayout = QHBoxLayout() _hlayout.addWidget(self._putSideBar()) _hlayout.addWidget(self._putTextArea()) self._centralWidget.setLayout(_hlayout) self.setCentralWidget(self._centralWidget)
def _initUI(self): # Variable settings = get_settings() # Widgets self._checkboxes = {} for program in settings.get_programs(): self._checkboxes[program] = QCheckBox(program.name) btn_selectall = QPushButton('Select all') btn_deselectall = QPushButton('Deselect all') # Layouts layout = _OptionsWizardPage._initUI(self) for program in sorted(self._checkboxes.keys() , key=attrgetter('name')): layout.addRow(self._checkboxes[program]) spacer = QSpacerItem(0, 1000, QSizePolicy.Expanding, QSizePolicy.Expanding) layout.addItem(spacer) sublayout = QHBoxLayout() sublayout.addWidget(btn_selectall) sublayout.addWidget(btn_deselectall) layout.addRow(sublayout) # Signals btn_selectall.released.connect(self._onSelectAll) btn_deselectall.released.connect(self._onDeselectAll) return layout
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) title = "" if kwargs.has_key( 'title' ): title = kwargs['title'] self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title sgCmds.makeFile( self.infoPath ) vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) groupBox.setAlignment( QtCore.Qt.AlignCenter ) vLayout.addWidget( groupBox ) hLayout = QHBoxLayout() lineEdit = QLineEdit() button = QPushButton("Load"); button.setFixedWidth( 50 ) hLayout.addWidget( lineEdit ) hLayout.addWidget( button ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex ) self.loadInfo()
def __init__(self, plugin, *args): QFrame.__init__(self, *args) self.plugin = plugin self.config_main = self.plugin.config_main self.config_theme = self.plugin.config_theme self.tools = self.plugin.tools self.lvars = self.plugin.lvars self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) self.edit = self.PlainTextEdit(self) self.number_bar = self.NumberBar(self.config_theme, self.edit) hbox = QHBoxLayout(self) hbox.setSpacing(0) hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjust_width) self.edit.updateRequest.connect(self.number_bar.update_contents) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"), self).\ activated.connect(self.save_file) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+F"), self).\ activated.connect(self.show_find) return
def deleteTab(self): dialog = QDialog( self ) dialog.setWindowTitle( "Remove Tab" ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout(dialog) description = QLabel( "'%s' ���� �����Ͻð� ���ϱ�?".decode('utf-8') % self.tabText( self.currentIndex() ) ) layoutButtons = QHBoxLayout() buttonDelete = QPushButton( "�����".decode('utf-8') ) buttonCancel = QPushButton( "���".decode('utf-8') ) layoutButtons.addWidget( buttonDelete ) layoutButtons.addWidget( buttonCancel ) mainLayout.addWidget( description ) mainLayout.addLayout( layoutButtons ) dialog.show() def cmd_delete(): self.removeTab( self.indexOf( self.currentWidget() ) ) dialog.close() def cmd_cancel(): dialog.close() QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL('clicked()'), cmd_delete ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL('clicked()'), cmd_cancel )
def initUI(self): mainlay = QVBoxLayout() mainlay.addWidget(QLabel('<b>Deformers ({0})</b>'.format(len(self.mdl.deformers)))) def_list = QListWidget() for index, el in enumerate(self.mdl.deformers): def_list.addItem('{0} - {1}'.format(index, el)) #def_list.addItems(self.mdl.deformers) mainlay.addWidget(def_list) self.def_list = def_list btns = QHBoxLayout() btns.addStretch() save = QPushButton('Save') save.clicked.connect(self.save) close = QPushButton('Close') close.clicked.connect(self.close) btns.addWidget(save) btns.addWidget(close) mainlay.addLayout(btns) self.setLayout(mainlay) self.setGeometry(340, 340, 200, 400) self.setWindowTitle('MSH Suite - {0} Deformers'.format(self.mdl.name)) self.show()
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent=parent) # Widgets self._cb_time = TimeComboBox() self._txt_values = MultiNumericalLineEdit() validator = _FactorParameterValidator(parameter, self._cb_time) self._txt_values.setValidator(validator) # Layouts layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._txt_values, 1) layout.addWidget(self._cb_time) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) self._txt_values.textChanged.connect(self.valuesChanged) self._cb_time.currentIndexChanged.connect(self.valuesChanged) self.validationRequested.emit()
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent) # Variables model = _LayerModel() self._material_class = Material # Actions act_add = QAction(getIcon("list-add"), "Add layer", self) act_remove = QAction(getIcon("list-remove"), "Remove layer", self) act_clean = QAction(getIcon('edit-clear'), "Clear", self) # Widgets self._cb_unit = UnitComboBox('m') self._cb_unit.setUnit('um') self._tbl_layers = QTableView() self._tbl_layers.setModel(model) self._tbl_layers.setItemDelegate(_LayerDelegate()) header = self._tbl_layers.horizontalHeader() header.setResizeMode(QHeaderView.Stretch) header.setStyleSheet('color: blue') self._tlb_layers = QToolBar() spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._tlb_layers.addWidget(spacer) self._tlb_layers.addAction(act_add) self._tlb_layers.addAction(act_remove) self._tlb_layers.addAction(act_clean) # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) sublayout = QHBoxLayout() sublayout.addStretch() sublayout.addWidget(QLabel('Thickness unit')) sublayout.addWidget(self._cb_unit) layout.addLayout(sublayout) layout.addWidget(self._tbl_layers) layout.addWidget(self._tlb_layers) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) act_add.triggered.connect(self._onAdd) act_remove.triggered.connect(self._onRemove) act_clean.triggered.connect(self._onClear) self._tbl_layers.doubleClicked.connect(self._onDoubleClicked) model.dataChanged.connect(self.valuesChanged) model.rowsInserted.connect(self.valuesChanged) model.rowsRemoved.connect(self.valuesChanged) self.validationRequested.emit()
def makeContent(self): layout = QHBoxLayout() prefs = PreferencesWidget(self.controller, self.transition) layout.addWidget(prefs, 1) rhs = QVBoxLayout() lblVersion = QLabel() lblVersion.setText("av-control version {0} (avx version {1})".format(_ui_version, _avx_version)) rhs.addWidget(lblVersion) self.lv = LogViewer(self.controller, self.mainWindow) log = ExpandingButton() log.setText("Log") log.clicked.connect(self.showLog) rhs.addWidget(log) btnQuit = ExpandingButton() btnQuit.setText("Exit AV Control") btnQuit.clicked.connect(self.mainWindow.close) rhs.addWidget(btnQuit) layout.addLayout(rhs, 1) return layout
def _initUI(self): '''Sets up the layout of the window''' # Define a central widget and a layout for the window self.setCentralWidget(QWidget()) self.mainLayout = QHBoxLayout() self.setWindowTitle('Spectral Exchange') # Make a layout for all the parameter views params = QVBoxLayout() params.addWidget(self.rate) params.addWidget(self.exchange) params.addWidget(self.peak) # Add the parameter dialog self.mainLayout.addLayout(params) # Add the plot plot_lim = QVBoxLayout() plot_lim.addWidget(self.plot) lim_clear = QHBoxLayout() lim_clear.addWidget(self.scale) lim_clear.addWidget(self.clear) plot_lim.addLayout(lim_clear) self.mainLayout.addLayout(plot_lim) # Add the widgets to the central widget self.centralWidget().setLayout(self.mainLayout)
def __init__(self, widget): super(CenterH, self).__init__() layout = QHBoxLayout() self.setLayout(layout) layout.addStretch() layout.addWidget(widget) layout.addStretch()
def __create_filter_ui(self): """ Create filter widgets """ filter_layout = QHBoxLayout() filter_layout.setSpacing(1) filter_layout.setContentsMargins(0, 0, 0, 0) self.filter_reset_btn = QPushButton() icon = QIcon(':/filtersOff.png') self.filter_reset_btn.setIcon(icon) self.filter_reset_btn.setIconSize(QSize(22, 22)) self.filter_reset_btn.setFixedSize(24, 24) self.filter_reset_btn.setToolTip('Reset filter') self.filter_reset_btn.setFlat(True) self.filter_reset_btn.clicked.connect( partial(self.on_filter_set_text, '')) self.filter_line = QLineEdit() self.filter_line.setPlaceholderText('Enter filter string here') self.filter_line.textChanged.connect(self.on_filter_change_text) completer = QCompleter(self) completer.setCaseSensitivity(Qt.CaseInsensitive) completer.setModel(QStringListModel([], self)) self.filter_line.setCompleter(completer) filter_layout.addWidget(self.filter_reset_btn) filter_layout.addWidget(self.filter_line) return filter_layout
def __init__(self, parent=None, index=None): super(PathEditor, self).__init__(parent) self.parent = parent self.index = index self.open_dialog_visible = False self.setFocusPolicy(Qt.StrongFocus) editor_layout = QHBoxLayout() editor_layout.setContentsMargins(0, 0, 0, 0) editor_layout.setSpacing(0) self.line_edit = LineEditor(self) editor_layout.addWidget(self.line_edit) self.button = QPushButton('') self.button.setIcon(QIcon(':/editor_folder')) self.button.setFixedSize(18, 17) self.button.setToolTip('Select a texture') self.button.setStatusTip('Select a texture') self.button.clicked.connect(self.select_file) editor_layout.addWidget(self.button) self.setFocusProxy(self.line_edit) self.setLayout(editor_layout)
def __init__(self, parent,silhouette,completeness,homogeneity,v_score,AMI,ARS): QDialog.__init__( self, parent ) layout = QVBoxLayout() viewLayout = QFormLayout() viewLayout.addRow(QLabel('Silhouette score: '),QLabel(silhouette)) viewLayout.addRow(QLabel('Completeness: '),QLabel(completeness)) viewLayout.addRow(QLabel('Homogeneity: '),QLabel(homogeneity)) viewLayout.addRow(QLabel('V score: '),QLabel(v_score)) viewLayout.addRow(QLabel('Adjusted mutual information: '),QLabel(AMI)) viewLayout.addRow(QLabel('Adjusted Rand score: '),QLabel(ARS)) viewWidget = QGroupBox() viewWidget.setLayout(viewLayout) layout.addWidget(viewWidget) #Accept cancel self.acceptButton = QPushButton('Ok') self.cancelButton = QPushButton('Cancel') self.acceptButton.clicked.connect(self.accept) self.cancelButton.clicked.connect(self.reject) hbox = QHBoxLayout() hbox.addWidget(self.acceptButton) hbox.addWidget(self.cancelButton) ac = QWidget() ac.setLayout(hbox) layout.addWidget(ac) self.setLayout(layout)
def create_spinbox(self, prefix, suffix, option, default=NoDefault, min_=None, max_=None, step=None, tip=None): if prefix: plabel = QLabel(prefix) else: plabel = None if suffix: slabel = QLabel(suffix) else: slabel = None spinbox = QSpinBox() if min_ is not None: spinbox.setMinimum(min_) if max_ is not None: spinbox.setMaximum(max_) if step is not None: spinbox.setSingleStep(step) if tip is not None: spinbox.setToolTip(tip) self.spinboxes[option] = spinbox layout = QHBoxLayout() for subwidget in (plabel, spinbox, slabel): if subwidget is not None: layout.addWidget(subwidget) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) widget = QWidget(self) widget.setLayout(layout) return widget
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args, **kwargs ) mainLayout = QHBoxLayout( self ) mainLayout.setContentsMargins(0,0,0,0) label = QLabel( "Aim Direction : " ) lineEdit1 = QLineEdit() lineEdit2 = QLineEdit() lineEdit3 = QLineEdit() verticalSeparator = Widget_verticalSeparator() checkBox = QCheckBox( "Set Auto" ) mainLayout.addWidget( label ) mainLayout.addWidget( lineEdit1 ) mainLayout.addWidget( lineEdit2 ) mainLayout.addWidget( lineEdit3 ) mainLayout.addWidget( verticalSeparator ) mainLayout.addWidget( checkBox ) validator = QDoubleValidator( -10000.0, 10000.0, 2 ) lineEdit1.setValidator( validator ) lineEdit2.setValidator( validator ) lineEdit3.setValidator( validator ) lineEdit1.setText( "0.0" ) lineEdit2.setText( "1.0" ) lineEdit3.setText( "0.0" ) checkBox.setChecked( True ) self.label = label; self.lineEdit1 = lineEdit1; self.lineEdit2 = lineEdit2; self.lineEdit3 = lineEdit3; self.checkBox = checkBox self.setVectorEnabled() QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()' ), self.setVectorEnabled )
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setWindowTitle('Tiny BLE Monitor') self.resize(800, 500) self.cwidget = QWidget() self.setCentralWidget(self.cwidget) layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.cwidget.setLayout(layout) self.pwidget = pg.PlotWidget() layout.addWidget(self.pwidget) self.pwidget.setTitle(title="press 'space' to freeze/resume") self.pwidget.setLabel('left', 'I', units='mA') self.pwidget.setLabel('bottom', 't') self.pwidget.showButtons() self.pwidget.setXRange(0, 3000) self.pwidget.setYRange(0, 16) # self.pwidget.enableAutoRange(axis=pg.ViewBox.YAxis) line = pg.InfiniteLine(pos=1.0, angle=0, movable=True, bounds=[0, 200]) self.pwidget.addItem(line) self.pwidget.showGrid(x=True, y=True, alpha=0.5) self.plot = self.pwidget.plot() self.plot.setPen((0, 255, 0)) # plotitem = self.pwidget.getPlotItem() # plotitem.setLimits(xMin=-1, yMin=-1, minXRange=-1, minYRange=-1) # require pyqtgraph 0.9.9+ self.thread = SerialThread() self.thread.error.connect(self.handle_error) self.thread.start() self.freeze = False self.timer = pg.QtCore.QTimer() self.timer.timeout.connect(self.update) self.timer.start(50)
def createGUI(self): self.mainWidget = QWidget() self._createMenus() hLayout = QHBoxLayout() vLayout = QVBoxLayout() innerVLayout = QVBoxLayout() self.profileBox = Profile(self.athlete) self.addPushupBtn = QPushButton("Add Pushup") self.addPushupBtn.setMaximumWidth(100) self.pushupsListWidget = PushupList(self.pushups) self.graphWidget = GraphWidget() #self.graphWidget.setMaximumSize(400, 300) vLayout.addWidget(self.profileBox) hLayout.addWidget(self.pushupsListWidget) innerVLayout.addWidget(self.graphWidget) hLayout.addLayout(innerVLayout) vLayout.addLayout(hLayout) vLayout.addWidget(self.addPushupBtn) self.mainWidget.setLayout(vLayout) self.setCentralWidget(self.mainWidget)
def __init__(self, editor, layout=None, *args, **kw): super(_FilterTableView, self).__init__(editor, *args, **kw) # vlayout = QVBoxLayout() # layout.setSpacing(2) # self.table = table = _myFilterTableView(parent) # self.table = table = _TableView(parent) # table.setSizePolicy(QSizePolicy.Fixed, # QSizePolicy.Fixed) # table.setMinimumHeight(100) # table.setMaximumHeight(50) # table.setFixedHeight(50) # table.setFixedWidth(50) hl = QHBoxLayout() self.button = button = QPushButton() button.setIcon(icon('delete').create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(15) button.setFixedHeight(15) self.text = text = QLineEdit() hl.addWidget(text) hl.addWidget(button) # vlayout.addLayout(hl) layout.addLayout(hl)
def addTab(self, label ): layoutWidget = QWidget() vLayout = QVBoxLayout(layoutWidget) vLayout.setContentsMargins(5,5,5,5) setFolderLayout = QHBoxLayout() listWidget = QListWidget() listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection ) vLayout.addLayout( setFolderLayout ) vLayout.addWidget( listWidget ) lineEdit = QLineEdit() setFolderButton = QPushButton( 'Set Folder' ) setFolderLayout.addWidget( lineEdit ) setFolderLayout.addWidget( setFolderButton ) QtCore.QObject.connect( setFolderButton, QtCore.SIGNAL( 'clicked()' ), Functions.setFolder ) QtCore.QObject.connect( listWidget, QtCore.SIGNAL( 'itemSelectionChanged()' ), Functions.loadImagePathArea ) QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged()' ), Functions.lineEdited ) listWidget.setObjectName( Window_global.listWidgetObjectName ) lineEdit.setContextMenuPolicy( QtCore.Qt.NoContextMenu ) lineEdit.setObjectName( Window_global.lineEditObjectName ) lineEdit.returnPressed.connect( Functions.lineEdited ) super( Tab, self ).addTab( layoutWidget, label )
def qbutton_with_arguments(parent, todo, button_display_text, argument_list): cWidget = QWidget() parent.addWidget(cWidget) cWidget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) cWidget.setContentsMargins(1, 1, 1, 1) newframe = QHBoxLayout() cWidget.setLayout(newframe) newframe.setSpacing(1) newframe.setContentsMargins(1, 1, 1, 1) qmy_button(newframe, todo, button_display_text) for entry in argument_list: # entry[0] is the variable, entry[1] is the text to display if len(entry) == 2: qe = qlabeled_entry(entry[0], entry[1], "top") qe.efield.returnPressed.connect(todo) var_val = entry[0].get() if type(var_val) == int: qe.efield.setText(str(var_val)) qe.efield.setMaximumWidth(50) else: qe.efield.setText(var_val) qe.efield.setMaximumWidth(100) newframe.addWidget(qe) else: qp = aLabeledPopup(entry[0], entry[1], entry[2], "top") newframe.addWidget(qp) return
def init ( self, parent ): """ Finishes initializing the editor by creating the underlying toolkit widget. """ # The control is a vertical layout. self.control = layout = QVBoxLayout() layout.setSpacing( 5 ) layout.setMargin( 0 ) # Add the standard font control: self._font = font = QLineEdit( self.str_value ) QObject.connect( font, SIGNAL( 'editingFinished()' ), self.update_object ) self.control.addWidget( font ) # Add all of the font choice controls: layout2 = QHBoxLayout() self._facename = control = QFontComboBox() control.setEditable( False ) QObject.connect( control, SIGNAL( 'currentFontChanged(QFont)' ), self.update_object_parts ) layout2.addWidget( control ) self._point_size = control = QComboBox() control.addItems( PointSizes ) QObject.connect( control, SIGNAL( 'currentIndexChanged(int)' ), self.update_object_parts ) layout2.addWidget( control ) # These don't have explicit controls. self._bold = self._italic = False self.control.addLayout( layout2 )
def foo(parent): vbox = QHBoxLayout() vbox.addWidget( QLabel('this is the label of component', parent) ) vbox.addWidget( QPushButton(parent, 'button') ) return vbox
def _footer(self): hbox2 = QHBoxLayout() self.layout.addLayout(hbox2) cancelbut = QtGui.QPushButton("Close") cancelbut.released.connect(self.close) hbox2.addStretch(1) hbox2.addWidget(cancelbut)
class ConsoleDialog(QtGui.QDialog): def __init__(self, stream=None): QtGui.QDialog.__init__(self) self.stream = stream self.setWindowTitle('Console Messages') self.layout = QHBoxLayout(self) self.layout.setSpacing(6) self.layout.setContentsMargins(3, 3, 3, 3) self.edit = QTextEdit(self) self.edit.setReadOnly(True) self.layout.addWidget(self.edit) self.resize(450, 250) def write(self, msg): self.edit.moveCursor(QtGui.QTextCursor.End) self.edit.insertPlainText(msg) if self.stream: self.stream.write(msg)
def setup_thresh_buttons(self): ''' set up buttons for overlay/clearing thresh view ''' self.button_frame = QFrame(self) self.button_frame.setGeometry( QRect(self.window_width * .52, self.window_height * .13 + self.video_height, self.video_width * .98, 50)) button_layout = QHBoxLayout() self.button_frame.setLayout(button_layout) self.clear_button = QPushButton('Clear') self.overlay_button = QPushButton('Overlay') button_layout.addWidget(self.clear_button) button_layout.addWidget(self.overlay_button) self.clear_button.setEnabled(False) self.clear_button.clicked.connect(self.clear_threshed) self.overlay_button.setEnabled(False) self.overlay_button.clicked.connect(self.overlay_threshed)
def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons
def setup_video_frames(self): ''' set up spots for playing video frames ''' filler_frame = np.zeros((360, 540, 3)) filler_frame = qimage2ndarray.array2qimage(filler_frame) self.raw_frame = QFrame(self) self.raw_label = QLabel() self.raw_label.setText('raw') self.raw_frame.setGeometry( QRect(self.window_width * .01, self.window_height * .15, self.video_width, self.video_height)) self.raw_frame raw_layout = QVBoxLayout() self.raw_frame.setLayout(raw_layout) raw_layout.addWidget(self.raw_label) self.threshed_frame = QFrame(self) self.threshed_label = QLabel() self.threshed_label.setText('Threshed') self.threshed_frame.setGeometry( QRect(self.window_width * .51, self.window_height * .15, self.video_width, self.video_height)) threshed_layout = QVBoxLayout() self.threshed_frame.setLayout(threshed_layout) threshed_layout.addWidget(self.threshed_label) self.label_frame = QFrame(self) self.label_frame.setGeometry( QRect(self.window_width * .01, self.window_height * .11, self.video_width * 2, 50)) self.label_rawlabel = QLabel() self.label_rawlabel.setText('Raw Video') self.label_threshedlabel = QLabel() self.label_threshedlabel.setText('Threshold View') label_layout = QHBoxLayout() self.label_frame.setLayout(label_layout) label_layout.addWidget(self.label_rawlabel) label_layout.addWidget(self.label_threshedlabel) self.raw_label.setPixmap(QPixmap.fromImage(filler_frame)) self.threshed_label.setPixmap(QPixmap.fromImage(filler_frame))
class LoggingArea(QWidget): def __init__(self, parent=None): super(LoggingArea, self).__init__() self.layout = QVBoxLayout(self) self.hbox_buttons_top = QHBoxLayout(self) self.button_start = QPushButton('Start Logging', self) self.button_start.clicked.connect(parent._start_logging) self.hbox_buttons_top.addWidget(self.button_start) self.button_stop = QPushButton('Stop Logging', self) self.button_stop.clicked.connect(parent._stop_logging) self.hbox_buttons_top.addWidget(self.button_stop) self.layout.addLayout(self.hbox_buttons_top) self.te_logging = QTextEdit(self) self.layout.addWidget(self.te_logging) self.hbox_buttons_bottom = QHBoxLayout(self) self.button_clear = QPushButton('Clear Data', self) self.button_clear.clicked.connect(self._clear_data) self.hbox_buttons_bottom.addWidget(self.button_clear) self.button_clipboard = QPushButton('Copy to Clipboard', self) self.button_clipboard.clicked.connect(self._copy_to_cliboard) self.hbox_buttons_bottom.addWidget(self.button_clipboard) self.button_file = QPushButton('Save to CSV', self) self.button_file.clicked.connect(self._save_to_csv) self.button_file.setEnabled(False) self.hbox_buttons_bottom.addWidget(self.button_file) self.layout.addLayout(self.hbox_buttons_bottom) self.setLayout(self.layout) def _clear_data(self): self.te_logging.clear() def _copy_to_cliboard(self): self.te_logging.selectAll() self.te_logging.copy() def _save_to_csv(self): print('Save to csv')
def __init__(self, parent=None, format=settings.log_fmt, level=logging.INFO): logging.Handler.__init__(self) # Initialize a log handler as the super class self.setFormatter(logging.Formatter(format)) # Set the formatter for the logger self.setLevel(level) # Set the logging level self.frame = QFrame(parent) # Initialize a QFrame to place other widgets in self.frame2 = QFrame(parent) # Initialize frame2 for the label and checkbox self.label = QLabel('Logs') # Define a label for the frame self.check = QCheckBox('Debugging') # Checkbox to enable debugging logging self.check.clicked.connect(self.__changeLevel) # Connect checkbox clicked to the __changeLevel method self.log_widget = QTextEdit() # Initialize a QPlainTextWidget to write logs to self.log_widget.verticalScrollBar().minimum() # Set a vertical scroll bar on the log widget self.log_widget.horizontalScrollBar().minimum() # Set a horizontal scroll bar on the log widget self.log_widget.setLineWrapMode(self.log_widget.NoWrap) # Set line wrap mode to no wrapping self.log_widget.setFont(QFont("Courier", 12)) # Set the font to a monospaced font self.log_widget.setReadOnly(True) # Set log widget to read only layout = QHBoxLayout() # Initialize a horizontal layout scheme for the label and checkbox frame layout.addWidget(self.label) # Add the label to the layout scheme layout.addWidget(self.check) # Add the checkbox to the layout scheme self.frame2.setLayout(layout) # Set the layout for frame to the horizontal layout layout = QVBoxLayout() # Initialize a layout scheme for the widgets layout.addWidget(self.frame2) # Add the label/checkbox frame to the layout scheme layout.addWidget(self.log_widget) # Add the text widget to the layout scheme self.frame.setLayout(layout)
class TextDialog(QDialog): NAME = "TextDialog" TEXT_DIALOG_OK = "TEXT_DIALOG_OK" TEXT_DIALOG_CANCEL = "TEXT_DIALOG_CANCEL" def __init__(self, *args, **kwargs): super(TextDialog, self).__init__(*args, **kwargs) self.edit_line = QLineEdit() self.ok_btn = QPushButton("&Ok") # noinspection PyUnresolvedReferences self.ok_btn.clicked.connect(self.accept) self.ok_btn.setDefault(True) self.cancel_btn = QPushButton("&Cancel") # noinspection PyUnresolvedReferences self.cancel_btn.clicked.connect(self.reject) self.h_layout = QHBoxLayout() self.v_layout = QVBoxLayout() self.h_layout.addStretch(0) self.h_layout.addWidget(self.ok_btn) self.h_layout.addWidget(self.cancel_btn) self.v_layout.addWidget(self.edit_line) self.v_layout.addLayout(self.h_layout) self.setLayout(self.v_layout) # noinspection PyUnresolvedReferences self.accepted.connect(self.on_accept) # noinspection PyUnresolvedReferences self.rejected.connect(self.on_reject) def on_accept(self): Facade.getInstance().sendNotification( TextDialog.TEXT_DIALOG_OK, {"text": self.edit_line.text()}, ) def on_reject(self): Facade.getInstance().sendNotification(TextDialog.TEXT_DIALOG_CANCEL, )
def __init__(self, *args, **kwargs): super(Widget_connectionList, self).__init__(*args, **kwargs) self.installEventFilter(self) mainLayout = QVBoxLayout(self) mainLayout.setContentsMargins(5, 5, 5, 5) mainLayout.setSpacing(0) treeWidget = QTreeWidget() treeWidget.setColumnCount(3) headerItem = treeWidget.headerItem() headerItem.setText(0, "Attribute") headerItem.setText(1, "Target Node") headerItem.setText(2, "Target Attr") treeWidget.setRootIsDecorated(False) self.treeWidget = treeWidget treeWidget.setStyleSheet( "QTreeWidget::item { border-bottom: 1px solid gray; padding:1px}\ QTreeWidget{ font-size:13px;}") treeWidget.header().setStyleSheet("font-size:12px;") w_buttons = QWidget() lay_buttons = QHBoxLayout(w_buttons) lay_buttons.setContentsMargins(0, 0, 0, 0) lay_buttons.setSpacing(5) button_add = QPushButton("Add Line") button_remove = QPushButton("Remove Line") lay_buttons.addWidget(button_add) lay_buttons.addWidget(button_remove) mainLayout.addWidget(treeWidget) mainLayout.addWidget(w_buttons) button_add.clicked.connect(self.cmd_addLine) button_remove.clicked.connect(self.cmd_removeLine) treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( treeWidget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.loadContextMenu) self.treeWidget = treeWidget self.readData()
def _init_widgets(self): main = QMainWindow() main.setWindowFlags(Qt.Widget) # main.setCorner(Qt.TopLeftCorner, Qt.TopDockWidgetArea) # main.setCorner(Qt.TopRightCorner, Qt.RightDockWidgetArea) pathtree = QPathTree(self, main) pathtree_dock = QDockWidget('PathTree', pathtree) main.setCentralWidget(pathtree_dock) # main.addDockWidget(Qt.BottomDockWidgetArea, pathtree_dock) pathtree_dock.setWidget(pathtree) pathgroups_logic = self.workspace.instance.path_groups if self.workspace.instance is not None else None pathgroups = QPathGroups(pathgroups_logic, main) pathgroups_dock = QDockWidget('PathGroups', pathgroups) main.addDockWidget(Qt.RightDockWidgetArea, pathgroups_dock) pathgroups_dock.setWidget(pathgroups) reg_viewer = QRegisterViewer(self) reg_viewer_dock = QDockWidget('Register Viewer', reg_viewer) main.addDockWidget(Qt.RightDockWidgetArea, reg_viewer_dock) reg_viewer_dock.setWidget(reg_viewer) mem_viewer = QMemoryViewer(self) mem_viewer_dock = QDockWidget('Memory Viewer', mem_viewer) main.addDockWidget(Qt.RightDockWidgetArea, mem_viewer_dock) mem_viewer_dock.setWidget(mem_viewer) main.tabifyDockWidget(reg_viewer_dock, mem_viewer_dock) self._pathtree = pathtree self._pathgroups = pathgroups self._register_viewer = reg_viewer self._memory_viewer = mem_viewer main_layout = QHBoxLayout() main_layout.addWidget(main) main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(main_layout)
def __init__(self, *args, **kwargs ): QDialog.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setWindowTitle( Window.title ) w_curvePart = Widget_curvePart() separator1 = Widget_horizontalSeparator() w_upObjectsPart = Widget_upObjectsPart() w_targetsPart = Widget_targetsPart() separator2 = Widget_horizontalSeparator() w_aimDirectionPart = Widget_aimDirectionPart() separator3 = Widget_horizontalSeparator() w_tangentButton = QPushButton( "Constraint tangent" ) w_scaleButton = QPushButton( "Constraint scale" ) listLayoutWidget = QWidget() listLayout = QHBoxLayout( listLayoutWidget ) listLayout.setContentsMargins(0,0,0,0) listLayout.addWidget( w_upObjectsPart ) listLayout.addWidget( w_targetsPart ) mainLayout = QVBoxLayout( self ) mainLayout.addWidget( w_curvePart ) mainLayout.addWidget( separator1 ) mainLayout.addWidget( w_aimDirectionPart ) mainLayout.addWidget( separator2 ) mainLayout.addWidget( listLayoutWidget ) mainLayout.addWidget( separator3 ) mainLayout.addWidget( w_tangentButton ) mainLayout.addWidget( w_scaleButton ) self.lineEdit_curve = w_curvePart.lineEdit self.listWidget_upObjects = w_upObjectsPart.listWidget self.listWidget_constrainTargets = w_targetsPart.listWidget self.x_lineEdit = w_aimDirectionPart.lineEdit1 self.y_lineEdit = w_aimDirectionPart.lineEdit2 self.z_lineEdit = w_aimDirectionPart.lineEdit3 self.checkBox_autoUpVector = w_aimDirectionPart.checkBox QtCore.QObject.connect( w_tangentButton, QtCore.SIGNAL( 'clicked()' ), self.constraintTangent ) QtCore.QObject.connect( w_scaleButton, QtCore.SIGNAL( 'clicked()' ), self.constraintScale )
def test_setLayout(self): layout = QVBoxLayout() btn1 = QPushButton("button_v1") layout.addWidget(btn1) btn2 = QPushButton("button_v2") layout.addWidget(btn2) layout2 = QHBoxLayout() btn1 = QPushButton("button_h1") layout2.addWidget(btn1) btn2 = QPushButton("button_h2") layout2.addWidget(btn2) layout.addLayout(layout2) widget = QWidget() widget.setLayout(layout)
def add_col(self, a): if self.mySQL.do: da_2 = QDialog(self.app) if self.table_Name != None: self.app.ref = True da_2.setWindowTitle("Delete Column From %s.%s" % (self.Data_Name, self.table_Name)) da_2.setFixedSize(600, 50) line_1 = edit.editText() but = QPushButton('ADD') hbox = QHBoxLayout(da_2) for i in (QLabel("New Column: "), line_1, but): hbox.addWidget(i) but.clicked.connect(lambda: self.mySQL.add_Tcol( self.Data_Name, self.table_Name, line_1.toPlainText())) da_2.exec_() else: MsgBox_2().showMsg("Select Table From %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def _init_widgets(self): self._linear_view = QLinearGraphicsView(self, self.disasm_view) layout = QHBoxLayout() layout.addWidget(self._linear_view) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) # Setup proxy methods self.update_label = self._linear_view.update_label self.select_instruction = self._linear_view.select_instruction self.unselect_instruction = self._linear_view.unselect_instruction self.unselect_all_instructions = self._linear_view.unselect_all_instructions self.select_operand = self._linear_view.select_operand self.unselect_operand = self._linear_view.unselect_operand self.unselect_all_operands = self._linear_view.unselect_all_operands self.show_selected = self._linear_view.show_selected self.show_instruction = self._linear_view.show_instruction
def __init__(self, *args, **kwargs ): self.mainWindow = args[0] QWidget.__init__( self, *args, **kwargs ) mainLayout = QVBoxLayout( self ) layout_expression = QHBoxLayout() b_create = QPushButton( "Create Expression" ) b_delete = QPushButton( "Delete Expression" ) layout_expression.addWidget( b_create ) layout_expression.addWidget( b_delete ) b_bake = QPushButton( "Bake" ) mainLayout.addLayout( layout_expression ) mainLayout.addWidget( b_bake ) QtCore.QObject.connect( b_create, QtCore.SIGNAL( "clicked()" ), self.createExpression ) QtCore.QObject.connect( b_delete, QtCore.SIGNAL( "clicked()" ), self.deleteExpression ) QtCore.QObject.connect( b_bake, QtCore.SIGNAL( "clicked()" ), self.bake )
def _init_widgets(self): # xref viewer xref_viewer = QXRefViewer(self._variable_manager, self._variable) # buttons btn_ok = QPushButton('OK') btn_close = QPushButton('Close') btn_close.clicked.connect(self._on_close_clicked) buttons_layout = QHBoxLayout() buttons_layout.addWidget(btn_ok) buttons_layout.addWidget(btn_close) layout = QVBoxLayout() layout.addWidget(xref_viewer) layout.addLayout(buttons_layout) self.setLayout(layout)
class UI_attrlist( QWidget ): def __init__(self, *args, **kwargs): QWidget.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.layout = QHBoxLayout( self ) self.layout.setContentsMargins( 0,0,0,0 ) self.lineEdit_srcAttr = QLineEdit() self.lineEdit_dstAttr = QLineEdit() self.layout.addWidget( self.lineEdit_srcAttr ) self.layout.addWidget( self.lineEdit_dstAttr ) def eventFilter( self, *args, **kwargs ): event = args[1] if event.type() == QtCore.QEvent.LayoutRequest or event.type() == QtCore.QEvent.Move : pass
def __init__(self, *args, **kw): super(ComboBoxWidget, self).__init__(*args, **kw) layout = QHBoxLayout() layout.setSpacing(2) self.combo = combo = QComboBox() combo.setSizeAdjustPolicy(QComboBox.AdjustToContents) combo.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.button = button = QPushButton() button.setEnabled(False) button.setIcon(icon('add').create_icon()) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(20) button.setFixedHeight(20) layout.addWidget(combo) layout.addSpacing(10) layout.addWidget(button) self.setLayout(layout)
def _init_widgets(self): # current function function_label = QLabel() self._function_label = function_label # options button option_btn = QPushButton() option_btn.setText('Options') option_btn.setMenu(self._options_menu.qmenu()) layout = QHBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.addWidget(function_label) layout.addStretch(0) layout.addWidget(option_btn) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def make_main_frame(self): self.main_frame = QWidget() win = pg.GraphicsWindow() self.crosshair_lb = pg.LabelItem(justify='right') win.addItem(self.crosshair_lb) self.plot = win.addPlot(row=1, col=0) self.plot.showGrid(x=True, y=True) self.right_panel = QGroupBox("Spectrometer Settings") hbox = QHBoxLayout() for w in [win, self.right_panel]: hbox.addWidget(w) form = QFormLayout() self.integration_sb = pg.SpinBox(value=0.001, bounds=(10*1e-6, 6553500*1e-6), suffix='s', siPrefix=True, \ dec=True, step=1) self.integration_sb.valueChanged.connect(self.change_integration_time) self.persistence_sb = QtGui.QSpinBox() self.persistence_sb.setValue(7) self.persistence_sb.setRange(1,10) self.persistence_sb.valueChanged.connect(self.change_persistence) self.take_background_btn = QtGui.QPushButton('Take background') self.take_background_btn.clicked.connect(self.on_take_background) self.conc_lb = pg.ValueLabel() self.spec_temp_lb = pg.ValueLabel() self.use_background_cb = QtGui.QCheckBox("enabled") self.use_background_cb.stateChanged.connect(self.on_use_background) form.addRow("Integration time", self.integration_sb) form.addRow("Persistence", self.persistence_sb) form.addRow("Background", self.take_background_btn) form.addRow("Use background", self.use_background_cb) self.right_panel.setLayout(form) self.main_frame.setLayout(hbox) self.setCentralWidget(self.main_frame)
def __init__(self, *args, **kwrgs): existing_widgets = Window.mayaWin.findChildren( QDialog, Window.objectName ) if existing_widgets: map( lambda x: x.deleteLater(), existing_widgets ) super( Window, self ).__init__( *args, **kwrgs ) self.installEventFilter( self ) self.setObjectName( Window.objectName ) self.setWindowTitle( Window.title ) mainLayout = QVBoxLayout( self ); mainLayout.setContentsMargins( 0,0,0,0 ); mainLayout.setSpacing(0) w_controller = Widget_loadObject( title="Controller", saveInfo=False ) w_separator1 = Widget_Separator() w_target = Widget_target() w_attrName = Widget_attributeName() w_startIndex = Widget_startIndex() w_buttons = QWidget() lay_buttons = QHBoxLayout( w_buttons ); lay_buttons.setContentsMargins( 10,0,10,10 ); lay_buttons.setSpacing( 0 ) button_connect = QPushButton( "Connect" ); button_connect.setFixedHeight( 25 ) button_close = QPushButton( "Close" ); button_close.setFixedHeight( 25 ) lay_buttons.addWidget( button_connect ) lay_buttons.addWidget( button_close ) mainLayout.addWidget(w_controller) mainLayout.addWidget(w_separator1) mainLayout.addWidget( w_target ) mainLayout.addWidget(w_attrName) mainLayout.addWidget(w_startIndex) mainLayout.addWidget( w_buttons ) self.resize( Window.defaultWidth, Window.defaultHeight ) self.load_shapeInfo( Window.path_uiInfo ) button_connect.clicked.connect( self.cmd_connect ) button_close.clicked.connect( self.deleteLater ) self.w_controller = w_controller self.w_target = w_target self.w_attrName = w_attrName self.w_startIndex = w_startIndex
def setup_ui(self): main_layout = QHBoxLayout(self) edt = QLineEdit(self) edt.setPlaceholderText("Wildcard filter") btn = QToolButton(self) btn.clicked.connect(self.set_icon) layout = QHBoxLayout(self) layout.addWidget(edt) layout.addWidget(btn) layout2 = QVBoxLayout() layout2.addLayout(layout) model = TListModel(self) proxy = QSortFilterProxyModel(self) proxy.setFilterCaseSensitivity(Qt.CaseInsensitive) proxy.setSourceModel(model) edt.textChanged.connect(proxy.setFilterWildcard) list = QListView() list.setModel(proxy) selection_model = list.selectionModel() selection_model.currentChanged.connect(self.currentChanged) layout2.addWidget(list) main_layout.addLayout(layout2) image = QLabel("Select icon", self) image.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) image.setMinimumWidth(256) main_layout.addWidget(image) self.btn = btn self.edt = edt self.image = image self.list = list self.proxy = proxy self.model = model self.selection_model = selection_model
class Report(): """ The Basic Report Module Class """ def __init__(self): #### self.report_tab_5 = QWidget() self.report_tab_5.setStyleSheet("") self.report_tab_5.setObjectName("report_tab_5") self.horizontalLayout_8 = QHBoxLayout(self.report_tab_5) self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.report_detail_tabWidget = QTabWidget(self.report_tab_5) self.report_detail_tabWidget.setObjectName("report_detail_tabWidget") self.add_tabs() self.horizontalLayout_8.addWidget(self.report_detail_tabWidget) ###signals and slots && other stuffs # self.mainwindow = Ui_MainWindow # just for the ease of finding the attributes in pycharm self.report_detail_tabWidget.currentChanged.connect(self.change_focus) self.report_tab_5.setFocusPolicy(Qt.StrongFocus) self.report_tab_5.focusInEvent = self.change_focus def add_tabs(self): """ add new tabs to the table """ employee = EmployeeNew() hygiene = Hygiene() report = Stock() self.report_detail_tabWidget.addTab(employee.employeedetail_tab_1, 'Employee') self.report_detail_tabWidget.addTab(hygiene.reporthygiene_tab_2, 'Hygiene') self.report_detail_tabWidget.addTab(report.stock_tab_1, 'Stock') def change_focus(self, event=None): """ sets focus for the child widgets """ wid = self.report_detail_tabWidget.currentWidget() if wid.isVisible(): wid.setFocus()
def __init__(self): super(Blew, self).__init__() self.setWindowModality(Qt.NonModal) self.setWindowFlags( Qt.FramelessWindowHint) # Qt.Tool | Qt.FramelessWindowHint l = QHBoxLayout() self.items_view = QTableView() # Make the dropdown nice l.setContentsMargins(0, 0, 0, 0) self.items_view.horizontalHeader().setStretchLastSection(True) self.items_view.horizontalHeader().hide() self.items_view.verticalHeader().hide() self.items_view.setShowGrid(False) self.setMinimumSize(300, 100) self.model = QuickComboModel(self) self.items_view.setModel(self.model) l.addWidget(self.items_view) self.setLayout(l)
def l_btns(self, glo): hlayout = QHBoxLayout() self.llo = QCheckBox("Looping") self.llo.setToolTip( 'Automate repeating the smae command on the smae device selected ') self.llo.setEnabled(False) self.nlo = QLineEdit() self.nlo.setPlaceholderText("duration in seconds. Default is 10") self.nlo.setEnabled(False) self.nlo.setToolTip("Duration of sleep after each loop") self.lbtn = QPushButton('Stop') self.lbtn.setEnabled(False) self.lbtn.setFont(self.tf) self.llo.setFont(self.sf) self.lbtn.setToolTip("stop on-going command or loop") self.llo.toggled.connect(self.loped) self.lbtn.clicked.connect(partial(self.inloop_state, out=True)) hlayout.addWidget(self.llo) hlayout.addWidget(self.nlo) hlayout.addWidget(self.lbtn) glo.addLayout(hlayout)
def f_btns(self, glo): hlayout = QHBoxLayout() self.ksbutton = QPushButton('Kill stream', self) self.ksbutton.setToolTip('Kill whetever been streamed') self.ksbutton.setFont(self.tf) self.ksbutton.clicked.connect(self.k_act) self.sbutton = QPushButton('Stream', self) self.sbutton.setFont(self.tf) self.sbutton.setToolTip('Stream a youtube video') self.fbutton = QPushButton('Factory reset', self) self.fbutton.setFont(self.tf) self.fbutton.setToolTip('Factory reset the device') self.fbutton.clicked.connect(self.fr_act) self.sbutton.clicked.connect(self.yv_input) self.ksbutton.setEnabled(False) self.sbutton.setEnabled(False) self.fbutton.setEnabled(False) hlayout.addWidget(self.ksbutton) hlayout.addWidget(self.sbutton) hlayout.addWidget(self.fbutton) glo.addLayout(hlayout)
def _init_widgets(self): lbl_function = QLabel(self) lbl_function.setText("Function") self._function_list = QFunctionComboBox( show_all_functions=True, selection_callback=self._on_function_selected, parent=self) function_layout = QHBoxLayout() function_layout.addWidget(lbl_function) function_layout.addWidget(self._function_list) self._string_table = QStringTable( self, selection_callback=self._on_string_selected) layout = QVBoxLayout() layout.addLayout(function_layout) layout.addWidget(self._string_table) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def _init_widgets(self): layout = QHBoxLayout() size_label = QLabel() size_label.setProperty('class', 'ast_viewer_size') size_label.setAlignment(Qt.AlignRight) size_label.setMaximumSize(QSize(24, 65536)) self._size_label = size_label ast_label = QLabel() self._ast_label = ast_label if self._ast is not None: self.reload() if self._display_size: layout.addWidget(self._size_label) layout.addWidget(ast_label) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
class ComboDialog(QDialog): COMBO_DIALOG_OK = "COMBO_DIALOG_OK" COMBO_DIALOG_CANCEL = "COMBO_DIALOG_CANCEL" def __init__(self, *args, **kwargs): super(ComboDialog, self).__init__(*args, **kwargs) self.combo_box = QComboBox() self.ok_btn = QPushButton("&Ok") # noinspection PyUnresolvedReferences self.ok_btn.clicked.connect(self.accept) self.ok_btn.setDefault(True) self.cancel_btn = QPushButton("&Cancel") # noinspection PyUnresolvedReferences self.cancel_btn.clicked.connect(self.reject) self.h_layout = QHBoxLayout() self.v_layout = QVBoxLayout() self.h_layout.addStretch(0) self.h_layout.addWidget(self.ok_btn) self.h_layout.addWidget(self.cancel_btn) self.v_layout.addWidget(self.combo_box) self.v_layout.addLayout(self.h_layout) self.setLayout(self.v_layout) # noinspection PyUnresolvedReferences self.accepted.connect(self.on_accept) # noinspection PyUnresolvedReferences self.rejected.connect(self.on_reject) def on_accept(self): Facade.getInstance().sendNotification(ComboDialog.COMBO_DIALOG_OK, ) def on_reject(self): Facade.getInstance().sendNotification( ComboDialog.COMBO_DIALOG_CANCEL, )
def __init__(self, *args, **kwargs): super(Widget_numController, self).__init__() self.installEventFilter(self) mainLayout = QHBoxLayout(self) mainLayout.setContentsMargins(5, 0, 5, 0) validator = QIntValidator() label = QLabel("Num Controller") lineEdit_width = QLineEdit() lineEdit_width.setValidator(validator) lineEdit_height = QLineEdit() lineEdit_height.setValidator(validator) lineEdit_width.setText('5') lineEdit_height.setText('5') mainLayout.addWidget(label) mainLayout.addWidget(lineEdit_width) mainLayout.addWidget(lineEdit_height) self.lineEdit_width = lineEdit_width self.lineEdit_height = lineEdit_height self.load_lineEdit_text([self.lineEdit_width, self.lineEdit_height], Widget_numController.path_uiInfo) QtCore.QObject.connect(self.lineEdit_width, QtCore.SIGNAL("returnPressed()"), self.save_info) QtCore.QObject.connect(self.lineEdit_height, QtCore.SIGNAL("returnPressed()"), self.save_info)
def __init__(self, parent): global dao super(ChooseSupplierDialog, self).__init__(parent) title = _("Choose supplier") self.setWindowTitle(title) top_layout = QVBoxLayout() self.title_widget = TitleWidget(title, self) top_layout.addWidget(self.title_widget) self.supplier_plate_widget = SupplierContactDataWidget(self) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel) self.buttons.addButton(QDialogButtonBox.Ok) hlayout = QHBoxLayout() # suppliers = dao.supplier_dao.all_frozen() suppliers = generic_load_all_frozen(Supplier, Supplier.fullname) table_prototype = [ TextLinePrototype('fullname', _('Name'), editable=False) ] self.filter_view = QuickPrototypedFilter(table_prototype, self) self.filter_view.selected_object_changed.connect( self.supplier_plate_widget.set_contact_data) self.filter_view.set_data(suppliers, lambda c: c.indexed_fullname) hlayout.addWidget(self.filter_view) hlayout.addWidget(self.supplier_plate_widget, 1000) # hlayout.addStretch() top_layout.addLayout(hlayout) #top_layout.addStretch() top_layout.addWidget(self.buttons) self.setLayout(top_layout) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.filter_view.list_view.doubleClicked.connect(self._item_selected)
def __init__(self, text, validator, minValue, maxValue ): QWidget.__init__( self ) layout = QHBoxLayout( self ) checkBox = QCheckBox() checkBox.setFixedWidth( 115 ) checkBox.setText( text ) layout.addWidget( checkBox ) hLayoutX = QHBoxLayout() lineEditXMin = QLineEdit() lineEditXMax = QLineEdit() hLayoutX.addWidget( lineEditXMin ) hLayoutX.addWidget( lineEditXMax ) lineEditXMin.setValidator( validator ) lineEditXMax.setValidator( validator ) lineEditXMin.setText( str( minValue ) ) lineEditXMax.setText( str( maxValue ) ) layout.addLayout( hLayoutX ) self.checkBox = checkBox self.lineEditX_min = lineEditXMin self.lineEditX_max = lineEditXMax self.lineEdits = [ lineEditXMin, lineEditXMax ] QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled ) self.updateEnabled()
def __init__(self, *args, **kwargs ): QDialog.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setWindowTitle( Window.title ) mainLayout = QVBoxLayout( self ) wLabelDescription = QLabel( "Select Object or Group" ) validator = QIntValidator() hLayout = QHBoxLayout() wLabel = QLabel( "Num Controller : " ) wLineEdit= QLineEdit();wLineEdit.setValidator(validator); wLineEdit.setText( '5' ) hLayout.addWidget( wLabel ) hLayout.addWidget( wLineEdit ) button = QPushButton( "Create" ) mainLayout.addWidget( wLabelDescription ) mainLayout.addLayout( hLayout ) mainLayout.addWidget( button ) self.resize(Window.defaultWidth,Window.defaultHeight) self.wlineEdit = wLineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.cmd_create )