def __init__(self): super(PhoneFrame, self).__init__() self.setWindowTitle('Phone Book.') self.name = QLineEdit() self.number = QLineEdit() entry = QFormLayout() entry.addRow(QLabel('Name'), self.name) entry.addRow(QLabel('Number'), self.number) buttons = QHBoxLayout() button = QPushButton('&Add') button.clicked.connect(self._addEntry) buttons.addWidget(button) button = QPushButton('&Update') button.clicked.connect(self._updateEntry) buttons.addWidget(button) button = QPushButton('&Delete') button.clicked.connect(self._deleteEntry) buttons.addWidget(button) dataDisplay = QTableView() dataDisplay.setModel(PhoneDataModel()) layout = QVBoxLayout() layout.addLayout(entry) layout.addLayout(buttons) layout.addWidget(dataDisplay) self.setLayout(layout) self.show()
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, parent, *args, **kw): super(_FilterTableView, self).__init__(*args, **kw) layout = QVBoxLayout() layout.setSpacing(2) self.table = table = _myFilterTableView(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(25) self.text = text = QLineEdit() hl.addWidget(text) hl.addWidget(button) layout.addLayout(hl) layout.addWidget(table) self.setLayout(layout)
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 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, parent=None): super(QtReducePreferencePane, self).__init__(parent) self.__createContents() self.toolBar = QtReducePreferencesToolBar(self) self.worksheet = QtReducePreferencesWorksheet(self) self.computation = QtReducePreferencesComputation(self) self.pagesWidget = QStackedWidget() self.pagesWidget.addWidget(self.toolBar) self.pagesWidget.addWidget(self.worksheet) self.pagesWidget.addWidget(self.computation) self.pagesWidget.setCurrentIndex( self.contentsWidget.row(self.contentsWidget.currentItem())) closeButton = QPushButton(self.tr("Close")) closeButton.clicked.connect(self.close) horizontalLayout = QHBoxLayout() horizontalLayout.addWidget(self.contentsWidget) horizontalLayout.addWidget(self.pagesWidget) buttonsLayout = QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QVBoxLayout() mainLayout.addLayout(horizontalLayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout) self.setWindowTitle(self.tr("QReduce Preferences"))
def __init__(self, page, layout, parent): self.page = page self.parent = parent container = QVBoxLayout() # actions section actionsContainer = QHBoxLayout() self.saveButton = QPushButton('Save') self.saveButton.clicked.connect(lambda: save_clicked(self)) actionsContainer.addWidget(QLabel('Link: ')) self.linkText = QLineEdit(page.url) label = QLabel('<a href="' + page.url + '">Open Externally</a>') label.setOpenExternalLinks(True) actionsContainer.addWidget(self.linkText) actionsContainer.addWidget(self.saveButton) actionsContainer.addWidget(label) container.addLayout(actionsContainer) # content self.view = QWebView() self.view.setUrl(page.url) container.addWidget(self.view) layout.addLayout(container)
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 __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 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, group_name, name_list, param_type = int, default_param = None, help_instance = None, handler = None, help_dict = None): QGroupBox.__init__(self, group_name) the_layout = QVBoxLayout() the_layout.setSpacing(5) the_layout.setContentsMargins(1, 1, 1, 1) self.setLayout(the_layout) self.widget_dict = OrderedDict([]) self.mytype= param_type self.is_popup = False if default_param == None: default_param = "" self.default_param = default_param for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) cb.setFont(QFont('SansSerif', 12)) efield = QLineEdit(str(default_param)) efield.setFont(QFont('SansSerif', 10)) efield.setMaximumWidth(25) qh.addWidget(cb) qh.addStretch() qh.addWidget(efield) the_layout.addLayout(qh) if handler != None: cb.toggled.connect(handler) self.widget_dict[txt] = [cb, efield] if (help_dict != None) and (help_instance != None): if txt in help_dict: help_button_widget = help_instance.create_button(txt, help_dict[txt]) qh.addWidget(help_button_widget) return
def __init__(self, *args, **kwargs ): QMainWindow.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setObjectName( Window.objectName ) self.setWindowTitle( Window.title ) mainWidget = QWidget(); self.setCentralWidget( mainWidget ) mainLayout = QVBoxLayout( mainWidget ) addButtonsLayout = QHBoxLayout() buttonAddTab = QPushButton( 'Add Tab' ) buttonAddLine = QPushButton( 'Add Line' ) addButtonsLayout.addWidget( buttonAddTab ) addButtonsLayout.addWidget( buttonAddLine ) tabWidget = TabWidget() self.tabWidget = tabWidget buttonLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonClose = QPushButton( "Close" ) buttonLayout.addWidget( buttonCreate ) buttonLayout.addWidget( buttonClose ) mainLayout.addLayout( addButtonsLayout ) mainLayout.addWidget( tabWidget ) mainLayout.addLayout( buttonLayout ) QtCore.QObject.connect( buttonAddTab, QtCore.SIGNAL( 'clicked()' ), partial( self.addTab ) ) QtCore.QObject.connect( buttonAddLine, QtCore.SIGNAL( "clicked()" ), partial( tabWidget.addLine ) ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( "clicked()" ), self.cmd_create ) QtCore.QObject.connect( buttonClose, QtCore.SIGNAL( "clicked()" ), self.cmd_close )
def _setup_ui(self): self._btn_pick_1.setFixedWidth(25) self._btn_pick_1.setToolTip('Pick first sequence.') self._btn_pick_2.setFixedWidth(25) self._btn_pick_2.setToolTip('Pick second sequence.') self._btn_compare.setToolTip('Compare sequences.') self._progress_bar.setFixedHeight(10) lyt_seq1 = QHBoxLayout() lyt_seq1.addWidget(self._ledit1) lyt_seq1.addWidget(self._btn_pick_1) lyt_seq2 = QHBoxLayout() lyt_seq2.addWidget(self._ledit2) lyt_seq2.addWidget(self._btn_pick_2) lyt_main = QVBoxLayout() lyt_main.addLayout(lyt_seq1) lyt_main.addLayout(lyt_seq2) lyt_main.addWidget(self._btn_compare) main_widget = QWidget() main_widget.setLayout(lyt_main) self.setCentralWidget(main_widget)
def __init__(self, group_name, name_list, param_dict, help_instance = None, handler = None, help_dict = None): QGroupBox.__init__(self, group_name) the_layout = QVBoxLayout() the_layout.setSpacing(5) the_layout.setContentsMargins(1, 1, 1, 1) self.setLayout(the_layout) self.widget_dict = {} self.is_popup = False self.param_dict = param_dict for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) qh.addWidget(cb) cb.setFont(QFont('SansSerif', 12)) param_widgets = {} for key, val in param_dict.items(): if type(val) == list: # param_widgets[key] = qHotField(key, type(val[0]), val[0], value_list=val, pos="top") else: param_widgets[key] = qHotField(key, type(val), val, pos="top") qh.addWidget(param_widgets[key]) qh.addStretch() the_layout.addLayout(qh) if handler != None: cb.toggled.connect(handler) self.widget_dict[txt] = [cb, param_widgets] if (help_dict != None) and (help_instance != None): if txt in help_dict: help_button_widget = help_instance.create_button(txt, help_dict[txt]) qh.addWidget(help_button_widget) return
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 _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, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def setup_gui(self): """Sets up a sample gui interface.""" central_widget = QWidget(self) central_widget.setObjectName('central_widget') self.label = QLabel('Hello World') self.input_field = QLineEdit() change_button = QPushButton('Change text') close_button = QPushButton('close') quit_button = QPushButton('quit') central_layout = QVBoxLayout() button_layout = QHBoxLayout() central_layout.addWidget(self.label) central_layout.addWidget(self.input_field) # a separate layout to display buttons horizontal button_layout.addWidget(change_button) button_layout.addWidget(close_button) button_layout.addWidget(quit_button) central_layout.addLayout(button_layout) central_widget.setLayout(central_layout) self.setCentralWidget(central_widget) # create a system tray icon. Uncomment the second form, to have an # icon assigned, otherwise you will only be seeing an empty space in # system tray self.systemtrayicon = QSystemTrayIcon(self) self.systemtrayicon.show() # set a fancy icon self.systemtrayicon.setIcon(QIcon.fromTheme('help-browser')) change_button.clicked.connect(self.change_text) quit_button.clicked.connect(QApplication.instance().quit) close_button.clicked.connect(self.hide) # show main window, if the system tray icon was clicked self.systemtrayicon.activated.connect(self.icon_activated)
class CheckGroupNoParameters(QGroupBox): def __init__(self, group_name, name_list, default=None, help_instance=None, handler=None, help_dict=None): QGroupBox.__init__(self, group_name) self.handler = handler self.help_dict = help_dict self.help_instance = help_instance self.the_layout = QVBoxLayout() self.the_layout.setSpacing(5) self.the_layout.setContentsMargins(1, 1, 1, 1) self.setLayout(self.the_layout) self.widget_dict = OrderedDict([]) self.is_popup = False self.create_check_boxes(name_list) if default is not None: self.set_myvalue([default]) return def reset(self): for cb in self.widget_dict.values(): cb.setChecked(False) def create_check_boxes(self, name_list): for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) cb.setFont(regular_small_font) qh.addWidget(cb) qh.addStretch() self.the_layout.addLayout(qh) if self.handler != None: cb.toggled.connect(self.handler) self.widget_dict[txt] = cb if (self.help_dict != None) and (self.help_instance != None): if txt in self.help_dict: help_button_widget = self.help_instance.create_button(txt, self.help_dict[txt]) qh.addWidget(help_button_widget) def recreate_check_boxes(self, new_name_list): for cb in self.widget_dict.values(): cb.hide() cb.deleteLater() del cb self.widget_dict = {} self.create_check_boxes(new_name_list) # returns a list where each item is [name, parameter value] def get_myvalue(self): result = [] for (fe, val) in self.widget_dict.items(): if val.isChecked(): result.append(fe) return result # Takes a lists where each item is [name, parameter value] def set_myvalue(self, true_items): self.reset() for fe in true_items: self.widget_dict[fe].setChecked(True) value = property(get_myvalue, set_myvalue)
def _createLayout(self): 'Create the Widget Layout' self._txtLogbook = QLineEdit() self._txtLogbook.setReadOnly(True) self._lblLogbook = QLabel(self.tr('&Logbook File:')) self._lblLogbook.setBuddy(self._txtLogbook) self._btnBrowse = QPushButton('...') self._btnBrowse.clicked.connect(self._btnBrowseClicked) self._btnBrowse.setStyleSheet('QPushButton { min-width: 24px; max-width: 24px; }') self._btnBrowse.setToolTip(self.tr('Browse for a Logbook')) self._cbxComputer = QComboBox() self._lblComputer = QLabel(self.tr('Dive &Computer:')) self._lblComputer.setBuddy(self._cbxComputer) self._btnAddComputer = QPushButton(QPixmap(':/icons/list-add.png'), self.tr('')) self._btnAddComputer.setStyleSheet('QPushButton { min-width: 24px; min-height: 24; max-width: 24px; max-height: 24; }') self._btnAddComputer.clicked.connect(self._btnAddComputerClicked) self._btnRemoveComputer = QPushButton(QPixmap(':/icons/list-remove.png'), self.tr('')) self._btnRemoveComputer.setStyleSheet('QPushButton { min-width: 24px; min-height: 24; max-width: 24px; max-height: 24; }') self._btnRemoveComputer.clicked.connect(self._btnRemoveComputerClicked) hbox = QHBoxLayout() hbox.addWidget(self._btnAddComputer) hbox.addWidget(self._btnRemoveComputer) gbox = QGridLayout() gbox.addWidget(self._lblLogbook, 0, 0) gbox.addWidget(self._txtLogbook, 0, 1) gbox.addWidget(self._btnBrowse, 0, 2) gbox.addWidget(self._lblComputer, 1, 0) gbox.addWidget(self._cbxComputer, 1, 1) gbox.addLayout(hbox, 1, 2) gbox.setColumnStretch(1, 1) self._pbTransfer = QProgressBar() self._pbTransfer.reset() self._txtStatus = QTextEdit() self._txtStatus.setReadOnly(True) self._btnTransfer = QPushButton(self.tr('&Transfer Dives')) self._btnTransfer.clicked.connect(self._btnTransferClicked) self._btnExit = QPushButton(self.tr('E&xit')) self._btnExit.clicked.connect(self.close) hbox = QHBoxLayout() hbox.addWidget(self._btnTransfer) hbox.addStretch() hbox.addWidget(self._btnExit) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addWidget(self._pbTransfer) vbox.addWidget(self._txtStatus) vbox.addLayout(hbox) self.setLayout(vbox)
def settings(self): if self.settings_window is None: window = QDialog(self) self.settings_window = window else: window = self.settings_window window = self.settings_window window.setWindowTitle('Settings') window.notelabel = QLabel("Currently these settings are only guaranteed to work prior to loading the first MIDI!\nYou'll have to restart ADLMIDI pyGui to change them again if they stop working. \n\nSorry! This will be fixed soon!") window.notelabel.setWordWrap(True) window.notelabel.setStyleSheet("font-size: 8pt; border-style: dotted; border-width: 1px; padding: 12px;") window.banklabel = QLabel("<B>Choose Instrument Bank</B>") window.space = QLabel("") window.optlabel = QLabel("<B>Options</B>") window.combo = QComboBox() window.combo.addItems(self.banks) #window.combo.setMaximumWidth(350) window.combo.setMaxVisibleItems(12) window.combo.setStyleSheet("combobox-popup: 0;") window.combo.setCurrentIndex(int(self.progset.value("sound/bank", 1))) window.combo.currentIndexChanged.connect(self.saveSettings) window.perc = QCheckBox("Adlib Percussion Instrument Mode") #window.perc.stateChanged.connect(self.checkOpts) window.tremamp = QCheckBox("Tremolo Amplification Mode") #window.tremamp.stateChanged.connect(self.checkOpts) window.vibamp = QCheckBox("Vibrato Amplification Mode") #window.vibamp.stateChanged.connect(self.checkOpts) window.modscale = QCheckBox("Scaling of Modulator Volume") #window.modscale.stateChanged.connect(self.checkOpts) window.okButton = QPushButton('OK') window.okButton.clicked.connect(window.hide) vbox = QVBoxLayout() vbox.addWidget(window.space) vbox.addWidget(window.banklabel) vbox.addWidget(window.combo) vbox.addWidget(window.space) vbox.addWidget(window.optlabel) vbox.addWidget(window.perc) vbox.addWidget(window.tremamp) vbox.addWidget(window.vibamp) vbox.addWidget(window.modscale) vbox.addWidget(window.notelabel) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(window.okButton) vbox.addLayout(hbox) window.setLayout(vbox) window.setFixedSize(530, 369) window.show() window.activateWindow() window.raise_()
def _init_ui(self, txt): self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) pal = QPalette() color = QColor() color.setNamedColor(self._window_bgcolor) color.setAlpha(255 * self._opacity) pal.setColor(QPalette.Background, color) self.setAutoFillBackground(True) self.setPalette(pal) wm, hm = 5, 5 spacing = 8 layout = QVBoxLayout() layout.setSpacing(spacing) layout.setContentsMargins(wm, hm, wm, hm) nlines, ts = self._generate_text(txt) qlabel = QLabel('\n'.join(ts)) ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color, self._font, self._fontsize) qlabel.setStyleSheet(ss) layout.addWidget(qlabel) hlabel = QLabel('double click to dismiss') hlabel.setStyleSheet('QLabel {font-size: 10px}') hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(hlabel) hlayout.addStretch() layout.addLayout(hlayout) self.setLayout(layout) font = QFont(self._font, self._fontsize) fm = QFontMetrics(font) pw = max([fm.width(ti) for ti in ts]) ph = (fm.height() + 2) * nlines w = pw + wm * 2 h = ph + (hm + spacing + 1) * 2 self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setFixedWidth(w) self.setFixedHeight(h) self.setMask(mask(self.rect(), 10))
def __init__(self): super().__init__() if separate_colorbars: if rescale_colorbars: self.vmins = tuple(np.min(u[0]) for u in U) self.vmaxs = tuple(np.max(u[0]) for u in U) else: self.vmins = tuple(np.min(u) for u in U) self.vmaxs = tuple(np.max(u) for u in U) else: if rescale_colorbars: self.vmins = (min(np.min(u[0]) for u in U),) * len(U) self.vmaxs = (max(np.max(u[0]) for u in U),) * len(U) else: self.vmins = (min(np.min(u) for u in U),) * len(U) self.vmaxs = (max(np.max(u) for u in U),) * len(U) layout = QHBoxLayout() plot_layout = QGridLayout() self.colorbarwidgets = [cbar_widget(self, vmin=vmin, vmax=vmax) if cbar_widget else None for vmin, vmax in zip(self.vmins, self.vmaxs)] plots = [widget(self, grid, vmin=vmin, vmax=vmax, bounding_box=bounding_box, codim=codim) for vmin, vmax in zip(self.vmins, self.vmaxs)] if legend: for i, plot, colorbar, l in zip(range(len(plots)), plots, self.colorbarwidgets, legend): subplot_layout = QVBoxLayout() caption = QLabel(l) caption.setAlignment(Qt.AlignHCenter) subplot_layout.addWidget(caption) if not separate_colorbars or backend == 'matplotlib': subplot_layout.addWidget(plot) else: hlayout = QHBoxLayout() hlayout.addWidget(plot) if colorbar: hlayout.addWidget(colorbar) subplot_layout.addLayout(hlayout) plot_layout.addLayout(subplot_layout, int(i/columns), (i % columns), 1, 1) else: for i, plot, colorbar in zip(range(len(plots)), plots, self.colorbarwidgets): if not separate_colorbars or backend == 'matplotlib': plot_layout.addWidget(plot, int(i/columns), (i % columns), 1, 1) else: hlayout = QHBoxLayout() hlayout.addWidget(plot) if colorbar: hlayout.addWidget(colorbar) plot_layout.addLayout(hlayout, int(i/columns), (i % columns), 1, 1) layout.addLayout(plot_layout) if not separate_colorbars: layout.addWidget(self.colorbarwidgets[0]) for w in self.colorbarwidgets[1:]: w.setVisible(False) self.setLayout(layout) self.plots = plots
def __init__(self, parent): QWidget.__init__(self, parent) # Variables self._options = parent.options() # Layouts layout = QVBoxLayout() layout.addLayout(self._initUI()) layout.addStretch() self.setLayout(layout)
class Profile(QWidget): ''' classdocs ''' def __init__(self, athlete=False): ''' Constructor ''' QWidget.__init__(self) self.initGUI() if athlete is not False: self.athlete = athlete self.setProfile(athlete) def initGUI(self): self.vLayout = QVBoxLayout() text = QLabel("<h3><b>Your profile</b></h3>") profileLayout = QFormLayout() self.nameLabel = QLabel() self.surnameLabel = QLabel() self.ageLabel = QLabel() self.bmiLabel = QLabel() self.heightLabel = QLabel() self.massLabel = QLabel() profileLayout.addRow("Name", self.nameLabel) profileLayout.addRow("Surname", self.surnameLabel) profileLayout.addRow("Age", self.ageLabel) profileLayout.addRow("Body Mass Index", self.bmiLabel) profileLayout.addRow("Height", self.heightLabel) profileLayout.addRow("Mass", self.massLabel) self.vLayout.addWidget(text) self.vLayout.addLayout(profileLayout) self.vLayout.addStretch(1) self.setLayout(self.vLayout) def setProfile(self, athlete): self.athlete = athlete self.nameLabel.setText(self.athlete._name) self.surnameLabel.setText(self.athlete._surname) self.ageLabel.setText(str(self.athlete.getAge())) self.bmiLabel.setText(str(self.athlete.getBMI())) self.heightLabel.setText(str(self.athlete._height) + " cm") self.massLabel.setText(str(self.athlete._mass) + " Kg")
def __init__(self,parent): global dao super(FindOrderDialog,self).__init__(parent) title = _("Find order") self.setWindowTitle(title) top_layout = QVBoxLayout() self.title_widget = TitleWidget(title,self) top_layout.addWidget(self.title_widget) hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Search"))) self.search_criteria = QLineEdit() self.search_criteria.setObjectName("search_criteria") hlayout.addWidget(self.search_criteria) top_layout.addLayout(hlayout) self.search_results_view = QTableView() self.headers_view = QHeaderView(Qt.Orientation.Horizontal) self.header_model = make_header_model([_("Preorder Nr"),_("Order Nr"),_("Customer Nr"),_("Customer"),_("Order Part")]) self.headers_view.setModel(self.header_model) # qt's doc : The view does *not* take ownership (bt there's something with the selecion mode self.search_results_model = QStandardItemModel() self.search_results_view.setModel(self.search_results_model) self.search_results_view.setEditTriggers(QAbstractItemView.NoEditTriggers) self.search_results_view.setHorizontalHeader(self.headers_view) self.search_results_view.verticalHeader().hide() # self.search_results_view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents) self.search_results_view.horizontalHeader().setResizeMode(3, QHeaderView.Stretch) self.search_results_view.horizontalHeader().setResizeMode(4, QHeaderView.Stretch) self.search_results_view.setSelectionBehavior(QAbstractItemView.SelectRows) self.buttons = QDialogButtonBox() self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel) self.buttons.addButton( QDialogButtonBox.Ok) self.buttons.button(QDialogButtonBox.Ok).setObjectName("go_search") top_layout.addWidget(self.search_results_view) top_layout.setStretch(2,1000) top_layout.addWidget(self.buttons) self.setLayout(top_layout) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.search_results_view.activated.connect(self.row_activated) self.search_criteria.returnPressed.connect(self.search_criteria_submitted) self.setMinimumSize(800,640)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.indexLabel) hbox.addSpacing(self.fontMetrics().width("W") * 4) hbox.addStretch() hbox.addWidget(self.gotoLabel) hbox.addWidget(self.gotoLineEdit, 1) hbox.addWidget(self.helpButton) layout.addLayout(hbox) layout.addWidget(self.view, 1) self.setLayout(layout)
class PluginDialog(QWidget): def __init__(self, pluginManager): super(PluginDialog, self).__init__() self.view = PluginView(pluginManager, self) self.vbLayout = QVBoxLayout(self) self.vbLayout.setContentsMargins(0, 0, 0, 0) self.vbLayout.setSpacing(0) self.vbLayout.addWidget(self.view) self.hbLayout = QHBoxLayout() self.vbLayout.addLayout(self.hbLayout) self.hbLayout.setContentsMargins(0, 0, 0, 0) self.hbLayout.setSpacing(6) self.detailsButton = QPushButton("Details", self) self.errorDetailsButton = QPushButton("Error Details", self) self.detailsButton.setEnabled(False) self.errorDetailsButton.setEnabled(False) self.hbLayout.addWidget(self.detailsButton) self.hbLayout.addWidget(self.errorDetailsButton) self.hbLayout.addStretch(5) self.resize(650, 300) self.setWindowTitle("Installed Plugins") self.view.currentPluginChanged.connect(self.updateButtons) self.view.pluginActivated.connect(self.openDetails) self.detailsButton.clicked.connect(self.openDetails) self.errorDetailsButton.clicked.connect(self.openErrorDetails) @Slot() def updateButtons(self): # todo pass @Slot() def openDetails(self): # todo pass @Slot() def openDetails(self, spec): # todo print("TODO open details") pass @Slot() def openErrorDetails(self): # todo pass
def __init__(self, parent): super(TimeEditDialog, self).__init__(parent) self.in_validation = False self.last_validated_identifier = None self.identifier_editor = OrderPartIdentifierEdit("identifier", _("identifier"), parent=self) self.identifier_editor.widget.editingFinished.connect( self.identifier_set) # self.identifier_widget = QLineEdit(self) # self.identifier_widget_validator = OrderPartIdentifierValidator() # self.identifier_widget.setValidator(self.identifier_widget_validator) # self.identifier_widget.editingFinished.connect(self.identifier_set) self.task_widget = AutoCompleteComboBox(None, self) self.task_widget.section_width = [300] self.task_widget.currentIndexChanged.connect(self.operation_set) self.tar_type_editor = TaskActionReportTypeComboBox( "tar_type", _("Action")) self.tar_type_editor.set_model( [TaskActionReportType.start_task, TaskActionReportType.stop_task]) self.machine_editor = ConstrainedMachineEdit("machine_id", _("Machine")) # self.machine_editor = AutoCompleteComboBox(None,self) # self.machine_editor.set_model(machine_service.find_machines_for_operation_definition(proxy.operation_definition_id)) self.start_time_editor = TimeStampEdit("start_time", _("Start time"), nullable=False) form_layout = QFormLayout() form_layout.addRow(_("Identifier"), self.identifier_editor.widget) form_layout.addRow(_("Task"), self.task_widget) form_layout.addRow(_("Machine"), self.machine_editor.widget) form_layout.addRow(_("Action"), self.tar_type_editor.widget) form_layout.addRow(_("Start time"), self.start_time_editor.widget) top_layout = QVBoxLayout() top_layout.addLayout(form_layout) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) self.buttons.addButton(QDialogButtonBox.Cancel) top_layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.cancel) self.setLayout(top_layout)
def __init__(self, parent=None): QWidget.__init__(self, parent) # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addLayout(self._initUI()) # Initialize widgets layout.addStretch() self.setLayout(layout) # Signals for widget in self._iter_parameter_widgets(): widget.valuesChanged.connect(self.valueChanged)
def vlayout(left, right): l = QVBoxLayout() if isinstance(left, QWidget): l.addWidget(left) else: l.addLayout(left) if isinstance(right, QWidget): l.addWidget(right) else: l.addLayout(right) return l
def setupUI(self): paneLayout = QHBoxLayout() paneLayout.setContentsMargins(0, 0, 0, 0) leftPane = QFrame() leftPane.setObjectName("leftPane") leftPaneLayout = QVBoxLayout() leftPaneLayout.setContentsMargins(20, 20, 20, 10) heading = QLabel("Select Employee: ") heading.setObjectName("heading") leftPaneLayout.addWidget(heading) leftPaneLayout.addSpacing(10) form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) leftPaneLayout.addLayout(form1) leftPaneLayout.addStretch() leftPane.setLayout(leftPaneLayout) layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setContentsMargins(10, 10, 10, 30) form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) paneLayout.addWidget(leftPane) paneLayout.addLayout(layout) self.setLayout(paneLayout)
def _make_supply_order_detail_view(self): # There's a self.proto somewhere, don't mess with it :-) # proto = [] # proto.append( TextLinePrototype('description',_('Description'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('quantity',_('Quantity'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('unit_price',_('Unit price'), editable=True,nullable=False)) # self.detail_model = PrototypedModelView(proto, self) # self.detail_view = PrototypedQuickView(proto, self) # self.detail_view.setModel(self.detail_model) # self.detail_view.verticalHeader().hide() self.detail_description = QTextEdit() self.detail_description.setTextInteractionFlags( Qt.TextBrowserInteraction) self.delivery_date_widget = QLabel() self.creation_date_widget = QLabel() self.supplier_reference_widget = QLabel() hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Delivery date"))) hlayout.addWidget(self.delivery_date_widget) hlayout.addStretch() hlayout3 = QHBoxLayout() hlayout3.addWidget(QLabel(_("Creation date"))) hlayout3.addWidget(self.creation_date_widget) hlayout3.addStretch() hlayout2 = QHBoxLayout() hlayout2.addWidget(QLabel(_("Supplier's reference"))) hlayout2.addWidget(self.supplier_reference_widget) hlayout2.addStretch() layout = QVBoxLayout() layout.addLayout(hlayout) layout.addLayout(hlayout3) layout.addLayout(hlayout2) layout.addWidget(self.detail_description) layout.addStretch() # layout.addWidget(self.detail_view) # layout.setStretch(0,1) # layout.setStretch(1,3) return layout
def _initGUI(self): #layout = QFormLayout() hLayout = QHBoxLayout() vLayout = QVBoxLayout() self.okBtn = QPushButton("Ok") self.cancelBtn = QPushButton("Cancel") self.okBtn.clicked.connect(self.accept) self.cancelBtn.clicked.connect(self.reject) hLayout.addWidget(self.okBtn) hLayout.addWidget(self.cancelBtn) vLayout.addLayout(hLayout) self.setLayout(vLayout)
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QVBoxLayout(self) horiz_layout = QHBoxLayout() self.conditional_legend_widget = EdgeWidget(self, True) self.conditional_legend_widget.setMinimumHeight(15) horiz_layout.addWidget(self.conditional_legend_widget) self.conditional_legend_label = QLabel("Conditional transition", self) horiz_layout.addWidget(self.conditional_legend_label) self.unconditional_legend_widget = EdgeWidget(self, False) self.unconditional_legend_widget.setMinimumHeight(15) horiz_layout.addWidget(self.unconditional_legend_widget) self.unconditional_legend_label = QLabel("Non-conditional transition", self) horiz_layout.addWidget(self.unconditional_legend_label) layout.addLayout(horiz_layout) self.splitter = QSplitter(self) layout.addWidget(self.splitter) self.view = ClassyView(self.splitter) # layout.addWidget(self.view) self.scene = ClassyScene(self) self.view.setScene(self.scene) self._menu_bar = QMenuBar(self) self._menu = QMenu("&File") self._menu_bar.addMenu(self._menu) layout.setMenuBar(self._menu_bar) self.open_action = QAction("O&pen", self) self.exit_action = QAction("E&xit", self) self._menu.addAction(self.open_action) self._menu.addAction(self.exit_action) self.connect(self.open_action, SIGNAL("triggered()"), self.open_file) self.connect(self.exit_action, SIGNAL("triggered()"), self.close) self.settings = QSettings("CD Projekt RED", "TweakDB") self.log_window = QPlainTextEdit(self.splitter) self.splitter.setOrientation(Qt.Vertical) self.setWindowTitle("Classy nodes")
def __init__(self, p_def): QWidget.__init__(self) self.__fields = p_def # 控件定义 self.widgets = dict() # 控件 _lay_inputs = QGridLayout() for _index in range(len(self.__fields)): if not self.__fields[_index]["ADD"]: continue _id = self.__fields[_index]["ID"] _type = self.__fields[_index]["TYPE"] _name = self.__fields[_index]["NAME"] _ess = self.__fields[_index]["ESSENTIAL"] _widget = create_editor(self, dict(TYPE=_type, SOURCE="ADD", FLAG=_id)) self.widgets[_id] = dict(TYPE=_type, NAME=_name, WIDGET=_widget, ESSENTIAL=_ess) if "OPERATE" == _type: _widget.sig_operate.connect(self.sig_operate.emit) _label = QLabel(("*" if _ess else " ") + _name + ":") _lay_inputs.addWidget(_label, _index, 0) _lay_inputs.addWidget(self.widgets[_id]["WIDGET"], _index, 1) buttuns = ViewButtons( [dict(id="submit", name=u"提交"), dict(id="cancel", name=u"取消")]) lay_main = QVBoxLayout() lay_main.addLayout(_lay_inputs) lay_main.addWidget(buttuns) self.setLayout(lay_main) buttuns.sig_clicked.connect(self.__operate) self.setStyleSheet(get_theme("Input"))
def createLayout(self): hbox = QHBoxLayout() hbox.addWidget(self.backButton) hbox.addWidget(self.forwardButton) hbox.addWidget(self.contentsButton) hbox.addWidget(self.searchLineEdit, 1) hbox.addWidget(self.zoomInButton) hbox.addWidget(self.zoomOutButton) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self.browser, 1) if self.debug: vbox.addWidget(self.urlLabel) widget = QWidget() widget.setLayout(vbox) self.setCentralWidget(widget)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.closeButton) hbox.addStretch() layout.addWidget(self.browser) layout.addLayout(hbox) widget = QWidget() widget.setLayout(layout) self.setCentralWidget(widget) if self.loadSaveSize: settings = QSettings() self.resize( QSize( settings.value(Gopt.Key.CheckForm_Size, Gopt.Default.CheckForm_Size)))
def layoutWidgets(self): buttonBox = QDialogButtonBox() buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) buttonBox.addButton(self.addButton, QDialogButtonBox.ActionRole) buttonBox.addButton(self.deleteButton, QDialogButtonBox.ActionRole) buttonBox.addButton(self.closeButton, QDialogButtonBox.AcceptRole) hbox = QHBoxLayout() hbox.addWidget(self.extensionLabel) hbox.addWidget(self.extensionComboBox) hbox.addStretch() hbox.addWidget(buttonBox) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self.tabWidget, 1) self.setLayout(vbox)
def __init__(self, parent, use_max, current_range, max_range, tag): """Creates a ColorMap widget. parent The Qt parent of this widget. use_max Whether the policy is to use max possible or set range. current_range The min and max range on creation. tag A name for this widget, will be emitted on change. """ super(RangeWidget, self).__init__(parent) self.edit_range = (current_range[0], current_range[1]) self.max_range = max_range self.use_max = use_max self.tag = tag layout = QVBoxLayout() self.range_check = QCheckBox("Use maximum range across applicable " + "modules.") layout.addWidget(self.range_check) if self.use_max: self.range_check.setChecked(True) else: self.range_check.setChecked(False) self.range_check.stateChanged.connect(self.checkChanged) layout.addItem(QSpacerItem(3, 3)) hlayout = QHBoxLayout() hlayout.addWidget(QLabel("Set range: ")) self.range_min = QLineEdit(str(current_range[0]), self) self.range_min.editingFinished.connect(self.rangeChanged) hlayout.addWidget(self.range_min) hlayout.addWidget(QLabel(" to ")) self.range_max = QLineEdit(str(current_range[1]), self) self.range_max.editingFinished.connect(self.rangeChanged) hlayout.addWidget(self.range_max) layout.addLayout(hlayout) self.setStates() self.setLayout(layout)
def _init_pathgroups_tab(self, tab): # pathgroups list pathgroups_label = QLabel(self) pathgroups_label.setText('PathGroup') pathgroups_list = QComboBox(self) self._pathgroups_list = pathgroups_list pg_layout = QHBoxLayout() pg_layout.addWidget(pathgroups_label) pg_layout.addWidget(pathgroups_list) # path group information viewer = QPathGroupViewer(None) self._pathgroup_viewer = viewer # # Buttons # # step button step_button = QPushButton() step_button.setText('Step Path Group') step_button.released.connect(self._on_step_clicked) # step until branch step_until_branch_button = QPushButton('Step Path Group until branch') step_until_branch_button.released.connect( self._on_step_until_branch_clicked) # explore button explore_button = QPushButton('Explore') explore_button.released.connect(self._on_explore_clicked) # buttons layout buttons_layout = QVBoxLayout() layout = QHBoxLayout() layout.addWidget(explore_button) buttons_layout.addLayout(layout) layout = QHBoxLayout() layout.addWidget(step_button) layout.addWidget(step_until_branch_button) buttons_layout.addLayout(layout) pathgroups_layout = QVBoxLayout() pathgroups_layout.addLayout(pg_layout) pathgroups_layout.addWidget(viewer) pathgroups_layout.addLayout(buttons_layout) frame = QFrame() frame.setLayout(pathgroups_layout) tab.addTab(frame, 'General')
class DefaultsDialog(QWidget): def __init__(self, kind, module, parent=None): super(DefaultsDialog, self).__init__() self.clipboard = parent.clipboard self.setWindowTitle("%s : %s" % (kind, module)) self.setGeometry(0, 0, 500, 500) self.move( QApplication.desktop().screenGeometry().center() - self.rect().center()) self.show() # Main layout self.layout = QVBoxLayout() self.setLayout(self.layout) self.display_tabs = QTabWidget() self.display = {} for k in ["yaml", "python", "bibliography"]: self.display[k] = QTextEdit() self.display[k].setLineWrapMode(QTextEdit.NoWrap) self.display[k].setFontFamily("mono") self.display[k].setCursorWidth(0) self.display[k].setReadOnly(True) self.display_tabs.addTab(self.display[k], k) self.layout.addWidget(self.display_tabs) # Fill text defaults_txt = get_default_info( module, kind, return_yaml=True, fail_if_not_found=True) from cobaya.yaml import yaml_load self.display["python"].setText( "from collections import OrderedDict\n\ninfo = " + pformat(yaml_load(defaults_txt))) self.display["yaml"].setText(defaults_txt) self.display["bibliography"].setText(get_bib_module(module, kind)) # Buttons self.buttons = QHBoxLayout() self.close_button = QPushButton('Close', self) self.copy_button = QPushButton('Copy to clipboard', self) self.buttons.addWidget(self.close_button) self.buttons.addWidget(self.copy_button) self.close_button.released.connect(self.close) self.copy_button.released.connect(self.copy_clipb) self.layout.addLayout(self.buttons) @Slot() def copy_clipb(self): self.clipboard.setText(self.display_tabs.currentWidget().toPlainText())
def __init__(self, vector, obj, parent=None): super(MagnitudeNormalWidget, self).__init__(parent) # for both py2 and py3 """ ui_path = os.path.join(os.path.dirname(__file__), "MagnitudeNormalWidget.ui") self.form = Gui.PySideUic.loadUi(ui_path) print(self.form.layout) print('type of self.form.inputVectorMag', type(self.form.inputVectorMag)) """ self.form = self self.inputVectorMag = _createInputField() self.labelMagnitude = QLabel('Magnitude') _magLayout = QHBoxLayout() _magLayout.addWidget(self.labelMagnitude) _magLayout.addWidget(self.inputVectorMag) self.buttonDirection = QPushButton( "select face or edge to add direction") self.buttonDirection.setCheckable(True) self.lineDirection = QLineEdit("Direction Shape Ref") self.checkReverse = QCheckBox("Reserve direction") self.labelVector = QLabel("Preview of vector value") _layout = QVBoxLayout() _layout.addLayout(_magLayout) _layout.addWidget(self.buttonDirection) _layout.addWidget(self.lineDirection) _layout.addWidget(self.checkReverse) _layout.addWidget(self.labelVector) self.setLayout(_layout) self.selecting_direction = False # add direction button status self.setVector(vector) if obj: self.obj = obj else: FreeCAD.Console.PrintError( "A FreeCAD DocumentObject derived object must provided for MagnitudeNormalWidget\n" ) self.form.inputVectorMag.valueChanged.connect( self.inputVectorMagChanged) self.form.lineDirection.textChanged.connect(self.lineDirectionChanged) self.form.buttonDirection.clicked.connect(self.buttonDirectionClicked) self.form.checkReverse.toggled.connect(self.checkReverseToggled)
def promptDialog(self, evt=0): mainPos = self.pos() objectName = Window_global.objectName + "_dialog" if cmds.window(objectName, ex=1): cmds.deleteUI(objectName) dialog = QMainWindow(self) dialog.setWindowFlags(QtCore.Qt.Dialog) dialog.setObjectName(objectName) dialog.resize(200, 100) dialog.move(self.addTabButton.clickedX + mainPos.x() + 10, self.addTabButton.clickedY + mainPos.y() + 40) dialog.show() vWidget = QWidget(dialog) vLayout = QVBoxLayout(vWidget) dialog.setCentralWidget(vWidget) hEditLayout = QHBoxLayout() hButtonLayout = QHBoxLayout() vLayout.addLayout(hEditLayout) vLayout.addLayout(hButtonLayout) textWidget = QLabel("Tab Name : ") editWidget = QLineEdit() hEditLayout.addWidget(textWidget) hEditLayout.addWidget(editWidget) okButtonWidget = QPushButton("OK") cancelButtonWidget = QPushButton("Cancel") hButtonLayout.addWidget(okButtonWidget) hButtonLayout.addWidget(cancelButtonWidget) def addTabFunc(evt=0): self.tabWidget.addTab(editWidget.text()) dialog.deleteLater() cancelButtonWidget.clicked.connect(dialog.deleteLater) okButtonWidget.clicked.connect(addTabFunc) editWidget.returnPressed.connect(addTabFunc)
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): results = self.te_logging.toPlainText() print results
def createGUI(self): self.series = QSpinBox() self.series.setMinimum(1) self.repetitions = QSpinBox() self.repetitions.setMaximum(512) self.avgHeartRateToggle = QCheckBox() self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox) self.avgHeartRate = QSpinBox() self.avgHeartRate.setMinimum(30) self.avgHeartRate.setMaximum(250) self.avgHeartRate.setValue(120) self.avgHeartRate.setDisabled(True) self.dateSelector_widget = QCalendarWidget() self.dateSelector_widget.setMaximumDate(QDate.currentDate()) self.addButton = QPushButton("Add pushup") self.addButton.setMaximumWidth(90) self.addButton.clicked.connect(self._createPushup) self.cancelButton = QPushButton("Cancel") self.cancelButton.setMaximumWidth(90) self.cancelButton.clicked.connect(self.reject) self.pushupForm.addRow("Series", self.series) self.pushupForm.addRow("Repetitions", self.repetitions) self.pushupForm.addRow("Store average heart rate ? ", self.avgHeartRateToggle) self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate) self.pushupForm.addRow("Exercise Date", self.dateSelector_widget) btnsLayout = QVBoxLayout() btnsLayout.addWidget(self.addButton) btnsLayout.addWidget(self.cancelButton) btnsLayout.setAlignment(Qt.AlignRight) layoutWrapper = QVBoxLayout() layoutWrapper.addLayout(self.pushupForm) layoutWrapper.addLayout(btnsLayout) self.setLayout(layoutWrapper)
def __init__(self, parent, remote_documents_service): super(NonconformitiesWidget, self).__init__(parent) self._track_changes = True self._current_qe = None self._change_tracker = ChangeTracker(Base) self.order_part_id = None self.quality_events = InstrumentedRelation() top_layout = QVBoxLayout() top_layout.addWidget(QLabel(u"<h3>{}</h3>".format( _("Non conformity")))) control_layout = QHBoxLayout() self.quality_issue_chooser = QComboBox(self) # self.quality_issue_chooser.addItems(["a","b"]) # self.quality_issue_chooser.activated.connect(self.set_quality_issue) self.quality_issue_chooser.currentIndexChanged.connect( self.set_quality_issue) self.add_quality_issue_button = QPushButton(_("Add")) self.remove_quality_issue_button = QPushButton(_("Remove")) self.add_quality_issue_button.clicked.connect(self.add_quality_issue) self.remove_quality_issue_button.clicked.connect( self.remove_quality_issue) control_layout.addWidget(self.quality_issue_chooser) control_layout.addWidget(self.add_quality_issue_button) control_layout.addWidget(self.remove_quality_issue_button) control_layout.setStretch(0, 1) top_layout.addLayout(control_layout) horizontalLine = QFrame(self) horizontalLine.setFrameStyle(QFrame.HLine) # horizontalLine.setMinimumHeight(1) # seems useless # horizontalLine.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Minimum) # seems useless top_layout.addWidget(horizontalLine) self.nc_edit = Nonconformity2Widget(self, remote_documents_service) self.nc_edit.issue_changed.connect(self._issue_edited_slot) top_layout.addWidget(self.nc_edit) self.setLayout(top_layout)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.formatPanel) layout.addLayout(hbox) seeGroup = QGroupBox("See") form = QFormLayout() form.addRow(self.seeLabel, self.seeTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seePrefixTextEdit) hbox.addWidget(self.seeSepLabel) hbox.addWidget(self.seeSepTextEdit) hbox.addWidget(self.seeSuffixLabel) hbox.addWidget(self.seeSuffixTextEdit) form.addRow(self.seePrefixLabel, hbox) seeGroup.setLayout(form) layout.addWidget(seeGroup) alsoGroup = QGroupBox("See Also") form = QFormLayout() form.addRow(self.seeAlsoLabel, self.seeAlsoTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seeAlsoPrefixTextEdit) hbox.addWidget(self.seeAlsoSepLabel) hbox.addWidget(self.seeAlsoSepTextEdit) hbox.addWidget(self.seeAlsoSuffixLabel) hbox.addWidget(self.seeAlsoSuffixTextEdit) form.addRow(self.seeAlsoPrefixLabel, hbox) form.addRow(self.seeAlsoPositionLabel, self.seeAlsoPositionComboBox) alsoGroup.setLayout(form) layout.addWidget(alsoGroup) form = QFormLayout() form.addRow(self.xrefToSubentryLabel, self.xrefToSubentryComboBox) form.addRow(self.genericConjunctionLabel, self.genericConjunctionTextEdit) layout.addLayout(form) layout.addStretch(2) self.setLayout(layout)
def __init__(self, currentFields, parent=None): super(FieldNameDialog, self).__init__(parent) label_choice = QLabel(self.tr("Choose output field name:")) self._chosen_field = None self.combobox_field_choice = SingleEditCombobox(currentFields) btn_ok = QPushButton(self.tr("OK")) btn_ok.clicked.connect(self.accepted) btn_cancel = QPushButton(self.tr("Cancel")) btn_cancel.clicked.connect(self.rejected) layout = QVBoxLayout() bottom_layout = QHBoxLayout() layout.addWidget(label_choice) layout.addWidget(self.combobox_field_choice) bottom_layout.addStretch() bottom_layout.addWidget(btn_ok) bottom_layout.addWidget(btn_cancel) layout.addLayout(bottom_layout) self.setLayout(layout) self.setWindowTitle(self.tr("Choose output field"))
def __init__(self): super(XMEGAProgrammerDialog, self).__init__(CWMainGUI.getInstance()) # self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.xmega = XMEGAProgrammer() self.setWindowTitle("ChipWhisperer-Lite XMEGA Programmer") layout = QVBoxLayout() layoutFW = QHBoxLayout() self.flashLocation = QtFixes.QLineEdit() flashFileButton = QPushButton("Find") flashFileButton.clicked.connect(self.findFlash) layoutFW.addWidget(QLabel("FLASH File")) layoutFW.addWidget(self.flashLocation) layoutFW.addWidget(flashFileButton) layout.addLayout(layoutFW) self.flashLocation.setText(QSettings().value("xmega-flash-location")) # Add buttons readSigBut = QPushButton("Check Signature") readSigBut.clicked.connect(self.readSignature) verifyFlashBut = QPushButton("Verify FLASH") verifyFlashBut.clicked.connect(self.verifyFlash) verifyFlashBut.setEnabled(False) progFlashBut = QPushButton("Erase/Program/Verify FLASH") progFlashBut.clicked.connect(self.writeFlash) layoutBut = QHBoxLayout() layoutBut.addWidget(readSigBut) layoutBut.addWidget(verifyFlashBut) layoutBut.addWidget(progFlashBut) layout.addLayout(layoutBut) # Add status stuff self.statusLine = QPlainTextEdit() self.statusLine.setReadOnly(True) # self.statusLine.setFixedHeight(QFontMetrics(self.statusLine.font()).lineSpacing() * 5 + 10) self.xmega.newTextLog.connect(self.append) layout.addWidget(self.statusLine) # Set dialog layout self.setLayout(layout)
def layoutWidgets(self): topLayout = QHBoxLayout() topLayout.addWidget(self.fontLabel) topLayout.addWidget(self.fontComboBox, 1) topLayout.addWidget(self.sizeLabel) topLayout.addWidget(self.sizeComboBox) bottomLayout = QHBoxLayout() bottomLayout.addWidget(self.copyTextLabel) bottomLayout.addWidget(self.copyTextLineEdit) bottomLayout.addWidget(self.findTextLabel) bottomLayout.addWidget(self.findTextLineEdit) layout = QVBoxLayout() layout.addLayout(topLayout) layout.addWidget(self.scrollArea, 1) layout.addLayout(bottomLayout) layout.addWidget(self.buttonBox) self.setLayout(layout)
def _load_tmps(self): state = self._state layout = QVBoxLayout() self._tmps.clear() if state is None: tmps = {} else: tmps = state.scratch.temps # tmps for tmp_id, tmp_value in tmps.iteritems(): sublayout = QHBoxLayout() lbl_tmp_name = QLabel(self) lbl_tmp_name.setProperty('class', 'reg_viewer_label') lbl_tmp_name.setText("tmp_%d" % tmp_id) lbl_tmp_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sublayout.addWidget(lbl_tmp_name) sublayout.addSpacing(10) tmp_viewer = QASTViewer(tmp_value, parent=self) self._tmps[tmp_id] = tmp_viewer sublayout.addWidget(tmp_viewer) layout.addLayout(sublayout) layout.setSpacing(0) layout.addStretch(0) layout.setContentsMargins(2, 2, 2, 2) # the container container = QFrame() container.setAutoFillBackground(True) palette = container.palette() palette.setColor(container.backgroundRole(), Qt.white) container.setPalette(palette) container.setLayout(layout) self._area.setWidget(container)
def __init__(self, parent, remote_documents_service): super(Nonconformity2Widget, self).__init__(parent) self._track_changes = True self._current_qe = None top_layout = QVBoxLayout() self._quality_event_prototype = QualityEventTypePrototype( "kind", _("Kind")) self._quality_event_type_widget = self._quality_event_prototype.edit_widget( self) self._quality_event_type_widget.activated.connect( self.event_type_changed) self._type_label = QLabel(_("Type :")) hlayout = QHBoxLayout() hlayout.addWidget(self._type_label) hlayout.addWidget(self._quality_event_prototype.edit_widget(self)) hlayout.setStretch(0, 0) hlayout.setStretch(1, 1) top_layout.addLayout(hlayout) # self.comments_widget = CommentsWidget(self, self._change_tracker) self.comments_widget = QTextEdit(self) self.comments_widget.textChanged.connect(self.comment_changed) self._description_label = QLabel(_("Description :")) top_layout.addWidget(self._description_label) top_layout.addWidget(self.comments_widget) self.documents = DocumentCollectionWidget( parent=self, doc_service=remote_documents_service, used_category_short_name='Qual.', no_header=True) self.documents.documents_list_changed.connect( self._documents_changed_slot) top_layout.addWidget(self.documents) top_layout.addStretch() self._enable_editing() self.setLayout(top_layout)
def __init__(self, parent, user_session): super(LoginDialog, self).__init__(parent) self.user = None self.user_session = user_session title = _("{} Login").format(configuration.get("Globals", "name")) self.setWindowTitle(title) self.title_widget = TitleWidget(title, self) self.userid = QLineEdit() self.password = QLineEdit() self.password.setEchoMode(QLineEdit.Password) self.remember_me = QCheckBox() form_layout = QFormLayout() form_layout.addRow(_("User ID"), self.userid) form_layout.addRow(_("Password"), self.password) form_layout.addRow(_("Remember me"), self.remember_me) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) top_layout = QVBoxLayout() top_layout.addWidget(self.title_widget) top_layout.addWidget(QLabel(_("Please identify yourself"))) top_layout.addLayout(form_layout) top_layout.addWidget(self.buttons) self.setLayout(top_layout) # QWidget takes ownership of the layout self.buttons.accepted.connect(self.try_login) self.buttons.rejected.connect(self.cancel) self.userid.textEdited.connect(self.login_changed) if configuration.get("AutoLogin", "user"): self.remember_me.setCheckState(Qt.Checked) self.userid.setText(configuration.get("AutoLogin", "user")) self.password.setText(configuration.get("AutoLogin", "password")) mainlog.debug("__init__ login dialog")
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 addTab(self): dialog = QDialog( self ) dialog.setWindowTitle( 'Add Tab' ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout( dialog ) tabNameLayout = QHBoxLayout() labelTabName = QLabel( 'Tab Name : ' ) lineEditTabName = QLineEdit() tabNameLayout.addWidget( labelTabName ) tabNameLayout.addWidget( lineEditTabName ) buttonsLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonCancel = QPushButton( "Cancel") buttonsLayout.addWidget( buttonCreate ) buttonsLayout.addWidget( buttonCancel ) mainLayout.addLayout( tabNameLayout ) mainLayout.addLayout( buttonsLayout ) dialog.show() def cmd_create(): tabName = lineEditTabName.text() if not tabName: msgbox = QMessageBox( self ) msgbox.setText( "�̸��� �������ּ���".decode( 'utf-8' ) ) msgbox.exec_() return self.tabWidget.addTab( tabName ) dialog.deleteLater() def cmd_cancel(): dialog.deleteLater() QtCore.QObject.connect( lineEditTabName, QtCore.SIGNAL( 'returnPressed()' ), cmd_create ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( 'clicked()' ), cmd_create ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL( 'clicked()' ), cmd_cancel )
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__(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 )