def __init__(self, value, parent=None): QGridLayout.__init__(self) font = tuple_to_qfont(value) assert font is not None # Font family self.family = QFontComboBox(parent) self.family.setCurrentFont(font) self.addWidget(self.family, 0, 0, 1, -1) # Font size self.size = QComboBox(parent) self.size.setEditable(True) sizelist = list(range(6, 12)) + list(range(12, 30, 2)) + [36, 48, 72] size = font.pointSize() if size not in sizelist: sizelist.append(size) sizelist.sort() self.size.addItems([str(s) for s in sizelist]) self.size.setCurrentIndex(sizelist.index(size)) self.addWidget(self.size, 1, 0) # Italic or not self.italic = QCheckBox(self.tr("Italic"), parent) self.italic.setChecked(font.italic()) self.addWidget(self.italic, 1, 1) # Bold or not self.bold = QCheckBox(self.tr("Bold"), parent) self.bold.setChecked(font.bold()) self.addWidget(self.bold, 1, 2)
def __init__(self): QGridLayout.__init__(self) self.visitSetId = SpinBox() self.seqtypeWidget = Label('previous') self.name = LineEdit('') self.comments = LineEdit('') self.cmdStr = LineEdit('') self.cmdStatus = LineEdit('') self.addWidget(Label('visit_set_id'), 0, 0) self.addWidget(self.visitSetId, 0, 1) self.addWidget(Label('sequence_type'), 1, 0) self.addWidget(self.seqtypeWidget, 1, 1) self.addWidget(Label('name'), 2, 0) self.addWidget(self.name, 2, 1) self.addWidget(Label('comments'), 3, 0) self.addWidget(self.comments, 3, 1) self.addWidget(Label('cmdStr'), 4, 0) self.addWidget(self.cmdStr, 4, 1) self.addWidget(Label('status'), 5, 0) self.addWidget(self.cmdStatus, 5, 1) df = utils.fetch_query(opdb.OpDB.url, 'select max(visit_set_id) from sps_sequence') max_visit_set_id, = df.loc[0].values self.visitSetId.setRange(1, max_visit_set_id) self.visitSetId.valueChanged.connect(self.load) self.visitSetId.setValue(max_visit_set_id)
def __init__(self, type='Experiment', commandParse=('spsait expose', 'arc <exptime>')): QGridLayout.__init__(self) self.typeLabel = Label('Type') self.type = Label(type) self.nameLabel = Label('Name') self.name = LineEdit('') self.commentsLabel = Label('Comments') self.comments = LineEdit('') self.cmdStrLabel = Label('CmdStr') self.cmdStr = LineEdit('spsait expose arc exptime=2.0 duplicate=3') self.addWidget(self.typeLabel, 1, 0) self.addWidget(self.type, 1, 1) self.addWidget(self.nameLabel, 2, 0) self.addWidget(self.name, 2, 1) self.addWidget(self.commentsLabel, 3, 0) self.addWidget(self.comments, 3, 1) self.addWidget(self.cmdStrLabel, 4, 0) self.addWidget(self.cmdStr, 4, 1)
def __init__(self, panelwidget): self.panelwidget = panelwidget QGridLayout.__init__(self) self.doAbort = False self.stateWidget = CLabel('OFF') self.startButton = PushButton("START") self.stopButton = PushButton("STOP") self.abortButton = AbortButton() self.delayBar = DelayBar(self) self.delay = QSpinBox() self.delay.setValue(0) self.delay.setRange(0, 24 * 60 * 10) self.startButton.clicked.connect(self.start) self.stopButton.clicked.connect(self.stop) self.abortButton.clicked.connect(self.abort) self.addWidget(Label("Delay (min)"), 0, 1) self.addWidget(self.stateWidget, 1, 0) self.addWidget(self.delay, 1, 1) self.addWidget(self.delayBar, 0, 2, 1, 2) self.addWidget(self.startButton, 1, 2) self.addWidget(self.stopButton, 1, 2) self.addWidget(self.abortButton, 1, 3) self.setState('off')
def __init__(self, parent, rule): QGridLayout.__init__(self) # the comaprison combo self.compCombo = QComboBox(parent) index = 0 for text, code in RULE_DATA: self.compCombo.addItem(text, code) if code == rule.comp: self.compCombo.setCurrentIndex(index) index += 1 self.addWidget(self.compCombo, 0, 0) # the number of bands spinbox self.numberBox = QSpinBox(parent) self.numberBox.setRange(1, 100) self.numberBox.setValue(rule.value) self.addWidget(self.numberBox, 0, 1) # the label for the color table rule self.colorTableLabel = QLabel(parent) self.colorTableLabel.setText("Color Table in Band") self.addWidget(self.colorTableLabel, 1, 0) # color table band spinbox self.colorTableBox = QSpinBox(parent) self.colorTableBox.setRange(0, 100) self.colorTableBox.setSpecialValueText('No color table required') if rule.ctband is None: self.colorTableBox.setValue(0) else: self.colorTableBox.setValue(rule.ctband) self.addWidget(self.colorTableBox, 1, 1)
def __init__(self, children: list, stretch: list = None, auto_right=True): QGridLayout.__init__(self) self.auto_right = auto_right self.add_children(children) if stretch: for x in range(len(stretch)): self.setColumnStretch(x, stretch[x])
def __init__(self, panelwidget): self.panelwidget = panelwidget QGridLayout.__init__(self) self.status = CLabel('OFF') self.startButton = QPushButton("START") self.stopButton = QPushButton("STOP") self.abortButton = QPushButton("ABORT") self.delayBar = DelayBar(panelwidget=panelwidget) self.delayBar.setFixedSize(160, 28) self.delay = QSpinBox() self.delay.setValue(0) self.delay.setRange(0, 24 * 60 * 10) self.startButton.clicked.connect(self.startSequence) self.stopButton.clicked.connect(self.stopSequence) self.abortButton.clicked.connect(self.abortSequence) self.addWidget(Label("Delay (min)"), 0, 1) self.addWidget(self.status, 1, 0) self.addWidget(self.delay, 1, 1) self.addWidget(self.delayBar, 0, 2, 1, 2) self.addWidget(self.startButton, 1, 2) self.addWidget(self.stopButton, 1, 2) self.addWidget(self.abortButton, 1, 3) self.stopButton.setVisible(False)
def __init__(self, parent=None): QGridLayout.__init__(self) self.parent = parent self._name = self.__class__.__name__ self.signals = SignalManager(self) self.settings = Settings(SETTING_FILEPTH['app'], ST_FORMAT['ini'], self)
def __init__(self, grid, h, w): QGridLayout.__init__(self) # Size of the grid self.m = grid.m self.n = grid.n self.grid = grid self.h = h self.w = w # Reduce the space between the images self.setHorizontalSpacing(1) self.setVerticalSpacing(1) self.initUI()
def __init__(self): QGridLayout.__init__(self) self.widgets = [ DoubleSpinBoxGB('X', -10, 10, 4), DoubleSpinBoxGB('Y', -10, 10, 4), DoubleSpinBoxGB('Z', -10, 10, 4), DoubleSpinBoxGB('U', -10, 10, 4), DoubleSpinBoxGB('V', -10, 10, 4), DoubleSpinBoxGB('W', -5, 10, 4) ] for i, spinbox in enumerate(self.widgets): self.addWidget(spinbox, i // 3, i % 3)
def __init__(self, dialog, token): """ :type dialog: QDialog :type token: Token :type callback: func """ QGridLayout.__init__(self) self.setSpacing(8) self.setColumnStretch(3, 1) self.dialog = dialog self.addresses = self.dialog.parent().wallet.get_addresses() self.token = token address_lb = QLabel(_("Contract Address:")) self.contract_addr_e = ButtonsLineEdit() self.contract_addr_e.setReadOnly(True) self.addWidget(address_lb, 1, 0) self.addWidget(self.contract_addr_e, 1, 1, 1, -1) name_lb = QLabel(_('Token Name:')) self.name_e = QLineEdit() self.name_e.setReadOnly(True) self.addWidget(name_lb, 2, 0) self.addWidget(self.name_e, 2, 1, 1, -1) symbol_lb = QLabel(_('Token Symbol:')) self.symbol_e = QLineEdit() self.symbol_e.setReadOnly(True) self.addWidget(symbol_lb, 3, 0) self.addWidget(self.symbol_e, 3, 1, 1, -1) decimals_lb = QLabel(_('Decimals:')) self.decimals_e = QLineEdit() self.decimals_e.setReadOnly(True) self.addWidget(decimals_lb, 4, 0) self.addWidget(self.decimals_e, 4, 1, 1, -1) address_lb = QLabel(_("My Address:")) self.address_e = QLineEdit() self.address_e.setMinimumWidth(300) self.address_e.setReadOnly(True) self.addWidget(address_lb, 5, 0) self.addWidget(self.address_e, 5, 1, 1, -1) self.cancel_btn = CancelButton(dialog) buttons = Buttons(*[self.cancel_btn]) buttons.addStretch() self.addLayout(buttons, 6, 2, 2, -1) self.update()
def __init__(self, panelwidget): QGridLayout.__init__(self) self.panelwidget = panelwidget self.logArea = CmdLogArea() self.showButton = PushButton('Show Logs') self.hideButton = PushButton('Hide Logs') self.showButton.clicked.connect(partial(self.show, True)) self.hideButton.clicked.connect(partial(self.show, False)) self.panelwidget.scheduler.addWidget(self.showButton, 1, 10) self.panelwidget.scheduler.addWidget(self.hideButton, 1, 11) self.addWidget(self.logArea) self.show(False)
def __init__(self, seqtype, cmdHead, lampExptime=None, options=None, **kwargs): self.seqtype = seqtype self.cmdHead = cmdHead QGridLayout.__init__(self) self.addWidget(Label('name'), 0, 0) self.addWidget(Label('comments'), 1, 0) self.cmdStr = CmdStr(self) self.name = EditableValue(self, 'name', '') self.comments = EditableValue(self, 'comments', '') self.fields = [] self.addWidget(self.name, 0, 1) self.addWidget(self.comments, 1, 1) if lampExptime is not None: exptime = ExposureTime(self, lamps=lampExptime) self.fields.extend(exptime.fields) self.addWidget(exptime, self.rowCount(), 0, exptime.grid.rowCount(), 2) for i, (key, value) in enumerate(kwargs.items()): nRows = self.rowCount() label, editableValue = Label(key), EditableValue( self, key, str(value)) self.fields.append(editableValue) self.addWidget(label, nRows + i, 0) self.addWidget(editableValue, nRows + i, 1) nRows = self.rowCount() self.addWidget(Label('cmdStr'), nRows, 0) self.addWidget(self.cmdStr, nRows, 1) if options is not None: options = OptionalArgs(self, options) self.fields.extend(options.fields) self.addWidget(options, self.rowCount(), 0, options.grid.rowCount(), 2) self.cmdStr.build()
def __init__(self, dialog, callback): """ :type dialog: QDialog :type callback: func """ QGridLayout.__init__(self) self.setSpacing(8) self.setColumnStretch(3, 1) self.callback = callback self.dialog = dialog self.addresses = self.dialog.parent( ).wallet.get_addresses_sort_by_balance() addr_type, __ = b58_address_to_hash160(self.addresses[0]) if not addr_type == constants.net.ADDRTYPE_P2PKH: self.dialog.show_message( _('only P2PKH address supports QRC20 Token')) self.dialog.reject() return address_lb = QLabel(_("Contract Address:")) self.contract_addr_e = ButtonsLineEdit() self.addWidget(address_lb, 1, 0) self.addWidget(self.contract_addr_e, 1, 1, 1, -1) address_lb = QLabel(_("My Address:")) self.address_combo = QComboBox() self.address_combo.setMinimumWidth(300) self.address_combo.setEditable(True) self.address_combo.addItems(self.addresses) self.addWidget(address_lb, 2, 0) self.addWidget(self.address_combo, 2, 1, 1, -1) self.cancel_btn = CancelButton(dialog) self.save_btn = QPushButton(_('Save')) self.save_btn.setDefault(True) self.save_btn.clicked.connect(self.save_input) buttons = Buttons(*[self.cancel_btn, self.save_btn]) buttons.addStretch() self.addLayout(buttons, 3, 2, 2, -1)
def __init__(self, dialog, dele: 'Delegation', mode: str): """ :type dialog: QDialog :type callback: func """ QGridLayout.__init__(self) self.setSpacing(8) self.setColumnStretch(3, 1) self.dialog = dialog self.dele = dele self.mode = mode if dele and dele.addr: self.addresses = [dele.addr] else: self.addresses = [''] delegations = self.dialog.parent().wallet.db.list_delegations() for addr in self.dialog.parent().wallet.get_addresses_sort_by_balance(): if addr in delegations: continue addr_type, __ = b58_address_to_hash160(addr) if addr_type == constants.net.ADDRTYPE_P2PKH: self.addresses.append(addr) address_lb = QLabel(_("Address:")) self.address_combo = QComboBox() self.address_combo.setMinimumWidth(300) self.address_combo.addItems(self.addresses) self.addWidget(address_lb, 1, 0) self.addWidget(self.address_combo, 1, 1, 1, -1) self.address_combo.currentIndexChanged.connect(self.on_address) staker_lb = QLabel(_("Staker:")) self.staker_e = ButtonsLineEdit() self.addWidget(staker_lb, 2, 0) self.addWidget(self.staker_e, 2, 1, 1, -1) fee_lb = QLabel(_('Fee Percent:')) self.fee_e = QLineEdit() self.addWidget(fee_lb, 3, 0) self.addWidget(self.fee_e, 3, 1, 1, -1) self.optional_lb = QLabel(_('Optional:')) self.addWidget(self.optional_lb, 4, 0) self.optional_widget = QWidget() optional_layout = QHBoxLayout() optional_layout.setContentsMargins(0, 0, 0, 0) optional_layout.setSpacing(0) gas_limit_lb = QLabel(_('gas limit: ')) self.gas_limit_e = AmountEdit(lambda: '', True, None, 0, 0) self.gas_limit_e.setText('2250000') gas_price_lb = QLabel(_('gas price: ')) self.gas_price_e = AmountEdit(lambda: '', False, None, 8, 0) self.gas_price_e.setText('0.00000040') optional_layout.addWidget(gas_limit_lb) optional_layout.addWidget(self.gas_limit_e) optional_layout.addStretch(1) optional_layout.addWidget(gas_price_lb) optional_layout.addWidget(self.gas_price_e) optional_layout.addStretch(0) self.optional_widget.setLayout(optional_layout) self.addWidget(self.optional_widget, 4, 1, 1, -1) self.cancel_btn = CancelButton(dialog) self.do_btn = QPushButton(self.mode[0].upper() + self.mode[1:]) self.do_btn.clicked.connect(self.do) buttons = Buttons(*[self.cancel_btn, self.do_btn]) buttons.addStretch() self.addLayout(buttons, 5, 2, 2, -1) self.update()
def __init__(self): QGridLayout.__init__(self) self.initUI()
def __init__(self, dialog, token, send_callback): """ :type dialog: QDialog :type token: Token :type callback: func """ QGridLayout.__init__(self) self.setSpacing(8) self.setColumnStretch(3, 1) self.dialog = dialog self.token = token self.send_callback = send_callback address_lb = QLabel(_("My Address:")) self.address_e = QLineEdit() self.address_e.setMinimumWidth(300) self.address_e.setReadOnly(True) self.address_e.setText(token.bind_addr) self.addWidget(address_lb, 1, 0) self.addWidget(self.address_e, 1, 1, 1, -1) address_to_lb = QLabel(_("Pay to:")) self.address_to_e = QLineEdit() self.address_to_e.setMinimumWidth(300) self.addWidget(address_to_lb, 2, 0) self.addWidget(self.address_to_e, 2, 1, 1, -1) amount_lb = QLabel(_("Amount:")) self.amount_e = AmountEdit(lambda: self.token.symbol, False, None, self.token.decimals, 0) self.addWidget(amount_lb, 3, 0) self.addWidget(self.amount_e, 3, 1, 1, -1) optional_lb = QLabel(_('Optional:')) self.addWidget(optional_lb, 4, 0) optional_widget = QWidget() optional_layout = QHBoxLayout() optional_layout.setContentsMargins(0, 0, 0, 0) optional_layout.setSpacing(0) gas_limit_lb = QLabel(_('gas limit: ')) self.gas_limit_e = AmountEdit(lambda: '', True, None, 0, 0) self.gas_limit_e.setText('75000') gas_price_lb = QLabel(_('gas price: ')) self.gas_price_e = AmountEdit(lambda: '', False, None, 8, 0) self.gas_price_e.setText('0.00000040') optional_layout.addWidget(gas_limit_lb) optional_layout.addWidget(self.gas_limit_e) optional_layout.addStretch(1) optional_layout.addWidget(gas_price_lb) optional_layout.addWidget(self.gas_price_e) optional_layout.addStretch(0) optional_widget.setLayout(optional_layout) self.addWidget(optional_widget, 4, 1, 1, -1) self.preview_btn = QPushButton(_('Preview')) self.preview_btn.setDefault(False) self.preview_btn.clicked.connect(self.preview) self.cancel_btn = CancelButton(dialog) self.send_btn = QPushButton(_('Send')) self.send_btn.setDefault(True) self.send_btn.clicked.connect(self.send) buttons = Buttons(*[self.cancel_btn, self.preview_btn, self.send_btn]) buttons.addStretch() self.addLayout(buttons, 5, 2, 2, -1)
def __init__(self, *args, title='', **kwargs): QGridLayout.__init__(self, *args, **kwargs) upMargin = 1 if not title else 8 self.setContentsMargins(0, upMargin, 0, 0) self.setSpacing(spacing)
def __init__(self, dialog, contract): QGridLayout.__init__(self) self.setSpacing(8) self.setColumnStretch(3, 1) self.dialog = dialog self.contract = contract self.senders = self.dialog.parent().wallet.get_spendable_addresses() address_lb = QLabel(_("Address:")) self.address_e = ButtonsLineEdit() qr_show = lambda: dialog.parent().show_qrcode( str(self.address_e.text()), 'Address', parent=dialog) qr_icon = "qrcode_white.png" if ColorScheme.dark_scheme else "qrcode.png" self.address_e.addButton(qr_icon, qr_show, _("Show as QR code")) self.address_e.setText(self.contract['address']) self.address_e.setReadOnly(True) self.addWidget(address_lb, 1, 0) self.addWidget(self.address_e, 1, 1, 1, -1) abi_lb = QLabel(_('Function:')) self.abi_combo = QComboBox() self.abi_signatures = [ (-1, "(00)"), ] for index, abi in enumerate(contract.get('interface', [])): if not abi.get('type') == 'function': continue signature = '{}({})'.format( abi.get('name', ''), ', '.join([ '{} {}'.format(i.get('type'), i.get('name')) for i in abi.get('inputs', []) ])) self.abi_signatures.append((index, signature)) self.abi_combo.addItems([s[1] for s in self.abi_signatures]) self.abi_combo.setFixedWidth(self.address_e.width()) if len(self.senders) > 0: self.abi_combo.setCurrentIndex(0) self.addWidget(abi_lb, 2, 0) self.addWidget(self.abi_combo, 2, 1, 1, -1) self.abi_combo.currentIndexChanged.connect(self.update) args_lb = QLabel(_('Parameters:')) self.args_e = QLineEdit() self.addWidget(args_lb, 3, 0) self.addWidget(self.args_e, 3, 1, 1, -1) self.optional_lb = QLabel(_('Optional:')) self.addWidget(self.optional_lb, 4, 0) self.optional_widget = QWidget() optional_layout = QHBoxLayout() optional_layout.setContentsMargins(0, 0, 0, 0) optional_layout.setSpacing(0) gas_limit_lb = QLabel(_('gas limit: ')) self.gas_limit_e = ButtonsLineEdit() self.gas_limit_e.setValidator(int_validator) self.gas_limit_e.setText('250000') gas_price_lb = QLabel(_('gas price: ')) self.gas_price_e = ButtonsLineEdit() self.gas_price_e.setValidator(float_validator) self.gas_price_e.setText('0.00000040') amount_lb = QLabel(_('amount: ')) self.amount_e = ButtonsLineEdit() self.amount_e.setValidator(float_validator) optional_layout.addWidget(gas_limit_lb) optional_layout.addWidget(self.gas_limit_e) optional_layout.addStretch(1) optional_layout.addWidget(gas_price_lb) optional_layout.addWidget(self.gas_price_e) optional_layout.addStretch(1) optional_layout.addWidget(amount_lb) optional_layout.addWidget(self.amount_e) optional_layout.addStretch(0) self.optional_widget.setLayout(optional_layout) self.addWidget(self.optional_widget, 4, 1, 1, -1) sender_lb = QLabel(_('Sender:')) self.addWidget(sender_lb, 5, 0) buttons = QHBoxLayout() self.sender_combo = QComboBox() self.sender_combo.setMinimumWidth(400) self.sender_combo.addItems(self.senders) buttons.addWidget(self.sender_combo) buttons.addStretch(1) self.call_button = EnterButton(_("Call"), self.do_call) self.sendto_button = EnterButton(_("Send to"), self.do_sendto) self.preview_btn = EnterButton(_("Preview"), self.do_preview) buttons.addWidget(self.call_button) buttons.addWidget(self.preview_btn) buttons.addWidget(self.sendto_button) buttons.addStretch() self.addLayout(buttons, 5, 1, 1, -1) self.update()
def __init__(self, num_elements, parent=None): QGridLayout.__init__(self, parent) self.num_elements = num_elements self.row, self.column = 0, 0 self.num_rows, self.num_columns = self._find_size()
def __init__(self, *args, **kwargs): QGridLayout.__init__(self, *args, **kwargs) self.setSpacing(spacing)