class OUi(object): def __init__(self, app): self._app = app self.songs_table_container = SongsTableContainer(self._app) self._lb_container = MFrame() self.login_dialog = LoginDialog(self._app, self._app) self.playlist_dialog = PlaylistDialog(self._app, self._app) self.login_btn = LoginButton(self._app) self.music_database_item = LPGroupItem(self._app, '音乐库') self.music_database_item.set_img_text('Ω') self._lbc_layout = QHBoxLayout(self._lb_container) self.setup() def setup(self): self._lbc_layout.setContentsMargins(0, 0, 0, 0) self._lbc_layout.setSpacing(0) self._lbc_layout.addWidget(self.login_btn) self.login_btn.setFixedSize(30, 30) self._lbc_layout.addSpacing(10) # TODO: connect with Main APP tp_layout = self._app.ui.top_panel.layout() tp_layout.addWidget(self._lb_container) library_panel = self._app.ui.central_panel.left_panel.library_panel library_panel.add_item(self.music_database_item) # action in OO.py
def __init__(self, Wizard, parent=None): super(DocsChangelogPage, self).__init__(parent) self.base = Wizard.base self.setTitle(self.tr("Document files page")) self.setSubTitle(self.tr("Add documentation files")) documentationFilesLabel = QLabel("Documentation files ") self.addDocumentationButton = QPushButton("+") self.addDocumentationButton.clicked.connect(self.openDocsFileDialog) self.removeDocumentationButton = QPushButton("-") self.openChangelogDialogButton = QPushButton("Changelog") self.openChangelogDialogButton.clicked.connect( self.openChangeLogDialog) self.documentationFilesList = QListWidget() mainLayout = QVBoxLayout() upperLayout = QHBoxLayout() midleLayout = QHBoxLayout() lowerLayout = QHBoxLayout() upperLayout.addWidget(self.addDocumentationButton) upperLayout.addWidget(self.removeDocumentationButton) upperLayout.addWidget(documentationFilesLabel) upperLayout.addSpacing(500) midleLayout.addWidget(self.documentationFilesList) lowerLayout.addWidget(self.openChangelogDialogButton) lowerLayout.addSpacing(700) mainLayout.addLayout(upperLayout) mainLayout.addLayout(midleLayout) mainLayout.addLayout(lowerLayout) self.setLayout(mainLayout)
def __init__(self, main_window, items): """ Connects to menu_btn_clicked signal and also emits it when button is clicked. """ super().__init__() self.hide() hbox = QHBoxLayout() hbox.setSpacing(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) hbox.addSpacing(25) main_window.communication.user_selected.connect(self._show) main_window.communication.menu_btn_clicked.connect(self._item_selected) self.buttons = [] labels = [each['sys'] for each in options.CONTROL_BUTTONS_LABELS] for i, text in enumerate(labels): btn = QPushButton(_(text)) self.buttons.append(btn) if i == 0: btn.setStyleSheet(self.BUTTON_SELECTED_QSS) btn.clicked.connect(functools.partial(main_window.communication.menu_btn_clicked.emit, i)) hbox.addWidget(btn) SelectItemMenu(main_window, self, items) self.buttons[0].setText(_(main_window.items[0].name)) self.buttons[0].setFixedWidth(int(main_window.width() / 5)) hbox.addStretch()
def _multipleChildLayout(self, formation, top): ''' A tree-like, indented layout/widget. name ------ | (recursion) | ''' if not top: # display formation name in the layout label = QLabel(formation.role + formation.name) self.addWidget(label) # else display name in window title indentedLayout = QHBoxLayout() indentedLayout.addSpacing(20) # Apparently pixels # Create lower right quadrant via recursion vLayout = QVBoxLayout() formation.displayContentsInLayout(vLayout) indentedLayout.addLayout(vLayout) self.addLayout(indentedLayout)
class Ui(object): def __init__(self, app): super().__init__() self._app = app self.login_dialog = LoginDialog(self._app, self._app) self.login_btn = LoginButton(self._app) self._lb_container = FFrame() self.songs_table_container = SongsTable_Container(self._app) self._lbc_layout = QHBoxLayout(self._lb_container) self.setup() def setup(self): self._lbc_layout.setContentsMargins(0, 0, 0, 0) self._lbc_layout.setSpacing(0) self._lbc_layout.addWidget(self.login_btn) self.login_btn.setFixedSize(30, 30) self._lbc_layout.addSpacing(10) tp_layout = self._app.ui.top_panel.layout() tp_layout.addWidget(self._lb_container)
def addStatControl(self,i,label=None): statbox = QHBoxLayout() statbox.addSpacing(1) statbox.setSpacing(0) statbox.setAlignment(Qt.AlignCenter) statlabel = QLabel(self.stats[i] if label is None else label) statlabel.setContentsMargins(0,0,0,0) statlabel.setAlignment(Qt.AlignCenter) statlabel.setFixedWidth(20) statbox.addWidget(statlabel) statcontrol = QLineEdit() statcontrol.setAlignment(Qt.AlignCenter) statcontrol.setFixedWidth(40) statcontrol.setText(str(self.skill.multipliers[i])) v = QDoubleValidator(0,99,3,statcontrol) v.setNotation(QDoubleValidator.StandardNotation) #v.setRange(0,100,decimals=3) statcontrol.setValidator(v) #print(v.top()) def statFuncMaker(j): def statFunc(newValue): self.skill.multipliers[j] = float(newValue) self.skillsChanged.emit() return statFunc statcontrol.textChanged[str].connect(statFuncMaker(i)) statbox.addWidget(statcontrol) statbox.addSpacing(1) self.layout.addLayout(statbox)
def __init__(self, Wizard, parent=None): super(BuildPage, self).__init__(parent) self.base = Wizard.base self.Wizard = Wizard # Main wizard of program self.nextPageIsFinal = True # BOOL to determine which page is next one self.setTitle(self.tr("Build page")) self.setSubTitle(self.tr("Options to build")) self.buildToButton = QPushButton("Build to") self.buildToButton.clicked.connect(self.openBuildPathFileDialog) self.uploadToCOPR_Button = QPushButton("Upload to COPR") self.editSpecButton = QPushButton("Edit SPEC file") self.uploadToCOPR_Button.clicked.connect(self.switchToCOPR) self.uploadToCOPR_Button.clicked.connect(self.Wizard.next) specWarningLabel = QLabel("* Edit SPEC file on your own risk") self.buildLocationEdit = QLineEdit() mainLayout = QVBoxLayout() midleLayout = QHBoxLayout() lowerLayout = QHBoxLayout() midleLayout.addWidget(self.editSpecButton) midleLayout.addWidget(specWarningLabel) midleLayout.addSpacing(330) midleLayout.addWidget(self.uploadToCOPR_Button) lowerLayout.addWidget(self.buildToButton) lowerLayout.addWidget(self.buildLocationEdit) mainLayout.addSpacing(60) mainLayout.addLayout(midleLayout) mainLayout.addSpacing(10) mainLayout.addLayout(lowerLayout) self.setLayout(mainLayout)
class SearchLineEdit(QLineEdit): """创建一个可自定义图片的输入框。""" def __init__(self, parent=None): super(SearchLineEdit, self).__init__() self.setObjectName("SearchLine") self.parent = parent self.setMinimumSize(218, 20) with open('QSS/searchLine.qss', 'r') as f: self.setStyleSheet(f.read()) self.button = QPushButton(self) self.button.setMaximumSize(13, 13) self.button.setCursor(QCursor(Qt.PointingHandCursor)) self.setTextMargins(3, 0, 19, 0) self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding) self.mainLayout = QHBoxLayout() self.mainLayout.addSpacerItem(self.spaceItem) # self.mainLayout.addStretch(1) self.mainLayout.addWidget(self.button) self.mainLayout.addSpacing(10) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) def setButtonSlot(self, funcName): self.button.clicked.connect(funcName)
class TopPanel(FFrame): def __init__(self, app, parent=None): super().__init__(parent) self._app = app self._layout = QHBoxLayout(self) self.pc_panel = PlayerControlPanel(self._app, self) self.mo_panel = SongOperationPanel(self._app, self) self.setObjectName('top_panel') self.set_theme_style() self.setup_ui() def set_theme_style(self): theme = self._app.theme_manager.current_theme style_str = ''' #{0} {{ background: transparent; color: {1}; border-bottom: 3px inset {3}; }} '''.format(self.objectName(), theme.foreground.name(), theme.color0_light.name(), theme.color0_light.name()) self.setStyleSheet(style_str) def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self.setFixedHeight(50) self._layout.addSpacing(5) self._layout.addWidget(self.pc_panel) self._layout.addWidget(self.mo_panel)
class ListItem (QWidget): def __init__(self, name=None, drawer=None, current_path=None, parent=None): super(ListItem, self).__init__(parent) self.current_path = current_path self.parent = parent self.file_layout = QHBoxLayout() self.file_layout.setContentsMargins(5, 5, 5, 0) self.name_label = QLabel("") self.size_label = QLabel("") self.size_label.setAlignment(Qt.AlignRight) self.file_layout.addWidget(self.name_label) self.file_layout.addWidget(self.size_label) self.file_layout.addSpacing(5) self.setLayout(self.file_layout) self.drawer = drawer self.name = name self.set_text(name) def set_text(self, text): if self.drawer: self.setStyleSheet('''color: rgb(0, 0, 255);''') self.size_label.setText("Drawer") else: self.setStyleSheet('''color: rgb(0, 0, 0);''') self.name_label.setText(self.name) def mouseDoubleClickEvent(self, event): if event.buttons() == Qt.LeftButton: if self.drawer: self.parent.create_list(current_path=self.current_path + self.name) else: self.parent.file_field.set_text(name=self.name, path=self.current_path)
def __init__(self, main_window, items): super().__init__() vbox = QVBoxLayout() vbox.setSpacing(0) vbox.setContentsMargins(0, 0, 0, 0) self.setLayout(vbox) top_system_buttons = TopSystemButtons(main_window) vbox.addWidget(top_system_buttons) vbox.addStretch() hbox = QHBoxLayout() hbox.addSpacing(25) hbox.setSpacing(0) hbox.setContentsMargins(0, 0, 0, 0) vbox.addLayout(hbox) l = QLabel() hbox.addWidget(l) vbox.addStretch() vbox.addWidget(SelectMenu(main_window, items)) main_window.communication.input_changed_signal.connect(l.setText) self.resizeEvent = functools.partial(main_window.resized, self, top_system_buttons) self.setGraphicsEffect(utils.get_shadow())
def __init__(self): super(MainWindow, self).__init__() centralWidget = QWidget() fontLabel = QLabel("Font:") self.fontCombo = QFontComboBox() sizeLabel = QLabel("Size:") self.sizeCombo = QComboBox() styleLabel = QLabel("Style:") self.styleCombo = QComboBox() fontMergingLabel = QLabel("Automatic Font Merging:") self.fontMerging = QCheckBox() self.fontMerging.setChecked(True) self.scrollArea = QScrollArea() self.characterWidget = CharacterWidget() self.scrollArea.setWidget(self.characterWidget) self.findStyles(self.fontCombo.currentFont()) self.findSizes(self.fontCombo.currentFont()) self.lineEdit = QLineEdit() clipboardButton = QPushButton("&To clipboard") self.clipboard = QApplication.clipboard() self.fontCombo.currentFontChanged.connect(self.findStyles) self.fontCombo.activated[str].connect(self.characterWidget.updateFont) self.styleCombo.activated[str].connect(self.characterWidget.updateStyle) self.sizeCombo.currentIndexChanged[str].connect(self.characterWidget.updateSize) self.characterWidget.characterSelected.connect(self.insertCharacter) clipboardButton.clicked.connect(self.updateClipboard) controlsLayout = QHBoxLayout() controlsLayout.addWidget(fontLabel) controlsLayout.addWidget(self.fontCombo, 1) controlsLayout.addWidget(sizeLabel) controlsLayout.addWidget(self.sizeCombo, 1) controlsLayout.addWidget(styleLabel) controlsLayout.addWidget(self.styleCombo, 1) controlsLayout.addWidget(fontMergingLabel) controlsLayout.addWidget(self.fontMerging, 1) controlsLayout.addStretch(1) lineLayout = QHBoxLayout() lineLayout.addWidget(self.lineEdit, 1) lineLayout.addSpacing(12) lineLayout.addWidget(clipboardButton) centralLayout = QVBoxLayout() centralLayout.addLayout(controlsLayout) centralLayout.addWidget(self.scrollArea, 1) centralLayout.addSpacing(4) centralLayout.addLayout(lineLayout) centralWidget.setLayout(centralLayout) self.setCentralWidget(centralWidget) self.setWindowTitle("Character Map")
class _TagCellWidget(FFrame): def __init__(self, app): super().__init__() self._app = app self.setObjectName('tag_cell') self.download_tag = FLabel('✓', self) self.download_flag = False self.download_tag.setObjectName('download_tag') self.download_tag.setAlignment(Qt.AlignCenter) self.set_theme_style() self._layout = QHBoxLayout(self) self.setup_ui() @property def download_label_style(self): theme = self._app.theme_manager.current_theme background = set_alpha(theme.color7, 50).name(QColor.HexArgb) if self.download_flag: color = theme.color4.name() else: color = set_alpha(theme.color7, 30).name(QColor.HexArgb) style_str = ''' #download_tag {{ color: {0}; background: {1}; border-radius: 10px; }} '''.format(color, background) return style_str def set_theme_style(self): theme = self._app.theme_manager.current_theme style_str = ''' #{0} {{ background: transparent; }} '''.format(self.objectName()) style_str = style_str + self.download_label_style self.setStyleSheet(style_str) def set_download_tag(self): self.download_flag = True self.set_theme_style() def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addSpacing(10) self._layout.addWidget(self.download_tag) self._layout.addSpacing(10) self._layout.addStretch(1) self.download_tag.setFixedSize(20, 20)
def __init__(self, main_combo=False): super(ActionBar, self).__init__() self.setObjectName("actionbar") hbox = QHBoxLayout(self) hbox.setContentsMargins(1, 1, 1, 1) hbox.setSpacing(1) self.lbl_checks = QLabel('') self.lbl_checks.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.lbl_checks.setFixedWidth(48) self.lbl_checks.setVisible(False) hbox.addWidget(self.lbl_checks) self.combo = ComboFiles()#self) self.combo.setIconSize(QSize(16, 16)) #model = QStandardItemModel() #self.combo.setModel(model) #self.combo.view().setDragDropMode(QAbstractItemView.InternalMove) self.combo.setMaximumWidth(300) self.combo.setObjectName("combotab") self.combo.currentIndexChanged[int].connect(self.current_changed) self.combo.setToolTip(translations.TR_COMBO_FILE_TOOLTIP) self.combo.setContextMenuPolicy(Qt.CustomContextMenu) self.combo.customContextMenuRequested['const QPoint &'].connect(self._context_menu_requested) hbox.addWidget(self.combo) #QTimer.singleShot(50000, lambda: print("singleShot", self.combo.showPopup())) self.symbols_combo = QComboBox() self.symbols_combo.setIconSize(QSize(16, 16)) self.symbols_combo.setObjectName("combo_symbols") self.symbols_combo.activated[int].connect(self.current_symbol_changed) hbox.addWidget(self.symbols_combo) self.code_navigator = CodeNavigator() hbox.addWidget(self.code_navigator) self._pos_text = "Line: %d, Col: %d" # self.lbl_position = QLabel(self._pos_text % (0, 0)) # self.lbl_position.setObjectName("position") # self.lbl_position.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) # hbox.addWidget(self.lbl_position) # hbox.addSpacerItem(QSpacerItem(10,10, QSizePolicy.Expanding)) hbox.addSpacing(100) self.btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') self.btn_close.setIconSize(QSize(16, 16)) if main_combo: self.btn_close.setObjectName('navigation_button') self.btn_close.setToolTip(translations.TR_CLOSE_FILE) self.btn_close.clicked['bool'].connect(lambda s: self.about_to_close_file()) else: self.btn_close.setObjectName('close_split') self.btn_close.setToolTip(translations.TR_CLOSE_SPLIT) self.btn_close.clicked['bool'].connect(self.close_split) self.btn_close.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) hbox.addWidget(self.btn_close)
def __init__(self, finders, iface, parent=None): self.iface = iface self.mapCanvas = iface.mapCanvas() self.rubber = QgsRubberBand(self.mapCanvas) self.rubber.setColor(QColor(255, 255, 50, 200)) self.rubber.setIcon(self.rubber.ICON_CIRCLE) self.rubber.setIconSize(15) self.rubber.setWidth(4) self.rubber.setBrushStyle(Qt.NoBrush) QComboBox.__init__(self, parent) self.setEditable(True) self.setInsertPolicy(QComboBox.InsertAtTop) self.setMinimumHeight(27) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.insertSeparator(0) self.lineEdit().returnPressed.connect(self.search) self.result_view = QTreeView() self.result_view.setHeaderHidden(True) self.result_view.setMinimumHeight(300) self.result_view.activated.connect(self.itemActivated) self.result_view.pressed.connect(self.itemPressed) self.setView(self.result_view) self.result_model = ResultModel(self) self.setModel(self.result_model) self.finders = finders for finder in self.finders.values(): finder.result_found.connect(self.result_found) finder.limit_reached.connect(self.limit_reached) finder.finished.connect(self.finished) self.clearButton = QPushButton(self) self.clearButton.setIcon(QIcon(":/plugins/quickfinder/icons/draft.svg")) self.clearButton.setText('') self.clearButton.setFlat(True) self.clearButton.setCursor(QCursor(Qt.ArrowCursor)) self.clearButton.setStyleSheet('border: 0px; padding: 0px;') self.clearButton.clicked.connect(self.clear) layout = QHBoxLayout(self) self.setLayout(layout) layout.addStretch() layout.addWidget(self.clearButton) layout.addSpacing(20) button_size = self.clearButton.sizeHint() # frameWidth = self.lineEdit().style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth) padding = button_size.width() # + frameWidth + 1 self.lineEdit().setStyleSheet('QLineEdit {padding-right: %dpx; }' % padding)
def __init__(self, parent, app): super().__init__(parent) self._app = app self.setFocusPolicy(Qt.StrongFocus) layout = QVBoxLayout() self.setLayout(layout) toolbar = QHBoxLayout() layout.addLayout(toolbar) self.focus_indicator = QLed(self) self.focus_indicator.setMinimumSize(24, 24) self.focus_indicator.setMaximumSize(24, 24) toolbar.addWidget(self.focus_indicator) toolbar.addSpacing(10) self._keyboard_listener = None self.keyboard_selector = QComboBox() self.keyboard_selector.addItem("None", userData=None) for device_id, port_info in self._app.midi_hub.list_devices(): self.keyboard_selector.addItem( "%s (%s)" % (port_info.name, port_info.client_info.name), userData=device_id) self.keyboard_selector.currentIndexChanged.connect( self.onKeyboardDeviceChanged) toolbar.addWidget(self.keyboard_selector) toolbar.addSpacing(10) # speaker icon should go here... #tb = QToolButton(self) #tb.setIcon(QIcon.fromTheme('multimedia-volume-control')) #toolbar.addWidget(tb) self.volume = QSlider(Qt.Horizontal, self) self.volume.setMinimumWidth(200) self.volume.setMinimum(0) self.volume.setMaximum(127) self.volume.setValue(127) self.volume.setTickPosition(QSlider.TicksBothSides) toolbar.addWidget(self.volume) toolbar.addStretch(1) self.piano_keys = PianoKeys(self) layout.addWidget(self.piano_keys)
def __init__(self, config, app, plugins): QDialog.__init__(self, None) BaseWizard.__init__(self, config, plugins) self.setWindowTitle('Vialectrum - ' + _('Install Wizard')) self.app = app self.config = config # Set for base base class self.language_for_seed = config.get('language') self.setMinimumSize(600, 400) self.accept_signal.connect(self.accept) self.title = QLabel() self.main_widget = QWidget() self.back_button = QPushButton(_("Back"), self) self.back_button.setText(_('Back') if self.can_go_back() else _('Cancel')) self.next_button = QPushButton(_("Next"), self) self.next_button.setDefault(True) self.logo = QLabel() self.please_wait = QLabel(_("Please wait...")) self.please_wait.setAlignment(Qt.AlignCenter) self.icon_filename = None self.loop = QEventLoop() self.rejected.connect(lambda: self.loop.exit(0)) self.back_button.clicked.connect(lambda: self.loop.exit(1)) self.next_button.clicked.connect(lambda: self.loop.exit(2)) outer_vbox = QVBoxLayout(self) inner_vbox = QVBoxLayout() inner_vbox.addWidget(self.title) inner_vbox.addWidget(self.main_widget) inner_vbox.addStretch(1) inner_vbox.addWidget(self.please_wait) inner_vbox.addStretch(1) scroll_widget = QWidget() scroll_widget.setLayout(inner_vbox) scroll = QScrollArea() scroll.setWidget(scroll_widget) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setWidgetResizable(True) icon_vbox = QVBoxLayout() icon_vbox.addWidget(self.logo) icon_vbox.addStretch(1) hbox = QHBoxLayout() hbox.addLayout(icon_vbox) hbox.addSpacing(5) hbox.addWidget(scroll) hbox.setStretchFactor(scroll, 1) outer_vbox.addLayout(hbox) outer_vbox.addLayout(Buttons(self.back_button, self.next_button)) self.set_icon('vialectrum.png') self.show() self.raise_() self.refresh_gui() # Need for QT on MacOSX. Lame.
def cypherseed_dialog(self, window): self.warn_old_revealer() d = WindowModalDialog(window, "Encryption Dialog") d.setMinimumWidth(500) d.setMinimumHeight(210) d.setMaximumHeight(450) d.setContentsMargins(11, 11, 1, 1) self.c_dialog = d hbox = QHBoxLayout(d) self.vbox = QVBoxLayout() logo = QLabel() hbox.addWidget(logo) logo.setPixmap(QPixmap(icon_path('revealer.png'))) logo.setAlignment(Qt.AlignLeft) hbox.addSpacing(16) self.vbox.addWidget(WWLabel("<b>" + _("Revealer Secret Backup Plugin") + "</b><br>" + _("Ready to encrypt for revealer {}") .format(self.versioned_seed.version+'_'+self.versioned_seed.checksum))) self.vbox.addSpacing(11) hbox.addLayout(self.vbox) grid = QGridLayout() self.vbox.addLayout(grid) cprint = QPushButton(_("Encrypt {}'s seed").format(self.wallet_name)) cprint.setMaximumWidth(250) cprint.clicked.connect(partial(self.seed_img, True)) self.vbox.addWidget(cprint) self.vbox.addSpacing(1) self.vbox.addWidget(WWLabel("<b>"+_("OR")+"</b> "+_("type a custom alphanumerical secret below:"))) self.text = ScanQRTextEdit() self.text.setTabChangesFocus(True) self.text.setMaximumHeight(70) self.text.textChanged.connect(self.customtxt_limits) self.vbox.addWidget(self.text) self.char_count = WWLabel("") self.char_count.setAlignment(Qt.AlignRight) self.vbox.addWidget(self.char_count) self.max_chars = WWLabel("<font color='red'>" + _("This version supports a maximum of {} characters.").format(self.MAX_PLAINTEXT_LEN) +"</font>") self.vbox.addWidget(self.max_chars) self.max_chars.setVisible(False) self.ctext = QPushButton(_("Encrypt custom secret")) self.ctext.clicked.connect(self.t) self.vbox.addWidget(self.ctext) self.ctext.setEnabled(False) self.vbox.addSpacing(11) self.vbox.addLayout(Buttons(CloseButton(d))) return bool(d.exec_())
class _NotifySubWidget(QFrame): def __init__(self, parent=None): super().__init__(parent) self.setStyleSheet( """ background: #1A2F39; border-radius: 10px; """ ) self._layout = QHBoxLayout(self) self._img_label = QLabel(self) self._img_label.setFixedSize(60, 60) self._vlayout = QVBoxLayout() self._title_label = QLabel(self) self._content_label = QLabel(self) self._vlayout.addWidget(self._title_label) self._vlayout.addWidget(self._content_label) self._layout.addWidget(self._img_label) self._layout.addSpacing(10) self._layout.addLayout(self._vlayout) self._init_widget_props() def _init_widget_props(self): self._title_label.setStyleSheet( """ font-size: 16px; font-weight: bold; color: #558ACF; """ ) self._content_label.setStyleSheet( """ color: #FBF7E4; """ ) self._content_label.setWordWrap(True) def set_title(self, title): self._title_label.setText(title) def set_content(self, content): self._content_label.setText(content) def set_pixmap(self, pixmap): self._img_label.setPixmap(pixmap.scaled(self._img_label.size(), transformMode=Qt.SmoothTransformation))
def __init__(self, parent=None): QDialog.__init__(self, parent) self.clickedButton = utils.BUTTON_CANCEL # Set the title and icon self.setWindowTitle("Authenticate Buddy") self.setWindowIcon(QIcon(qtUtils.getAbsoluteImagePath('icon.png'))) smpQuestionLabel = QLabel("Question:", self) self.smpQuestionInput = QLineEdit(self) smpAnswerLabel = QLabel("Answer (case sensitive):", self) self.smpAnswerInput = QLineEdit(self) okayButton = QPushButton(QIcon.fromTheme('dialog-ok'), "OK", self) cancelButton = QPushButton(QIcon.fromTheme('dialog-cancel'), "Cancel", self) keyIcon = QLabel(self) keyIcon.setPixmap(QPixmap(qtUtils.getAbsoluteImagePath('fingerprint.png')).scaledToWidth(50, Qt.SmoothTransformation)) helpLabel = QLabel("In order to ensure that no one is listening in on your conversation\n" "it's best to verify the identity of your buddy by entering a question\n" "that only your buddy knows the answer to.") okayButton.clicked.connect(lambda: self.buttonClicked(utils.BUTTON_OKAY)) cancelButton.clicked.connect(lambda: self.buttonClicked(utils.BUTTON_CANCEL)) helpLayout = QHBoxLayout() helpLayout.addStretch(1) helpLayout.addWidget(keyIcon) helpLayout.addSpacing(15) helpLayout.addWidget(helpLabel) helpLayout.addStretch(1) # Float the buttons to the right buttons = QHBoxLayout() buttons.addStretch(1) buttons.addWidget(okayButton) buttons.addWidget(cancelButton) vbox = QVBoxLayout() vbox.addLayout(helpLayout) vbox.addWidget(QLine()) vbox.addWidget(smpQuestionLabel) vbox.addWidget(self.smpQuestionInput) vbox.addWidget(smpAnswerLabel) vbox.addWidget(self.smpAnswerInput) vbox.addLayout(buttons) self.setLayout(vbox)
def __init__(self, nick, question, parent=None): QDialog.__init__(self, parent) self.clickedButton = utils.BUTTON_CANCEL # Set the title and icon self.setWindowTitle("Authenticate %s" % nick) self.setWindowIcon(QIcon(qtUtils.getAbsoluteImagePath('icon.png'))) smpQuestionLabel = QLabel("Question: <b>%s</b>" % question, self) smpAnswerLabel = QLabel("Answer (case sensitive):", self) self.smpAnswerInput = QLineEdit(self) okayButton = QPushButton(QIcon.fromTheme('dialog-ok'), "OK", self) cancelButton = QPushButton(QIcon.fromTheme('dialog-cancel'), "Cancel", self) keyIcon = QLabel(self) keyIcon.setPixmap(QPixmap(qtUtils.getAbsoluteImagePath('fingerprint.png')).scaledToWidth(60, Qt.SmoothTransformation)) helpLabel = QLabel("%s has requested to authenticate your conversation by asking you a\n" "question only you should know the answer to. Enter your answer below\n" "to authenticate your conversation.\n\n" "You may wish to ask your buddy a question as well." % nick) okayButton.clicked.connect(lambda: self.buttonClicked(utils.BUTTON_OKAY)) cancelButton.clicked.connect(lambda: self.buttonClicked(utils.BUTTON_CANCEL)) helpLayout = QHBoxLayout() helpLayout.addStretch(1) helpLayout.addWidget(keyIcon) helpLayout.addSpacing(15) helpLayout.addWidget(helpLabel) helpLayout.addStretch(1) # Float the buttons to the right buttons = QHBoxLayout() buttons.addStretch(1) buttons.addWidget(okayButton) buttons.addWidget(cancelButton) vbox = QVBoxLayout() vbox.addLayout(helpLayout) vbox.addWidget(QLine()) vbox.addWidget(smpQuestionLabel) vbox.addWidget(smpAnswerLabel) vbox.addWidget(self.smpAnswerInput) vbox.addLayout(buttons) self.setLayout(vbox)
class PlotSetting_2d(PlotSetting): def __init__(self, parent, df): PlotSetting.__init__(self, parent=parent, df=df) self.general_scroll_area_content.setGeometry(QRect(0, 0, 460, 600)) # x_axis self.x = AxisBox_full('X', df) self.general_hbox_x = QHBoxLayout() self.general_hbox_x.addSpacing(10) self.general_hbox_x.addWidget(self.x) self.general_hbox_x.addSpacing(10) # y axis self.y = AxisBox_full('Y', df) self.general_hbox_y = QHBoxLayout() self.general_hbox_y.addSpacing(10) self.general_hbox_y.addWidget(self.y) self.general_hbox_y.addSpacing(10) self.general_vbox = QVBoxLayout() self.general_vbox.addLayout(self.general_hbox) self.general_vbox.addLayout(self.general_hbox_x) self.general_vbox.addLayout(self.general_hbox_y) self.general_scroll_area_content.setLayout(self.general_vbox) self.trendline_checkBox = QCheckBox(self.advance_group_box) self.advance_group_diff_by_gridLayout.addWidget( self.trendline_checkBox, 2, 0, 1, 1) self.trendline_combo_box = QComboBox(self.advance_group_box) self.advance_group_diff_by_gridLayout.addWidget( self.trendline_combo_box, 2, 1, 1, 3) self.trendline_combo_box.addItem("Least Squares Regression") self.trendline_combo_box.addItem("Locally Weighted Smoothing") self.trendline_combo_box.setEnabled(False) self.trendline_checkBox.stateChanged.connect( partial(self.checkBoxChangedAction, widgets=[self.trendline_combo_box])) self.trendline_checkBox.setText("trendline") def getCurrentInfo(self): info = super().getCurrentInfo() if self.trendline_checkBox.isChecked(): if self.trendline_combo_box.currentText( ) == "Least Squares Regression": info['trendline'] = 'lowess' elif self.trendline_combo_box.currentText( ) == "Locally Weighted Smoothing": info['trendline'] = 'ols' else: info['trendline'] = None return info
def __init__(self): super(MainWindow, self).__init__() self.selectedDate = QDate.currentDate() self.fontSize = 10 centralWidget = QWidget() dateLabel = QLabel("Date:") monthCombo = QComboBox() for month in range(1, 13): monthCombo.addItem(QDate.longMonthName(month)) yearEdit = QDateTimeEdit() yearEdit.setDisplayFormat('yyyy') yearEdit.setDateRange(QDate(1753, 1, 1), QDate(8000, 1, 1)) monthCombo.setCurrentIndex(self.selectedDate.month() - 1) yearEdit.setDate(self.selectedDate) self.fontSizeLabel = QLabel("Font size:") self.fontSizeSpinBox = QSpinBox() self.fontSizeSpinBox.setRange(1, 64) self.fontSizeSpinBox.setValue(10) self.editor = QTextBrowser() self.insertCalendar() monthCombo.activated.connect(self.setMonth) yearEdit.dateChanged.connect(self.setYear) self.fontSizeSpinBox.valueChanged.connect(self.setfontSize) controlsLayout = QHBoxLayout() controlsLayout.addWidget(dateLabel) controlsLayout.addWidget(monthCombo) controlsLayout.addWidget(yearEdit) controlsLayout.addSpacing(24) controlsLayout.addWidget(self.fontSizeLabel) controlsLayout.addWidget(self.fontSizeSpinBox) controlsLayout.addStretch(1) centralLayout = QVBoxLayout() centralLayout.addLayout(controlsLayout) centralLayout.addWidget(self.editor, 1) centralWidget.setLayout(centralLayout) self.setCentralWidget(centralWidget)
def _initControlPanel(self): layout = QHBoxLayout() layout.setContentsMargins(0,0,0,0) self._playButton = QPushButton(QIcon.fromTheme("media-playback-start"), "", self) self._playButton.setCheckable(True) self._playButton.setFocusPolicy(Qt.NoFocus) self._playButton.setToolTip(_("Play/Pause")) self._slider = QSlider(Qt.Horizontal, self) self._slider.setDisabled(True) self._timeLabel = QLabel("0:00:00.000", self) layout.addWidget(self._playButton) layout.addWidget(self._slider) layout.addWidget(self._timeLabel) layout.addSpacing(5) return layout
def gen_row(self, left_text, *widgets, **kw): row = QHBoxLayout() row.setContentsMargins(0, 0, 0, 0) row.setSpacing(0) row.addSpacing(16) left_widget = Builder().text(left_text).name('left').build() width = kw.get('left_width', 130) left_widget.setMinimumWidth(width) left_widget.setMaximumWidth(width) row.addWidget(left_widget) for widget in widgets: if isinstance(widget, QWidget): row.addWidget(widget) row.addSpacing(5) row.addStretch(1) return row
def initUI(self): self.setSizePolicy( QSizePolicy(QSizePolicy.Preferred, QSizePolicy.MinimumExpanding)) align = QHBoxLayout(self) align.setSizeConstraint(QLayout.SetMaximumSize) self.text.setWordWrap(True) ## self.text.setSizePolicy( ## QSizePolicy( ## QSizePolicy.ShrinkFlag | QSizePolicy.ExpandFlag, #### QSizePolicy.Preferred, ## QSizePolicy.MinimumExpanding ## ) ## ) align.addWidget(self.text) align.addStretch(0) align.addSpacing(20)
def firstLine(self): hbox = QHBoxLayout() self.titleLabel = QLabel("x. Skill Name") self.rankLabel = QLabel("Rank x") self.levelLabel = QLabel("Level X") self.titleLabel.setFont(QFont("Arial", 8, QFont.Bold)) hbox.addWidget(self.titleLabel) hbox.addSpacing(5) hbox.addWidget(self.rankLabel) hbox.addStretch(1) hbox.addWidget(self.levelLabel) return hbox
class ListItem (QWidget): def __init__(self, name=None, drawer=None, current_path=None, parent=None): super(ListItem, self).__init__(parent) self.current_path = current_path self.parent = parent self.file_layout = QHBoxLayout() self.file_layout.setContentsMargins(5, 5, 5, 0) self.name_label = QLabel("") self.size_label = QLabel("") self.name_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.size_label.setAlignment(Qt.AlignRight) self.file_layout.addWidget(self.name_label) self.file_layout.addWidget(self.size_label) self.file_layout.addSpacing(5) self.setLayout(self.file_layout) self.drawer = drawer self.name = name self.set_text(name) def set_text(self, text, text2="Drawer"): if self.drawer: self.setStyleSheet('''color: rgb(0, 0, 255);''') self.size_label.setText(text2) else: self.setStyleSheet('''color: rgb(0, 0, 0);''') filesize = os.path.getsize(self.current_path + self.name) self.size_label.setText(self.GetHumanReadable(filesize)) # self.size_label.setText("file") self.name_label.setText(self.name) def mouseDoubleClickEvent(self, event): if event.buttons() == Qt.LeftButton: if self.drawer: self.parent.create_list(current_path=self.current_path + self.name) else: self.parent.file_field.set_text(name=self.name, path=self.current_path) def xyz(self): return self.name def GetHumanReadable(self, size, precision=2): suffixes = ['B', 'KB', 'MB', 'GB', 'TB'] suffixIndex = 0 while size > 1024 and suffixIndex < 4: suffixIndex += 1 # increment the index of the suffix size = size/1024.0 # apply the division return "%.*f%s" % (precision, size, suffixes[suffixIndex])
class Ui(object): def __init__(self, app): super().__init__() self._app = app self.login_dialog = LoginDialog(self._app, self._app) self.login_btn = LoginButton(self._app) self._lb_container = FFrame() self.songs_table_container = SongsTable_Container(self._app) self.fm_item = LP_GroupItem(self._app, '私人FM') self.fm_item.set_img_text('Ω') self.recommend_item = LP_GroupItem(self._app, '每日推荐') self.recommend_item.set_img_text('✦') self.simi_item = LP_GroupItem(self._app, '相似歌曲') self.simi_item.set_img_text('∾') self._lbc_layout = QHBoxLayout(self._lb_container) self.setup() def setup(self): self._lbc_layout.setContentsMargins(0, 0, 0, 0) self._lbc_layout.setSpacing(0) self._lbc_layout.addWidget(self.login_btn) self.login_btn.setFixedSize(30, 30) self._lbc_layout.addSpacing(10) tp_layout = self._app.ui.top_panel.layout() tp_layout.addWidget(self._lb_container) def on_login_in(self): self.login_btn.setToolTip('点击可刷新歌单列表') if self.login_dialog.isVisible(): self.login_dialog.hide() library_panel = self._app.ui.central_panel.left_panel.library_panel library_panel.add_item(self.fm_item) library_panel.add_item(self.simi_item) self.hide_simi_item() library_panel.add_item(self.recommend_item) def show_simi_item(self): self.simi_item.show() def hide_simi_item(self): self.simi_item.hide()
def __init__(self, name, listener, init, min=0, max=100, default=50, logarithmic=False, log_base=2): super(QWidget, self).__init__() hbox = QHBoxLayout() self.listener = listener self.name = name self.default = default self.min = min self.max = max self.logarithmic = logarithmic self.log_base = log_base self.log_factor = 100.0 / math.log(max - min + 1, log_base) self.name_label = QLabel(name, self) self.name_label.setMaximumWidth(100) self.name_label.setMinimumWidth(100) self.slider = QSlider(Qt.Horizontal, self) self.slider.setRange(min if not self.logarithmic else 0, max if not self.logarithmic else 100) self.slider.setFocusPolicy(Qt.NoFocus) self.slider.setPageStep(5) self.slider.valueChanged.connect( self._change_value if not self.logarithmic else lambda x: self. _change_value(self._value_from_range(x))) self.label = QLineEdit('0', self) self.label.setAlignment(Qt.AlignCenter | Qt.AlignVCenter) self.label.setMaximumWidth(80) self.label.editingFinished.connect( lambda: self._change_value(str(self.label.text()))) hbox.addWidget(self.name_label) hbox.addWidget(self.slider) hbox.addWidget(self.label) hbox.addSpacing(15) self.setLayout(hbox) self._change_value(init)
def _getColorsGroupBox(self): self.targetComboBox = QComboBox() self._populateTargetComboBox() self.targetComboBox.currentIndexChanged.connect( self._updateHighlightTab) targetLayout = QHBoxLayout() targetLayout.addWidget(self.targetComboBox) targetLayout.addStretch() colors = self.getColorList() self.bgColorComboBox = QComboBox() self.bgColorComboBox.addItems(colors) setComboBoxItem(self.bgColorComboBox, self.settings['highlightBgColor']) self.bgColorComboBox.currentIndexChanged.connect( self._updateColorPreview) self.textColorComboBox = QComboBox() self.textColorComboBox.addItems(colors) setComboBoxItem(self.textColorComboBox, self.settings['highlightTextColor']) self.textColorComboBox.currentIndexChanged.connect( self._updateColorPreview) bgColorLabel = QLabel('Background') bgColorLayout = QHBoxLayout() bgColorLayout.addWidget(bgColorLabel) bgColorLayout.addSpacing(10) bgColorLayout.addWidget(self.bgColorComboBox) textColorLabel = QLabel('Text') textColorLayout = QHBoxLayout() textColorLayout.addWidget(textColorLabel) textColorLayout.addSpacing(10) textColorLayout.addWidget(self.textColorComboBox) layout = QVBoxLayout() layout.addLayout(bgColorLayout) layout.addLayout(textColorLayout) layout.addStretch() groupBox = QGroupBox('Colors') groupBox.setLayout(layout) return groupBox
def generate_work_time_input_layout(self): layout = QHBoxLayout() minus_button = QPushButton('-', font=self.button_font) minus_button.clicked.connect(self.work_time_minus_action) layout.addWidget(minus_button) layout.addSpacing(20) self.work_time_input = QLabel("%02d:%02d" % ( 6, 0 ), alignment=Qt.AlignCenter, font=self.input_font) layout.addWidget(self.work_time_input) layout.addSpacing(20) plus_button = QPushButton('+', font=self.button_font) plus_button.clicked.connect(self.work_time_plus_action) layout.addWidget(plus_button) return layout
def init_gui(self): # NO MODIFICAR self.setWindowTitle("Seleccion personajes") # Creamos la grilla central grilla = QGridLayout() # Definimos los espacios entre elementos para que "calcen" con la imagen de fondo grilla.setHorizontalSpacing(4) grilla.setVerticalSpacing(8) numero_pj = 1 # Contador del elemento for fila in range(3): for columna in range(4): # Creamos una label, le seteamos la foto adecuada, el tamano y el estilo foto = QLabel() foto.setPixmap(QPixmap(self.rutas[f"personaje_{numero_pj}"])) foto.setStyleSheet("border: 4px solid rgb(252, 233, 0)") foto.setFixedSize(105, 153) # Agregamos la foto en la posicion y vamos al siguiente personaj grilla.addWidget(foto, fila, columna) numero_pj += 1 # Creamos un VBox y un Hbox que centre la label de grilla de personajes. Le damos este # layout a la label que contiene la grilla vbox = QVBoxLayout(self.grilla_personajes) vbox.addSpacing(50) hbox = QHBoxLayout() hbox.addSpacing(45) hbox.addLayout(grilla) hbox.addSpacing(40) vbox.addLayout(hbox) # Le damos la imagen de fondo al contenedor de la grilla self.grilla_personajes.setPixmap(QPixmap(self.ruta_fondo)) self.grilla_personajes.setScaledContents(True) # Esta es la seccion de botones inferiores. self.spinbox_personaje.setRange(1, 12) self.boton_comenzar = QPushButton("Iniciar combate") # Aqui definimos el layout general hbox_inferior = QHBoxLayout() hbox_inferior.addStretch() hbox_inferior.addWidget(self.spinbox_personaje) hbox_inferior.addWidget(self.boton_comenzar) vbox_total = QVBoxLayout(self) vbox_total.setContentsMargins(0, 0, 0, 0) vbox_total.addWidget(self.grilla_personajes) vbox_total.addStretch() vbox_total.addLayout(hbox_inferior) # Por ultimo, conectamos la señal self.boton_comenzar.clicked.connect(self.iniciar_combate)
def __init__(self, mosaic): QWidget.__init__(self) self.mosaic = mosaic title = mosaic_title(mosaic) self.nameLabel = QLabel( f'<span style="color:black;"><b>{title}</b></span>' f'<br><span style="color:grey;">{mosaic[NAME]}</span>') self.iconLabel = QLabel() self.toolsButton = QLabel() self.toolsButton.setPixmap(COG_ICON.pixmap(QSize(18, 18))) self.toolsButton.mousePressEvent = self.showContextMenu pixmap = QPixmap(PLACEHOLDER_THUMB, "SVG") thumb = pixmap.scaled(48, 48, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.iconLabel.setPixmap(thumb) self.checkBox = QCheckBox("") self.checkBox.stateChanged.connect(self.basemapSelected.emit) layout = QHBoxLayout() layout.setMargin(2) layout.addWidget(self.checkBox) vlayout = QVBoxLayout() vlayout.setMargin(0) vlayout.addWidget(self.iconLabel) self.iconWidget = QWidget() self.iconWidget.setFixedSize(48, 48) self.iconWidget.setLayout(vlayout) layout.addWidget(self.iconWidget) layout.addWidget(self.nameLabel) layout.addStretch() layout.addWidget(self.toolsButton) layout.addSpacing(10) self.setLayout(layout) if THUMB in mosaic[LINKS]: download_thumbnail(mosaic[LINKS][THUMB], self) else: THUMBNAIL_DEFAULT_URL = ( "https://tiles.planet.com/basemaps/v1/planet-tiles/" "{name}/thumb?api_key={apikey}") download_thumbnail( THUMBNAIL_DEFAULT_URL.format( name=mosaic[NAME], apikey=PlanetClient.getInstance().api_key()), self, )
def _mk_button_layout(self, lang): ret = QHBoxLayout() btn_ok = QPushButton("Ok") btn_ok.resize(40, 30) btn_ok.clicked.connect(lambda _: self._save()) btn_cancel = QPushButton(Strings.str_LABEL_CANCEL.get(lang)) btn_cancel.resize(40, 30) btn_cancel.clicked.connect(lambda _: self.close()) ret.addStretch(1) ret.addWidget(btn_ok) ret.addSpacing(10) ret.addWidget(btn_cancel) return ret
class RightWidgetGroup(QWidget): """ 播放按钮组 """ def __init__(self, parent=None): super().__init__(parent) # 创建小部件 self.volumeButton = VolumeButton(self) self.volumeSlider = Slider(Qt.Horizontal, self) self.smallPlayModeButton = BasicButton( r"app\resource\images\playBar\最小播放模式_45_45.png", self ) self.moreActionsButton = BasicButton( r"app\resource\images\playBar\更多操作_45_45.png", self ) self.widget_list = [ self.volumeButton, self.volumeSlider, self.smallPlayModeButton, self.moreActionsButton, ] # 创建布局 self.h_layout = QHBoxLayout() # 初始化界面 self.__initWidget() self.__initLayout() def __initWidget(self): """ 初始化小部件 """ self.setFixedSize(301, 16 + 67) self.volumeSlider.setRange(0, 100) self.volumeSlider.setObjectName("volumeSlider") # 将音量滑动条数值改变信号连接到槽函数 self.volumeSlider.setValue(20) def __initLayout(self): """ 初始化布局 """ self.__spacing_list = [7, 8, 8, 5, 7] self.h_layout.setSpacing(0) self.h_layout.setContentsMargins(0, 0, 0, 0) # 将小部件添加到布局中 for i in range(4): self.h_layout.addSpacing(self.__spacing_list[i]) self.h_layout.addWidget(self.widget_list[i]) else: self.h_layout.addSpacing(self.__spacing_list[-1]) self.setLayout(self.h_layout)
class _NotifySubWidget(QFrame): def __init__(self, parent=None): super().__init__(parent) self.setStyleSheet(""" background: #1A2F39; border-radius: 10px; """) self._layout = QHBoxLayout(self) self._img_label = QLabel(self) self._img_label.setFixedSize(60, 60) self._vlayout = QVBoxLayout() self._title_label = QLabel(self) self._content_label = QLabel(self) self._vlayout.addWidget(self._title_label) self._vlayout.addWidget(self._content_label) self._layout.addWidget(self._img_label) self._layout.addSpacing(10) self._layout.addLayout(self._vlayout) self._init_widget_props() def _init_widget_props(self): self._title_label.setStyleSheet(""" font-size: 16px; font-weight: bold; color: #558ACF; """) self._content_label.setStyleSheet(""" color: #FBF7E4; """) self._content_label.setWordWrap(True) def set_title(self, title): self._title_label.setText(title) def set_content(self, content): self._content_label.setText(content) def set_pixmap(self, pixmap): self._img_label.setPixmap( pixmap.scaled(self._img_label.size(), transformMode=Qt.SmoothTransformation))
def __init__(self, parent=None, f=Qt.ToolTip | Qt.FramelessWindowHint): super(Notification, self).__init__(parent, f) self.parent = parent self.theme = self.parent.theme self.setObjectName('notification') self.setWindowModality(Qt.NonModal) self.setMinimumWidth(450) self._title, self._message = '', '' self._icons = dict() self.buttons = list() self.msgLabel = QLabel(self) self.msgLabel.setWordWrap(True) logo = QPixmap(82, 82) logo.load(':/images/vidcutter-small.png', 'PNG') logo_label = QLabel(self) logo_label.setPixmap(logo) self.left_layout = QVBoxLayout() self.left_layout.addWidget(logo_label) self.right_layout = QVBoxLayout() self.right_layout.addWidget(self.msgLabel) if sys.platform != 'win32': effect = QGraphicsOpacityEffect() effect.setOpacity(1) self.window().setGraphicsEffect(effect) self.animations = QSequentialAnimationGroup(self) self.pauseAnimation = self.animations.addPause( int(self.duration / 2 * 1000)) opacityAnimation = QPropertyAnimation(effect, b'opacity', self.animations) opacityAnimation.setDuration(2000) opacityAnimation.setStartValue(1.0) opacityAnimation.setEndValue(0.0) opacityAnimation.setEasingCurve(QEasingCurve.InOutQuad) self.animations.addAnimation(opacityAnimation) self.animations.finished.connect(self.close) self.shown.connect(self.fadeOut) else: self.shown.connect( lambda: QTimer.singleShot(self.duration * 1000, self.fadeOut)) layout = QHBoxLayout() layout.addStretch(1) layout.addLayout(self.left_layout) layout.addSpacing(10) layout.addLayout(self.right_layout) layout.addStretch(1) self.setLayout(layout)
def initUI(self, parent, game): self.game = game # Layout # table Head hboxHead = QHBoxLayout() self.blackHeadL = QLabel("Black") hboxHead.addWidget(self.blackHeadL) hboxHead.addSpacing(10) self.whiteHeadL = QLabel("White") hboxHead.addWidget(self.whiteHeadL) # Player names and rank row hboxPlayers = QHBoxLayout() blackLabel = QLabel() blackLabel.setText(game.playerBlack.name + " (" + game.playerBlack.rank + ")") hboxPlayers.addWidget(blackLabel) hboxPlayers.addSpacing(10) whiteLabel = QLabel() whiteLabel.setText(game.playerWhite.name + " (" + game.playerWhite.rank + ")") hboxPlayers.addWidget(whiteLabel) # Captures row hboxCaps = QHBoxLayout() self.blackCapsL = QLabel("Caps: " + str(self.game.currentBoard.capsBlack)) self.whiteCapsL = QLabel("Caps: " + str(self.game.currentBoard.capsWhite)) hboxCaps.addWidget(self.blackCapsL) hboxCaps.addWidget(self.whiteCapsL) vbox = QVBoxLayout() # Main Vertical Box Layout vbox.addLayout(hboxHead) vbox.addLayout(hboxPlayers) vbox.addLayout(hboxCaps) self.setLayout(vbox) # initial update self.updateSlot() # signals parent.updateSignal.connect(self.updateSlot)
def drawWindow(self): VLayout = QVBoxLayout() rowLayout = QHBoxLayout() titleLblStyleSheet = 'QLabel {font-weight: bold;}' rowLayout.setAlignment(Qt.AlignLeft) rowLayout.addSpacing(10) titleLbl = QLabel('Select the behaviour to import:') titleLbl.setStyleSheet(titleLblStyleSheet) rowLayout.addWidget(titleLbl) VLayout.addLayout(rowLayout) scrollArea = QScrollArea() scrollArea.setWidgetResizable(True) scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.scrollVlayout = QVBoxLayout() self.scrollVlayout.setDirection(QBoxLayout.TopToBottom) self.scrollVlayout.setAlignment(Qt.AlignTop) dummyBox = QGroupBox() dummyBox.setStyleSheet('QGroupBox {padding: 0px; margin: 0px;}') dummyBox.setLayout(self.scrollVlayout) scrollArea.setWidget(dummyBox) VLayout.addWidget(scrollArea) btnLayout = QHBoxLayout() btnLayout.setAlignment(Qt.AlignRight) cancelBtn = QPushButton("Cancel") cancelBtn.setFixedWidth(80) cancelBtn.clicked.connect(self.cancelClicked) btnLayout.addWidget(cancelBtn) VLayout.addLayout(btnLayout) self.statusLbl = QLabel('') VLayout.addWidget(self.statusLbl) self.setLayout(VLayout) self.show() self.setStatus("Fetching Catalogue . . .") self.getCatalogue = DownloadFile("Catalogue.xml") self.getCatalogue.fileStr.connect(self.displayCatalogue) self.getCatalogue.start()
def __init__(self, settings, parent=None): super(self.__class__, self).__init__(parent) self.settings = settings tableWidget = QTableWidget(6, 1) tableWidget.setItem(0, 0, QTableWidgetItem(settings.parser.Equal)) tableWidget.setItem(0, 1, QTableWidgetItem(settings.parser.Implies)) tableWidget.setItem(0, 2, QTableWidgetItem(settings.parser.Not)) tableWidget.setItem(0, 3, QTableWidgetItem(settings.parser.Or)) tableWidget.setItem(0, 4, QTableWidgetItem(settings.parser.And)) tableWidget.setItem(0, 5, QTableWidgetItem(settings.parser.Xor)) tableWidget.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents) headerLabels = ("Equal", "Implies", "Not", "Or", "And", "Xor") tableWidget.setVerticalHeaderLabels(headerLabels) tableWidget.setEditTriggers(QAbstractItemView.DoubleClicked | QAbstractItemView.SelectedClicked) tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows) tableWidget.resizeColumnsToContents() tableWidget.horizontalHeader().setVisible(False) resetButton = QPushButton("Reset") resetButton.clicked.connect(self.__reset) defaultButton = QPushButton("Default") defaultButton.clicked.connect(self.__default) self.tableWidget = tableWidget buttonLayout = QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(resetButton) buttonLayout.addWidget(defaultButton) buttonLayout.addSpacing(12) tableLayout = QHBoxLayout() tableLayout.addStretch(1) tableLayout.addWidget(tableWidget) tableLayout.addStretch(1) tableLayout.addSpacing(12) mainLayout = QVBoxLayout() mainLayout.addLayout(tableLayout) mainLayout.addLayout(buttonLayout) mainLayout.addStretch(1) self.setLayout(mainLayout)
def __init__(self, parent=None): QWidget.__init__(self, parent) # Create connecting image self.connectingGif = QMovie(qtUtils.getAbsoluteImagePath('waiting.gif')) self.connectingGif.start() self.connetingImageLabel = QLabel(self) self.connetingImageLabel.setMovie(self.connectingGif) self.connectingLabel = QLabel(self) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.connetingImageLabel, alignment=Qt.AlignCenter) hbox.addSpacing(10) hbox.addWidget(self.connectingLabel, alignment=Qt.AlignCenter) hbox.addStretch(1) self.setLayout(hbox)
def secondLine(self): hbox = QHBoxLayout() self.spLabel = QLabel("SP: ") self.spPerHourLabel = QLabel("SP/Hour: ") self.trainingTimeLabel = QLabel("Training Time: ") self.progressLabel = QLabel(" % Done") hbox.addWidget(self.spLabel) hbox.addSpacing(5) hbox.addWidget(self.spPerHourLabel) hbox.addSpacing(5) hbox.addWidget(self.trainingTimeLabel) hbox.addStretch(1) hbox.addWidget(self.progressLabel) return hbox
def make_buttonbar(self): '''Returns bottom buttonbar widget''' widget = QWidget() layout = QHBoxLayout() self.about_button = QPushButton('About') self.about_button.clicked.connect(self.onclick_about) layout.addWidget(self.about_button) layout.addSpacing(int(MainWindow.WIDTH * 0.5)) self.launch_button = QPushButton('Launch') self.launch_button.clicked.connect(self.onclick_launch) layout.addWidget(self.launch_button) widget.setLayout(layout) return widget
def __init__(self, parent=None, device=None): super(KeyController, self).__init__(parent) layout = QHBoxLayout() self.l1 = QLabel("Press UP,DOWN keys to move servo angle: ") self.l1.setAlignment(Qt.AlignCenter) self.label = QLabel("0", self) self.label.setAlignment(Qt.AlignCenter | Qt.AlignVCenter) self.label.setMinimumWidth(80) self.angle = 0 layout.addSpacing(15) layout.addWidget(self.l1) layout.addWidget(self.label) self.setLayout(layout) self.setGeometry(10, 10, 350, 250) self.device = device
def ui(self, widget): layout = QVBoxLayout(widget) layout.setSpacing(20) self.loading = Loading() layout.addLayout(self.gen_row('Payment password:'******'', self.loading, left_width=120)) self.loading.hide() hbox = QHBoxLayout() hbox.addStretch(1) self.ok = Button.Builder(width=100, height=28).style( 'primary').click(self.beforeSend).text('OK').build() hbox.addWidget(self.ok) hbox.addSpacing(5) layout.addLayout(hbox) return layout
def add_xrange_widget_view(self): """Add widgets below the view combobox to select the x-range applied to view transformation""" hlayout = QHBoxLayout() hlayout.addStretch() # eta self.eta_view = QLineEdit("4") self.eta_view.setToolTip("Value of steady state viscosity") self.eta_view.editingFinished.connect(self.set_eta) self.eta_view.setMaximumWidth(35) self.eta_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.eta_label = QLabel("<b>log(eta)</b>") hlayout.addWidget(self.eta_label) hlayout.addWidget(self.eta_view) # space hlayout.addSpacing(5) # xmin self.xmin_view = QLineEdit("-inf") self.xmin_view.setToolTip("Discard data points below this value before i-Rheo transformation") self.xmin_view.editingFinished.connect(self.set_xmin) self.xmin_view.setMaximumWidth(35) self.xmin_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.xmin_label = QLabel("<b>log(t<sub>min</sub>)</b>") hlayout.addWidget(self.xmin_label) hlayout.addWidget(self.xmin_view) # space hlayout.addSpacing(5) # xmax self.xmax_view = QLineEdit("inf") self.xmax_view.setToolTip("Discard data points above this value before i-Rheo transformation") self.xmax_view.editingFinished.connect(self.set_xmax) self.xmax_view.setMaximumWidth(35) self.xmax_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.xmax_label = QLabel(" <b>log(t<sub>max</sub>)</b>") hlayout.addWidget(self.xmax_label) hlayout.addWidget(self.xmax_view) # push button to refresh view self.pb = QPushButton("GO") self.pb.setMaximumWidth(25) self.pb.clicked.connect(self.update_all_ds_plots) hlayout.addWidget(self.pb) self.hlayout_view = hlayout self.ViewDataTheoryLayout.insertLayout(1, self.hlayout_view)
def add_xrange_widget_view(self): """Add widgets below the view combobox to select the x-range applied to view transformation""" hlayout = QHBoxLayout() hlayout.addStretch() #eta self.eta_view = QLineEdit("4") self.eta_view.textChanged.connect(self.change_eta) self.eta_view.setValidator(QDoubleValidator()) self.eta_view.setMaximumWidth(35) self.eta_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.eta_label = QLabel("<b>log(eta)</b>") hlayout.addWidget(self.eta_label) hlayout.addWidget(self.eta_view) #space hlayout.addSpacing(5) #xmin self.xmin_view = QLineEdit("-inf") self.xmin_view.textChanged.connect(self.change_xmin) self.xmin_view.setValidator(QDoubleValidator()) self.xmin_view.setMaximumWidth(35) self.xmin_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.xmin_label = QLabel("<b>log(t<sub>min</sub>)</b>") hlayout.addWidget(self.xmin_label) hlayout.addWidget(self.xmin_view) #space hlayout.addSpacing(5) #xmax self.xmax_view = QLineEdit("inf") self.xmax_view.textChanged.connect(self.change_xmax) self.xmax_view.setValidator(QDoubleValidator()) self.xmax_view.setMaximumWidth(35) self.xmax_view.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.xmax_label = QLabel(" <b>log(t<sub>max</sub>)</b>") hlayout.addWidget(self.xmax_label) hlayout.addWidget(self.xmax_view) #push button to refresh view self.pb = QPushButton("GO") self.pb.setMaximumWidth(25) self.pb.clicked.connect(self.update_all_ds_plots) hlayout.addWidget(self.pb) self.hlayout_view = hlayout self.ViewDataTheoryLayout.insertLayout(1, self.hlayout_view)
def initUI(self): # ボタンを生成 # buttons = { # "L": [Button, Button, ...], # "CL": [...], # "C": [...] # ... # } buttons = {} for name in ("L", "CL", "C", "CR", "R"): buttons[name] = [ QPushButton(name + "_" + str(i), self) for i in range(4) ] # レイアウトウィジェット hBox = QHBoxLayout() vBoxes = {} # 各列に対してボタンを設置し, for name in ("L", "CL", "C", "CR", "R"): # vBoxレイアウトウィジェットの生成 vBoxes[name] = QVBoxLayout() # ボタンを縦に4つvBoxにセット for i in range(4): vBoxes[name].addWidget(buttons[name][i]) # vBoxをhBoxにセット hBox.addLayout(vBoxes[name]) # vBox間にスペースを入れる if name != "R": hBox.addSpacing(10) # CLとCの間に伸縮スペースを入れる if name == "CL": hBox.addStretch(100) self.setLayout(hBox) #vBoxをMyWidgetに追加 self.show()
def __init__(self, parent, icon_name): super(Titlebar, self).__init__(parent) self.parentwidget = parent self.setFixedHeight(Titlebar.TITLEBAR_HEIGHT) self.icon_name = icon_name self.m_pBackgroundLabel = QLabel(self) self.m_pIconLabel = QLabel(self) self.m_pTitleLabel = QLabel(self) self.m_pMinimizeButton = QPushButton(self) self.m_pReturnButton = QPushButton(self) self.m_pCloseButton = QPushButton(self) self.m_pIconLabel.setFixedSize(Titlebar.ICON_SIZE) self.m_pIconLabel.setScaledContents(True) self.m_pTitleLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.m_pBackgroundLabel.setObjectName(Titlebar.BACKGROUND_LABEL_NAME) # 三大金刚按钮大小 self.m_pReturnButton.setFixedSize(Titlebar.RET_BUTT_SIZE) self.m_pMinimizeButton.setFixedSize(Titlebar.MIN_BUTT_SIZE) self.m_pCloseButton.setFixedSize(Titlebar.CLOSE_BUTT_SIZE) # 统一设置ObjName self.m_pTitleLabel.setObjectName(Titlebar.TITLE_LABEL_NAME) self.m_pBackgroundLabel.resize(self.parentwidget.width(), Titlebar.TITLEBAR_HEIGHT) self.m_pReturnButton.setObjectName(Titlebar.RET_BUTT_NAME) self.m_pMinimizeButton.setObjectName(Titlebar.MIN_BUTT_NAME) self.m_pCloseButton.setObjectName(Titlebar.CLOSE_BUTT_NAME) # 布局 pLayout = QHBoxLayout(self) pLayout.addWidget(self.m_pIconLabel) pLayout.addSpacing(5) pLayout.addWidget(self.m_pTitleLabel) pLayout.addWidget(self.m_pReturnButton) pLayout.addWidget(self.m_pMinimizeButton) pLayout.addWidget(self.m_pCloseButton) pLayout.setSpacing(0) pLayout.setContentsMargins(5, 0, 5, 0) self.setLayout(pLayout) # 信号连接 self.m_pReturnButton.clicked.connect(self.__slot_onclicked) self.m_pMinimizeButton.clicked.connect(self.__slot_onclicked) self.m_pCloseButton.clicked.connect(self.__slot_onclicked) # 置中 self.center()
class ProductWidget(QFrame): clicked = QtCore.pyqtSignal() def __init__(self, product: Product, parent=None): super().__init__(parent=parent) self.product = product self.name = QVBoxLayout() self.line = QHBoxLayout() self.title = QLabel() self.image = ImageWidget(self.product.image, 40) self.price = QLabel() self.count = QLabel() self.initUI() def initUI(self): self.setObjectName('product') self.setFixedHeight(72) self.line.setContentsMargins(0, 15, 0, 15) self.title.setObjectName('product_title') self.price.setObjectName('product_price') self.count.setObjectName('product_count') self.title.setText(self.product.name) self.price.setText(self.product.selling_price) self.count.setText(self.product.count) self.name.addWidget(self.title) self.name.addWidget(self.count) self.line.addSpacing(8) self.line.addWidget(self.image) self.line.addLayout(self.name) self.line.addStretch(1) self.line.addWidget(self.price) self.setLayout(self.line) def mousePressEvent(self, event: QMouseEvent) -> None: self.clicked.emit()
class TableOverview(QFrame): def __init__(self, parent): super().__init__(parent) self._height = 180 self.cover_label = QLabel(self) self._desc_container = DescriptionContainer(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self._layout = QHBoxLayout(self) self._left_sub_layout = QVBoxLayout() self._right_sub_layout = QVBoxLayout() self._right_sub_layout.addWidget(self._desc_container) self._left_sub_layout.addWidget(self.cover_label) self._left_sub_layout.addStretch(0) self._layout.addLayout(self._left_sub_layout) self._layout.addSpacing(20) self._layout.addLayout(self._right_sub_layout) self._layout.setStretch(1, 1) self.cover_label.setFixedWidth(200) self.setFixedHeight(self._height) def set_cover(self, pixmap): self.cover_label.setPixmap( pixmap.scaledToWidth(self.cover_label.width(), mode=Qt.SmoothTransformation)) def set_desc(self, desc): self._desc_container.show() self._desc_container.set_html(desc) def keyPressEvent(self, event): key_code = event.key() if key_code == Qt.Key_Space: if self._height < 300: self._height = 300 self.setMinimumHeight(self._height) self.setMaximumHeight(self._height) else: self._height = 180 self.setMinimumHeight(self._height) self.setMaximumHeight(self._height) event.accept()
def __init__(self, Wizard, parent=None): super(SubpackagesPage, self).__init__(parent) self.base = Wizard.base self.tree = self.SubpackTreeWidget(self) self.setTitle(self.tr("Subpackages page")) self.setSubTitle(self.tr("Choose subpackages")) filesLabel = QLabel("Do not include: ") subpackagesLabel = QLabel("Packages: ") self.addPackButton = QPushButton("+") self.addPackButton.setMaximumWidth(68) self.addPackButton.setMaximumHeight(60) self.addPackButton.clicked.connect(self.openSubpackageDialog) self.removePackButton = QPushButton("-") self.removePackButton.setMaximumWidth(68) self.removePackButton.setMaximumHeight(60) self.removePackButton.clicked.connect(self.removeItem) self.transferButton = QPushButton("->") self.transferButton.setMaximumWidth(120) self.transferButton.setMaximumHeight(20) self.transferButton.clicked.connect(self.moveFileToTree) self.filesListWidget = QListWidget() mainLayout = QVBoxLayout() upperLayout = QHBoxLayout() lowerLayout = QHBoxLayout() upperLayout.addSpacing(150) upperLayout.addWidget(filesLabel) upperLayout.addSpacing(190) upperLayout.addWidget(subpackagesLabel) upperLayout.addWidget(self.addPackButton) upperLayout.addWidget(self.removePackButton) lowerLayout.addWidget(self.filesListWidget) lowerLayout.addWidget(self.transferButton) lowerLayout.addWidget(self.tree) mainLayout.addLayout(upperLayout) mainLayout.addLayout(lowerLayout) self.setLayout(mainLayout)
def initUI(self): hbox = QHBoxLayout() sbox = QSpinBox(self) sbox.valueChanged.connect(self.updateLabel) self.label = QLabel('0', self) hbox.addWidget(sbox) hbox.addSpacing(15) hbox.addWidget(self.label) self.setLayout(hbox) self.setGeometry(300, 300, 350, 250) self.setWindowTitle('QSpinBox') self.show()
def _initUI(self): base = QVBoxLayout(self) widget = QHBoxLayout() self.txt_name, self.cb_comp, self.cb_type, left = self._mk_left_layout( self.lang, self.companies, self.colorTypes) self.txt_article_id, self.cb_owned, self.cb_inSto, right = self._mk_right_layout( self.lang) buttons = self._mk_button_layout(self.lang) widget.addLayout(left) widget.addSpacing(5) widget.addLayout(right) base.addLayout(widget) base.addSpacing(10) base.addLayout(buttons)
def __init__(self, parent, text=""): QDialog.__init__(self, parent) # Create waiting image waitingImage = QMovie(qtUtils.getAbsoluteImagePath('waiting.gif')) waitingImage.start() waitingImageLabel = QLabel(self) waitingImageLabel.setMovie(waitingImage) waitingLabel = QLabel(text, self) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(waitingImageLabel) hbox.addSpacing(10) hbox.addWidget(waitingLabel) hbox.addStretch(1) self.setLayout(hbox)
def __init__(self, parent): super(Titlebar, self).__init__(parent) self.parentwidget = parent self.setFixedHeight(Titlebar.TITLEBAR_HEIGHT) self.m_pBackgroundLabel = QLabel(self) self.m_pIconLabel = QLabel(self) self.m_pTitleLabel = QLabel(self) self.m_pMinimizeButton = QPushButton(self) self.m_pMaximizeButton = QPushButton(self) self.m_pCloseButton = QPushButton(self) self.m_pIconLabel.setFixedSize(Titlebar.ICON_SIZE) self.m_pIconLabel.setScaledContents(True) self.m_pTitleLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.m_pBackgroundLabel.setObjectName(Titlebar.BACKGROUND_LABEL_NAME) # 三大金刚按钮大小 self.m_pMinimizeButton.setFixedSize(Titlebar.MIN_BUTT_SIZE) self.m_pMaximizeButton.setFixedSize(Titlebar.MAX_BUTT_SIZE) self.m_pCloseButton.setFixedSize(Titlebar.CLOSE_BUTT_SIZE) # 统一设置ObjName self.m_pTitleLabel.setObjectName(Titlebar.TITLE_LABEL_NAME) self.m_pBackgroundLabel.resize(self.parentwidget.width(), Titlebar.TITLEBAR_HEIGHT) self.m_pMinimizeButton.setObjectName(Titlebar.MIN_BUTT_NAME) self.m_pMaximizeButton.setObjectName(Titlebar.MAX_BUTT_NAME) self.m_pCloseButton.setObjectName(Titlebar.CLOSE_BUTT_NAME) # 三大金刚按钮图片设置 self.setButtonImages() # 布局 pLayout = QHBoxLayout(self) pLayout.addWidget(self.m_pIconLabel) pLayout.addSpacing(10) pLayout.addWidget(self.m_pTitleLabel) pLayout.addWidget(self.m_pMinimizeButton) pLayout.addWidget(self.m_pMaximizeButton) pLayout.addWidget(self.m_pCloseButton) pLayout.setSpacing(1) pLayout.setContentsMargins(5, 0, 5, 0) self.setLayout(pLayout) # 信号连接 self.m_pMinimizeButton.clicked.connect(self.__slot_onclicked) self.m_pMaximizeButton.clicked.connect(self.__slot_onclicked) self.m_pCloseButton.clicked.connect(self.__slot_onclicked) # 设置默认样式(bar的字颜色和背景颜色) self.setTitleBarStyle(Titlebar.BGD_COLOR, Titlebar.TITLE_TEXT_COLOR)
def __init__(self, name_variables, precision_slds, lower_bounds, upper_bounds, slider_fun, button_names, button_funs): super(ViewHandTuner, self).__init__() # initialize window self.setGeometry(350, 40, 1000, 550) self.setWindowTitle('HandTuner') # create left-hand side (slider and buttons) layout_left = QVBoxLayout() self.slds = list() for i in range(len(name_variables)): layout_sld, sld = self.create_slider(name_variables[i], i, precision_slds[i], lower_bounds[i], upper_bounds[i], slider_fun) self.slds.append(sld) layout_left.addLayout(layout_sld) layout_left.addSpacing(50) for i in range(len(button_names)): btn = self.create_button(button_names[i], button_funs[i]) layout_left.addWidget(btn) # create right-hand side (images) layout_right = QVBoxLayout() self.imgs = list() for i in range(2): self.imgs.append(dict()) self.imgs[i]['fig'] = pl.figure(tight_layout=True) self.imgs[i]['ax'] = self.imgs[i]['fig'].add_subplot(111) self.imgs[i]['canvas'] = FigureCanvas(self.imgs[i]['fig']) self.toolbar = NavigationToolbar(self.imgs[i]['canvas'], self, coordinates=True) layout_right.addWidget(self.imgs[i]['canvas']) layout_right.addWidget(self.toolbar) # create outer layout layout_outer = QHBoxLayout() layout_outer.addLayout(layout_left) layout_outer.addSpacing(50) layout_outer.addLayout(layout_right) self.setLayout(layout_outer) # start GUI self.show()