class RunTab(QWidget): def __init__(self, main_window): super().__init__() self.main_window = main_window self.layout = QVBoxLayout(self) self.validation_panel = ValidationPanel(self.main_window) self.layout.addLayout(self.validation_panel.layout) self.log_panel = LogPanel(self) self.layout.addWidget(self.log_panel.widget) self.run_button = QPushButton("Run", self) self.run_button.clicked.connect(self.run) self.layout.addWidget(self.run_button) self.main_window.running_changed.connect( lambda b: self.run_button.setEnabled(not b)) self.thread = RunThread( lambda: self.main_window.running_changed.emit(True), lambda: self.main_window.running_changed.emit(False), ) def run(self): self.validation_panel.clear() self.log_panel.clear() self.thread.start( self.main_window.config, self.log_panel, self.validation_panel, )
def __init__(self, programInstance: ProgramInstance, uniqueRun): super().__init__() AppGlobals.Instance().onChipModified.connect(self.UpdateParameterItems) self.editingParameterVisibility = False self.programInstance = programInstance self.uniqueRun = uniqueRun self._programNameWidget = QLabel() layout = QVBoxLayout() self.setLayout(layout) self.runButton = QPushButton("Run") self.runButton.clicked.connect(self.RunProgram) self._stopButton = QPushButton("Stop") self._stopButton.clicked.connect(self.StopProgram) self.parameterItems: List[ProgramParameterItem] = [] self._parametersLayout = QVBoxLayout() layout.addWidget(self._programNameWidget) layout.addLayout(self._parametersLayout) layout.addWidget(self.runButton) layout.addWidget(self._stopButton) timer = QTimer(self) timer.timeout.connect(self.UpdateInstanceView) timer.start(30) self.UpdateInstanceView() self.UpdateParameterItems()
def __init__(self, parent, start, stop): super().__init__(parent) self.setWindowTitle("Crop data") vbox = QVBoxLayout(self) grid = QGridLayout() self.start_checkbox = QCheckBox("Start time:") self.start_checkbox.setChecked(True) self.start_checkbox.stateChanged.connect(self.toggle_start) grid.addWidget(self.start_checkbox, 0, 0) self._start = QDoubleSpinBox() self._start.setMaximum(999999) self._start.setValue(start) self._start.setDecimals(2) self._start.setSuffix(" s") grid.addWidget(self._start, 0, 1) self.stop_checkbox = QCheckBox("Stop time:") self.stop_checkbox.setChecked(True) self.stop_checkbox.stateChanged.connect(self.toggle_stop) grid.addWidget(self.stop_checkbox, 1, 0) self._stop = QDoubleSpinBox() self._stop.setMaximum(999999) self._stop.setValue(stop) self._stop.setDecimals(2) self._stop.setSuffix(" s") grid.addWidget(self._stop, 1, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
def createSequencerControls(self): widget = QWidget() layout = QVBoxLayout() layout.addWidget(self.createSequencerSections(1)) layout.addWidget(self.createSequencerSections(2)) layout.addWidget(self.createRhythmSection()) hbox = Qtw.QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.createTransportSection()) hbox.addWidget(self.createEnvSection()) hbox.setStretch(0, 1) hbox.setStretch(1, 1) layout.addLayout(hbox) layout.setContentsMargins(0, 0, 0, 0) widget.setContentsMargins(0, 0, 0, 0) layout.setStretch(0, 2) layout.setStretch(1, 2) layout.setStretch(2, 4) layout.setStretch(3, 2) widget.setLayout(layout) return widget
def __init__(self, valve: Valve): super().__init__() AppGlobals.Instance().onChipModified.connect(self.CheckForValve) self._valve = valve self.valveToggleButton = QToolButton() self.valveNumberLabel = QLabel("Number") self.valveNumberDial = QSpinBox() self.valveNumberDial.setMinimum(0) self.valveNumberDial.setValue(self._valve.solenoidNumber) self.valveNumberDial.setMaximum(9999) self.valveNumberDial.valueChanged.connect(self.UpdateValve) self.valveNameLabel = QLabel("Name") self.valveNameField = QLineEdit(self._valve.name) self.valveNameField.textChanged.connect(self.UpdateValve) mainLayout = QVBoxLayout() mainLayout.addWidget(self.valveToggleButton, alignment=Qt.AlignCenter) layout = QGridLayout() layout.addWidget(self.valveNameLabel, 0, 0) layout.addWidget(self.valveNameField, 0, 1) layout.addWidget(self.valveNumberLabel, 1, 0) layout.addWidget(self.valveNumberDial, 1, 1) mainLayout.addLayout(layout) self.containerWidget.setLayout(mainLayout) self.valveToggleButton.clicked.connect(self.Toggle) self.Update() self.Move(QPointF())
class DataView(object): uifile = QDir(os.path.dirname(os.path.realpath(__file__))) def setupUi(self, Form): if not Form.objectName(): Form.setObjectName(u"Form") Form.resize(529, 777) self.verticalLayout = QVBoxLayout(Form) self.verticalLayout.setObjectName(u"verticalLayout") self.stepsLayout = QVBoxLayout() self.stepsLayout.setSpacing(10) self.stepsLayout.setObjectName(u"stepsLayout") self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize) self.stepsLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.addLayout(self.stepsLayout) self.retranslateUi(Form) QMetaObject.connectSlotsByName(Form) # setupUi def retranslateUi(self, form): form.setWindowTitle( QCoreApplication.translate(b"dataPane", b"dataPane", None))
def __init__(self, previewImage, fileName): super(ImageView, self).__init__() self.fileName = fileName mainLayout = QVBoxLayout(self) self.imageLabel = QLabel() self.imageLabel.setPixmap(QPixmap.fromImage(previewImage)) mainLayout.addWidget(self.imageLabel) topLayout = QHBoxLayout() self.fileNameLabel = QLabel(QDir.toNativeSeparators(fileName)) self.fileNameLabel.setTextInteractionFlags(Qt.TextBrowserInteraction) topLayout.addWidget(self.fileNameLabel) topLayout.addStretch() copyButton = QPushButton("Copy") copyButton.setToolTip("Copy file name to clipboard") topLayout.addWidget(copyButton) copyButton.clicked.connect(self.copy) launchButton = QPushButton("Launch") launchButton.setToolTip("Launch image viewer") topLayout.addWidget(launchButton) launchButton.clicked.connect(self.launch) mainLayout.addLayout(topLayout)
def __init__(self, arg=None): super(Table, self).__init__(arg) # 设置窗体的标题和初始大小 self.setWindowTitle("QTableView 表格视图控件的例子") self.resize(600, 300) # 准备数据模型,设置数据层次结构为6行5列 self.model = QStandardItemModel(6, 5) # 设置数据栏名称 self.model.setHorizontalHeaderLabels(['标题1', '标题2', '标题3', '标题4', '标题5']) for row in range(6): for column in range(5): item = QStandardItem("行 %s, 列 %s" % (row, column )) self.model.setItem(row, column, item) # 实例化表格视图,设置模型为自定义的模型 self.tableView = QTableView() self.tableView.setModel(self.model) ############ 下面代码让表格 100% 的填满窗口 self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # 局部布局 vboxLayout = QVBoxLayout() vboxLayout.addWidget(self.tableView) # 全局布局 wl = QVBoxLayout(self) wl.addLayout(vboxLayout)
def __init__(self, parent, name, data): QWidget.__init__(self, parent) DockContextHandler.__init__(self, self, name) self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) status_layout = QHBoxLayout() status_layout.addWidget(QLabel('Status: ')) self.status = QLabel('idle') status_layout.addWidget(self.status) status_layout.setAlignment(QtCore.Qt.AlignCenter) client_dbg_layout = QHBoxLayout() client_dbg_layout.addWidget(QLabel('Client debugger: ')) self.client_dbg = QLabel('n/a') client_dbg_layout.addWidget(self.client_dbg) client_dbg_layout.setAlignment(QtCore.Qt.AlignCenter) client_pgm_layout = QHBoxLayout() client_pgm_layout.addWidget(QLabel('Client program: ')) self.client_pgm = QLabel('n/a') client_pgm_layout.addWidget(self.client_pgm) client_pgm_layout.setAlignment(QtCore.Qt.AlignCenter) layout = QVBoxLayout() layout.addStretch() layout.addLayout(status_layout) layout.addLayout(client_dbg_layout) layout.addLayout(client_pgm_layout) layout.addStretch() self.setLayout(layout)
def initUI(self): """ Init widget """ vbox = QVBoxLayout() vbox.addSpacing(2) # Head hbox = QHBoxLayout() hbox.addSpacing(2) # Create button which returns to the menu self._buttonBack = QPushButton(QIcon(PATH_IMAGE_BACK_NEDDLE), "", self) self._buttonBack.clicked.connect(self.signalController.back2menu) hbox.addWidget(self._buttonBack, 0, QtCore.Qt.AlignLeft) # Header of this widget self._headWidget = QLabel("About game") hbox.addWidget(self._headWidget, 1, QtCore.Qt.AlignCenter) vbox.addLayout(hbox, 0) # Create text about game text = ABOUT_GAME_STR self.textAboutGame = QLabel(text) self.textAboutGame.setWordWrap(True) self.setFont(QFont("Times", 12, QFont.Bold)) vbox.addWidget(self.textAboutGame, 1, QtCore.Qt.AlignCenter) self.setLayout(vbox) self.setWindowTitle("About game")
def __init__(self, persepolis_setting): super().__init__() icon = QIcon() self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle( QCoreApplication.translate("setting_ui_tr", 'Preferences')) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) global icons icons = ':/' + str( self.persepolis_setting.value('settings/icons')) + '/' window_verticalLayout = QVBoxLayout(self) self.pressKeyLabel = QLabel(self) window_verticalLayout.addWidget(self.pressKeyLabel) self.capturedKeyLabel = QLabel(self) window_verticalLayout.addWidget(self.capturedKeyLabel) # window buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # labels self.pressKeyLabel.setText( QCoreApplication.translate("setting_ui_tr", "Press new keys")) self.cancel_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "Cancel")) self.ok_pushButton.setText( QCoreApplication.translate("setting_ui_tr", "OK"))
def __init__(self, data): global instance_id QWidget.__init__(self) self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) offset_layout = QHBoxLayout() offset_layout.addWidget(QLabel("Offset: ")) self.offset = QLabel(hex(0)) offset_layout.addWidget(self.offset) offset_layout.setAlignment(QtCore.Qt.AlignCenter) datatype_layout = QHBoxLayout() datatype_layout.addWidget(QLabel("Data Type: ")) self.datatype = QLabel("") datatype_layout.addWidget(self.datatype) datatype_layout.setAlignment(QtCore.Qt.AlignCenter) layout = QVBoxLayout() title = QLabel("Hello Pane", self) title.setAlignment(QtCore.Qt.AlignCenter) instance = QLabel("Instance: " + str(instance_id), self) instance.setAlignment(QtCore.Qt.AlignCenter) layout.addStretch() layout.addWidget(title) layout.addWidget(instance) layout.addLayout(datatype_layout) layout.addLayout(offset_layout) layout.addStretch() self.setLayout(layout) instance_id += 1 self.data = data # Populate initial state self.updateState() # Set up view and address change notifications self.notifications = HelloNotifications(self)
def __init__(self): super(MainWindow, self).__init__() self.setWindowTitle("My App") pagelayout = QVBoxLayout() button_layout = QHBoxLayout() self.stacklayout = QStackedLayout() pagelayout.addLayout(button_layout) pagelayout.addLayout(self.stacklayout) btn = QPushButton("red") btn.pressed.connect(self.activate_tab_1) button_layout.addWidget(btn) self.stacklayout.addWidget(Color("red")) btn = QPushButton("green") btn.pressed.connect(self.activate_tab_2) button_layout.addWidget(btn) self.stacklayout.addWidget(Color("green")) btn = QPushButton("yellow") btn.pressed.connect(self.activate_tab_3) button_layout.addWidget(btn) self.stacklayout.addWidget(Color("yellow")) widget = QWidget() widget.setLayout(pagelayout) self.setCentralWidget(widget)
def __init__(self, program: Program): super().__init__() self._program = program parametersLabel = QLabel("Parameters") newParameterButton = QPushButton("Add Parameter") newParameterButton.clicked.connect(self.AddParameter) layout = QVBoxLayout() titleLayout = QHBoxLayout() titleLayout.addWidget(parametersLabel) titleLayout.addWidget(newParameterButton) layout.addLayout(titleLayout) self._listArea = QScrollArea() self._listArea.setWidgetResizable(True) self._listArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self._listArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) layout.addWidget(self._listArea, stretch=1) listWidget = QWidget() self._itemLayout = QVBoxLayout() self._itemLayout.setAlignment(Qt.AlignTop) listWidget.setLayout(self._itemLayout) self.setLayout(layout) self._listArea.setWidget(listWidget) self.items: List[ParameterEditorItem] = [] self._temporaryParameters = program.parameters.copy() self.Populate()
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def initUI(self): self.cam = CamImage() self.start_button = QPushButton("Start") self.quit_button = QPushButton("Quit") controls = ControlWidget() self.combo = QComboBox(self) for it in self.MainProcess.list_of_filters: self.combo.addItem(it[0]) hbox = QHBoxLayout() hbox.addWidget(controls) hbox.addStretch(1) hbuttons = QHBoxLayout() hbuttons.addWidget(self.combo) hbuttons.addWidget(self.start_button) hbuttons.addWidget(self.quit_button) vbutton = QVBoxLayout() vbutton.addLayout(hbuttons) vbutton.addWidget(self.fps_label) hbox.addLayout(vbutton) vbox = QVBoxLayout() vbox.addWidget(self.cam) vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.setGeometry(300, 300, 300, 150) self.setWindowTitle('Buttons') self.show()
def __init__(self, name): global instance_id GlobalAreaWidget.__init__(self, name) self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) offset_layout = QHBoxLayout() offset_layout.addWidget(QLabel("Offset: ")) self.offset = QLabel(hex(0)) offset_layout.addWidget(self.offset) offset_layout.setAlignment(QtCore.Qt.AlignCenter) datatype_layout = QHBoxLayout() datatype_layout.addWidget(QLabel("Data Type: ")) self.datatype = QLabel("") datatype_layout.addWidget(self.datatype) datatype_layout.setAlignment(QtCore.Qt.AlignCenter) layout = QVBoxLayout() title = QLabel(name, self) title.setAlignment(QtCore.Qt.AlignCenter) instance = QLabel("Instance: " + str(instance_id), self) instance.setAlignment(QtCore.Qt.AlignCenter) layout.addStretch() layout.addWidget(title) layout.addWidget(instance) layout.addLayout(datatype_layout) layout.addLayout(offset_layout) layout.addStretch() self.setLayout(layout) instance_id += 1 self.data = None
def initUI(self): """ Init widget """ vbox = QVBoxLayout() vbox.addSpacing(2) # Head hbox = QHBoxLayout() hbox.addSpacing(3) # Create button which returns to the menu self._buttonBack = QPushButton(QIcon(PATH_IMAGE_BACK_NEDDLE), "", self) self._buttonBack.clicked.connect(self.signalController.back2menu) hbox.addWidget(self._buttonBack, 0, QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) # Header of this widget self._headWidget = QLabel("Add new figure") hbox.addWidget(self._headWidget, 1, QtCore.Qt.AlignCenter | QtCore.Qt.AlignTop) # Create button to choose color of new figure self._pickColorButton = QPushButton('Pick color') self._pickColorButton.clicked.connect(self.update_color_name) hbox.addWidget(self._pickColorButton, 2, QtCore.Qt.AlignRight | QtCore.Qt.AlignTop) # Create button to save figure self._saveFigureButton = QPushButton('Save') self._saveFigureButton.clicked.connect(self.save_figure_shape) hbox.addWidget(self._saveFigureButton, 2, QtCore.Qt.AlignRight | QtCore.Qt.AlignTop) vbox.addLayout(hbox, 0) grid = QGridLayout() self._sheet = [] self._choosenFigureList = [] self._proposedFiguresList = [] self._savedColor = 'black' for i in range(self.MAX_X): row = [] for j in range(self.MAX_Y): single = DrawBlockQFrame(self.signalPressedFrames, j, i) if i == 3 and j == 3: # Button in the center - must be with blur color # Save figure - possible only if blue button also clicked # This magic stuff are made in order to simplify saving figure single.COLOR_DEFAULT = 'blue' single.default_color() self.centerSheet = single row.append(single) grid.addWidget(single, i, j) self._sheet.append(row) vbox.addLayout(grid, 1) self.setLayout(vbox) self.setWindowTitle("Add new figure")
def __init__(self, values=None): super().__init__() vbox = QVBoxLayout(self) self.grid = QGridLayout() self.grid.setColumnStretch(1, 1) vbox.addLayout(self.grid) vbox.addStretch(1) self.set_values(values)
def __init__(self, parent, rows, selected=None, disabled=None): super().__init__(parent) self.setWindowTitle("Select XDF Stream") self.model = QStandardItemModel() self.model.setHorizontalHeaderLabels( ["ID", "Name", "Type", "Channels", "Format", "Sampling Rate"]) for index, stream in enumerate(rows): items = [] for item in stream: tmp = QStandardItem() tmp.setData(item, Qt.DisplayRole) items.append(tmp) for item in items: item.setEditable(False) if disabled is not None and index in disabled: item.setFlags(Qt.NoItemFlags) self.model.appendRow(items) self.view = QTableView() self.view.setModel(self.model) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) if selected is not None: self.view.selectRow(selected) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) vbox = QVBoxLayout(self) vbox.addWidget(self.view) hbox = QHBoxLayout() self._effective_srate = QCheckBox("Use effective sampling rate") self._effective_srate.setChecked(True) hbox.addWidget(self._effective_srate) self._prefix_markers = QCheckBox("Prefix markers with stream ID") self._prefix_markers.setChecked(False) if not disabled: self._prefix_markers.setEnabled(False) hbox.addWidget(self._prefix_markers) vbox.addLayout(hbox) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(775, 650) self.view.setColumnWidth(0, 90) self.view.setColumnWidth(1, 200) self.view.setColumnWidth(2, 140)
def __init__(self): super().__init__() self.layout = QHBoxLayout() i = 0 self.names = [] self.ebutons = [] self.dbutons = [] folder = './saved' #-------------Loading saved images from ./saved------------ if (len(os.listdir(folder)) == 0): #print oput nothing saved self.label = QLabel("Nothing Saved") self.layout.addWidget(self.label) else: for filename in os.listdir(folder): self.names.append(filename) self.ebutons.append(i) self.dbutons.append(i) lay = QVBoxLayout() gbox = QGroupBox('Result' + str(i + 1)) path = folder + "/" + filename with open(path, 'rb') as thefile: imag = pickle.load(thefile) path += ".jpg" im = Image.open( requests.get(imag['urls']['thumb'], stream=True).raw) im.save(path) self.ebutons[i] = QPushButton("Edit") self.ebutons[i].clicked.connect( lambda state=i, a=i: self.editme(state)) self.dbutons[i] = QPushButton("Delete") self.dbutons[i].clicked.connect( lambda state=i, a=i: self.deleteme(state)) pixmap = QPixmap(path) self.image = QLabel() self.image.setPixmap(pixmap) lay.addWidget(self.image) buts = QHBoxLayout() buts.addWidget(self.ebutons[i]) buts.addWidget(self.dbutons[i]) lay.addLayout(buts) gbox.setLayout(lay) self.layout.addWidget(gbox) try: if os.path.isfile(path) or os.path.islink(path): os.unlink(path) elif os.path.isdir(path): shutil.rmtree(path) except Exception as e: print('Failed to delete %s. Reason: %s' % (file_path, e)) i += 1 print("done") self.setLayout(self.layout)
class PrePickerDialog(QDialog): def __init__(self): super(PrePickerDialog, self).__init__() self.resize(250, 150) # Label self.label = QLabel(self) self.label.setObjectName(u"label") self.label.setLineWidth(1) self.label.setTextFormat(Qt.RichText) # Radio Buttons self.radioButton = QRadioButton(self) self.radioButton.setObjectName(u"radioButton") self.radioButton.toggle() self.radioButton_2 = QRadioButton(self) self.radioButton_2.setObjectName(u"radioButton_2") # Buttons buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel self.buttonBox = QDialogButtonBox(buttons) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) # HBoxes self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.addWidget(self.radioButton) self.horizontalLayout_2.addWidget(self.radioButton_2) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.addWidget(self.buttonBox) # VBox for whole content self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.addWidget(self.label) self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout) # Texts self.text_ui() def text_ui(self): self.setWindowTitle("Choose option") self.label.setText( "<h2 align=\"center\" style=\" margin-top:18px; margin-bottom:12px; " "margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" "<span style=\" font-size:7pt; font-weight:700;\">Choose color for:</span></h2>" ) self.radioButton.setText("Line") self.radioButton_2.setText("Brush")
def draw_board(self, file_config): """Initiate UI The UI consists of 2 parts, top is the board title and info and button is the subbords with tiles in each ones the subboard is drawn based on file_configuration """ config, content = file_config mainlayout = QVBoxLayout() mainlayout.setContentsMargins(20, 20, 20, 20) title_edit = QLineEdit( config["xban_config"]["title"], objectName="windowEdit_title", parent=self, ) title_edit.setPlaceholderText("Enter title here ...") info_edit = NoteTile(config["xban_config"]["description"], "windowEdit_text", self) info_edit.setPlaceholderText("Enter description here ...") mainlayout.addWidget(title_edit) mainlayout.addWidget(info_edit) self.sublayout = QHBoxLayout() color = config["xban_config"]["board_color"] self.sublayout.setContentsMargins(10, 10, 10, 10) self.sublayout.setSpacing(20) add_btn = BanButton( "+", clicked=self.insert_board, toolTip="add board", objectName="windowBtn_add", ) shadow = QGraphicsDropShadowEffect(self, blurRadius=10, offset=5, color=QColor("lightgrey")) add_btn.setGraphicsEffect(shadow) self.sublayout.addWidget(add_btn) mainlayout.addLayout(self.sublayout) self.setLayout(mainlayout) for i, tile_contents in enumerate(content.items()): # insert the boards self.insert_board(tile_contents, color[i])
def __init__(self, parent, nchan, methods): super().__init__(parent) self.setWindowTitle("Run ICA") vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Method:"), 0, 0) self.method = QComboBox() self.method.addItems(methods) self.method.setCurrentIndex(0) self.method.currentIndexChanged.connect(self.toggle_options) grid.addWidget(self.method, 0, 1) self.extended_label = QLabel("Extended:") grid.addWidget(self.extended_label, 1, 0) self.extended = QCheckBox() self.extended.setChecked(True) grid.addWidget(self.extended, 1, 1) self.ortho_label = QLabel("Orthogonal:") grid.addWidget(self.ortho_label, 2, 0) self.ortho = QCheckBox() self.ortho.setChecked(False) grid.addWidget(self.ortho, 2, 1) if "Picard" not in methods: self.ortho_label.hide() self.ortho.hide() grid.addWidget(QLabel("Number of components:"), 3, 0) self.n_components = QSpinBox() self.n_components.setRange(0, nchan) self.n_components.setValue(nchan) self.n_components.setAlignment(Qt.AlignRight) grid.addWidget(self.n_components, 3, 1) grid.addWidget(QLabel("Exclude bad segments:"), 4, 0) self.exclude_bad_segments = QCheckBox() self.exclude_bad_segments.setChecked(True) grid.addWidget(self.exclude_bad_segments, 4, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize) self.toggle_options()
def set_ui(self): layout = self.simple_timer.layout() i = layout.indexOf(self.simple_timer.timer_edit) layout.takeAt(i) hlayout = QHBoxLayout() hlayout.addWidget(self.estimate_label) hlayout.addWidget(self.estimate_pomo_widget) vlayout = QVBoxLayout() vlayout.addLayout(hlayout) vlayout.addWidget(self.pomo_count_lbl) vlayout.addWidget(self.state_lbl) vlayout.addWidget(self.simple_timer) self.setLayout(vlayout)
def __init__(self, parent=None): super(Maker, self).__init__(parent) self.setWindowTitle("Project Maker") self.userFilepath = QLineEdit() self.userFilepath.setPlaceholderText("Your filepath here...") self.projName = QLineEdit() self.projName.setPlaceholderText("Your project name here...") self.makeButton = QPushButton("Create Project") self.fileSearchButton = QPushButton("...") self.fileSearchButton.setToolTip( "Search for a directory for your project") self.goProj = QRadioButton("Go Project") self.goProj.setToolTip("You will still need a go.mod file") self.pyProj = QRadioButton("Python Project") self.versionControlFiles = QCheckBox( "Create README.md and .gitignore?") self.versionControlFiles.setToolTip( "Creates the files used in online version control, such as Github") self.pyProj.setChecked(True) self.versionControlFiles.setChecked(True) projSelect = QGroupBox("Project Selection") projectOptions = QVBoxLayout() projectOptions.addWidget(self.pyProj) projectOptions.addWidget(self.goProj) projectOptions.addWidget(self.versionControlFiles) projectOptions.stretch(1) projSelect.setLayout(projectOptions) searchLayout = QHBoxLayout() searchLayout.addWidget(self.userFilepath) searchLayout.addWidget(self.fileSearchButton) searchLayout.stretch(1) layout = QVBoxLayout() layout.addLayout(searchLayout) layout.addWidget(self.projName) layout.addWidget(self.makeButton) layout.addWidget(self.fileSearchButton) layout.addWidget(projSelect) self.setLayout(layout) self.makeButton.clicked.connect(self.createFiles) self.fileSearchButton.clicked.connect(self.onClickFileSearch)
def initUI(self): okBtn = QPushButton("OK") cancelBtn = QPushButton("Cancel") hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(okBtn) hbox.addWidget(cancelBtn) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.setGeometry(300, 300, 300, 300) self.setWindowTitle("Buttons")
def __init__(self, parent: QWidget, parent_layout: QVBoxLayout, resource_database: ResourceDatabase, item: ResourceRequirement, rows: List["ItemRow"]): self.parent = parent self.resource_database = resource_database self._rows = rows rows.append(self) self.layout = QHBoxLayout() self.layout.setObjectName(f"Box layout for {item.resource.long_name}") parent_layout.addLayout(self.layout) self.resource_type_combo = _create_resource_type_combo( item.resource.resource_type, parent) self.resource_type_combo.setMinimumWidth(75) self.resource_type_combo.setMaximumWidth(75) self.resource_name_combo = _create_resource_name_combo( self.resource_database, item.resource.resource_type, item.resource, self.parent) self.negate_combo = QComboBox(parent) self.negate_combo.addItem("≥", False) self.negate_combo.addItem("<", True) self.negate_combo.setCurrentIndex(int(item.negate)) self.negate_combo.setMinimumWidth(40) self.negate_combo.setMaximumWidth(40) self.amount_edit = QLineEdit(parent) self.amount_edit.setValidator(QIntValidator(1, 10000)) self.amount_edit.setText(str(item.amount)) self.amount_edit.setMinimumWidth(45) self.amount_edit.setMaximumWidth(45) self.remove_button = QPushButton(parent) self.remove_button.setText("X") self.remove_button.setMaximumWidth(20) self.layout.addWidget(self.resource_type_combo) self.layout.addWidget(self.resource_name_combo) self.layout.addWidget(self.negate_combo) self.layout.addWidget(self.amount_edit) self.layout.addWidget(self.remove_button) self.resource_type_combo.currentIndexChanged.connect(self._update_type) self.remove_button.clicked.connect(self._delete_row)
def __init__(self, parent, compatibles, title="Append data"): super().__init__(parent) self.setWindowTitle(title) vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Source"), 0, 0, Qt.AlignCenter) grid.addWidget(QLabel("Destination"), 0, 2, Qt.AlignCenter) self.source = QListWidget(self) self.source.setAcceptDrops(True) self.source.setDragEnabled(True) self.source.setSelectionMode(QAbstractItemView.ExtendedSelection) self.source.setDefaultDropAction(Qt.DropAction.MoveAction) self.source.insertItems(0, [d["name"] for d in compatibles]) grid.addWidget(self.source, 1, 0) self.move_button = QPushButton("→") self.move_button.setEnabled(False) grid.addWidget(self.move_button, 1, 1, Qt.AlignHCenter) self.destination = QListWidget(self) self.destination.setAcceptDrops(True) self.destination.setDragEnabled(True) self.destination.setSelectionMode(QAbstractItemView.ExtendedSelection) self.destination.setDefaultDropAction(Qt.DropAction.MoveAction) grid.addWidget(self.destination, 1, 2) vbox.addLayout(grid) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) vbox.addWidget(self.buttonbox) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize) self.destination.model().rowsInserted.connect(self.toggle_ok_button) self.destination.model().rowsRemoved.connect(self.toggle_ok_button) self.source.itemSelectionChanged.connect(self.toggle_move_source) self.destination.itemSelectionChanged.connect( self.toggle_move_destination) self.move_button.clicked.connect(self.move) self.toggle_ok_button() self.toggle_move_source() self.toggle_move_destination()
def __init__(self, parent=None): super(Dialog, self).__init__(parent) self.server = FortuneServer() statusLabel = QLabel() statusLabel.setTextInteractionFlags(Qt.TextBrowserInteraction) statusLabel.setWordWrap(True) quitButton = QPushButton("Quit") quitButton.setAutoDefault(False) if not self.server.listen(): QMessageBox.critical( self, "Threaded Fortune Server", "Unable to start the server: %s." % self.server.errorString()) self.close() return for ipAddress in QNetworkInterface.allAddresses(): if ipAddress != QHostAddress.LocalHost and ipAddress.toIPv4Address( ) != 0: break else: ipAddress = QHostAddress(QHostAddress.LocalHost) ipAddress = ipAddress.toString() statusLabel.setText("The server is running on\n\nIP: %s\nport: %d\n\n" "Run the Fortune Client example now." % (ipAddress, self.server.serverPort())) quitButton.clicked.connect(self.close) buttonLayout = QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(quitButton) buttonLayout.addStretch(1) mainLayout = QVBoxLayout() mainLayout.addWidget(statusLabel) mainLayout.addLayout(buttonLayout) self.setLayout(mainLayout) self.setWindowTitle("Threaded Fortune Server")