def __init__(self, name, stringlist=None, parent=None): super(StringListDlg, self).__init__(parent) self.name = name self.listWidget = QListWidget() if stringlist is not None: self.listWidget.addItems(stringlist) self.listWidget.setCurrentRow(0) buttonLayout = QVBoxLayout() for text, slot in (("&Add...", self.add), ("&Edit...", self.edit), ("&Remove...", self.remove), ("&Up", self.up), ("&Down", self.down), ("&Sort", self.listWidget.sortItems), ("Close", self.accept)): button = QPushButton(text) if not MAC: button.setFocusPolicy(Qt.NoFocus) if text == "Close": buttonLayout.addStretch() buttonLayout.addWidget(button) self.connect(button, SIGNAL("clicked()"), slot) layout = QHBoxLayout() layout.addWidget(self.listWidget) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle("Edit {0} List".format(self.name))
def __init__(self, parent, app): super(QWidget, self).__init__() layout1 = QHBoxLayout() layout2 = QVBoxLayout() layout1.addStretch() layout1.addLayout(layout2) layout1.addStretch() label = QLabel(self) label.setText("Simple Project: <b>Display Environment Measurements on LCD</b>. Simply displays all measured values on LCD. Sources in all programming languages can be found <a href=\"http://www.tinkerforge.com/en/doc/Kits/WeatherStation/WeatherStation.html#display-environment-measurements-on-lcd\">here</a>.<br>") label.setTextFormat(Qt.RichText) label.setTextInteractionFlags(Qt.TextBrowserInteraction) label.setOpenExternalLinks(True) label.setWordWrap(True) label.setAlignment(Qt.AlignJustify) layout2.addSpacing(10) layout2.addWidget(label) layout2.addSpacing(10) self.lcdwidget = LCDWidget(self, app) layout2.addWidget(self.lcdwidget) layout2.addStretch() self.setLayout(layout1) self.qtcb_update_illuminance.connect(self.update_illuminance_data_slot) self.qtcb_update_air_pressure.connect(self.update_air_pressure_data_slot) self.qtcb_update_temperature.connect(self.update_temperature_data_slot) self.qtcb_update_humidity.connect(self.update_humidity_data_slot) self.qtcb_button_pressed.connect(self.button_pressed_slot)
def __init__(self, buttonText, imagePath, buttonCallback, imageSize, parent=None): QWidget.__init__(self, parent) icon = QLabel(self) icon.setPixmap(QPixmap(imagePath).scaled(imageSize, imageSize)) button = QPushButton(buttonText) button.clicked.connect(buttonCallback) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(icon, alignment=Qt.AlignHCenter) vbox.addSpacing(20) vbox.addWidget(button) vbox.addStretch(1) # Add some horizontal padding hbox = QHBoxLayout() hbox.addSpacing(10) hbox.addLayout(vbox) hbox.addSpacing(10) groupBox = QGroupBox() groupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(groupBox) hbox.addStretch(1) self.setLayout(hbox)
def __init__(self, broker, parent=None): super(BrokerWidget, self).__init__(parent) self.broker = broker self.dataTable = TableView() self.dataTable.setModel(self.broker.dataModel) self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch) #self.dataTable.resizeColumnsToContents() dataLabel = QLabel('Price Data') dataLabel.setBuddy(self.dataTable) dataLayout = QVBoxLayout() dataLayout.addWidget(dataLabel) dataLayout.addWidget(self.dataTable) addButton = QPushButton("&Add Symbol") saveDataButton = QPushButton("&Save Data") #deleteButton = QPushButton("&Delete") buttonLayout = QVBoxLayout() buttonLayout.addWidget(addButton) buttonLayout.addWidget(saveDataButton) buttonLayout.addStretch() layout = QHBoxLayout() layout.addLayout(dataLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(addButton, SIGNAL('clicked()'), self.addSubscription) self.connect(saveDataButton, SIGNAL('clicked()'), self.saveData)
def __init__(self, parent=None, param=None): super(SphereWidget, self).__init__(parent) if param is None: self.param = SphereParam() else: self.param = param gbC_lay = QVBoxLayout() l_cmap = QLabel("Cmap ") self.cmap = list(get_colormaps().keys()) self.combo = QComboBox(self) self.combo.addItems(self.cmap) self.combo.currentIndexChanged.connect(self.updateParam) self.param.dict["colormap"] = self.cmap[0] hbox = QHBoxLayout() hbox.addWidget(l_cmap) hbox.addWidget(self.combo) gbC_lay.addLayout(hbox) self.sp = [] # subdiv lL = QLabel("subdiv") self.sp.append(QSpinBox()) self.sp[-1].setMinimum(0) self.sp[-1].setMaximum(6) self.sp[-1].setValue(self.param.dict["subdiv"]) # Layout hbox = QHBoxLayout() hbox.addWidget(lL) hbox.addWidget(self.sp[-1]) gbC_lay.addLayout(hbox) # signal's self.sp[-1].valueChanged.connect(self.updateParam) # Banded self.gbBand = QGroupBox(u"Banded") self.gbBand.setCheckable(True) hbox = QGridLayout() lL = QLabel("nbr band", self.gbBand) self.sp.append(QSpinBox(self.gbBand)) self.sp[-1].setMinimum(0) self.sp[-1].setMaximum(100) # Layout hbox = QHBoxLayout() hbox.addWidget(lL) hbox.addWidget(self.sp[-1]) self.gbBand.setLayout(hbox) gbC_lay.addWidget(self.gbBand) # signal's self.sp[-1].valueChanged.connect(self.updateParam) self.gbBand.toggled.connect(self.updateParam) gbC_lay.addStretch(1.0) hbox = QHBoxLayout() hbox.addLayout(gbC_lay) self.setLayout(hbox) self.updateMenu()
def __init__(self, parent): CstmPanel.__init__(self, parent) sizer = QHBoxLayout() vsizer = QVBoxLayout() hsizer = QHBoxLayout() self.sm = QLabel(u'Affichage des effectifs: ') hsizer.addWidget(self.sm) self.mode = QComboBox() self.mode.addItems((u'tels quels', u'en pourcentages', u'en fréquences')) self.mode.setCurrentIndex(self.main.param("mode_effectifs")) self.mode.currentIndexChanged.connect(self.main.EvtCheck) hsizer.addWidget(self.mode) vsizer.addLayout(hsizer) sizer.addLayout(vsizer) vsizer = QVBoxLayout() self.hachures = QCheckBox(u'Mode noir et blanc (hachures).') self.hachures.setChecked(self.main.param("hachures")) self.hachures.stateChanged.connect(self.main.EvtCheck) vsizer.addWidget(self.hachures) self.auto = QCheckBox(u"Réglage automatique de la fenêtre d'affichage.") self.auto.setChecked(self.main.param("reglage_auto_fenetre")) self.auto.stateChanged.connect(self.main.EvtCheck) vsizer.addWidget(self.auto) sizer.addLayout(vsizer, 0) self.add(sizer) self.finaliser()
def setupUi(self): """layout the window""" self.setWindowTitle(m18n('Customize rulesets') + ' - Kajongg') self.setObjectName('Rulesets') hlayout = QHBoxLayout(self) v1layout = QVBoxLayout() self.v1widget = QWidget() v1layout = QVBoxLayout(self.v1widget) v2layout = QVBoxLayout() hlayout.addWidget(self.v1widget) hlayout.addLayout(v2layout) for widget in [self.v1widget, hlayout, v1layout, v2layout]: widget.setContentsMargins(0, 0, 0, 0) hlayout.setStretchFactor(self.v1widget, 10) self.btnCopy = QPushButton() self.btnRemove = QPushButton() self.btnCompare = QPushButton() self.btnClose = QPushButton() self.rulesetView = RuleTreeView(m18nc('kajongg','Rule'), self.btnCopy, self.btnRemove, self.btnCompare) v1layout.addWidget(self.rulesetView) self.rulesetView.setWordWrap(True) self.rulesetView.setMouseTracking(True) spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) v2layout.addWidget(self.btnCopy) v2layout.addWidget(self.btnRemove) v2layout.addWidget(self.btnCompare) self.btnCopy.clicked.connect(self.rulesetView.copyRow) self.btnRemove.clicked.connect(self.rulesetView.removeRow) self.btnCompare.clicked.connect(self.rulesetView.compareRow) self.btnClose.clicked.connect(self.hide) v2layout.addItem(spacerItem) v2layout.addWidget(self.btnClose) self.retranslateUi() StateSaver(self) self.show()
def __init__(self): QWidget.__init__(self, None) self.setMinimumSize(600, 400) # Create two labels and a button self.vertLabel = QLabel("Vertex code", self) self.fragLabel = QLabel("Fragment code", self) self.theButton = QPushButton("Compile!", self) self.theButton.clicked.connect(self.on_compile) # Create two editors self.vertEdit = TextField(self) self.vertEdit.setPlainText(VERT_CODE) self.fragEdit = TextField(self) self.fragEdit.setPlainText(FRAG_CODE) # Create a canvas self.canvas = Canvas(parent=self) # Layout hlayout = QHBoxLayout(self) self.setLayout(hlayout) vlayout = QVBoxLayout() # hlayout.addLayout(vlayout, 1) hlayout.addWidget(self.canvas.native, 1) # vlayout.addWidget(self.vertLabel, 0) vlayout.addWidget(self.vertEdit, 1) vlayout.addWidget(self.fragLabel, 0) vlayout.addWidget(self.fragEdit, 1) vlayout.addWidget(self.theButton, 0) self.show()
def layout_widgets(self): vLayout1 = QVBoxLayout() vLayout1.addWidget(self.label1) vLayout1.addWidget(self.listWidget1) vLayout2 = QVBoxLayout() vLayout2.addWidget(self.button1) vLayout2.addWidget(self.button2) vLayout3 = QVBoxLayout() vLayout3.addWidget(self.label2) vLayout3.addWidget(self.listWidget2) hLayout1 = QHBoxLayout() hLayout1.addLayout(vLayout1) hLayout1.addLayout(vLayout2) hLayout1.addLayout(vLayout3) hButtonLayout = QHBoxLayout() hButtonLayout.addItem(self.spacer) hButtonLayout.addWidget(self.buttonBox) hFinalLayout = QGridLayout() hFinalLayout.addLayout(hLayout1, 0, 0) hFinalLayout.addLayout(hButtonLayout, 1, 0) self.setLayout(hFinalLayout)
def __init__(self, parent, path, value): QDialog.__init__(self) self.setWindowTitle(self.tr("Attribute value")) vlayout = QVBoxLayout() hlayout = QHBoxLayout() label = QLabel() label.setPixmap(self.style().standardIcon( QStyle.SP_MessageBoxInformation).pixmap(32, 32)) hlayout.addWidget(label) button = QDialogButtonBox(QDialogButtonBox.Ok) self.connect(button, SIGNAL('accepted()'), self.accept) attributeLayout = QHBoxLayout() attributeLabel = QLabel(self.tr("Attribute") + ":") linePath = ItemLineEdit(path) attributeLayout.addWidget(attributeLabel) attributeLayout.addWidget(linePath) attributeLayout.setSizeConstraint(QLayout.SetFixedSize) vlayout.addLayout(attributeLayout) if value: valueLayout = QHBoxLayout() valueLabel = QLabel(self.tr("Value" + ":")) lineValue = ItemLineEdit(value) valueLayout.addWidget(valueLabel) valueLayout.addWidget(lineValue) valueLayout.setSizeConstraint(QLayout.SetFixedSize) vlayout.addLayout(valueLayout) vlayout.addWidget(button) hlayout.addLayout(vlayout) self.setLayout(hlayout) self.setFixedHeight(self.sizeHint().height())
def _configurarGui(self): mainLayout = QHBoxLayout() layoutUsuario = QVBoxLayout() layoutNomeConexao = QHBoxLayout() self._barraNome = BarraNome(self._servico) self._barraConexao = BarraConexao(self._servico) layoutNomeConexao.addWidget(self._barraNome) layoutNomeConexao.addWidget(self._barraConexao) self._noteLista = NoteLista(self._servico) layoutUsuario.addLayout(layoutNomeConexao) layoutUsuario.addWidget(self._barraNome) layoutUsuario.addWidget(self._noteLista) layoutConversa = QVBoxLayout() # self._barraArquivo = BarraMultiploArquivo() self._barraArquivo = BarraArquivo() self._barraConversa = BarraConversa(self._servico) layoutConversa.addWidget(self._barraArquivo) layoutConversa.addWidget(self._barraConversa) mainLayout.addLayout(layoutUsuario, 1) mainLayout.addLayout(layoutConversa, 2) self.setLayout(mainLayout)
def __init__(self, parent, path, value): QDialog.__init__(self) self.setWindowTitle(self.tr("Attribute value")) vlayout = QVBoxLayout() hlayout = QHBoxLayout() label = QLabel() label.setPixmap(self.style().standardIcon(QStyle.SP_MessageBoxInformation).pixmap(32, 32)) hlayout.addWidget(label) button = QDialogButtonBox(QDialogButtonBox.Ok) self.connect(button, SIGNAL('accepted()'), self.accept) attributeLayout = QHBoxLayout() attributeLabel = QLabel(self.tr("Attribute") + ":") linePath = ItemLineEdit(path) attributeLayout.addWidget(attributeLabel) attributeLayout.addWidget(linePath) attributeLayout.setSizeConstraint(QLayout.SetFixedSize) vlayout.addLayout(attributeLayout) if value: valueLayout = QHBoxLayout() valueLabel = QLabel(self.tr("Value" + ":")) lineValue = ItemLineEdit(value) valueLayout.addWidget(valueLabel) valueLayout.addWidget(lineValue) valueLayout.setSizeConstraint(QLayout.SetFixedSize) vlayout.addLayout(valueLayout) vlayout.addWidget(button) hlayout.addLayout(vlayout) self.setLayout(hlayout) self.setFixedHeight(self.sizeHint().height())
def show(self): self.view = QWidget() mainLayout = QVBoxLayout() self.view.setLayout(mainLayout) transformsLayout = QHBoxLayout() mainLayout.addLayout(transformsLayout) for key, value in self.transforms.iteritems(): transrormLayout = QVBoxLayout() transformsLayout.addLayout(transrormLayout) header = QLabel(key) image = QLabel() image.setPixmap(QPixmap.fromImage(Ipl2QIm(value))) transrormLayout.addWidget(header) transrormLayout.addWidget(image) for symbol in self.symbols: transformsLayout = QHBoxLayout() mainLayout.addLayout(transformsLayout) for key, value in symbol.transforms.iteritems(): transrormLayout = QVBoxLayout() transformsLayout.addLayout(transrormLayout) header = QLabel(key) image = QLabel() image.setPixmap(QPixmap.fromImage(Ipl2QIm(value))) transrormLayout.addWidget(header) transrormLayout.addWidget(image) self.view.show()
def createWidgets(self): """ """ self.readButton = QPushButton("&Read SeleniumIDE\n(HTML File)") self.exportButton = QPushButton( "&Import in %s" % Settings.instance().readValue(key='Common/product-name')) self.exportButton.setEnabled(False) self.actsTable = ActionsTableView(self, core=self.core()) rightLayout = QVBoxLayout() rightLayout.addWidget(QLabel("Controls")) rightLayout.addWidget(self.readButton) rightLayout.addWidget(self.exportButton) rightLayout.addStretch(1) leftLayout = QVBoxLayout() leftLayout.addWidget(QLabel("Actions")) leftLayout.addWidget(self.actsTable) mainLayout = QHBoxLayout() mainLayout.addLayout(leftLayout) mainLayout.addLayout(rightLayout) self.setLayout(mainLayout)
def createDialog(self): """ Create qt dialog """ commentLabel = QLabel("Add a comment on this test result:") self.commentEdit = QTextEdit() self.commentEdit.setMinimumWidth(650) self.commentEdit.setMinimumWidth(500) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonLayout = QVBoxLayout() self.okButton = QPushButton("Add", self) self.cancelButton = QPushButton("Cancel", self) buttonLayout.addWidget(self.okButton) buttonLayout.addWidget(self.cancelButton) mainLayout = QVBoxLayout() subMainLayout = QHBoxLayout() mainLayout.addWidget(commentLabel) subMainLayout.addWidget(self.commentEdit) subMainLayout.addLayout(buttonLayout) mainLayout.addLayout(subMainLayout) self.setLayout(mainLayout) self.setWindowTitle("Test Result > Add comment")
def __init__(self, *args): PluginBase.__init__(self, None, *args, override_base_name='Unknown') # All new released Bricklets will have a comcu self.has_comcu = True info = args[1] layout = QVBoxLayout() layout.addStretch() label = QLabel("""The {6} with * Device Identifier: {0} * UID: {1} * Position: {2} * FW Version: {3}.{4}.{5} is not yet supported. Please update Brick Viewer!""".format(info.device_identifier, info.uid, info.position.upper(), info.firmware_version_installed[0], info.firmware_version_installed[1], info.firmware_version_installed[2], 'Brick' if str(info.device_identifier).startswith('1') else 'Bricklet')) #label.setAlignment(Qt.AlignHCenter) layout.addWidget(label) layout.addStretch() hbox = QHBoxLayout(self) hbox.addStretch() hbox.addLayout(layout) hbox.addStretch()
def __init__(self): super(Demo, self).__init__() self.code_editor = CodeEditor(self) self.code_editor.setup_editor( language = "python", font = QFont("Courier New") ) run_sc = QShortcut(QKeySequence("F5"), self, self.run) self.shell = InternalShell(self, {"demo":self}, multithreaded = False, max_line_count = 3000, font = QFont("Courier new", 10), message='caonima' ) self.dict_editor = DictEditorWidget(self, {}) self.dict_editor.editor.set_filter(self.filter_namespace) self.dict_editor.set_data(self.shell.interpreter.namespace) vbox = QVBoxLayout() vbox.addWidget(self.code_editor) vbox.addWidget(self.shell) hbox = QHBoxLayout() hbox.addWidget(self.dict_editor) hbox.addLayout(vbox) self.setLayout(hbox) self.resize(800, 600)
def __init__(self, parent = None): QWidget.__init__(self, parent) vbox = QVBoxLayout() frameLabel = QLabel('Рамка:') frameFileDialog = QPushButton("Выбрать рамку...") QObject.connect(frameFileDialog, SIGNAL('clicked()'), self.FRAME_FILE_DIALOG) bgLabel = QLabel('Фон:') bgFileDialog = QPushButton("Выбрать фон...") QObject.connect(bgFileDialog, SIGNAL('clicked()'), self.BG_FILE_DIALOG) textLabel = QLabel("Текст:") self.textEdit = QTextEdit() authorLabel = QLabel("Автор:") self.authorEdit = QLineEdit() saver = QPushButton("Сохранить") QObject.connect(saver,SIGNAL('clicked()'), self.callMakeImage) vbox.addWidget(frameLabel) vbox.addWidget(frameFileDialog) vbox.addWidget(bgLabel) vbox.addWidget(bgFileDialog) vbox.addWidget(textLabel) vbox.addWidget(self.textEdit) vbox.addWidget(authorLabel) vbox.addWidget(self.authorEdit) vbox.addWidget(saver) hbox = QHBoxLayout() hbox.addLayout(vbox) self.ready = QLabel() hbox.addWidget(self.ready) self.setLayout(hbox) self.framePath = 'data/Nones/None.png' self.bgPath = 'data/Nones/None.png' self.SAVE_PATH = 'READYS/' + str(random.randrange(0, 9999)) + '.png'
def create_scedit(self, text, option, default=NoDefault, tip=None, without_layout=False): label = QLabel(text) clayout = ColorLayout(QColor(Qt.black), self) clayout.lineedit.setMaximumWidth(80) if tip is not None: clayout.setToolTip(tip) cb_bold = QCheckBox() cb_bold.setIcon(get_icon("bold.png")) cb_bold.setToolTip(_("Bold")) cb_italic = QCheckBox() cb_italic.setIcon(get_icon("italic.png")) cb_italic.setToolTip(_("Italic")) self.scedits[(clayout, cb_bold, cb_italic)] = (option, default) if without_layout: return label, clayout, cb_bold, cb_italic layout = QHBoxLayout() layout.addWidget(label) layout.addLayout(clayout) layout.addSpacing(10) layout.addWidget(cb_bold) layout.addWidget(cb_italic) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) widget = QWidget(self) widget.setLayout(layout) return widget
def __init__(self,broker,parent = None ): super(BrokerWidget,self).__init__(parent) self.broker = broker self.dataTable = TableView() self.dataTable.setModel(self.broker.dataModel) self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch) #self.dataTable.resizeColumnsToContents() dataLabel = QLabel('Price Data') dataLabel.setBuddy(self.dataTable) dataLayout = QVBoxLayout() dataLayout.addWidget(dataLabel) dataLayout.addWidget(self.dataTable) addButton = QPushButton("&Add Symbol") saveDataButton = QPushButton("&Save Data") #deleteButton = QPushButton("&Delete") buttonLayout = QVBoxLayout() buttonLayout.addWidget(addButton) buttonLayout.addWidget(saveDataButton) buttonLayout.addStretch() layout = QHBoxLayout() layout.addLayout(dataLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(addButton,SIGNAL('clicked()'),self.addSubscription) self.connect(saveDataButton,SIGNAL('clicked()'),self.saveData)
def __init__(self, mainloop, addr, title, parent=None): QWidget.__init__(self, parent) self.mainloop = mainloop self.addr = addr self.title = QLabel(title) self.title.setFont(QFont('Monospace', 16)) self.message = QLabel('') self.message.setFont(QFont('Monospace', 13)) self.bt_open = self.init_button('arrow-up-icon.png', QSize(50, 50)) self.bt_close = self.init_button('arrow-down-icon.png', QSize(50, 50)) info_layout = QVBoxLayout() info_layout.addWidget(self.title) layout = QHBoxLayout() layout.addLayout(info_layout) layout.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Expanding)) self.options_layout = QHBoxLayout() layout.addLayout(self.options_layout) layout.addWidget(self.bt_open) layout.addWidget(self.bt_close) self.setLayout(layout) self.bt_open.clicked.connect(self.open) self.bt_close.clicked.connect(self.close) self.grabGesture(Qt.TapAndHoldGesture)
def _createLayout(self): l = QVBoxLayout() h = QHBoxLayout() v = QVBoxLayout() v.addWidget(self.ride_time) v.addWidget(self.avg_speed) v.addWidget(self.avg_hr) v.addWidget(self.avg_cad) v.addWidget(self.avg_pwr) h.addLayout(v) v = QVBoxLayout() v.addWidget(self.calories) v.addWidget(self.max_speed) v.addWidget(self.max_hr) v.addWidget(self.max_cad) v.addWidget(self.max_pwr) h.addLayout(v) l.addLayout(h) l.addSpacing(10) l.addWidget(self.laps) l.addStretch() self.setLayout(l)
def setupUi(self): self.widget = MSView( MSQtCanvas(self.peaks, "peaks@%s" % str(self.peaks[0]), labels={ 'bottom': 'RT(s)', 'left': 'INTENSITY' }, flags='peak')) self.tableView = QTableView() self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.setSortingEnabled(True) self.corr = QLabel("Nan") self.calcCorr = QPushButton("r_coef:") #v = QVBoxLayout(self) self.addWidget(self.widget) self.wid = QWidget() vb = QVBoxLayout() vb.addWidget(self.calcCorr) vb.addWidget(self.corr) hb = QHBoxLayout(self.wid) #if self.choosenOne.formulas: hb.addWidget(self.tableView) #else: # hb.addWidget(QLabel("Identification not performed yet...")) hb.addLayout(vb) self.addWidget(self.wid)
def _fill_environment_box(self): # Main Layout main_lo = QVBoxLayout() self.environment_gb.setLayout(main_lo) # Combobox lo, self.env_select_cb, lab = GBuilder().label_combobox(self, "Current Environment:", [], self._env_select_changed) hl = QHBoxLayout() hl.addLayout(lo) but = GBuilder().pushbutton(self, "New", self._new_env_hit) but.setFixedWidth(40) hl.addWidget(but) lab.setFixedWidth(140) self.env_select_cb.setFixedHeight(22) self.env_select_cb.setFixedWidth(350) main_lo.addLayout(hl) # Groupbox (to make it look nicer) self.content_gb = EnvironmentView(self.environment_gb) main_lo.addWidget(self.content_gb) self.content_gb.setFixedHeight(550) self.content_gb.setFixedWidth(1000) self.content_gb.setLayout(lo) # QStackedWidget with environments self.stacked_env = QStackedWidget() lo.addWidget(self.stacked_env)
def __init__(self, parent): super(FindInFilesWidget, self).__init__(parent) self._main_container = IDE.get_service('main_container') self._explorer_container = IDE.get_service('explorer') self._result_widget = FindInFilesResult() self._open_find_button = QPushButton(translations.TR_FIND + "!") self._stop_button = QPushButton(translations.TR_STOP + "!") self._clear_button = QPushButton(translations.TR_CLEAR + "!") self._replace_button = QPushButton(translations.TR_REPLACE) self._find_widget = FindInFilesDialog(self._result_widget, self) self._error_label = QLabel(translations.TR_NO_RESULTS) self._error_label.setVisible(False) #Replace Area self.replace_widget = QWidget() hbox_replace = QHBoxLayout(self.replace_widget) hbox_replace.setContentsMargins(0, 0, 0, 0) self.lbl_replace = QLabel(translations.TR_REPLACE_RESULTS_WITH) self.lbl_replace.setTextFormat(Qt.PlainText) self.replace_edit = QLineEdit() hbox_replace.addWidget(self.lbl_replace) hbox_replace.addWidget(self.replace_edit) self.replace_widget.setVisible(False) #Main Layout main_hbox = QHBoxLayout(self) #Result Layout tree_vbox = QVBoxLayout() tree_vbox.addWidget(self._result_widget) tree_vbox.addWidget(self._error_label) tree_vbox.addWidget(self.replace_widget) main_hbox.addLayout(tree_vbox) #Buttons Layout vbox = QVBoxLayout() vbox.addWidget(self._open_find_button) vbox.addWidget(self._stop_button) vbox.addWidget(self._clear_button) vbox.addSpacerItem( QSpacerItem(0, 50, QSizePolicy.Fixed, QSizePolicy.Expanding)) vbox.addWidget(self._replace_button) main_hbox.addLayout(vbox) self._open_find_button.setFocus() #signals self.connect(self._open_find_button, SIGNAL("clicked()"), self.open) self.connect(self._stop_button, SIGNAL("clicked()"), self._find_stop) self.connect(self._clear_button, SIGNAL("clicked()"), self._clear_results) self.connect(self._result_widget, SIGNAL("itemActivated(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._result_widget, SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._find_widget, SIGNAL("finished()"), self._find_finished) self.connect(self._find_widget, SIGNAL("findStarted()"), self._find_started) self.connect(self._replace_button, SIGNAL("clicked()"), self._replace_results)
def __init__(self, parent=None, filename=None): super(MainForm, self).__init__(parent) self.view = GraphicsView() background = QPixmap(filename) self.filename = os.path.splitext(filename)[0] if ("-%s" % ORG) in self.filename: self.filename = self.filename[:-len(ORG)-5] + ".png" self.view.setBackgroundBrush(QBrush(background)) # self.view.setCacheMode(QGraphicsView.CacheBackground) # self.view.setDragMode(QGraphicsView.ScrollHandDrag) self.scene = QGraphicsScene(self) global scene scene = self.scene self.view.dialog = self self.view.setScene(self.scene) self.prevPoint = QPoint() self.lastStamp = -1 buttonLayout = QVBoxLayout() for text, slot in ( ("&Tag", self.addTag), ("Align &bottom", self.alignBottom), ("Align &left", self.alignLeft), ("&Save", self.save), ("&Quit", self.accept)): button = QPushButton(text) if not MAC: button.setFocusPolicy(Qt.NoFocus) self.connect(button, SIGNAL("clicked()"), slot) if text == "&Save": buttonLayout.addStretch(5) if text == "&Quit": buttonLayout.addStretch(1) buttonLayout.addWidget(button) buttonLayout.addStretch() self.view.resize(background.width(), background.height()) self.scene.setSceneRect(0, 0, background.size().width(), background.size().height()) self.view.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) layout = QHBoxLayout() layout.addWidget(self.view, 1) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle(AppName) info_name = self.filename + "-" + TAG + ".txt" if os.path.exists(info_name): for tag, x, y in [line.strip().split("\t") for line in open(info_name, "rt").readlines()]: self.addTag(int(tag), QPointF(int(x), int(y)), adjust_position=False) global Dirty; Dirty=False self.show() self.raise_()
def __init__(self, parent): QWidget.__init__(self, parent) self._main_container = main_container.MainContainer() self._explorer_container = explorer_container.ExplorerContainer() self._result_widget = FindInFilesResult() self._open_find_button = QPushButton(self.tr("Find!")) self._stop_button = QPushButton(self.tr("Stop")) self._clear_button = QPushButton(self.tr("Clear!")) self._replace_button = QPushButton(self.tr("Replace")) self._find_widget = FindInFilesDialog(self._result_widget, self) self._error_label = QLabel(self.tr("No Results")) self._error_label.setVisible(False) #Replace Area self.replace_widget = QWidget() hbox_replace = QHBoxLayout(self.replace_widget) hbox_replace.setContentsMargins(0, 0, 0, 0) self.lbl_replace = QLabel(self.tr("Replace results with:")) self.lbl_replace.setTextFormat(Qt.PlainText) self.replace_edit = QLineEdit() hbox_replace.addWidget(self.lbl_replace) hbox_replace.addWidget(self.replace_edit) self.replace_widget.setVisible(False) #Main Layout main_hbox = QHBoxLayout(self) #Result Layout tree_vbox = QVBoxLayout() tree_vbox.addWidget(self._result_widget) tree_vbox.addWidget(self._error_label) tree_vbox.addWidget(self.replace_widget) main_hbox.addLayout(tree_vbox) #Buttons Layout vbox = QVBoxLayout() vbox.addWidget(self._open_find_button) vbox.addWidget(self._stop_button) vbox.addWidget(self._clear_button) vbox.addSpacerItem( QSpacerItem(0, 50, QSizePolicy.Fixed, QSizePolicy.Expanding)) vbox.addWidget(self._replace_button) main_hbox.addLayout(vbox) self._open_find_button.setFocus() #signals self.connect(self._open_find_button, SIGNAL("clicked()"), self.open) self.connect(self._stop_button, SIGNAL("clicked()"), self._find_stop) self.connect(self._clear_button, SIGNAL("clicked()"), self._clear_results) self.connect(self._result_widget, SIGNAL("itemActivated(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._result_widget, SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._find_widget, SIGNAL("finished()"), self._find_finished) self.connect(self._find_widget, SIGNAL("findStarted()"), self._find_started) self.connect(self._replace_button, SIGNAL("clicked()"), self._replace_results)
def __init__(self, parent): QWidget.__init__(self, parent) self._main_container = main_container.MainContainer() self._explorer_container = explorer_container.ExplorerContainer() self._result_widget = FindInFilesResult() self._open_find_button = QPushButton(self.tr("Find!")) self._stop_button = QPushButton(self.tr("Stop")) self._clear_button = QPushButton(self.tr("Clear!")) self._replace_button = QPushButton(self.tr("Replace")) self._find_widget = FindInFilesDialog(self._result_widget, self) self._error_label = QLabel(self.tr("No Results")) self._error_label.setVisible(False) #Replace Area self.replace_widget = QWidget() hbox_replace = QHBoxLayout(self.replace_widget) hbox_replace.setContentsMargins(0, 0, 0, 0) self.lbl_replace = QLabel(self.tr("Replace results with:")) self.lbl_replace.setTextFormat(Qt.PlainText) self.replace_edit = QLineEdit() hbox_replace.addWidget(self.lbl_replace) hbox_replace.addWidget(self.replace_edit) self.replace_widget.setVisible(False) #Main Layout main_hbox = QHBoxLayout(self) #Result Layout tree_vbox = QVBoxLayout() tree_vbox.addWidget(self._result_widget) tree_vbox.addWidget(self._error_label) tree_vbox.addWidget(self.replace_widget) main_hbox.addLayout(tree_vbox) #Buttons Layout vbox = QVBoxLayout() vbox.addWidget(self._open_find_button) vbox.addWidget(self._stop_button) vbox.addWidget(self._clear_button) vbox.addSpacerItem(QSpacerItem(0, 50, QSizePolicy.Fixed, QSizePolicy.Expanding)) vbox.addWidget(self._replace_button) main_hbox.addLayout(vbox) self._open_find_button.setFocus() #signals self.connect(self._open_find_button, SIGNAL("clicked()"), self.open) self.connect(self._stop_button, SIGNAL("clicked()"), self._find_stop) self.connect(self._clear_button, SIGNAL("clicked()"), self._clear_results) self.connect(self._result_widget, SIGNAL( "itemActivated(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._result_widget, SIGNAL( "itemClicked(QTreeWidgetItem *, int)"), self._go_to) self.connect(self._find_widget, SIGNAL("finished()"), self._find_finished) self.connect(self._find_widget, SIGNAL("findStarted()"), self._find_started) self.connect(self._replace_button, SIGNAL("clicked()"), self._replace_results)
class Appointment(QWidget): def __init__(self, parent = None): super(Appointment, self).__init__(parent) #std. settings self.stdFont = QFont("Arial", 16) self.bigFont = QFont("Arial", 48) #layouts self.mainLayout = QHBoxLayout() self.leftLayout = QVBoxLayout() self.rightLayout = QVBoxLayout() #components self.participantLabel = QLabel("Participant Name") self.participantLabel.setFont(self.stdFont) self.eventTitle = QLabel("Event Title") self.eventTitle.setFont(self.bigFont) self.eventStart = QLabel("Event Start") self.eventStart.setFont(self.stdFont) self.eventEnd = QLabel("Event End") self.eventEnd.setFont(self.stdFont) self.leftLayout.addWidget(self.eventStart) self.leftLayout.addStretch() self.leftLayout.addWidget(self.eventEnd) self.rightLayout.addStretch() self.rightLayout.addWidget(self.participantLabel) self.rightLayout.addWidget(self.eventTitle) self.rightLayout.addStretch() self.mainLayout.addLayout(self.leftLayout) self.mainLayout.addSpacerItem(QSpacerItem(1,128)) self.mainLayout.addLayout(self.rightLayout) self.setLayout(self.mainLayout) self.mainLayout.setMargin(0) self.mainLayout.setSpacing(0) self.setStyleSheet("background-color: #ccc; color: #fff") self.setFixedHeight(128) def setTitle(self, title): self.eventTitle.setText(title) def setStartTime(self,start): self.eventStart.setText(start) def setEndTime(self, end): self.eventEnd.setText(end) def setParticipants(self,participants): self.participantLabel.setText(participants)
def __init__(self, parent=None,index=0,account=None): super(QDialog, self).__init__(parent) self.index = index self.hostname = QLineEdit(account.hostname) self.hostname.setInputMethodHints(Qt.ImhNoAutoUppercase) self.port = QLineEdit(unicode(account.port)) self.port.setInputMethodHints(Qt.ImhNoAutoUppercase) self.username = QLineEdit(account.username) self.username.setInputMethodHints(Qt.ImhNoAutoUppercase) self.password = QLineEdit(account.password) self.password.setEchoMode(QLineEdit.Password) self.password.setInputMethodHints(Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhHiddenText) # self.password.setInputMethodHints(Qt.ImhHiddenText) self.local_dir = QLineEdit(account.local_dir) self.local_dir.setInputMethodHints(Qt.ImhNoAutoUppercase) self.remote_dir = QLineEdit(account.remote_dir) self.remote_dir.setInputMethodHints(Qt.ImhNoAutoUppercase) self.save_button = QPushButton('Save') self.delete_button = QPushButton('Delete') gridLayout = QGridLayout() leftLayout = QVBoxLayout() gridLayout.addWidget(QLabel('Hostname'), 0, 0) gridLayout.addWidget(self.hostname, 0, 1) gridLayout.addWidget(QLabel('Port'), 1, 0) gridLayout.addWidget(self.port, 1, 1) gridLayout.addWidget(QLabel('Username'), 2, 0) gridLayout.addWidget(self.username, 2, 1) gridLayout.addWidget(QLabel('Password'), 3, 0) gridLayout.addWidget(self.password, 3, 1) gridLayout.addWidget(QLabel('Local dir'), 4, 0) gridLayout.addWidget(self.local_dir, 4, 1) gridLayout.addWidget(QLabel('Remote dir'), 5, 0) gridLayout.addWidget(self.remote_dir, 5, 1) leftLayout.addLayout(gridLayout) buttonLayout = QVBoxLayout() buttonLayout.addWidget(self.save_button) buttonLayout.addWidget(self.delete_button) buttonLayout.addStretch() mainLayout = QHBoxLayout() mainLayout.addLayout(leftLayout) mainLayout.addLayout(buttonLayout) self.setLayout(mainLayout) mainLayout.setSizeConstraint( QLayout.SetFixedSize) self.save_button.clicked.connect(self.saveit) self.delete_button.clicked.connect(self.deleteit) self.setWindowTitle("Edit account")
def __init__(self, parent=None): super( FindDialog, self, ).__init__(parent) self.label = QLabel(str("Find &what:")) self.lineEdit = QLineEdit() self.label.setBuddy(self.lineEdit) self.caseCheckBox = QCheckBox(str("Match &case")) self.backwardCheckBox = QCheckBox(str("Search &backward")) self.findButton = QPushButton(str("&Find")) self.findButton.setDefault(True) self.findButton.setEnabled(False) closeButton = QPushButton(str("Close")) #-------------------------------------------------------- # 1. 连接的槽 必须 指定 @pyqtSlot(QString) self.connect(self.lineEdit, SIGNAL("textChanged(QString)"), self, SLOT("enableFindButton(QString)")) # 2. 不必指定 @pyqtSlot(QString) # self.connect(self.lineEdit, SIGNAL("textChanged(QString)"), # self.enableFindButton) #--------------------------------------------------------- self.connect(self.findButton, SIGNAL("clicked()"), self, SLOT("findClicked()")) self.connect(closeButton, SIGNAL("clicked()"), self, SLOT("close()")) #------------- 布局 ------------------------- topLeftLayout = QHBoxLayout() topLeftLayout.addWidget(self.label) topLeftLayout.addWidget(self.lineEdit) leftLayout = QVBoxLayout() leftLayout.addLayout(topLeftLayout) leftLayout.addWidget(self.caseCheckBox) leftLayout.addWidget(self.backwardCheckBox) rightLayout = QVBoxLayout() rightLayout.addWidget(self.findButton) rightLayout.addWidget(closeButton) rightLayout.addStretch() # 添加 分割 符号 mainLayout = QHBoxLayout() mainLayout.addLayout(leftLayout) mainLayout.addLayout(rightLayout) self.setLayout(mainLayout) #------------------------------- self.setWindowTitle(str("Find")) # 设置 固定 高度 # sizeHint().height() 返回一个 窗口 "理想"的尺寸 self.setFixedHeight(self.sizeHint().height())
def __init__(self, engine, parent=None, channels=4): QFrame.__init__(self, parent) self.setAutoFillBackground(True) self.palette().setColor(self.backgroundRole(), spec.BACKGROUND) self.controlPanel = controlpanel.ControlPanel(self) self.keyboard = keyboard.Keyboard(self, orientation=Qt.Vertical) self.keyboard.keywidth = 25 self.keyboard.setHalfSteps(127) self.keyboard.setMinimumWidth(50) self.controls = [] self.synthzones = [] MixerLayout = QHBoxLayout() for i in range(channels): ChannelLayout = QVBoxLayout() for j in range(SYNTHS): synthzone = slots.SynthSlot(self) QObject.connect(synthzone, SIGNAL('selected(QWidget *)'), self.clicked) synthzone.channel = i ChannelLayout.addWidget(synthzone) controls = ChannelControls(self) controls.channel = i ChannelLayout.addWidget(controls) MixerLayout.addLayout(ChannelLayout) self.toolbox = toolbox.ToolBox(self) self.toolbox.setFrameShape(spec.FRAME_SHAPE) self.toolbox.setFixedWidth(spec.PART_WIDTH + spec.SCROLLPAD_WIDTH + 10) self.engine = engine self.rtplayer = rtplayer.RTPlayer(engine.server) self.rt_note = None self.current_synth = None self.mode = None self.set_mode('select') self.notes = {} QObject.connect(self.controlPanel.modeGroup, SIGNAL('buttonClicked(QAbstractButton *)'), self.mode_clicked) QObject.connect(self.keyboard, SIGNAL('noteon(int, int)'), self.noteon) QObject.connect(self.keyboard, SIGNAL('noteoff(int, int)'), self.noteoff) Layout = QHBoxLayout(self) Layout.addWidget(self.controlPanel) Layout.addWidget(self.keyboard) Layout.addLayout(MixerLayout) Layout.addWidget(self.toolbox)
class SummaryPanel(QFrame): def __init__(self, parent=None): QFrame.__init__(self, parent) self.setMinimumWidth(250) self.setMinimumHeight(150) widget = QWidget() self.layout = QHBoxLayout() widget.setLayout(self.layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(widget) layout = QGridLayout() layout.addWidget(scroll) self.setLayout(layout) self.updateSummary() def updateSummary(self): summary = ErtSummary() text = SummaryTemplate("Forward Model") for job in summary.getForwardModels(): text.addRow(job) self.addColumn(text.getText()) text = SummaryTemplate("Parameters") for parameters in summary.getParameters(): text.addRow(parameters) self.addColumn(text.getText()) text = SummaryTemplate("Observations") for observations in summary.getObservations(): text.addRow(observations) self.addColumn(text.getText()) def addColumn(self, text): layout = QVBoxLayout() text_widget = QLabel(text) text_widget.setWordWrap(True) text_widget.setTextFormat(Qt.RichText) layout.addWidget(text_widget) layout.addStretch(1) self.layout.addLayout(layout)
def __init__(self, parent, search_text = r"# ?TODO|# ?FIXME|# ?XXX", search_text_regexp=True, search_path=None, include=[".", ".py"], include_idx=None, include_regexp=True, exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None, exclude_regexp=True, supported_encodings=("utf-8", "iso-8859-1", "cp1252"), in_python_path=False, more_options=False): QWidget.__init__(self, parent) self.setWindowTitle(_('Find in files')) self.search_thread = None self.get_pythonpath_callback = None self.find_options = FindOptions(self, search_text, search_text_regexp, search_path, include, include_idx, include_regexp, exclude, exclude_idx, exclude_regexp, supported_encodings, in_python_path, more_options) self.connect(self.find_options, SIGNAL('find()'), self.find) self.connect(self.find_options, SIGNAL('stop()'), self.stop_and_reset_thread) self.result_browser = ResultsBrowser(self) collapse_btn = create_toolbutton(self) collapse_btn.setDefaultAction(self.result_browser.collapse_all_action) expand_btn = create_toolbutton(self) expand_btn.setDefaultAction(self.result_browser.expand_all_action) restore_btn = create_toolbutton(self) restore_btn.setDefaultAction(self.result_browser.restore_action) # collapse_sel_btn = create_toolbutton(self) # collapse_sel_btn.setDefaultAction( # self.result_browser.collapse_selection_action) # expand_sel_btn = create_toolbutton(self) # expand_sel_btn.setDefaultAction( # self.result_browser.expand_selection_action) btn_layout = QVBoxLayout() btn_layout.setAlignment(Qt.AlignTop) for widget in [collapse_btn, expand_btn, restore_btn]: # collapse_sel_btn, expand_sel_btn]: btn_layout.addWidget(widget) hlayout = QHBoxLayout() hlayout.addWidget(self.result_browser) hlayout.addLayout(btn_layout) layout = QVBoxLayout() left, _x, right, bottom = layout.getContentsMargins() layout.setContentsMargins(left, 0, right, bottom) layout.addWidget(self.find_options) layout.addLayout(hlayout) self.setLayout(layout)
def __init__(self, status = None, Actions = None): super (View, self).__init__() self.setWindowTitle("Standalone View") self.sdb_tree_table = SDBTree(self) self.sdb_raw_tree_table = SDBRawTree(self) main_layout = QVBoxLayout() #Create the buttons expand_raw_button = QPushButton("Expand All") collapse_raw_button = QPushButton("Collapse All") expand_parsed_button = QPushButton("Expand All") collapse_parsed_button = QPushButton("Collapse All") #Connect the signals expand_raw_button.clicked.connect(self.sdb_raw_tree_table.expandAll) collapse_raw_button.clicked.connect(self.sdb_raw_tree_table.collapseAll) expand_parsed_button.clicked.connect(self.sdb_tree_table.expandAll) collapse_parsed_button.clicked.connect(self.sdb_tree_table.collapseAll) layout = QHBoxLayout() main_layout.addLayout(layout) raw_tree_table_layout = QVBoxLayout() raw_tree_table_layout.addWidget(QLabel("Raw SDB")) l = QHBoxLayout() l.addWidget(expand_raw_button) l.addWidget(collapse_raw_button) raw_tree_table_layout.addLayout(l) raw_tree_table_layout.addWidget(self.sdb_raw_tree_table) parsed_tree_table_layout = QVBoxLayout() parsed_tree_table_layout.addWidget(QLabel("Parsed SDB")) l = QHBoxLayout() l.addWidget(expand_parsed_button) l.addWidget(collapse_parsed_button) parsed_tree_table_layout.addLayout(l) parsed_tree_table_layout.addWidget(self.sdb_tree_table) layout.addLayout(raw_tree_table_layout) layout.addLayout(parsed_tree_table_layout) self.text = "" self.te = QLabel(self.text) self.te.setMaximumWidth(500) self.te.setWordWrap(True) self.te.setAlignment(Qt.AlignTop) layout.addWidget(self.te) #self.setLayout(layout) self.setLayout(main_layout) self.text = "" self.te.setText("")
def __init__(self, parent, search_text=r"# ?TODO|# ?FIXME|# ?XXX", search_text_regexp=True, search_path=None, include=".", include_regexp=True, exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_regexp=True, supported_encodings=("utf-8", "iso-8859-1", "cp1252")): QWidget.__init__(self, parent) self.search_thread = SearchThread(self) self.connect(self.search_thread, SIGNAL("finished()"), self.search_complete) self.find_options = FindOptions(self, search_text, search_text_regexp, search_path, include, include_regexp, exclude, exclude_regexp, supported_encodings) self.connect(self.find_options, SIGNAL('find()'), self.find) self.connect(self.find_options, SIGNAL('stop()'), self.stop) self.result_browser = ResultsBrowser(self) collapse_btn = create_toolbutton( self, get_icon("collapse.png"), tip=translate('FindInFiles', "Collapse all"), triggered=self.result_browser.collapseAll) expand_btn = create_toolbutton(self, get_icon("expand.png"), tip=translate('FindInFiles', "Expand all"), triggered=self.result_browser.expandAll) restore_btn = create_toolbutton(self, get_icon("restore.png"), tip=translate( 'FindInFiles', "Restore original tree layout"), triggered=self.result_browser.restore) btn_layout = QVBoxLayout() btn_layout.setAlignment(Qt.AlignTop) for widget in [collapse_btn, expand_btn, restore_btn]: btn_layout.addWidget(widget) hlayout = QHBoxLayout() hlayout.addWidget(self.result_browser) hlayout.addLayout(btn_layout) layout = QVBoxLayout() left, _, right, bottom = layout.getContentsMargins() layout.setContentsMargins(left, 0, right, bottom) layout.addWidget(self.find_options) layout.addLayout(hlayout) self.setLayout(layout)
def __init__(self, id_, ad, nm, ip, ms='', gw='', dns='', parent=None): super(NetConfigTile, self).__init__(parent) self.animation = QPropertyAnimation(self, "size") self.setObjectName('tile') self.setCursor(QCursor(Qt.PointingHandCursor)) effect = QGraphicsDropShadowEffect(self) effect.setOffset(0, 0) effect.setBlurRadius(20) self.setGraphicsEffect(effect) # self.setContextMenuPolicy(Qt.ActionsContextMenu) # action = QAction('edit', self) # self.addAction(action) self.setToolTip( 'interfaz: %s\nnombre: %s\nip: %s\nmascara: %s\ngateway: %s\ndns: %s' % (ad, nm, ip, ms, gw, dns)) self.setFixedWidth(300) self.setMinimumHeight(90) self.ID = id_ self.lbl_nm = QLabel(nm) self.lbl_nm.setObjectName('lbl_nm') self.lbl_ad = QLabel(ad) self.lbl_ad.setObjectName('lbl_ad') self.lbl_ip = QLabel(ip) self.lbl_ip.setObjectName('lbl_ip') self.lbl_ms = QLabel(ms) self.lbl_ms.setObjectName('lbl_ms') self.lbl_gw = QLabel(gw) self.lbl_gw.setObjectName('lbl_gw') self.lbl_dns = QLabel(dns) self.lbl_dns.setObjectName('lbl_dns') layout_left = QVBoxLayout() layout_left.addWidget(self.lbl_ad) layout_left.addWidget(self.lbl_nm) layout_left.addWidget(self.lbl_ip) layout_lbl = QHBoxLayout() layout_lbl.addLayout(layout_left) self.btn_remove = QPushButton() self.btn_remove.setFixedSize(QSize(60, 60)) self.btn_remove.setObjectName('btn_remove') self.btn_remove.setCursor(QCursor(Qt.ArrowCursor)) self.grid_layout = QGridLayout() self.grid_layout.addWidget(self.btn_remove, 1, 0) self.grid_layout.addLayout(layout_lbl, 1, 1, 1, 2) self.setLayout(self.grid_layout) self.setStyleSheet(self.load_style_sheet()) self.connect(self.btn_remove, SIGNAL('released()'), self.remove_tile)
def __init__(self,parent=None): super(FindDialog, self,).__init__(parent) self.label = QLabel(str("Find &what:")) self.lineEdit = QLineEdit() self.label.setBuddy(self.lineEdit) self.caseCheckBox = QCheckBox(str("Match &case")) self.backwardCheckBox = QCheckBox(str("Search &backward")) self.findButton = QPushButton(str("&Find")) self.findButton.setDefault(True) self.findButton.setEnabled(False) closeButton = QPushButton(str("Close")) #-------------------------------------------------------- # 1. 连接的槽 必须 指定 @pyqtSlot(QString) self.connect(self.lineEdit, SIGNAL("textChanged(QString)"), self, SLOT("enableFindButton(QString)")) # 2. 不必指定 @pyqtSlot(QString) # self.connect(self.lineEdit, SIGNAL("textChanged(QString)"), # self.enableFindButton) #--------------------------------------------------------- self.connect(self.findButton, SIGNAL("clicked()"), self, SLOT("findClicked()")) self.connect(closeButton, SIGNAL("clicked()"), self, SLOT("close()")) #------------- 布局 ------------------------- topLeftLayout = QHBoxLayout() topLeftLayout.addWidget(self.label) topLeftLayout.addWidget(self.lineEdit) leftLayout = QVBoxLayout() leftLayout.addLayout(topLeftLayout) leftLayout.addWidget(self.caseCheckBox) leftLayout.addWidget(self.backwardCheckBox) rightLayout = QVBoxLayout() rightLayout.addWidget(self.findButton) rightLayout.addWidget(closeButton) rightLayout.addStretch() # 添加 分割 符号 mainLayout = QHBoxLayout() mainLayout.addLayout(leftLayout) mainLayout.addLayout(rightLayout) self.setLayout(mainLayout) #------------------------------- self.setWindowTitle(str("Find")) # 设置 固定 高度 # sizeHint().height() 返回一个 窗口 "理想"的尺寸 self.setFixedHeight(self.sizeHint().height())
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.tableWidget = QTableWidget() self.tableWidget.setColumnCount(3) self.tableWidget.verticalHeader().hide() groupBox1 = QGroupBox('Experiment data') buttonHelp = QPushButton('help') buttonHelp.setEnabled(False) buttonHelp.setToolTip('Enter the input weights into the "w(i)" column and the signal values into the "x(i)"\n' + 'column.\n\n' + 'TIP: To recalculate the result, press Enter. To increment and decrement the value\n' + 'using the arrow keys, press F2 first or click the apropriate table cell with the left\n' + 'mouse button.') hboxLayoutGroupBox1 = QHBoxLayout() hboxLayoutGroupBox1.addWidget(QLabel('Enter the input weights and signal\n' + 'values in the table below')) hboxLayoutGroupBox1.addWidget(buttonHelp) vboxLayoutGroupBox1 = QVBoxLayout() vboxLayoutGroupBox1.addLayout(hboxLayoutGroupBox1) vboxLayoutGroupBox1.addWidget(self.tableWidget) groupBox1.setLayout(vboxLayoutGroupBox1) vboxLayout1 = QVBoxLayout() vboxLayout1.addWidget(QLabel('Perform experiments')) vboxLayout1.addWidget(groupBox1) groupBox2 = QGroupBox('Experiment result') self.memoryEdit = QLineEdit() self.memoryEdit.setReadOnly(True) self.signalEdit = QLineEdit() self.signalEdit.setReadOnly(True) self.outputEdit = QLineEdit() self.outputEdit.setReadOnly(True) self.buttonRecalculate = QPushButton('Recalculate!') gridLayoutGroupBox2 = QGridLayout() gridLayoutGroupBox2.addWidget(QLabel('Memory trace strength'), 0, 0) gridLayoutGroupBox2.addWidget(self.memoryEdit, 0, 1) gridLayoutGroupBox2.addWidget(QLabel('Input signal strength'), 1, 0) gridLayoutGroupBox2.addWidget(self.signalEdit, 1, 1) gridLayoutGroupBox2.addWidget(QLabel('Output'), 2, 0) gridLayoutGroupBox2.addWidget(self.outputEdit, 2, 1) gridLayoutGroupBox2.addWidget(self.buttonRecalculate, 3, 0) groupBox2.setLayout(gridLayoutGroupBox2) hboxLayout = QHBoxLayout() hboxLayout.addLayout(vboxLayout1) hboxLayout.addWidget(groupBox2) self.setLayout(hboxLayout)
def createDialog(self): """ Create qt dialog """ mainLayout = QHBoxLayout() paramLayout = QHBoxLayout() paramLayout.addWidget(QLabel("Interface:")) self.intComboBox = QComboBox() self.intComboBox.setEditable(1) self.intComboBox.addItems( ['any', 'eth0', 'eth1', 'eth2', 'eth3', 'eth4', 'lo0']) paramLayout.addWidget(self.intComboBox) paramLayout.addWidget(QLabel("Filter:")) self.filterEdit = QLineEdit() paramLayout.addWidget(self.filterEdit) dataLayout = QVBoxLayout() self.labelHelp = QLabel( "Network interface to dump:\nIf the interface name does not exist in the list\nplease to edit the combox list to change it." ) self.listBox = QTreeWidget(self) self.listBox.setIndentation(0) self.labels = [self.tr("Interface"), self.tr("Filter")] self.listBox.setHeaderLabels(self.labels) dataLayout.addWidget(self.labelHelp) dataLayout.addLayout(paramLayout) dataLayout.addWidget(self.listBox) buttonLayout = QVBoxLayout() self.addButton = QPushButton("Add", self) self.delButton = QPushButton("Remove", self) self.delButton.setEnabled(False) self.editButton = QPushButton("Edit", self) self.editButton.setEnabled(False) self.clearButton = QPushButton("Clear", self) self.okButton = QPushButton("Ok", self) self.cancelButton = QPushButton("Cancel", self) buttonLayout.addWidget(self.addButton) buttonLayout.addWidget(self.delButton) buttonLayout.addWidget(self.editButton) buttonLayout.addWidget(self.clearButton) buttonLayout.addWidget(self.okButton) buttonLayout.addWidget(self.cancelButton) mainLayout.addLayout(dataLayout) mainLayout.addLayout(buttonLayout) self.setLayout(mainLayout) self.setWindowTitle("Network Probe > Arguments")
def createTopLayout(self): top_layout = QHBoxLayout() image_label = QLabel() image = util.resourceImage("splash.jpg") image_label.setPixmap(image.scaled(200, 240, Qt.KeepAspectRatio)) top_layout.addWidget(image_label) top_layout.addLayout(self.createInfoLayout(), 1) return top_layout
def createTopLayout(self): top_layout = QHBoxLayout() image_label = QLabel() image = resourceImage("splash.png") image_label.setPixmap(image.scaled(200, 240, Qt.KeepAspectRatio)) top_layout.addWidget(image_label) top_layout.addLayout(self.createInfoLayout(), 1) return top_layout
def setupUi(self) : "Setup the UI." self.info('Seting up the UI.') self.fileDialog = QFileDialog() self.fileDialog.setFileMode(QFileDialog.AnyFile) self.fileDialog.setViewMode(QFileDialog.Detail) self.loadButton = QPushButton( r'Open/New :', self) self.loadButton.setAutoDefault(False) self.textList = QListWidget(self) self.inputLine = tabEnabledLineEdit(self) self.toggleButton = QPushButton(r'Show/Hide', self) self.toggleButton.setAutoDefault(False) self.toggleButton.setCheckable(True) self.textLabel = QLabel() self.hBox = QHBoxLayout() self.hBox.addWidget(self.inputLine) self.hBox.addWidget(self.toggleButton) self.statusBar = QStatusBar(self) msg = 'Hello World! I love YOU!!!' self.statusBar.showMessage(msg, 5000) vBox = QVBoxLayout() items = [self.loadButton, self.textList, self.hBox, self.statusBar] for item in items : try : vBox.addWidget(item) except : vBox.addLayout(item) self.textViewer = QTextEdit() self.textViewer.setHidden(True) self.textViewer.setReadOnly(True) HBox = QHBoxLayout() items = [vBox, self.textViewer] for item in items : try : HBox.addWidget(item) except : HBox.addLayout(item) self.setLayout(HBox) self.resize(350, 500) self.setWindowTitle("VocVoc -- Your Vocabulary Helper") self.info('UI is set up now.')
def h_centered(layout, item): l_spacer = QSpacerItem(0, 0) r_spacer = QSpacerItem(0, 0) proxy = QHBoxLayout() proxy.setSpacing(0) proxy.setMargin(0) proxy.addItem(l_spacer) if isinstance(item, QLayout): proxy.addLayout(item) else: proxy.addWidget(item) proxy.addItem(r_spacer) layout.addLayout(proxy)
class AboutBox(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.MSWindowsFixedSizeDialogHint QDialog.__init__(self, parent, flags) self.app = app self._setupUi() self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) def _setupUi(self): self.setWindowTitle( tr("About {}").format( QCoreApplication.instance().applicationName())) self.resize(400, 190) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) self.horizontalLayout = QHBoxLayout(self) self.logoLabel = QLabel(self) self.logoLabel.setPixmap(QPixmap(':/%s_big' % self.app.LOGO_NAME)) self.horizontalLayout.addWidget(self.logoLabel) self.verticalLayout = QVBoxLayout() self.nameLabel = QLabel(self) font = QFont() font.setWeight(75) font.setBold(True) self.nameLabel.setFont(font) self.nameLabel.setText(QCoreApplication.instance().applicationName()) self.verticalLayout.addWidget(self.nameLabel) self.versionLabel = QLabel(self) self.versionLabel.setText( tr("Version {}").format( QCoreApplication.instance().applicationVersion())) self.verticalLayout.addWidget(self.versionLabel) self.label_3 = QLabel(self) self.verticalLayout.addWidget(self.label_3) self.label_3.setText(tr("Copyright Hardcoded Software 2014")) self.label = QLabel(self) font = QFont() font.setWeight(75) font.setBold(True) self.label.setFont(font) self.verticalLayout.addWidget(self.label) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.horizontalLayout.addLayout(self.verticalLayout)
def __init__(self, image, imageWidth, connectClickedSlot, nick='', parent=None): QWidget.__init__(self, parent) self.connectClickedSlot = connectClickedSlot # Image self.image = QLabel(self) self.image.setPixmap( QPixmap(qtUtils.getAbsoluteImagePath(image)).scaledToWidth( imageWidth, Qt.SmoothTransformation)) # Nick field self.nickLabel = QLabel("Nickname:", self) self.nickEdit = QLineEdit(nick, self) self.nickEdit.setMaxLength(constants.NICK_MAX_LEN) self.nickEdit.returnPressed.connect(self.__connectClicked) self.nickEdit.setFocus() # Connect button self.connectButton = QPushButton("Connect", self) self.connectButton.resize(self.connectButton.sizeHint()) self.connectButton.setAutoDefault(False) self.connectButton.clicked.connect(self.__connectClicked) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.nickLabel) hbox.addWidget(self.nickEdit) hbox.addStretch(1) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addLayout(hbox) vbox.addWidget(self.connectButton) vbox.addStretch(1) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.image) hbox.addSpacing(10) hbox.addLayout(vbox) hbox.addStretch(1) self.setLayout(hbox)
def initControls(self): self.plot3 = Qwt.QwtPlot(self) self.plot3.setCanvasBackground(Qt.white) self.plot3.enableAxis(Qwt.QwtPlot.yLeft, False) self.plot3.enableAxis(Qwt.QwtPlot.xBottom, False) self.plot1 = Qwt.QwtPlot(self) self.plot1.setCanvasBackground(Qt.white) self.plot2 = Qwt.QwtPlot(self) self.plot2.setCanvasBackground(Qt.white) library_label = QLabel("MS in mass spectra Library:") self.library_list = QTreeWidget() self.library_list.setColumnCount(3) self.library_list.setHeaderLabels( ['No.', 'Similarity', 'Mol Wt', 'Formula', 'Name']) self.library_list.setSortingEnabled(False) self.connect(self.library_list, SIGNAL("itemSelectionChanged()"), self.libraryListClicked) self.connect(self.library_list, SIGNAL("itemActivated (QTreeWidgetItem *,int)"), self.libraryListDoubleClicked) mxiture_label = QLabel("Molecular structure :") # self.mixture_list = QListWidget() okButton = QPushButton("&Search") self.connect(okButton, SIGNAL("clicked()"), self.Seach) left_vbox = QVBoxLayout() left_vbox.addWidget(self.plot1) left_vbox.addWidget(self.plot2) right_vbox = QVBoxLayout() right_vbox.addWidget(library_label) right_vbox.addWidget(self.library_list) hboxPercent = QHBoxLayout() # hboxPercent.addWidget(percent_label) # hboxPercent.addWidget(self.edit_percent) right_vbox.addLayout(hboxPercent) # right_vbox.addWidget(self.add_button) right_vbox.addWidget(mxiture_label) right_vbox.addWidget(self.plot3) right_vbox.addWidget(okButton) hbox = QHBoxLayout() hbox.addLayout(left_vbox, 2.5) hbox.addLayout(right_vbox, 1.5) self.setLayout(hbox)
def __init__(self): super(TestWindow, self).__init__() self.setWindowTitle("LivePlot Example Runner") layout = QHBoxLayout(self) button_layout = QVBoxLayout() time_layout = QHBoxLayout() time_spin = QSpinBox() self.timer = QTimer() time_spin.valueChanged.connect(self.timer.setInterval) self.timer.timeout.connect(self.iterate) self.progress_bar = QProgressBar() time_spin.setValue(50) time_spin.setRange(0, 1000) time_layout.addWidget(QLabel("Sleep Time (ms)")) time_layout.addWidget(time_spin) button_layout.addLayout(time_layout) tests = { 'plot y': test_plot_y, 'plot xy': test_plot_xy, 'plot parametric': test_plot_xy_parametric, 'plot z': test_plot_z, 'plot huge': test_plot_huge, 'append y': test_append_y, 'append xy': test_append_xy, 'append z': test_append_z, } fn_text_widget = QPlainTextEdit() fn_text_widget.setMinimumWidth(500) def make_set_iterator(iter): def set_iterator(): fn_text_widget.setPlainText(inspect.getsource(iter)) QApplication.instance().processEvents() self.iterator = iter() self.timer.start() return set_iterator for name, iter in tests.items(): button = QPushButton(name) button.clicked.connect(make_set_iterator(iter)) button_layout.addWidget(button) layout.addLayout(button_layout) text_layout = QVBoxLayout() text_layout.addWidget(fn_text_widget) text_layout.addWidget(self.progress_bar) layout.addLayout(text_layout)
def __build_header(self, column_id): self.set_column_id(column_id) username = get_username_from(self.account_id) column_slug = get_column_slug_from(column_id) column_slug = column_slug.replace('%23', '#') column_slug = column_slug.replace('%40', '@') #font = QFont('Titillium Web', 18, QFont.Normal, False) # This is to handle the 96dpi vs 72dpi screen resolutions on Mac vs the world if detect_os() == OS_MAC: font = QFont('Maven Pro Light', 25, 0, False) font2 = QFont('Monda', 14, 0, False) else: font = QFont('Maven Pro Light', 16, QFont.Light, False) font2 = QFont('Monda', 10, QFont.Light, False) bg_style = "background-color: %s; color: %s;" % (self.base.bgcolor, self.base.fgcolor) label = "%s : %s" % (username, column_slug) caption = QLabel(username) caption.setStyleSheet("QLabel { %s }" % bg_style) caption.setFont(font) caption2 = QLabel(column_slug) caption2.setStyleSheet("QLabel { %s }" % bg_style) caption2.setFont(font2) caption2.setAlignment(Qt.AlignLeft | Qt.AlignBottom) caption_box = QHBoxLayout() caption_box.setSpacing(8) caption_box.addWidget(caption) caption_box.addWidget(caption2) caption_box.addStretch(1) close_button = ImageButton(self.base, 'action-delete-shadowed.png', i18n.get('delete_column')) close_button.clicked.connect(self.__delete_column) close_button.setStyleSheet("QToolButton { %s border: 0px solid %s;}" % (bg_style, self.base.bgcolor)) header_layout = QHBoxLayout() header_layout.addLayout(caption_box, 1) header_layout.addWidget(close_button) header = QWidget() header.setStyleSheet("QWidget { %s }" % bg_style) header.setLayout(header_layout) return header
def __init__(self, old_pw, parent=None): super().__init__(parent) self._canceled = False self._pw = old_pw layout = QVBoxLayout() labelBox = QVBoxLayout() labelBox.addWidget(QLabel(_('ChangePasswd.current'))) labelBox.addWidget(QLabel(_('ChangePasswd.new'))) labelBox.addWidget(QLabel(_('ChangePasswd.confirm'))) fieldBox = QVBoxLayout() self._cur_box = QLineEdit() self._cur_box.setEchoMode(QLineEdit.Password) fieldBox.addWidget(self._cur_box) self._new_box = QLineEdit() self._new_box.setEchoMode(QLineEdit.Password) fieldBox.addWidget(self._new_box) self._confirm_box = QLineEdit() self._confirm_box.setEchoMode(QLineEdit.Password) fieldBox.addWidget(self._confirm_box) buttonBox = QHBoxLayout() buttonBox.addStretch(1) cancelButton = QPushButton(_('cancel')) cancelButton.clicked.connect(self.reject) buttonBox.addWidget(cancelButton) okButton = QPushButton(_('OK')) okButton.setDefault(True) okButton.clicked.connect(self.accept) buttonBox.addWidget(okButton) labelFieldBox = QHBoxLayout() labelFieldBox.addLayout(labelBox) labelFieldBox.addLayout(fieldBox) layout.addLayout(labelFieldBox) layout.addLayout(buttonBox) self.rejected.connect(self._cancel) self.setLayout(layout) self.setWindowTitle(_('ChangePasswd.title'))
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletRotaryEncoderV2, *args) self.re = self.device self.cbe_count = CallbackEmulator( functools.partial(self.re.get_count, False), self.cb_count, self.increase_error_count) self.qtcb_pressed.connect(self.cb_pressed) self.re.register_callback(self.re.CALLBACK_PRESSED, self.qtcb_pressed.emit) self.qtcb_released.connect(self.cb_released) self.re.register_callback(self.re.CALLBACK_RELEASED, self.qtcb_released.emit) self.reset_button = QPushButton('Reset Count') self.reset_button.clicked.connect(self.reset_clicked) self.encoder_knob = KnobWidget(self) self.encoder_knob.setFocusPolicy(Qt.NoFocus) self.encoder_knob.set_total_angle(360) self.encoder_knob.set_range(0, 24) self.encoder_knob.set_scale(2, 2) self.encoder_knob.set_scale_text_visible(False) self.encoder_knob.set_scale_arc_visible(False) self.encoder_knob.set_knob_radius(25) self.encoder_knob.set_value(0) self.current_count = None plots = [('Count', Qt.red, lambda: self.current_count, str)] self.plot_widget = PlotWidget('Count', plots, curve_motion_granularity=40, update_interval=0.025) vlayout = QVBoxLayout() vlayout.addStretch() vlayout.addWidget(self.encoder_knob) vlayout.addWidget(self.reset_button) vlayout.addStretch() layout = QHBoxLayout(self) layout.addWidget(self.plot_widget) layout.addLayout(vlayout)