def init_ui(self): self.setWindowTitle("IG Suite") self.login_button = QPushButton("Login") self.login_button.clicked.connect(self.open_login_dialog) self.open_button = QPushButton("Open Image") self.open_button.clicked.connect(self.open_filename_dialog) self.caption_label = QLabel("Caption") self.caption_box = QPlainTextEdit() self.caption_box.setPlaceholderText("#ootd #photooftheday #travel") self.upload_button = QPushButton("Upload") self.upload_button.clicked.connect(self.upload) self.scheduled_ul_button = QPushButton("Scheduled Upload") self.scheduled_ul_button.clicked.connect(self.set_schedule) self.clear_button = QPushButton("Unfollow non-followers") self.clear_button.clicked.connect(self.unfollow_unfollowers) self.img_view = QLabel(self) hbox = QHBoxLayout() hbox.addWidget(self.login_button) hbox.addWidget(self.open_button) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self.caption_label) vbox.addWidget(self.caption_box) hbox = QHBoxLayout() hbox.addWidget(self.upload_button) hbox.addWidget(self.scheduled_ul_button) vbox.addLayout(hbox) vbox.addWidget(self.clear_button) hbox = QHBoxLayout() hbox.addLayout(vbox) hbox.addWidget(self.img_view) self.setLayout(hbox) self.show()
def slot_edit_palette_data(self): '''A function for giving a gui to edit palette metadata... I also want this to be the way to edit the settings of the palette docker. ''' dialog = QDialog(self) tabWidget = QTabWidget() dialog.setWindowTitle(i18n("Edit Palette Data")) dialog.setLayout(QVBoxLayout()) dialog.layout().addWidget(tabWidget) paletteWidget = QWidget() paletteWidget.setLayout(QVBoxLayout()) tabWidget.addTab(paletteWidget, i18n("Palette Data")) paletteName = QLineEdit() paletteName.setText(self.cmb_palettes.currentText()) paletteWidget.layout().addWidget(paletteName) paletteColumns = QSpinBox() paletteColumns.setValue(self.currentPalette.columnCount()) paletteWidget.layout().addWidget(paletteColumns) paletteComment = QPlainTextEdit() paletteComment.appendPlainText(self.currentPalette.comment()) paletteWidget.layout().addWidget(paletteComment) buttons = QDialogButtonBox(QDialogButtonBox.Ok) dialog.layout().addWidget(buttons) buttons.accepted.connect(dialog.accept) # buttons.rejected.connect(dialog.reject()) if dialog.exec_() == QDialog.Accepted: Resource = Application.resources("palette")[ self.cmb_palettes.currentText()] Resource.setName(paletteName.text()) self.currentPalette = Palette(Resource) self.currentPalette.setColumnCount(paletteColumns.value()) self.paletteView.setPalette(self.currentPalette) self.slot_fill_combobox() self.currentPalette.setComment(paletteComment.toPlainText()) self.currentPalette.save()
def __init__(self): QMainWindow.__init__(self) self.setMinimumSize(QSize(640, 480)) self.setWindowTitle("Hello world") centralWidget = QWidget(self) self.setCentralWidget(centralWidget) gridLayout = QGridLayout() centralWidget.setLayout(gridLayout) title = QLabel("Hello World from PyQt", self) title.setAlignment(QtCore.Qt.AlignCenter) gridLayout.addWidget(title, 0, 0, 1, 10) logging_text_edit = QPlainTextEdit() gridLayout.addWidget(logging_text_edit, 2, 0, 1, 10) mapper = QSignalMapper(self) mapper.mapped[int].connect(self.log_button_pressed) for x in range(10): button = QPushButton(self) button.setText("Print %d" % (x,)) gridLayout.addWidget(button, 3, x, QtCore.Qt.AlignHCenter) button.pressed.connect(mapper.map) mapper.setMapping(button, x) class QLogHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) def emit(self, record): record = self.format(record) logging_text_edit.appendPlainText(record) q_log_handler = QLogHandler() q_log_handler.setLevel(logging.DEBUG) q_log_handler.setFormatter(logging.Formatter('%(asctime)s\n%(name)s\n%(levelname)s:%(message)s\n')) logging.basicConfig(level=logging.DEBUG) logging.getLogger('').addHandler(q_log_handler)
def treeItemWindow_open(self, item): title = item.text(0) subWind = QMdiSubWindow(self) subWind.setAttribute(Qt.WA_DeleteOnClose) subWind.setWindowTitle(title) self.newDocIndex += 1 mainWid = QWidget() l = QtWidgets.QVBoxLayout(mainWid) txtWind = QPlainTextEdit(mainWid) txtWind.setPlainText(f"perfmon.x = {item.x}, \n y = {item.y}") figWind = MyCanvas(mainWid, width=5, height=4, dpi=100, treeWidgetItem=item) l.addWidget(figWind) l.addWidget(txtWind) l.setStretch(0, 3) # 设置第一列的伸展比例为 3 l.setStretch(1, 1) # 设置第二列的伸展比例为 1, 这样2列的伸展比为3:1 subWind.setWidget(mainWid) self.mdiArea.addSubWindow(subWind) subWind.show()
def __init__(self, parent, csv_area): super().__init__(parent) self.parent = parent self.csv_area = csv_area self.dialect = self.default_dialect self.setWindowTitle(self.title) self.parameter_groupbox = CsvParameterGroupBox(self) self.csv_preview = QPlainTextEdit(self) self.csv_preview.setReadOnly(True) layout = QVBoxLayout(self) layout.addWidget(self.parameter_groupbox) layout.addWidget(self.csv_preview) layout.addWidget(self.create_buttonbox()) self.setLayout(layout) self.reset()
def __init__(self): super().__init__() self.resize(300, 100) mainLayout = QVBoxLayout() validator = QRegExpValidator(QRegExp(r'[0-9 ]+')) self.lineEdit = QLineEdit() self.lineEdit.setStyleSheet('font-size: 30px; height: 50px') self.lineEdit.setValidator(validator) self.lineEdit.textChanged.connect(self.onTextChanged) mainLayout.addWidget(self.lineEdit) self.textEditor = QPlainTextEdit() self.textEditor.setStyleSheet('font-size: 30px; color:green') mainLayout.addWidget(self.textEditor) for i in range(1, 21): self.textEditor.appendPlainText('line {0}'.format(i)) self.highlighter = SyntaxHighlighter(self.textEditor.document()) self.setLayout(mainLayout)
def _on_finish_decompiler(self, data): self.app.hide_progress() self._working = False decompile_data = data[0] if self._prefs.get(KEY_WIDESCREEN_MODE, False): if self.disassembly_view.decompilation_view is None: self.disassembly_view.decompilation_view = R2ScrollArea() r2_decompiler_view = self.disassembly_view.decompilation_view self.disassembly_view.addWidget( self.disassembly_view.decompilation_view) else: r2_decompiler_view = QPlainTextEdit() r2_decompiler_view.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) r2_decompiler_view.setHorizontalScrollBarPolicy( Qt.ScrollBarAsNeeded) self.app.main_tabs.addTab(r2_decompiler_view, 'decompiler') index = self.app.main_tabs.indexOf(r2_decompiler_view) self.app.main_tabs.setCurrentIndex(index) if decompile_data is not None: r2_decompiler_view.setText('<pre>' + decompile_data + '</pre>')
def __init__(self): super().__init__() config = mindsapi.MindsAPI.get_config() self.api = mindsapi.MindsAPI( config['minds']['user'], config['minds']['password']) self.api.login() self.title = 'Post to Minds' self.setWindowTitle(self.title) self.textbox = QPlainTextEdit(self) self.shortcut = QShortcut(QKeySequence("Ctrl+Return"), self) self.shortcut.activated.connect(self.on_click) grid = QGridLayout() grid.setSpacing(0) grid.addWidget(self.textbox) self.setLayout(grid) self.setGeometry(100, 100, 300, 200) self.show()
def __init__(self, parent, title, description, exception): QDialog.__init__(self, parent) self.setWindowTitle(title) self.setMinimumSize(500, 280) self.setMaximumSize(1000, 400) vbox = QVBoxLayout(self) text_label = QLabel(description) text_label.setWordWrap(True) vbox.addWidget(text_label) text_label = QLabel(_( "The server returned the following message, which may or may not help describe " "the problem. A malicious server may return misleading messages, so act on it " "at your own risk. In particular, do not download software from any links " "provided; the official ElectrumSV website is only https://electrumsv.io/." )) text_label.setWordWrap(True) vbox.addWidget(text_label) text_edit = QPlainTextEdit(str(exception)) text_edit.setReadOnly(True) vbox.addWidget(text_edit) vbox.addStretch(1) vbox.addLayout(Buttons(CloseButton(self))) self.setLayout(vbox)
def _get_bottom_bar(self): """Make a bar at the bottom with information in it.""" hbox = QHBoxLayout() hbox.addStretch(7) self._toggle_show_max_button = QPushButton('Show Maxima') self._toggle_show_max_button.released.connect(self._toggle_show_max) hbox.addWidget(self._toggle_show_max_button) self._intensity_label = QLabel('') # update later hbox.addWidget(self._intensity_label) RAS_label = QLabel('RAS =') self._RAS_textbox = QPlainTextEdit('') # update later self._RAS_textbox.setMaximumHeight(25) self._RAS_textbox.setMaximumWidth(200) self._RAS_textbox.focusOutEvent = self._update_RAS self._RAS_textbox.textChanged.connect(self._check_update_RAS) hbox.addWidget(RAS_label) hbox.addWidget(self._RAS_textbox) self._update_moved() # update text now return hbox
def __init__(self, parent=None): super().__init__(parent) self.setObjectName("ConsoleDock") self.setWindowTitle(self.tr("Debug Console")) widget = QWidget(self) layout = QVBoxLayout(widget) layout.setContentsMargins(5, 5, 5, 5) self.plainTextEdit = QPlainTextEdit() self.plainTextEdit.setReadOnly(True) self.plainTextEdit.setStyleSheet( QString("QAbstractScrollArea {" " background-color: black;" " color:green;" "}")) layout.addWidget(self.plainTextEdit) for output in PluginManager.objects(LoggingInterface): self.registerOutput(output) PluginManager.instance().objectAdded.connect(self.onObjectAdded) self.setWidget(widget)
def __init__(self, parent, backend, invoiceLabel): super().__init__(parent, backend) self.backend = backend self.showLabel = 'label' not in self.backend.getMissingFields( self.backend.Invoice) self.bolt11 = None self.setWindowTitle('Create a new invoice') self.setErrorMessage('Failed to create a new invoice') if self.showLabel: self.labelText = QLineEdit(invoiceLabel, self) self.addRow('Label:', self.labelText) self.descriptionText = QPlainTextEdit(self) self.amountText = AmountInput(self, self.backend.getNativeCurrency()) self.expiryText = DurationInput(self) self.addRow('Description:', self.descriptionText) self.addRow('Amount:', self.amountText) self.addRow('Expires:', self.expiryText)
def selectTaskAction(self, i): currentTask = self.tasks[i] for index in reversed(range(self.taskLayout.count())): self.taskLayout.itemAt(index).widget().setParent(None) self.taskLayout.addWidget(QLabel(currentTask["name"])) self.taskLayout.addWidget(QLabel(currentTask["description"])) self.taskLayout.addWidget(QLabel(currentTask["full"])) self.taskLayout.addWidget(QLabel("Enter solution:")) answer = QPlainTextEdit(self) answer.insertPlainText(self.answers[i]['text']) answer.setEnabled(self.answers[i]['enabled']) answer.textChanged.connect( lambda: self.writeAnswerAction(i, answer.toPlainText())) self.taskLayout.addWidget(answer) button = QPushButton("Submit") button.setEnabled(self.answers[i]['enabled']) button.clicked.connect( lambda: self.submitTaskAction(i, answer, button)) self.taskLayout.addWidget(button)
def make_result_label(self, line): widget_item = self.grid.itemAtPosition(line, self.result_col) if widget_item: l = widget_item.widget() else: l = QPlainTextEdit(self.win) l.setFixedSize(self.long_line, self.line_heigth * self.mult_line_height) l.setStyleSheet("background-color: lightyellow") result = self.aget('result', line) exchange = self.aget('exchange', line) if result: txt = str(result) elif exchange: txt = str(exchange) else: txt = "" txt = txt.replace(",", ",\n") l.setPlainText("{}".format(txt)) return l
def __init__(self): super(LicenseDialog, self).__init__() self.resize(650, 450) license_text = QPlainTextEdit() license_text.setReadOnly(True) fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont) license_text.setFont(fixed_font) license_text.insertPlainText(gplv3.get_txt()) license_text.moveCursor(QTextCursor.Start) license_text.ensureCursorVisible() button_box = QDialogButtonBox(QDialogButtonBox.Ok) button_box.accepted.connect(self.accept) layout = QVBoxLayout() layout.setContentsMargins(10, 10, 10, 10) layout.addWidget(license_text) layout.addWidget(button_box) self.setLayout(layout) self.setWindowTitle("License")
def inicializarGui(self): self.setWindowTitle('Editor Básico de Texto') self.setFixedSize(400, 300) barra_herramientas = self.addToolBar('Archivo') mni_nuevo_archivo = QAction(QIcon('parte17/new.png'), 'Nuevo', self) mni_nuevo_archivo.triggered.connect(self.crear_archivo) barra_herramientas.addAction(mni_nuevo_archivo) mni_abrir_archivo = QAction(QIcon('parte17/open.png'), 'Abrir', self) mni_abrir_archivo.triggered.connect(self.abrir_archivo) barra_herramientas.addAction(mni_abrir_archivo) mni_guardar_archivo = QAction(QIcon('parte17/save.png'), 'Guardar', self) mni_guardar_archivo.triggered.connect(self.guardar_archivo) barra_herramientas.addAction(mni_guardar_archivo) self.contenido = QPlainTextEdit(self) self.contenido.move(10, 50) self.contenido.setFixedWidth(380) self.contenido.setFixedHeight(240)
def initUI(self): self.setWindowTitle('Помощь') self.check = [] self.combo1 = QComboBox(self) self.combo1.addItems(list(map(lambda x: x.place, connect.places))) self.combo1.activated[str].connect(self.onActivated1) self.combo2 = QComboBox(self) self.combo2.addItems(list(map(lambda x: x.ddd, connect.times))) self.combo2.activated[str].connect(self.onActivated2) self.combo3 = QComboBox(self) need = [] for el in connect.all: if el[2] != Seat([0, 0]): cin = 'Фильм: {}, время: {}'.format(el[-1].glance, el[-2].hhh) need.append(cin) self.combo3.addItems(need) self.combo3.activated[str].connect(self.onActivated3) grid = QGridLayout() grid.addWidget(self.createExampleGroup(), 0, 0) self.text = QPlainTextEdit(self) vbox1 = QVBoxLayout() vbox1.addWidget(self.combo1) vbox1.addWidget(self.combo2) vbox1.addWidget(self.combo3) vbox1.addWidget(self.text) vbox1.addStretch(1) groupBox1 = QGroupBox(" ") groupBox1.setLayout(vbox1) grid.addWidget(groupBox1, 0, 1) self.setLayout(grid)
def OnCreate(self, form): self.parent = self.FormToPyQtWidget(form) self.label1 = QLabel("Folder Path : ") self.path = QLineEdit() self.PathButton = QPushButton("path") self.PathButton.clicked.connect(self.choose_path) self.label2 = QLabel("Yara rule") self.TextEdit1 = QPlainTextEdit() self.TextEdit1.setStyleSheet("""QPlainTextEdit{ font-family:'Consolas';}""") self.highlighter = YaraHighlighter(self.TextEdit1.document()) self.TextEdit1.insertPlainText(self.data) self.SearchButton = QPushButton("Search") self.SearchButton.clicked.connect(self.Search) self.label3 = QLabel("Detect Count : ") self.label4 = QLabel("0") self.layout = QVBoxLayout() GL1 = QGridLayout() GL1.addWidget(self.label1, 0, 0) GL1.addWidget(self.path, 0, 1) GL1.addWidget(self.PathButton, 0, 2) GL1.addWidget(self.label3, 0, 3) GL1.addWidget(self.label4, 0, 4) self.layout.addLayout(GL1) self.layout.addWidget(self.label2) self.layout.addWidget(self.TextEdit1) self.layout.addWidget(self.SearchButton) self.tableWidget = QTableWidget() self.tableWidget.setRowCount(0) self.tableWidget.setColumnCount(5) self.tableWidget.setHorizontalHeaderLabels( ["Path", "Filename", "Address", "Variable_name", "String"]) self.layout.addWidget(self.tableWidget) self.parent.setLayout(self.layout)
def _setupUi(self): self.setWindowTitle(tr("Error Report")) self.resize(553, 349) self.verticalLayout = QVBoxLayout(self) self.label = QLabel(self) self.label.setText( tr("Something went wrong. How about reporting the error?")) self.label.setWordWrap(True) self.verticalLayout.addWidget(self.label) self.errorTextEdit = QPlainTextEdit(self) self.errorTextEdit.setReadOnly(True) self.verticalLayout.addWidget(self.errorTextEdit) msg = tr( "Error reports should be reported as Github issues. You can copy the error traceback " "above and paste it in a new issue.\n\nPlease make sure to run a search for any already " "existing issues beforehand. Also make sure to test the very latest version available from the repository, " "since the bug you are experiencing might have already been patched.\n\n" "What usually really helps is if you add a description of how you got the error. Thanks!" "\n\n" "Although the application should continue to run after this error, it may be in an " "unstable state, so it is recommended that you restart the application." ) self.label2 = QLabel(msg) self.label2.setWordWrap(True) self.verticalLayout.addWidget(self.label2) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.addItem(horizontal_spacer()) self.dontSendButton = QPushButton(self) self.dontSendButton.setText(tr("Close")) self.dontSendButton.setMinimumSize(QSize(110, 0)) self.horizontalLayout.addWidget(self.dontSendButton) self.sendButton = QPushButton(self) self.sendButton.setText(tr("Go to Github")) self.sendButton.setMinimumSize(QSize(110, 0)) self.sendButton.setDefault(True) self.horizontalLayout.addWidget(self.sendButton) self.verticalLayout.addLayout(self.horizontalLayout)
def initUI(self): self.setGeometry(400, 400, 400, 400) self.setWindowTitle('Мини калькулятор') self.gamb = QCheckBox('Гамбургер', self) self.gamb.move(100, 150) self.gamb.toggle() self.gamb.stateChanged.connect(self.gambu) self.chis = QCheckBox('Чизбургер', self) self.chis.move(100, 180) self.chis.toggle() self.chis.stateChanged.connect(self.chisb) self.mini = QCheckBox('Мини картошка фрии', self) self.mini.move(200, 150) self.mini.toggle() self.mini.stateChanged.connect(self.mifr) self.big = QCheckBox('Большая картошка фри', self) self.big.move(200, 180) self.big.toggle() self.big.stateChanged.connect(self.bifr) self.cola = QCheckBox('Кола', self) self.cola.move(300, 150) self.cola.toggle() self.cola.stateChanged.connect(self.col) self.fanta = QCheckBox('Фанта', self) self.fanta.move(300, 180) self.fanta.toggle() self.fanta.stateChanged.connect(self.fan) self.eat = QPlainTextEdit(self) self.eat.move(200, 250) self.eat.setPlainText('Заказ') self.btn = QPushButton('Заказать', self) self.btn.resize(self.btn.sizeHint()) self.btn.move(150, 50) self.btn.clicked.connect(self.ras)
def init_UI(self): grid = QGridLayout() # Title for widget title = QLabel("2, 단어를 입력세요.") grid.addWidget(title, 0, 0) # Text box to input words self.input_words = QPlainTextEdit() # self.input_words.resize() self.input_words.setPlaceholderText("단어들을 입력한 후 *검색 키워드 설정* 버튼을 누르세요.\nex) 토끼, 거북이, 사자 or banana, peach, grape \n각 버튼의 단축키는 마우스를 버튼 위로 올려두면 표시됩니다.") grid.addWidget(self.input_words, 1, 0, 4, 1) # line edit box to set the suffix words self.line_suffix = QLineEdit() self.line_suffix.setPlaceholderText('예시: png') self.line_suffix.resize(self.line_suffix.sizeHint()) # add line edit widget to layout grid.addWidget(self.line_suffix, 3, 1) # make button self.set_keyword_bt = QPushButton('검색 키워드 설정') self.set_keyword_bt.setToolTip('단축키 : Ctrl + G') self.set_keyword_bt.setShortcut("Ctrl+G") # settings for Set Keyword Button self.set_keyword_bt.clicked.connect(self.set_keyword) self.c.press_set_keyword_bt.connect(self.set_keyword) self.c.disable_set_keyword_bt.connect(self.disable_set_keyword_bt) self.c.enable_set_keyword_bt.connect(self.enable_set_keyword_bt) # add button widget to layout grid.addWidget(self.set_keyword_bt, 4, 1) # adjust the size of the column layout grid.setColumnStretch(0, 13) grid.setColumnStretch(1, 2) self.setLayout(grid) self.show()
def _initWidgets(self): # create the button open Polygon self.btnOpenPolygon = QPushButton('Load\nPolygons', self, icon=self.style().standardIcon( QStyle.SP_DialogOpenButton)) self.btnOpenPolygon.setToolTip('<b>Open</b> a .i2s or .shp file') self.btnOpenPolygon.setFixedSize(105, 50) self.btnOpenPolygon.setEnabled(False) # create some text fields displaying the IO files info self.polygonNameBox = QPlainTextEdit() self.polygonNameBox.setReadOnly(True) self.polygonNameBox.setFixedHeight(50) self.csvNameBox = QLineEdit() self.csvNameBox.setReadOnly(True) self.csvNameBox.setFixedHeight(30) # create combo box widgets for choosing variables self.firstVarBox = QComboBox() self.firstVarBox.setFixedSize(400, 30) self.secondVarBox = QComboBox() self.secondVarBox.setFixedSize(400, 30) # create the boxes for volume calculation options self.supVolumeBox = QCheckBox( 'Compute positive and negative volumes (slow)', self) self.timeSampling = QLineEdit('1') self.timeSampling.setFixedWidth(50) # create the submit button self.btnSubmit = QPushButton('Submit\n(to .csv)', self, icon=self.style().standardIcon( QStyle.SP_DialogSaveButton)) self.btnSubmit.setFixedSize(105, 50) self.btnSubmit.setEnabled(False)
def init_ui(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) # Create textboxGivens self.textboxExpr = QLineEdit(self) self.textboxExpr.move(20, 20) self.textboxExpr.resize(300, 30) font = self.textboxExpr.font() font.setPointSize(10) self.textboxExpr.setFont(font) # Create textboxConclusion self.textboxConc = QLineEdit(self) self.textboxConc.move(330, 20) self.textboxConc.resize(50, 30) font = self.textboxConc.font() font.setPointSize(10) self.textboxConc.setFont(font) self.verboseText = QPlainTextEdit(self) self.verboseText.setReadOnly(True) self.verboseText.move(20, 60) self.verboseText.resize(550, 500) font = self.verboseText.font() font.setPointSize(12) self.verboseText.setFont(font) # Create a button in the window self.button = QPushButton('Resolute', self) self.button.move(400, 20) # connect button to function on_click self.button.clicked.connect(self.on_click) self.show()
def show_working_window_objective(self, task, reactions_list): self.signal.emit({"event": EVENT_SET_OBJECTIVE, "result": None}) self.win = QWidget(self.window) self.win.setGeometry(0, 20, WIDTH, HEIGHT-20) vbox = QVBoxLayout() text = self.get_text_task(task) text.setWordWrap(True) vbox.addWidget(text) vbox.addWidget(QLabel("<br>")) self.text2 = QLabel("<strong>Step 1: </strong> Select objective function:") self.text2.setWordWrap(True) vbox.addWidget(self.text2) self.cb = QComboBox() self.cb.addItems(["Default"] + reactions_list) self.cb.currentIndexChanged.connect(self.selectionchange) vbox.addWidget(self.cb) self.text3 = QLabel("<strong>Step 2: </strong>Select FVA fraction (default: 1.0):") self.text3.setWordWrap(True) vbox.addWidget(self.text3) self.set_fraction.show() vbox.addWidget(self.set_fraction) vbox.addStretch() self.log = QPlainTextEdit() self.log.resize(WIDTH * 0.9, HEIGHT * 0.8) self.log.setPlainText("") self.log.hide() vbox.addWidget(self.log) vbox.addWidget(self.start_working) vbox.addWidget(self.cancel_working) self.show_start_button() self.win.setLayout(vbox) self.win.show()
def initUI(self): ''' Configuration of widgets ''' self.gLayoutBrowser.addWidget(self.browser) self.loadingAnimation = QMovie('loading.gif') self.loadingAnimation.setScaledSize(QtCore.QSize(24, 24)) self.labelLoading.setMovie(self.loadingAnimation) self.labelLoading.setVisible(False) self.fileModel = QFileSystemModel() self.fileModel.setRootPath(QtCore.QDir.currentPath()) self.fileView.setModel(self.fileModel) self.fileModel.setNameFilters(('.html', '.txt')) self.fileView.setColumnWidth(0, 170) self.fileView.setColumnWidth(1, 50) self.fileView.setColumnWidth(2, 50) self.splitterMain.setStretchFactor(1, 3) self.splitterSidebar.setStretchFactor(0, 1) self.urlBar.setPlaceholderText('Tapez ici votre URL') self.loadPage(online=True) self.pixmap_ssl = QPixmap(os.path.join('static/button', 'lock-ssl.png')) self.pixmap_nossl = QPixmap( os.path.join('static/button', 'lock-nossl.png')) print(f'w: {self.pixmap_ssl.width()} | h: {self.pixmap_ssl.height()}') self.httpsicon.setPixmap(self.pixmap_nossl) self.setGeometry(300, 300, 1280, 720) self.updateTitle() # self.codeEdit = TxtInput([QPushButton('Hello'), QPushButton('World')]) # self.editor = CustomTextEditor(txtInput=self.codeEdit) self.codeEdit = QPlainTextEdit() self.splitterSidebar.addWidget(self.codeEdit) self.show()
def initUI(self): self.setGeometry(300, 300, 300, 220) self.setFixedSize(800, 500) self.setWindowTitle("CryptoDiary") new = QPushButton("New", self) new.setFont(QFont("SansSerif", 10)) new.clicked.connect(self.new) new.resize(new.sizeHint()) new.move(528, 10) del new save = QPushButton("Save", self) save.setFont(QFont("SansSerif", 10)) save.clicked.connect(self.save) save.resize(save.sizeHint()) save.move(700, 10) del save load = QPushButton("Load", self) load.setFont(QFont("SansSerif", 10)) load.clicked.connect(self.load) load.resize(load.sizeHint()) load.move(614, 10) del load self.filename = QLineEdit(self) self.filename.setGeometry(10, 10, 515, 28) self.text = QPlainTextEdit(self) self.text.resize(QSize(780, 445)) self.text.move(10, 45) self.show()
def drawWindow(self): VLayout = QVBoxLayout() titleLblStyleSheet = 'QLabel {font-weight: bold;}' rowLayout = QHBoxLayout() titleLbl = QLabel('Description:') titleLbl.setMinimumWidth(200) titleLbl.setStyleSheet(titleLblStyleSheet) rowLayout.addWidget(titleLbl) # titleLbl = QLabel('Snapshot:') # titleLbl.setMinimumWidth(200) # titleLbl.setStyleSheet(titleLblStyleSheet) # rowLayout.addWidget(titleLbl) VLayout.addLayout(rowLayout) rowLayout = QHBoxLayout() descBox = QPlainTextEdit(self.description) descBox.setReadOnly(True) rowLayout.addWidget(descBox) # descBox = QPlainTextEdit('') # rowLayout.addWidget(descBox) VLayout.addLayout(rowLayout) btnLayout = QHBoxLayout() btnLayout.setAlignment(Qt.AlignRight) self.importBtn = QPushButton("Import") self.importBtn.setFixedWidth(80) self.importBtn.clicked.connect(self.importClicked) btnLayout.addWidget(self.importBtn) self.cancelBtn = QPushButton("Cancel") self.cancelBtn.setFixedWidth(80) self.cancelBtn.clicked.connect(self.cancelClicked) btnLayout.addWidget(self.cancelBtn) VLayout.addLayout(btnLayout) self.statusLbl = QLabel('') VLayout.addWidget(self.statusLbl) self.setLayout(VLayout)
def _initWidgets(self): # create a text field for mesh intersection info display self.infoBox = QPlainTextEdit() self.infoBox.setFixedHeight(60) self.infoBox.setReadOnly(True) # create two 3-column tables for variables selection self.firstTable = VariableTable() self.secondTable = VariableTable() # create combo box widgets for choosing the operation self.operationBox = QComboBox() self.operationBox.setFixedSize(400, 30) for op in [ 'Project B on A', 'B - A', 'A - B', 'max(A, B)', 'min(A, B)' ]: self.operationBox.addItem(op) # create the widget displaying message logs self.logTextBox = QPlainTextEditLogger(self) self.logTextBox.setFormatter( logging.Formatter(settings.LOGGING_FMT_GUI)) logging.getLogger().addHandler(self.logTextBox) logging.getLogger().setLevel(self.parent.logging_level) # create a check box for output file format (simple or double precision) self.singlePrecisionBox = QCheckBox( 'Convert to SERAFIN \n(single precision)', self) self.singlePrecisionBox.setEnabled(False) # create the submit button self.btnSubmit = QPushButton('Submit', self, icon=self.style().standardIcon( QStyle.SP_DialogSaveButton)) self.btnSubmit.setToolTip('<b>Submit</b> to write a Serafin output') self.btnSubmit.setFixedSize(105, 50)
def __init__(self, parent, title, description, exception: Optional[Exception] = None, untrusted_text: str = "") -> None: QDialog.__init__( self, parent, Qt.WindowSystemMenuHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle(title) self.setMinimumSize(500, 280) self.setMaximumSize(1000, 400) vbox = QVBoxLayout(self) text_label = QLabel(description) text_label.setWordWrap(True) vbox.addWidget(text_label) text_label = QLabel( _("The server returned the following message, which may or may not help describe " "the problem. A malicious server may return misleading messages, so act on it " "at your own risk. In particular, do not download software from any links " "provided; the official ElectrumSV website is only https://electrumsv.io/." )) text_label.setWordWrap(True) vbox.addWidget(text_label) if isinstance(exception, RPCError): untrusted_text += str(exception) elif isinstance(exception, Exception): untrusted_text += "".join( traceback.TracebackException.from_exception( exception).format()) text_edit = QPlainTextEdit(untrusted_text) text_edit.setReadOnly(True) vbox.addWidget(text_edit) vbox.addStretch(1) vbox.addLayout(Buttons(CloseButton(self))) self.setLayout(vbox)
def initUI(self): # Layouts self.main_layout = QVBoxLayout() self.h_layout = QHBoxLayout() self.form = QFormLayout() # Widgets font = QFont() font.setBold(True) font.setPointSize(12) font_o = QFont() font_o.setBold(True) font_o.setPointSize(10) self.name = QLabel(self.title) self.name.setFont(font) self.output = QPlainTextEdit() self.output.setReadOnly(True) self.output.setFont(font_o) self.run = QPushButton('Run Algorithm') self.clear = QPushButton('Clear') self.run.setMinimumSize(100, 30) self.clear.setMinimumSize(100, 30) self.generate_fields() # Setup main layout self.main_layout.addWidget(self.name) self.main_layout.addLayout(self.form) self.main_layout.addWidget(self.output) self.main_layout.addLayout(self.h_layout) # Setup h layout self.h_layout.addStretch() self.h_layout.addWidget(self.clear) self.h_layout.addWidget(self.run) self.setLayout(self.main_layout) # Conecting button. self.run.clicked.connect(self.run_algorithm) self.clear.clicked.connect(self.clear_output) self.show()