def __init__(self, url, color): QWidget.__init__(self) self.setStyleSheet("background-color: black") self.file_name_font = QFont() self.file_name_font.setPointSize(24) self.file_name_label = QLabel(self) self.file_name_label.setText(url) self.file_name_label.setFont(self.file_name_font) self.file_name_label.setAlignment(Qt.AlignCenter) self.file_name_label.setStyleSheet("color: #eee") self.qrcode_label = QLabel(self) self.notify_font = QFont() self.notify_font.setPointSize(12) self.notify_label = QLabel(self) self.notify_label.setText("Scan above QR to copy information") self.notify_label.setFont(self.notify_font) self.notify_label.setAlignment(Qt.AlignCenter) self.notify_label.setStyleSheet("color: #eee") layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter) layout.addSpacing(20) layout.addWidget(self.file_name_label, 0, Qt.AlignCenter) layout.addSpacing(40) layout.addWidget(self.notify_label, 0, Qt.AlignCenter) layout.addStretch() self.qrcode_label.setPixmap(qrcode.make(url, image_factory=Image).pixmap())
def __init__(self, parent): super(CharacterDialog, self).__init__(parent) self.setWindowTitle(_("KeepKey Seed Recovery")) self.character_pos = 0 self.word_pos = 0 self.loop = QEventLoop() self.word_help = QLabel() self.char_buttons = [] vbox = QVBoxLayout(self) vbox.addWidget(WWLabel(CHARACTER_RECOVERY)) hbox = QHBoxLayout() hbox.addWidget(self.word_help) for i in range(4): char_button = CharacterButton('*') char_button.setMaximumWidth(36) self.char_buttons.append(char_button) hbox.addWidget(char_button) self.accept_button = CharacterButton(_("Accept Word")) self.accept_button.clicked.connect(partial(self.process_key, 32)) self.rejected.connect(partial(self.loop.exit, 1)) hbox.addWidget(self.accept_button) hbox.addStretch(1) vbox.addLayout(hbox) self.finished_button = QPushButton(_("Seed Entered")) self.cancel_button = QPushButton(_("Cancel")) self.finished_button.clicked.connect(partial(self.process_key, Qt.Key_Return)) self.cancel_button.clicked.connect(self.rejected) buttons = Buttons(self.finished_button, self.cancel_button) vbox.addSpacing(40) vbox.addLayout(buttons) self.refresh() self.show()
def __init__(self, parent=None): super(BasicFilterPage, self).__init__(parent) self.blockCombo = QComboBox() self.deviceCombo = QComboBox() self.unitCombo = QComboBox() self.combos = {'block': self.blockCombo, \ 'device': self.deviceCombo, \ 'unit': self.unitCombo} groupLayout = QFormLayout() groupLayout.addRow("Skupina měření:", self.blockCombo) groupLayout.addRow("Přístroj:", self.deviceCombo) groupLayout.addRow("Veličina:", self.unitCombo) filterGroup = QGroupBox("Základní filtry") filterGroup.setLayout(groupLayout) self.deviatedValuesCheckbox = QCheckBox() valuesLayout = QFormLayout() valuesLayout.addRow("Mimo odchylku:", self.deviatedValuesCheckbox) valuesGroup = QGroupBox("Hodnoty") valuesGroup.setLayout(valuesLayout) layout = QVBoxLayout() layout.addWidget(filterGroup) layout.addSpacing(12) layout.addWidget(valuesGroup) layout.addStretch(1) self.setLayout(layout)
def __init__(self): """The constructor initializes the class NewVariantDialog.""" super().__init__() # information about sales tax self.taxHeadline = QLabel() self.taxHint = QLabel(wordWrap=True) # information about associated employer outlay self.outlayHeadline = QLabel() self.outlayHint = QLabel(wordWrap=True) # create an ok button and abort button within a button box line = QFrame(frameShadow=QFrame.Sunken, frameShape=QFrame.HLine) button = QDialogButtonBox(QDialogButtonBox.Ok) # create the dialog layout layout = QVBoxLayout(self) layout.addWidget(self.taxHeadline) layout.addWidget(self.taxHint) layout.addSpacing(15) layout.addWidget(self.outlayHeadline) layout.addWidget(self.outlayHint) layout.addWidget(line) layout.addWidget(button) # connect the button action button.accepted.connect(self.accept) # translate the graphical user interface self.retranslateUi()
class SongsTable_Container(FFrame): def __init__(self, app, parent=None): super().__init__(parent) self._app = app self.songs_table = None self.table_control = TableControl(self._app) self._layout = QVBoxLayout(self) self.setup_ui() def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addWidget(self.table_control) def set_table(self, songs_table): if self.songs_table: self._layout.replaceWidget(self.songs_table, songs_table) self.songs_table.close() del self.songs_table else: self._layout.addWidget(songs_table) self._layout.addSpacing(10) self.songs_table = songs_table
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)
def __init__(self, parent): super(MatrixDialog, self).__init__(parent) self.setWindowTitle(_("Trezor Matrix Recovery")) self.num = 9 self.loop = QEventLoop() vbox = QVBoxLayout(self) vbox.addWidget(WWLabel(MATRIX_RECOVERY)) grid = QGridLayout() grid.setSpacing(0) self.char_buttons = [] for y in range(3): for x in range(3): button = QPushButton('?') button.clicked.connect(partial(self.process_key, ord('1') + y * 3 + x)) grid.addWidget(button, 3 - y, x) self.char_buttons.append(button) vbox.addLayout(grid) self.backspace_button = QPushButton("<=") self.backspace_button.clicked.connect(partial(self.process_key, Qt.Key_Backspace)) self.cancel_button = QPushButton(_("Cancel")) self.cancel_button.clicked.connect(partial(self.process_key, Qt.Key_Escape)) buttons = Buttons(self.backspace_button, self.cancel_button) vbox.addSpacing(40) vbox.addLayout(buttons) self.refresh() self.show()
def choice_and_line_dialog(self, title: str, message1: str, choices: List[Tuple[str, str, str]], message2: str, test_text: Callable[[str], int], run_next, default_choice_idx: int=0) -> Tuple[str, str]: vbox = QVBoxLayout() c_values = [x[0] for x in choices] c_titles = [x[1] for x in choices] c_default_text = [x[2] for x in choices] def on_choice_click(clayout): idx = clayout.selected_index() line.setText(c_default_text[idx]) clayout = ChoicesLayout(message1, c_titles, on_choice_click, checked_index=default_choice_idx) vbox.addLayout(clayout.layout()) vbox.addSpacing(50) vbox.addWidget(WWLabel(message2)) line = QLineEdit() def on_text_change(text): self.next_button.setEnabled(test_text(text)) line.textEdited.connect(on_text_change) on_choice_click(clayout) # set default text for "line" vbox.addWidget(line) self.exec_layout(vbox, title) choice = c_values[clayout.selected_index()] return str(line.text()), choice
class LP_LibraryPanel(FFrame): def __init__(self, app, parent=None): super().__init__(parent) self._app = app self.header = LP_GroupHeader(self._app, '我的音乐') self.current_playlist_item = LP_GroupItem(self._app, '当前播放列表') self.current_playlist_item.set_img_text('❂') self._layout = QVBoxLayout(self) self.setObjectName('lp_library_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; }} '''.format(self.objectName(), theme.color3.name()) self.setStyleSheet(style_str) def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addSpacing(3) self._layout.addWidget(self.header) self._layout.addWidget(self.current_playlist_item) def add_item(self, item): self._layout.addWidget(item)
def __init__(self, parent, app): super().__init__() layout1 = QHBoxLayout() layout2 = QVBoxLayout() layout1.addStretch() layout1.addLayout(layout2) layout1.addStretch() label = QLabel(self) label.setText("Simple Project: <b>Display Environment Measurements on LCD</b>. Simply displays all measured values on LCD. Sources in all programming languages can be found <a href=\"http://www.tinkerforge.com/en/doc/Kits/WeatherStation/WeatherStation.html#display-environment-measurements-on-lcd\">here</a>.<br>") label.setTextFormat(Qt.RichText) label.setTextInteractionFlags(Qt.TextBrowserInteraction) label.setOpenExternalLinks(True) label.setWordWrap(True) label.setAlignment(Qt.AlignJustify) layout2.addSpacing(10) layout2.addWidget(label) layout2.addSpacing(10) self.lcdwidget = LCDWidget(self, app) layout2.addWidget(self.lcdwidget) layout2.addStretch() self.setLayout(layout1) self.qtcb_update_illuminance.connect(self.update_illuminance_data_slot) self.qtcb_update_air_pressure.connect(self.update_air_pressure_data_slot) self.qtcb_update_temperature.connect(self.update_temperature_data_slot) self.qtcb_update_humidity.connect(self.update_humidity_data_slot) self.qtcb_button_pressed.connect(self.button_pressed_slot)
def __init__(self): 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")
def __init__(self, parent=None): super().__init__(parent) self.setObjectName("toolbar") self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self._action_layout = QVBoxLayout() self._action_layout.setContentsMargins(0, 0, 0, 0) spacer = QVBoxLayout(self) spacer.addLayout(self._action_layout) spacer.addStretch() spacer.addSpacing(2) spacer.setContentsMargins(0, 0, 0, 0)
def __init__(self, Wizard, parent=None): super(InstallPage, self).__init__(parent) self.base = Wizard.base self.setTitle(self.tr("Package installation information")) self.setSubTitle(self.tr( "Properties for installation of package")) self.textLabel = QLabel() self.textLabel.setText( "<html><head/><body><p><span style=\"font-size:12pt;\">" + "Please fill commands to execute before installation, " + "how install your files and what to do after installation." + "</p></body></html>") pretransLabel = QLabel("%pretrans: ") self.pretransEdit = QTextEdit() pretransLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) pretransLabel.setToolTip("At the start of transaction") preLabel = QLabel("%pre: ") self.preEdit = QTextEdit() preLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) preLabel.setToolTip("Before a package is installed") installLabel = QLabel("%install: ") self.installEdit = QTextEdit() installLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) installLabel.setToolTip("Script commands to install the program") postLabel = QLabel("%post: ") self.postEdit = QTextEdit() postLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) postLabel.setToolTip("After a package is installed") mainLayout = QVBoxLayout() grid = QGridLayout() gridtext = QGridLayout() grid.setVerticalSpacing(15) gridtext.addWidget(self.textLabel, 0, 0) grid.addWidget(pretransLabel, 1, 0, 1, 1) grid.addWidget(self.pretransEdit, 1, 1, 1, 1) grid.addWidget(preLabel, 2, 0, 1, 1) grid.addWidget(self.preEdit, 2, 1, 1, 1) grid.addWidget(installLabel, 3, 0, 1, 1) grid.addWidget(self.installEdit, 3, 1, 1, 1) grid.addWidget(postLabel, 4, 0, 1, 1) grid.addWidget(self.postEdit, 4, 1, 1, 1) mainLayout.addSpacing(25) mainLayout.addLayout(gridtext) mainLayout.addSpacing(15) mainLayout.addLayout(grid) self.setLayout(mainLayout)
def __init__(self, parent=None): super().__init__(parent) self.setObjectName("toolbar_actionbar") self._action_layout = QVBoxLayout() self._action_layout.setContentsMargins(0, 0, 0, 0) spacer = QVBoxLayout(self) spacer.addLayout(self._action_layout) spacer.addSpacing(10) spacer.setContentsMargins(0, 0, 0, 0) spacer.setSpacing(0) self.setContentsMargins(0, 0, 0, 0)
def setup_dialog(self, window): self.wallet = window.parent().wallet self.update_wallet_name(self.wallet) self.user_input = False self.d = WindowModalDialog(window, "Setup Dialog") self.d.setMinimumWidth(500) self.d.setMinimumHeight(210) self.d.setMaximumHeight(320) self.d.setContentsMargins(11,11,1,1) self.hbox = QHBoxLayout(self.d) vbox = QVBoxLayout() logo = QLabel() self.hbox.addWidget(logo) logo.setPixmap(QPixmap(icon_path('revealer.png'))) logo.setAlignment(Qt.AlignLeft) self.hbox.addSpacing(16) vbox.addWidget(WWLabel("<b>"+_("Revealer Secret Backup Plugin")+"</b><br>" +_("To encrypt your backup, first we need to load some noise.")+"<br/>")) vbox.addSpacing(7) bcreate = QPushButton(_("Create a new Revealer")) bcreate.setMaximumWidth(181) bcreate.setDefault(True) vbox.addWidget(bcreate, Qt.AlignCenter) self.load_noise = ScanQRTextEdit() self.load_noise.setTabChangesFocus(True) self.load_noise.textChanged.connect(self.on_edit) self.load_noise.setMaximumHeight(33) self.hbox.addLayout(vbox) vbox.addWidget(WWLabel(_("or type an existing revealer code below and click 'next':"))) vbox.addWidget(self.load_noise) vbox.addSpacing(3) self.next_button = QPushButton(_("Next"), self.d) self.next_button.setEnabled(False) vbox.addLayout(Buttons(self.next_button)) self.next_button.clicked.connect(self.d.close) self.next_button.clicked.connect(partial(self.cypherseed_dialog, window)) vbox.addWidget( QLabel("<b>" + _("Warning") + "</b>: " + _("Each revealer should be used only once.") +"<br>"+_("more information at <a href=\"https://revealer.cc/faq\">https://revealer.cc/faq</a>"))) def mk_digital(): try: self.make_digital(self.d) except Exception: self.logger.exception('') else: self.cypherseed_dialog(window) bcreate.clicked.connect(mk_digital) return bool(self.d.exec_())
def __init__(self, Wizard, parent=None): super(RequiresPage, self).__init__(parent) self.base = Wizard.base self.setTitle(self.tr("Requires page")) self.setSubTitle(self.tr("Write requires and provides")) buildRequiresLabel = QLabel("BuildRequires: ") self.bRequiresEdit = QTextEdit() self.bRequiresEdit.setMaximumHeight(220) buildRequiresLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) buildRequiresLabel.setToolTip( "A line-separated list of packages required for building " + "(compiling) the program") self.textLabel = QLabel() self.textLabel.setText( "<html><head/><body><p><span style=\"font-size:12pt;\">" + "Add required packages for compilation and run. <br> " + "</p></body></html>") requiresLabel = QLabel("Requires: ") self.requiresEdit = QTextEdit() self.requiresEdit.setMaximumHeight(220) requiresLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) requiresLabel.setToolTip( "A line-separate list of packages that are required " + "when the program is installed") providesLabel = QLabel("Provides: ") self.providesEdit = QTextEdit() providesLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) providesLabel.setToolTip( "List virtual package names that this package provides") mainLayout = QVBoxLayout() grid = QGridLayout() gridtext = QGridLayout() grid.setVerticalSpacing(15) gridtext.addWidget(self.textLabel, 0, 0) grid.addWidget(buildRequiresLabel, 1, 0, 1, 1) grid.addWidget(self.bRequiresEdit, 1, 1, 1, 1) grid.addWidget(requiresLabel, 2, 0, 1, 1) grid.addWidget(self.requiresEdit, 2, 1, 1, 1) grid.addWidget(providesLabel, 3, 0, 1, 1) grid.addWidget(self.providesEdit, 3, 1, 1, 1) mainLayout.addSpacing(25) mainLayout.addLayout(gridtext) mainLayout.addLayout(grid) self.setLayout(mainLayout)
def __init__(self, parent, options): QDialog.__init__(self, parent) ##self.setPalette(white_palette) self.setWindowTitle(options.titre) self.parent = parent self.onglets = QTabWidget(self) main_sizer = QVBoxLayout() main_sizer.addWidget(self.onglets) self.setLayout(main_sizer) ##dimensions_onglets = [] self.widgets = {} for theme in options: panel = QWidget(self.onglets) sizer = QVBoxLayout() self.onglets.addTab(panel, theme.titre) for elt in theme: if isinstance(elt, Section): box = QGroupBox(elt.titre, panel) bsizer = QVBoxLayout() box.setLayout(bsizer) bsizer.addSpacing(3) for parametre in elt: if isinstance(parametre, Parametre): psizer = self.ajouter_parametre(parametre, panel, sizer) bsizer.addLayout(psizer) elif isinstance(parametre, str): bsizer.addWidget(QLabel(parametre)) else: raise NotImplementedError(repr(type(elt))) bsizer.addSpacing(3) sizer.addWidget(box) elif isinstance(elt, Parametre): psizer = self.ajouter_parametre(elt, panel, sizer) sizer.addLayout(psizer) elif isinstance(elt, str): sizer.addWidget(QLabel(elt)) else: raise NotImplementedError(repr(type(elt))) boutons = QHBoxLayout() ok = QPushButton('OK', clicked=self.ok) boutons.addWidget(ok) defaut = QPushButton("Défaut", clicked=self.defaut) boutons.addWidget(defaut) annuler = QPushButton("Annuler", clicked=self.close) boutons.addWidget(annuler) sizer.addStretch() sizer.addLayout(boutons) panel.setLayout(sizer)
def __init__(self, map_limits, fig_names, fig_queues): QMainWindow.__init__(self) self.setAttribute(Qt.WA_DeleteOnClose) # self.setWindowTitle("application main window") self.main_widget = QWidget(self) self.main_widget.setStyleSheet("* { background-color: white }") grid = QVBoxLayout(self.main_widget) grid.setContentsMargins(0, 0, 0, 0) grid.setSpacing(0) self.dc = [] self.information_getters = [] self.fig_queues = fig_queues self.shutdown = Event() for i in range(len(fig_names)): shared_object = shared_zeros(map_limits["width"], map_limits["height"]) self.information_getters.append(InformationGetter(queue=fig_queues[i], shared_object=shared_object, shutdown=self.shutdown)) self.dc.append(DynamicMplCanvas(self.main_widget, data=shared_object, width=5, height=4, dpi=100)) label = QLabel(fig_names[i]) label.setStyleSheet("QLabel { background-color: white }") label.setAlignment(Qt.AlignCenter) grid.addWidget(label) grid.addWidget(self.dc[i]) grid.addSpacing(20) for i in self.information_getters: i.start() self.main_widget.setFocus() self.setCentralWidget(self.main_widget) timer = QTimer(self) timer.timeout.connect(self.update_display) timer.setInterval(0) timer.start() self.show()
def __init__(self): super().__init__() # things self.model = None self.tax = True self.setContentsMargins(0, 0, 0, 0) # create tree view self.view = EnhancedTreeView() self.view.setUniformRowHeights(True) self.view.setItemDelegate(TreeDelegate()) self.view.header().setSectionResizeMode(QHeaderView.ResizeToContents) # create buttons self.addButton = QPushButton() self.addButton.setMinimumWidth(140) self.removeButton = QPushButton() self.removeButton.setEnabled(False) self.modifyButton = QPushButton() self.modifyButton.setEnabled(False) self.calcButton = QPushButton() self.calcButton.setEnabled(False) # create button box layout buttonBox = QVBoxLayout() buttonBox.setContentsMargins(0, 0, 0, 0) buttonBox.addWidget(self.addButton) buttonBox.addWidget(self.removeButton) buttonBox.addWidget(self.modifyButton) buttonBox.addSpacing(12) buttonBox.addWidget(self.calcButton) buttonBox.addStretch() # set up main layout layout = QHBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addLayout(buttonBox) layout.addWidget(self.view) # connect button actions self.addButton.clicked.connect(self.addAction) self.removeButton.clicked.connect(self.removeAction) self.modifyButton.clicked.connect(self.modifyAction) self.calcButton.clicked.connect(self.calcAction) self.view.doubleClicked.connect(self.modifyAction) # translage the gui self.retranslateUi()
def __init__(self, parent=None): super(FilterDialog, self).__init__(parent) self.accepted.connect(self.createFilter) self.contentsWidget = QListWidget() self.contentsWidget.setViewMode(QListView.IconMode) self.contentsWidget.setIconSize(QSize(96, 84)) self.contentsWidget.setMovement(QListView.Static) self.contentsWidget.setMaximumWidth(128) self.contentsWidget.setSpacing(12) self.basicFilterPage = BasicFilterPage() self.timeFilterPage = DateTimeFilterPage() self.locationFilterPage = LocationFilterPage() self.pagesWidget = QStackedWidget() self.pagesWidget.addWidget(self.basicFilterPage) self.pagesWidget.addWidget(self.timeFilterPage) self.pagesWidget.addWidget(self.locationFilterPage) self.pagesWidget.setMinimumHeight(360) rejectButton = QPushButton("Storno") rejectButton.clicked.connect(self.reject) acceptButton = QPushButton("OK") acceptButton.clicked.connect(self.accept) self.createIcons() self.contentsWidget.setCurrentRow(0) horizontalLayout = QHBoxLayout() horizontalLayout.addWidget(self.contentsWidget) horizontalLayout.addWidget(self.pagesWidget, 1) buttonsLayout = QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(acceptButton) buttonsLayout.addWidget(rejectButton) layout = QVBoxLayout() layout.addLayout(horizontalLayout) layout.addStretch(1) layout.addSpacing(12) layout.addLayout(buttonsLayout) self.setLayout(layout) self.setMinimumWidth(450) self.setWindowTitle("Filtrování výsledků")
class LPLibraryPanel(MFrame): def __init__(self, app, parent=None): super().__init__(parent) self._app = app self.header = LPGroupHeader(self._app, '我的音乐') self.current_playlist_item = LPGroupItem(self._app, '当前播放列表') self.current_playlist_item.set_img_text('❂') self.music_buy_item = LPGroupItem(self._app, '壕买的音乐') self.music_buy_item.set_img_text('♫') self.music_love_item = LPGroupItem(self._app, '买不起的音乐') self.music_love_item.set_img_text('♡') self.music_rank = LPGroupItem(self._app, '排行榜') self.music_rank.set_img_text('☢') self._layout = QVBoxLayout(self) self.setObjectName('lp_library_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; }} '''.format(self.objectName(), theme.color3.name()) self.setStyleSheet(style_str) def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addSpacing(3) self._layout.addWidget(self.header) self._layout.addWidget(self.current_playlist_item) self._layout.addWidget(self.music_buy_item) self._layout.addWidget(self.music_love_item) self._layout.addWidget(self.music_rank) def add_item(self, item): self._layout.addWidget(item) def add_playlist(self, name): # implement: add playlist to buy current playlist item = LPGroupItem(self._app, name) self.add_item(item)
def __init__(self, Wizard, parent=None): super(BuildPage, self).__init__(parent) self.base = Wizard.base self.Wizard = Wizard # Main wizard of program self.setTitle(self.tr("Build page")) self.setSubTitle(self.tr("Options to build")) specEditBox = QGroupBox() buildPathBox = QGroupBox() layoutspecEditBox = QGridLayout() layoutbuildPathBox = QGridLayout() specEditBox.setTitle("Edit SPEC file") specWarningLabel = QLabel("* Edit SPEC file on your own risk") self.editSpecButton = QPushButton("Edit SPEC file") self.editSpecButton.clicked.connect(self.editSpecFile) layoutspecEditBox.setColumnStretch(0, 1) layoutspecEditBox.setColumnStretch(1, 1) layoutspecEditBox.setColumnStretch(2, 1) layoutspecEditBox.setColumnStretch(3, 1) layoutspecEditBox.setColumnStretch(4, 1) layoutspecEditBox.setColumnStretch(5, 1) layoutspecEditBox.addWidget(specWarningLabel, 0, 0) layoutspecEditBox.addWidget(self.editSpecButton, 2, 2) specEditBox.setLayout(layoutspecEditBox) buildPathBox.setTitle("Build SRPM to") self.buildLocationEdit = QLineEdit() self.buildToButton = QPushButton("Change path") self.buildToButton.clicked.connect(self.openBuildPathFileDialog) layoutbuildPathBox.addWidget(self.buildLocationEdit, 0, 0) layoutbuildPathBox.addWidget(self.buildToButton, 0, 1) buildPathBox.setLayout(layoutbuildPathBox) mainLayout = QVBoxLayout() midleLayout = QHBoxLayout() lowerLayout = QHBoxLayout() midleLayout.addWidget(specEditBox) lowerLayout.addWidget(buildPathBox) mainLayout.addSpacing(40) mainLayout.addLayout(midleLayout) mainLayout.addSpacing(20) mainLayout.addLayout(lowerLayout) self.setLayout(mainLayout)
def __init__(self, Wizard, parent=None): super(CoprFinalPage, self).__init__(parent) self.base = Wizard.base CoprFinalPage.setFinalPage(self, True) self.setTitle(self.tr("Copr final page")) self.setSubTitle(self.tr("Copr additional information")) self.textFinalLabel = QLabel() mainLayout = QVBoxLayout() gridFinalText = QGridLayout() gridFinalText.addWidget(self.textFinalLabel, 0, 1, 1, 1) mainLayout.addSpacing(190) mainLayout.addLayout(gridFinalText) mainLayout.addSpacing(190) self.setLayout(mainLayout)
def buildRpm(self): self.rpm_dialog = QDialog(self) self.rpm_dialog.resize(600, 400) self.rpm_dialog.setWindowTitle("Building RPM") self.rpm_progress = QTextEdit() self.rpm_progress.setReadOnly(True) self.rpm_progress.setText("Building RPM package is in progress...") mainLayout = QVBoxLayout() mainLayout.addSpacing(50) mainLayout.addWidget(self.rpm_progress) mainLayout.addSpacing(50) self.rpm_dialog.setLayout(mainLayout) self.rpm_dialog.show() time.sleep(5) self.base.build_rpm(self.distro, self.arch) self.rpm_dialog.close()
def __init__(self, url, color): QWidget.__init__(self) url = os.path.expanduser(url) self.setStyleSheet("background-color: black") self.file_name_font = QFont() self.file_name_font.setPointSize(24) self.file_name_label = QLabel(self) self.file_name_label.setText("Your file will uploading to\n{0}".format(url)) self.file_name_label.setFont(self.file_name_font) self.file_name_label.setAlignment(Qt.AlignCenter) self.file_name_label.setStyleSheet("color: #eee") self.qrcode_label = QLabel(self) self.notify_font = QFont() self.notify_font.setPointSize(12) self.notify_label = QLabel(self) self.notify_label.setText("Scan above QR to uploading file.\nMake sure that your smartphone is connected to the same WiFi network as this computer.") self.notify_label.setFont(self.notify_font) self.notify_label.setAlignment(Qt.AlignCenter) self.notify_label.setStyleSheet("color: #eee") layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter) layout.addSpacing(20) layout.addWidget(self.file_name_label, 0, Qt.AlignCenter) layout.addSpacing(40) layout.addWidget(self.notify_label, 0, Qt.AlignCenter) layout.addStretch() self.port = "8000" self.local_ip = self.get_local_ip() self.address = "http://{0}:{1}".format(self.local_ip, self.port) self.qrcode_label.setPixmap(qrcode.make(self.address, image_factory=Image).pixmap()) global upload_dir upload_dir = url t = threading.Thread(target=self.run_http_server, name='LoopThread') t.start()
def __init__(self, parent=None): super(ExportDialog, self).__init__(parent) self.filter = {} self.filename = '' self.msgBox = QMessageBox(self) self.msgBox.setIcon(QMessageBox.Information) self.filteringWidget = FilteringWidget() self.filteringWidget.filterChanged.connect(self.on_filterChanged) self.filteringWidget.setContentsMargins(0, 0, 0, 0) self.fileChooserWidget = FileChooserWidget() self.fileChooserWidget.filenameChanged.connect( self.on_filenameChanged) groupLayout = QGridLayout() groupLayout.addWidget(self.filteringWidget, 0, 0, 1, 2) groupLayout.addWidget(QLabel('Výstupní soubor: '), 1, 0) groupLayout.addWidget(self.fileChooserWidget, 1, 1) groupLayout.setColumnStretch(1, 1) groupLayout.setContentsMargins(0, 0, 0, 0) groupLayout.setHorizontalSpacing(0) self.exportButton = QPushButton("Export") self.exportButton.clicked.connect(self.on_exportClicked) self.cancelButton = QPushButton("Storno") self.cancelButton.clicked.connect(self.reject) buttonLayout = QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(self.exportButton) buttonLayout.addWidget(self.cancelButton) layout = QVBoxLayout() layout.addLayout(groupLayout) layout.addSpacing(30) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle("Export") self.setMinimumWidth(500) self.setModal(True)
def __init__(self, Wizard, parent=None): super(UninstallPage, self).__init__(parent) self.base = Wizard.base self.setTitle(self.tr("Package uninstallation information")) self.setSubTitle(self.tr( "Properties for uninstallation of package")) self.textLabel = QLabel() self.textLabel.setText( "<html><head/><body><p><span style=\"font-size:12pt;\">" + "Please fill commands to execute before uninstallation " + "and what to do after uninstallation.<br></p></body></html>") preunLabel = QLabel("%preun: ") self.preunEdit = QTextEdit() preunLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) preunLabel.setToolTip("Before a package is uninstalled") postunLabel = QLabel("%postun: ") self.postunEdit = QTextEdit() postunLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) postunLabel.setToolTip("After a package is uninstalled") posttransLabel = QLabel("%posttrans: ") self.posttransEdit = QTextEdit() posttransLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor)) posttransLabel.setToolTip("At the end of transaction") mainLayout = QVBoxLayout() grid = QGridLayout() gridtext = QGridLayout() grid.setVerticalSpacing(15) gridtext.addWidget(self.textLabel, 0, 0) grid.addWidget(preunLabel, 1, 0, 1, 1) grid.addWidget(self.preunEdit, 1, 1, 1, 1) grid.addWidget(postunLabel, 2, 0, 1, 1) grid.addWidget(self.postunEdit, 2, 1, 1, 1) grid.addWidget(posttransLabel, 3, 0, 1, 1) grid.addWidget(self.posttransEdit, 3, 1, 1, 1) mainLayout.addSpacing(25) mainLayout.addLayout(gridtext) mainLayout.addLayout(grid) self.setLayout(mainLayout)
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()
def settings_dialog(self, window): wallet = window.parent().wallet d = WindowModalDialog(window, _("Label Settings")) hbox = QHBoxLayout() hbox.addWidget(QLabel("Label sync options:")) upload = ThreadedButton("Force upload", partial(self.push_thread, wallet), partial(self.done_processing, d)) download = ThreadedButton("Force download", partial(self.pull_thread, wallet, True), partial(self.done_processing, d)) vbox = QVBoxLayout() vbox.addWidget(upload) vbox.addWidget(download) hbox.addLayout(vbox) vbox = QVBoxLayout(d) vbox.addLayout(hbox) vbox.addSpacing(20) vbox.addLayout(Buttons(OkButton(d))) return bool(d.exec_())
def waiting_dialog(self, task, msg, on_finished=None): label = WWLabel(msg) vbox = QVBoxLayout() vbox.addSpacing(100) label.setMinimumWidth(300) label.setAlignment(Qt.AlignCenter) vbox.addWidget(label) self.set_layout(vbox, next_enabled=False) self.back_button.setEnabled(False) t = threading.Thread(target=task) t.start() while True: t.join(1.0/60) if t.is_alive(): self.refresh_gui() else: break if on_finished: on_finished()
def __init__(self, parent=None): super(UpdatePage, self).__init__(parent) updateGroup = QGroupBox("Package selection") systemCheckBox = QCheckBox("Update system") appsCheckBox = QCheckBox("Update applications") docsCheckBox = QCheckBox("Update documentation") packageGroup = QGroupBox("Existing packages") packageList = QListWidget() qtItem = QListWidgetItem(packageList) qtItem.setText("Qt") qsaItem = QListWidgetItem(packageList) qsaItem.setText("QSA") teamBuilderItem = QListWidgetItem(packageList) teamBuilderItem.setText("Teambuilder") startUpdateButton = QPushButton("Start update") updateLayout = QVBoxLayout() updateLayout.addWidget(systemCheckBox) updateLayout.addWidget(appsCheckBox) updateLayout.addWidget(docsCheckBox) updateGroup.setLayout(updateLayout) packageLayout = QVBoxLayout() packageLayout.addWidget(packageList) packageGroup.setLayout(packageLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(updateGroup) mainLayout.addWidget(packageGroup) mainLayout.addSpacing(12) mainLayout.addWidget(startUpdateButton) mainLayout.addStretch(1) self.setLayout(mainLayout)
def __init__(self, url, color): QWidget.__init__(self) self.setStyleSheet("background-color: black") file_path = os.path.expanduser(url) self.file_name_font = QFont() self.file_name_font.setPointSize(24) self.file_name_label = QLabel(self) self.file_name_label.setText(file_path) self.file_name_label.setFont(self.file_name_font) self.file_name_label.setAlignment(Qt.AlignCenter) self.file_name_label.setStyleSheet("color: #eee") self.qrcode_label = QLabel(self) self.notify_font = QFont() self.notify_font.setPointSize(12) self.notify_label = QLabel(self) self.notify_label.setText( "Scan QR code above to download this file on your smartphone.\nMake sure the smartphone is connected to the same WiFi network as this computer." ) self.notify_label.setFont(self.notify_font) self.notify_label.setAlignment(Qt.AlignCenter) self.notify_label.setStyleSheet("color: #eee") layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter) layout.addSpacing(20) layout.addWidget(self.file_name_label, 0, Qt.AlignCenter) layout.addSpacing(40) layout.addWidget(self.notify_label, 0, Qt.AlignCenter) layout.addStretch() self.start_server(file_path)
def __init__(self, parent: QWidget = None) -> None: super().__init__(parent) self.tcpServer = QTcpServer() self.tcpClient = QTcpSocket() self.tcpServerConnection: QTcpSocket = None self.bytesToWrite = 0 self.bytesWritten = 0 self.bytesReceived = 0 self.clientProgressBar = QProgressBar() self.clientStatusLabel = QLabel(self.tr("Client ready")) self.serverProgressBar = QProgressBar() self.serverStatusLabel = QLabel(self.tr("Server ready")) self.startButton = QPushButton(self.tr("&Start")) self.quitButton = QPushButton(self.tr("&Quit")) self.buttonBox = QDialogButtonBox() self.buttonBox.addButton(self.startButton, QDialogButtonBox.ActionRole) self.buttonBox.addButton(self.quitButton, QDialogButtonBox.RejectRole) self.startButton.clicked.connect(self.start) self.quitButton.clicked.connect(self.close) self.tcpServer.newConnection.connect(self.acceptConnection) self.tcpClient.connected.connect(self.startTransfer) self.tcpClient.bytesWritten.connect(self.updateClientProgress) self.tcpClient.error.connect(self.displayError) mainLayout = QVBoxLayout(self) mainLayout.addWidget(self.clientProgressBar) mainLayout.addWidget(self.clientStatusLabel) mainLayout.addWidget(self.serverProgressBar) mainLayout.addWidget(self.serverStatusLabel) mainLayout.addStretch(1) mainLayout.addSpacing(10) mainLayout.addWidget(self.buttonBox)
class PySettings(QWidget): def __init__(self, parent): super().__init__() self.parent = parent self.project = None self.setWindowTitle("PyEngine4 - Engine Settings") self.resize(200, 200) title = QLabel("Engine Settings", self) editor = QLabel("Script Editor", self) self.editor_select = QPushButton("Select Editor", self) self.current_editor = self.parent.engine_settings.values.get("editor", None) self.valid = QPushButton("Validate", self) title.setFont(QFont("arial", 20, 1)) title.setAlignment(Qt.AlignHCenter) editor.setAlignment(Qt.AlignHCenter) self.editor_select.clicked.connect(self.select_editor) self.valid.clicked.connect(self.validate) self.layout = QVBoxLayout() self.layout.addWidget(title) self.layout.addSpacing(40) self.layout.addWidget(editor) self.layout.addWidget(self.editor_select) self.layout.addSpacing(40) self.layout.addWidget(self.valid) self.layout.setContentsMargins(50, 10, 50, 10) self.setLayout(self.layout) def select_editor(self): file_name = QFileDialog.getOpenFileName(self, "Open Editor", filter="Editor (*.exe)") if len(file_name[0]) > 0: self.current_editor = file_name[0] def validate(self): self.parent.engine_settings.values["editor"] = self.current_editor self.parent.engine_settings.save() self.close()
def setupWindow(self): """Set up the widgets for the login GUI.""" header_label = QLabel("SQL Management GUI") header_label.setFont(QFont('Arial', 20)) header_label.setAlignment(Qt.AlignCenter) server_name_entry = QLineEdit() server_name_entry.setMinimumWidth(250) server_name_entry.setText("localhost") self.user_entry = QLineEdit() self.user_entry.setMinimumWidth(250) self.password_entry = QLineEdit() self.password_entry.setMinimumWidth(250) self.password_entry.setEchoMode(QLineEdit.Password) # Arrange the QLineEdit widgets into a QFormLayout login_form = QFormLayout() login_form.setLabelAlignment(Qt.AlignLeft) login_form.addRow("Server Name:", server_name_entry) login_form.addRow("User Login:"******"Password:"******"Connect") connect_button.clicked.connect(self.connectToDatabase) new_user_button = QPushButton("No Account?") new_user_button.clicked.connect(self.createNewUser) main_v_box = QVBoxLayout() main_v_box.setAlignment(Qt.AlignTop) main_v_box.addWidget(header_label) main_v_box.addSpacing(10) main_v_box.addLayout(login_form) main_v_box.addWidget(connect_button) main_v_box.addWidget(new_user_button) self.setLayout(main_v_box)
class About(QWidget): def __init__(self, parent): super().__init__() self.parent = parent self.project = None self.setWindowTitle("PyEngine4 - About") self.resize(350, 350) title = QLabel("About PyEngine 4", self) pe4version = QLabel("PyEngine4 Version : "+common.__version__+" ("+common.__num_version__+")", self) pgversion = QLabel("PyGame Version : "+pygame.version.ver) sdlversion = QLabel("SDL Version : "+".".join(map(str, pygame.version.SDL))) thanks = QLabel("Thanks to LycosNovation.") creator = QLabel("Created by LavaPower.") title.setFont(QFont("arial", 20, 1)) title.setAlignment(Qt.AlignHCenter) pe4version.setFont(QFont("arial", 14, 1)) pe4version.setAlignment(Qt.AlignHCenter) pgversion.setFont(QFont("arial", 14, 1)) pgversion.setAlignment(Qt.AlignHCenter) sdlversion.setFont(QFont("arial", 14, 1)) sdlversion.setAlignment(Qt.AlignHCenter) thanks.setFont(QFont("arial", 14, 1)) thanks.setAlignment(Qt.AlignHCenter) creator.setFont(QFont("arial", 14, 1)) creator.setAlignment(Qt.AlignHCenter) self.layout = QVBoxLayout() self.layout.addWidget(title) self.layout.addSpacing(15) self.layout.addWidget(pe4version) self.layout.addWidget(pgversion) self.layout.addWidget(sdlversion) self.layout.addSpacing(15) self.layout.addWidget(thanks) self.layout.addWidget(creator) self.layout.setContentsMargins(20, 10, 20, 10) self.setLayout(self.layout)
def __init__(self, parent=None): super(Configuration, self).__init__(parent) self.contentsWidget = QListWidget() self.contentsWidget.setViewMode(QListView.IconMode) self.contentsWidget.setIconSize(QSize(96, 84)) self.contentsWidget.setMovement(QListView.Static) self.contentsWidget.setMaximumWidth(128) self.contentsWidget.setSpacing(12) self.pagesWidget = QStackedWidget() self.pagesWidget.addWidget(ServerConfig()) self.pagesWidget.addWidget(UpdatePage()) self.pagesWidget.addWidget(QueryPage()) closeButton = QPushButton("Close") self.createIcons() self.contentsWidget.setCurrentRow(0) closeButton.clicked.connect(self.close) horizontalLayout = QHBoxLayout() horizontalLayout.addWidget(self.contentsWidget) horizontalLayout.addWidget(self.pagesWidget, 1) buttonsLayout = QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QVBoxLayout() mainLayout.addLayout(horizontalLayout) mainLayout.addStretch(1) mainLayout.addSpacing(12) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout) self.setWindowTitle("Config Dialog")
def ui(self, widget): layout = QVBoxLayout(widget) layout.setContentsMargins(0, 0, 0, 0) layout.addSpacing(16) layout.addLayout( self.gen_row( 'Password:'******'Rate:', Rate())) layout.addSpacing(16) layout.addLayout( self.gen_row( 'Comment:', Text.Builder(width=320, height=80).model(self.comment).placeholder( "Your comment means a lot to all").build())) layout.addSpacing(40) bottom = QHBoxLayout() bottom.addStretch(1) bottom.setSpacing(20) btn_width = 80 btn_height = 30 bottom.addWidget( Button.Builder(width=btn_width, height=btn_height).click( self.cancel).text('Cancel').build()) bottom.addWidget( Button.Builder(width=btn_width, height=btn_height).click( self.ok).style("primary").text('OK').build()) bottom.addSpacing(32) layout.addLayout(bottom) layout.addSpacing(24) layout.addStretch(1) return layout
def initialize(self): self._set_font() self._set_style_sheet() self.button_new_tree = QPushButton("New focus", self, font=self.font) self.button_forest = QPushButton("Forest", self, font=self.font) self.button_exit = QPushButton("Exit", self, font=self.font) self._set_button_style() vbox = QVBoxLayout() vbox.addStretch() vbox.addWidget(self.button_new_tree, alignment=Qt.AlignCenter) vbox.addSpacing(60) vbox.addWidget(self.button_forest, alignment=Qt.AlignCenter) vbox.addSpacing(60) vbox.addWidget(self.button_exit, alignment=Qt.AlignCenter) vbox.addStretch() hbox = QHBoxLayout() hbox.addLayout(vbox) self.setLayout(hbox)
class SongsTableContainer(MFrame): def __init__(self, app, parent=None): super().__init__(parent) self._app = app self.songs_table = None self.table_control = TableControl(self._app) self._layout = QVBoxLayout(self) self.setup_ui() def set_table(self, songs_table): if self.songs_table: self._layout.replaceWidget(self.songs_table, songs_table) self.songs_table.deleteLater() else: self._layout.addWidget(songs_table) self._layout.addSpacing(10) self.songs_table = songs_table def setup_ui(self): self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addWidget(self.table_control)
def __init__(self, parent, shared_data): super(ExportationInterface, self).__init__(parent) self.__shared_data = shared_data self.__dataset_display_widget = DatasetDisplayWidget( self, self.__shared_data) self.__export_select_widget = ExportSelectorWidget( self, self.__shared_data) self.__export_action_widget = ExportActionWidget( self, self.__shared_data) right_layout = QVBoxLayout() main_layout = QHBoxLayout() right_layout.addWidget(self.__export_select_widget) right_layout.addSpacing(15) right_layout.addWidget(self.__export_action_widget) right_layout.addStretch(1) main_layout.addWidget(self.__dataset_display_widget) main_layout.addLayout(right_layout) self.setLayout(main_layout)
class ToolLeft2(ScrollArea): def __init__(self, parent=None): super().__init__() self.setObjectName('ToolLeft') self.parent = parent self.setMaximumWidth(60) self.mainLayout = QVBoxLayout(self.frame) self.mainLayout.addSpacing(5) #self.mainLayout.addStretch(1) for item in configuration.menus: toolButton = QToolButton() #toolButton.setText(item['title']) toolButton.setIcon(QIcon(item['icon'])) toolButton.setIconSize(QSize(24, 24)) toolButton.setAutoRaise(True) toolButton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.mainLayout.addWidget(toolButton) self.mainLayout.addStretch(3)
def __init__(self, window: QMainWindow, has_dedicated_gpu: bool): # noinspection PyArgumentList super().__init__() self.label = QLabel( "Everything went fine. Click the button below if you want to proceed with the data extraction.\n" "You will be able to review the data after this process.") self.extract_data_button = QPushButton( "Extract data from output files") self.extract_data_button.clicked.connect( lambda: self.extract_data_from_generated_files( window, has_dedicated_gpu)) h_box = QHBoxLayout() h_box.addStretch() h_box.addWidget(self.extract_data_button, alignment=Qt.AlignCenter) h_box.addStretch() v_box = QVBoxLayout() v_box.addWidget(self.label, alignment=Qt.AlignCenter) v_box.addSpacing(15) v_box.addLayout(h_box) self.setLayout(v_box)
def initUI(self): RIGHT_SPACING = 350 LINE_EDIT_WIDTH = 200 self.central_widget = QWidget() self.start_btn = QPushButton("Start Cable Test / 开始测试") self.start_btn.setFixedWidth(350) self.start_btn.setAutoDefault(True) self.start_btn.setFont(self.label_font) self.start_btn.clicked.connect(self.start) self.logo_img = QPixmap(self.resource_path("h_logo.png")) self.logo_img = self.logo_img.scaledToWidth(600) self.logo = QLabel() self.logo.setPixmap(self.logo_img) hbox_logo = QHBoxLayout() hbox_logo.addStretch() hbox_logo.addWidget(self.logo) hbox_logo.addStretch() hbox_start_btn = QHBoxLayout() hbox_start_btn.addStretch() hbox_start_btn.addWidget(self.start_btn) hbox_start_btn.addStretch() vbox = QVBoxLayout() vbox.addStretch() vbox.addLayout(hbox_logo) vbox.addSpacing(100) vbox.addLayout(hbox_start_btn) vbox.addStretch() self.central_widget.setLayout(vbox) self.setCentralWidget(self.central_widget) self.setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT) self.setWindowTitle("BeadedStream Cable Test Utility")
def __initUI(self): self.setStyleSheet(''' *{font-size: 15px;} QProgressBar{ text-align : center ; } ''') self.setWindowTitle('统计结果') self.setWindowFlags(Qt.WindowCloseButtonHint) self.textLabel=QLabel('进度:') self.progressBar=QProgressBar() startButton=QPushButton('开始') lookReportButton=QPushButton("查看") hbox=QHBoxLayout() hbox.addStretch(1) hbox.addWidget(startButton) hbox.addSpacing(10) hbox.addWidget(lookReportButton) vbox=QVBoxLayout() vbox.addSpacing(10) vbox.addWidget(self.textLabel) vbox.addSpacing(10) vbox.addWidget(self.progressBar) vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.progressBar.setMaximum(3) self.progressBar.setValue(0) startButton.clicked.connect(self.__startButton) lookReportButton.clicked.connect(self.__lookReport)
def __init__(self, nama): super(AdminGUI, self).__init__() self.nama = nama vb = QVBoxLayout() self.create_table() self.test = sideMenu() self.lbl_kantin = myFrameLabel('Kantin ITK', font_jdl_u) self.lbl_nama = myFrameLabel(f'Halo, {self.nama}!', font_dlg) self.btn = myFrameBtn('Log out', self.logout) self.btn2 = myFrameBtn('Tambah pegawai', self.tambah) self.btn3 = myFrameBtn('Pecat', self.pecat) vb.addWidget(self.lbl_kantin, alignment=Qt.AlignLeft) vb.addWidget(self.lbl_nama, alignment=Qt.AlignLeft) vb.addWidget(self.btn2, alignment=Qt.AlignCenter) vb.addWidget(self.btn3, alignment=Qt.AlignCenter) vb.addSpacing(200) vb.addWidget(self.btn, alignment=Qt.AlignCenter) flay = QFormLayout() flay.addRow(vb) flay.setFormAlignment(Qt.AlignTop) self.test.setLayout(flay) hb = QHBoxLayout() hb.addWidget(self.table, alignment=Qt.AlignLeft) hb.setContentsMargins(0, 0, 0, 0) # self.btn.clicked.connect() hb.addWidget(self.test) self.lastClick = None self.setLayout(hb)
def __init_ui(self): self.setFixedSize(350, 350) self.setWindowTitle(Translator.tr("Über")) self.setWindowIcon( QIcon(SystemInfo.RESOURCES + 'images/PhiPi_icon.png')) self.setWindowModality(Qt.ApplicationModal) font = QFont(SystemInfo.FONT) icon = QLabel(self) img = QPixmap(SystemInfo.RESOURCES + 'images/PhiPi_icon.png') icon.setPixmap(img) title = QLabel("PhyPiGUI", self) font.setPointSize(15) title.setFont(font) version = QLabel('v' + SystemInfo.VERSION, self) font.setPointSize(10) version.setFont(font) description = QLabel(self) font.setPointSize(10) description.setFont(font) description.setWordWrap(True) description.setAlignment(Qt.AlignCenter) description.setText( Translator. tr("PhyPiGUI ist ein Softwareprojekt, dass im Rahmen von Praxis der " "Softwareentwicklung am Karlsruher Institut für Technologie entstanden ist" ) + ".\n\n" + Translator. tr("Es bietet eine für Schüler ausgelegte grafische Benutzeroberfläche " "zur vereinfachten Benutzung der Software PhyPiDAQ von Günter Quast" ) + ".") authors = QLabel( "Simon Essig | Christian Hauser | Fritz Hund\nAhmad Jayossi | Sandro Negri" ) font.setPointSize(8) authors.setFont(font) authors.setAlignment(Qt.AlignCenter) layout = QVBoxLayout() layout.setContentsMargins(15, 15, 15, 10) layout.setSpacing(0) layout.addWidget(icon, alignment=Qt.AlignCenter) layout.addSpacing(5) layout.addWidget(title, alignment=Qt.AlignCenter) layout.addWidget(version, alignment=Qt.AlignCenter) layout.addSpacing(15) layout.addWidget(description, alignment=Qt.AlignCenter) layout.addStretch(1) layout.addWidget(authors, alignment=Qt.AlignCenter) layout.addSpacing(3) self.setLayout(layout)
def initUI(self): self.initNums = InitNumberSpinBoxes() initNumsGroup = QGroupBox() initNumsGroup.setLayout(self.initNums.initNumbersLayout) initNumsGroup.setTitle("Waruki początkowe") self.fundParams = BasicParams() basicParamsGroup = QGroupBox() basicParamsGroup.setLayout(self.fundParams.basicModelParamsLayout) basicParamsGroup.setTitle("Parametry modelu podstawowego") self.limitCaption = CaptionLimitWidget() limitedCaptionGroup = QGroupBox() limitedCaptionGroup.setLayout(self.limitCaption.initNumVLay) limitedCaptionGroup.setTitle( "Parametry modelu ograniczonej pojemności środowiska") self.outFactor = OutsideFactorParamsWidget() outFactorGroup = QGroupBox() outFactorGroup.setLayout(self.outFactor.initNumVLay) outFactorGroup.setTitle( "Parametry modelu własnego - z czynnikiem zewnętrznym") self.mainButton = QPushButton("Wykonaj") self.mainButton.resize(150, 100) self.mainButton.setStyleSheet( "background-color: #2d3847; color: white;") leftPanVlay = QVBoxLayout(self) leftPanVlay.setContentsMargins(10, 10, 10, 20) leftPanVlay.addWidget(initNumsGroup) leftPanVlay.addWidget(basicParamsGroup) leftPanVlay.addWidget(limitedCaptionGroup) leftPanVlay.addWidget(outFactorGroup) leftPanVlay.addSpacing(80) leftPanVlay.addWidget(self.mainButton)
def _create_parameters_gui(self, parent): from PyQt5.QtWidgets import QFrame, QVBoxLayout f = QFrame(parent) layout = QVBoxLayout(f) layout.setContentsMargins(0,0,0,0) layout.setSpacing(2) from chimerax.ui.widgets import EntriesRow oe = EntriesRow(f, 'Origin index', '', ('center', self._center_origin), ('reset', self._reset_origin)) self._origin = o = oe.values[0] o.return_pressed.connect(self._origin_changed) import sys if sys.platform == 'darwin': layout.addSpacing(-12) # Reduce Mac push button vertical space. vse = EntriesRow(f, 'Voxel size', '', ('reset', self._reset_voxel_size)) self._voxel_size = vs = vse.values[0] vs.return_pressed.connect(self._voxel_size_changed) if sys.platform == 'darwin': layout.addSpacing(-8) # Reduce Mac push button vertical space. cae = EntriesRow(f, 'Cell angles', '') self._cell_angles = ca = cae.values[0] ca.return_pressed.connect(self._cell_angles_changed) rae = EntriesRow(f, 'Rotation axis', '', 'angle', 0.0) self._rotation_axis, self._rotation_angle = ra, ran = rae.values ra.return_pressed.connect(self._rotation_changed) ran.return_pressed.connect(self._rotation_changed) return f
def initUI(self): vbox = QVBoxLayout() hbox = QHBoxLayout() self.label = QLabel('Please select the CSV format.', self) self.rb1 = QRadioButton("Automatic detection", self) self.rb1.setChecked(True) self.rb2 = QRadioButton("Comma delimiter", self) self.rb3 = QRadioButton("Semicolon delimiter", self) hbox.addWidget(self.rb1) hbox.addWidget(self.rb2) hbox.addWidget(self.rb3) self.btn_ok = QPushButton("Ok") self.btn_ok.clicked.connect(self.button_press) self.btn_cancel = QPushButton("Cancel") self.btn_cancel.clicked.connect(self.button_press) self.btn_cancel.move(80, 0) buttons = QHBoxLayout() buttons.addWidget(self.btn_ok) buttons.addWidget(self.btn_cancel) buttons_widget = QWidget() buttons_widget.setLayout(buttons) layout = QVBoxLayout() layout.addWidget(buttons_widget) vbox.addSpacing(15) vbox.addLayout(hbox) vbox.addWidget(self.label) vbox.addWidget(buttons_widget) self.setLayout(vbox)
def __init__(self, parent, app): super().__init__() layout1 = QHBoxLayout() layout2 = QVBoxLayout() layout1.addStretch() layout1.addLayout(layout2) layout1.addStretch() label = QLabel(self) label.setText( "Simple Project: <b>Display Environment Measurements on LCD</b>. Simply displays all measured values on LCD. Sources in all programming languages can be found <a href=\"http://www.tinkerforge.com/en/doc/Kits/WeatherStation/WeatherStation.html#display-environment-measurements-on-lcd\">here</a>.<br>" ) label.setTextFormat(Qt.RichText) label.setTextInteractionFlags(Qt.TextBrowserInteraction) label.setOpenExternalLinks(True) label.setWordWrap(True) label.setAlignment(Qt.AlignJustify) layout2.addSpacing(10) layout2.addWidget(label) layout2.addSpacing(10) self.lcdwidget = LCDWidget(self, app) layout2.addWidget(self.lcdwidget) layout2.addStretch() self.setLayout(layout1) self.qtcb_update_illuminance.connect(self.update_illuminance_data_slot) self.qtcb_update_air_pressure.connect( self.update_air_pressure_data_slot) self.qtcb_update_temperature.connect(self.update_temperature_data_slot) self.qtcb_update_humidity.connect(self.update_humidity_data_slot) self.qtcb_button_pressed.connect(self.button_pressed_slot)
def __init__(self, window: QMainWindow): # noinspection PyArgumentList super().__init__() self.title = QLabel("Welcome to P.E.R.A.C.O.T.T.A.") self.subtitle = QLabel( "(Progetto Esteso Raccolta Automatica Configurazioni hardware Organizzate Tramite Tarallo Autonomamente)" ) self.intro = QLabel( "When you're ready to generate the files required to gather info about this system, click the " "'Generate files' button below.") # noinspection PyArgumentList title_font = QFont("futura", pointSize=24, italic=False) # noinspection PyArgumentList subtitle_font = QFont("futura", pointSize=14, italic=True) self.title.setFont(title_font) self.subtitle.setFont(subtitle_font) self.generate_files_button = QPushButton("Generate Files") # noinspection PyUnresolvedReferences self.generate_files_button.clicked.connect( lambda: self.prompt_has_dedicated_gpu(window)) h_box = QHBoxLayout() h_box.addStretch() h_box.addWidget(self.generate_files_button, alignment=Qt.AlignCenter) h_box.addStretch() v_box = QVBoxLayout() v_box.addWidget(self.title, alignment=Qt.AlignCenter) v_box.addWidget(self.subtitle, alignment=Qt.AlignCenter) v_box.addSpacing(30) v_box.addWidget(self.intro, alignment=Qt.AlignCenter) v_box.addSpacing(15) v_box.addLayout(h_box) self.setLayout(v_box)
class RenamePlaylistDialog(QDialog): """ This dialog allows a user to rename an existing playlist for update in the DB and in the UI """ def __init__(self, parent: QObject, playlist: Playlist): super().__init__(parent) self.setWindowTitle(" ") self.__playlist = playlist self.__layout_manager = QVBoxLayout(self) self.__name_line_edit = QLineEdit(self) self.__name_line_edit.setPlaceholderText("New name") self.__finish_btn = QPushButton("Finish", self) # Connect signals to slots self.__finish_btn.clicked.connect(lambda: self.accept()) self.__layout_ui() def __layout_ui(self): # Set up header label header_text = f"What would you like to rename {self.__playlist.name} to?" header_label = QLabel(header_text, self) header_label.setObjectName("dialog-header") self.__layout_manager.addWidget(header_label) self.__layout_manager.addWidget(self.__name_line_edit) # Finish button self.__layout_manager.addSpacing(10) self.__layout_manager.addWidget(self.__finish_btn, Qt.AlignCenter) def get_new_name(self) -> str: """ Returns the selected name """ return self.__name_line_edit.text()
def __init__(self, url, background_color, foreground_color): QWidget.__init__(self) self.setStyleSheet("background-color: transparent;") self.file_name_font = QFont() self.file_name_font.setPointSize(24) self.file_name_label = QLabel(self) self.file_name_label.setText(url) self.file_name_label.setFont(self.file_name_font) self.file_name_label.setAlignment(Qt.AlignCenter) self.file_name_label.setStyleSheet( "color: {}".format(foreground_color)) self.qrcode_label = QLabel(self) self.notify_font = QFont() self.notify_font.setPointSize(12) self.notify_label = QLabel(self) self.notify_label.setText("Scan QR code above to copy data.") self.notify_label.setFont(self.notify_font) self.notify_label.setAlignment(Qt.AlignCenter) self.notify_label.setStyleSheet("color: {}".format(foreground_color)) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter) layout.addSpacing(20) layout.addWidget(self.file_name_label, 0, Qt.AlignCenter) layout.addSpacing(40) layout.addWidget(self.notify_label, 0, Qt.AlignCenter) layout.addStretch() self.qrcode_label.setPixmap( qrcode.make(url, image_factory=Image).pixmap())
def initAboutTabUI(self) -> None: """ Initialize 'About' tab :return: None """ layout = QVBoxLayout() self.aboutTab.setLayout(layout) # prepare logo view: create pixmap, scale it using nicer method iconPixmap = QPixmap(util.resource_path('../img/icon.png')).scaledToWidth(LOGO_SIZE, Qt.SmoothTransformation) iconLabel = QLabel() # QLabel is used to store the pixmap iconLabel.setPixmap(iconPixmap) iconLabel.setAlignment(Qt.AlignCenter) aboutTextBrowser = QTextBrowser() # read-only text holder with rich text support aboutTextBrowser.setHtml(ABOUT_TEXT) aboutTextBrowser.setOpenExternalLinks(True) layout.addSpacing(40) layout.addWidget(iconLabel, Qt.AlignCenter) layout.addSpacing(40) layout.addWidget(aboutTextBrowser)
def __init__(self, idx): super().__init__() self.idx = idx self.container = QGridLayout() self.populate_container() w = QWidget() w.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) w.setLayout(self.container) l = QVBoxLayout() l.addStretch() l.addSpacing(10) l.addWidget(w) l.setAlignment(w, QtCore.Qt.AlignHCenter) l.addSpacing(10) lbl = QLabel( "Use <code>TD({})</code> to set up this action in the keymap.". format(self.idx)) l.addWidget(lbl) l.setAlignment(lbl, QtCore.Qt.AlignHCenter) l.addStretch() self.w2 = QWidget() self.w2.setLayout(l)
def initUI(self): # elements declarations self.startTime = QSpinBox() self.startTime.setValue(0) self.startTime.setFixedSize(250, 30) self.startTime.setMinimum(0) self.startTime.setStyleSheet("background-color: #2d3847; color: white") self.stopTime = QSpinBox() self.stopTime.setValue(50) self.stopTime.setMaximum(1000) self.stopTime.setFixedSize(250, 30) self.stopTime.setStyleSheet("background-color: #2d3847; color: white") # layout of own params gui elements HLayout = QHBoxLayout() HLayout.addWidget(QLabel("Start symulacji [t(0)]: ")) HLayout.addWidget(self.startTime) HLayout.addWidget(QLabel("Stop symulacji [t(n)]: ")) HLayout.addWidget(self.stopTime) VLayout = QVBoxLayout(self) VLayout.addWidget(QLabel("Czas symulacji ")) VLayout.addSpacing(30) VLayout.addLayout(HLayout)
def _mk_left_layout(self, lang, companies, colorTypes): ret = QVBoxLayout() lbl_name = QLabel(Strings.str_LABEL_NAME.get(lang)) txt_name = QLineEdit() company_grid_layout = QGridLayout() lbl_comp = QLabel(Strings.str_LABEL_COMPANY.get(lang)) cb_comp = QComboBox() for company in companies: cb_comp.addItem(company.Name) btn_add_company = QPushButton("+") btn_add_company.clicked.connect(lambda _: self._add_company()) company_grid_layout.addWidget(cb_comp, 0, 0, 1, 4) company_grid_layout.addWidget(btn_add_company, 0, 5) type_grid_layout = QGridLayout() lbl_type = QLabel(Strings.str_LABEL_COLOR_TYPE.get(lang)) cb_type = QComboBox() for typ in colorTypes: cb_type.addItem(typ.Name) btn_add_type = QPushButton("+") btn_add_type.clicked.connect(lambda _: self._add_type()) type_grid_layout.addWidget(cb_type, 0, 0, 1, 4) type_grid_layout.addWidget(btn_add_type, 0, 5) ret.addWidget(lbl_name) ret.addWidget(txt_name) ret.addSpacing(15) ret.addWidget(lbl_comp) ret.addLayout(company_grid_layout) ret.addSpacing(15) ret.addWidget(lbl_type) ret.addLayout(type_grid_layout) return txt_name, cb_comp, cb_type, ret
def __init__(self, main_window: 'ElectrumWindow', account_id: int) -> None: super().__init__(main_window) self._main_window = weakref.proxy(main_window) self._account_id = account_id self._account = main_window._wallet.get_account(account_id) self._logger = logs.get_logger(f"receive-view[{self._account_id}]") self._receive_key_id: Optional[int] = None self._request_list_toolbar_layout = TableTopButtonLayout() self._request_list_toolbar_layout.refresh_signal.connect( self._main_window.refresh_wallet_display) self._request_list_toolbar_layout.filter_signal.connect(self._filter_request_list) form_layout = self.create_form_layout() self._request_list = RequestList(self, main_window) request_container = self.create_request_list_container() vbox = QVBoxLayout(self) vbox.addLayout(form_layout) vbox.addSpacing(20) vbox.addWidget(request_container, 1) self.setLayout(vbox)
def init_UI(self): """Initialise the UI by loading the GIF and adding the text label """ vbox = QVBoxLayout() vbox.setAlignment(Qt.AlignHCenter) self.movie_screen = QLabel(self) self.movie_screen.setFixedSize(50, 50) self.movie = QMovie(self.file, QByteArray(), self) self.movie.setScaledSize(self.movie_screen.size()) self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.movie.start() self.movie.loopCount() self.loading = QLabel(self.text) self.loading.setAlignment(Qt.AlignCenter) vbox.addStretch(2) vbox.addWidget(self.movie_screen, Qt.AlignCenter) vbox.addSpacing(10) vbox.addWidget(self.loading, Qt.AlignHCenter) vbox.addStretch(1) self.setLayout(vbox)