def __init__(self): super(PointsWidget, self).__init__() self.landmarkWidgets = [] self.activeIndex = 0 self.scrollArea = QScrollArea(self) self.scrollArea.setFrameShape(QFrame.NoFrame) self.scrollArea.setAutoFillBackground(False) self.scrollArea.setAttribute(Qt.WA_TranslucentBackground) self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollArea.setWidgetResizable(True) landmarkLocationsLayout = QGridLayout() landmarkLocationsLayout.setSpacing(0) landmarkLocationsLayout.setContentsMargins(0, 0, 0, 0) landmarkLocationsLayout.setAlignment(Qt.AlignTop) self.landmarkLocationsWidget = QWidget() Style.styleWidgetForTab(self.landmarkLocationsWidget) self.landmarkLocationsWidget.setLayout(landmarkLocationsLayout) self.scrollArea.setWidget(self.landmarkLocationsWidget) layout = QGridLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.scrollArea) self.setLayout(layout)
def __init__(self, parent=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") main_layout = QVBoxLayout() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) settings = QSettings() db_group = QGroupBox("Database") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("File"), 0, 0) text = settings.value('DB/File') self.file = QLineEdit(text) self.file.setText(text) grid_layout.addWidget(self.file, 0, 1) browse = QPushButton("Browse") browse.clicked.connect(self.browse) grid_layout.addWidget(browse, 0, 2) db_group.setLayout(grid_layout) main_layout.addWidget(db_group) ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000 ") smtp_group = QGroupBox("SMTP") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) text = settings.value('SMTP/Server') self.smtp_server = QLineEdit(text) self.smtp_server.setText(text) grid_layout.addWidget(self.smtp_server, 0, 1) smtp_group.setLayout(grid_layout) main_layout.addWidget(smtp_group) self.http_proxy = QGroupBox("HTTP Proxy") self.http_proxy.setCheckable(True) self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled'))) grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) self.http_proxy_ip = QLineEdit() self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP')) self.http_proxy_ip.setMinimumWidth(ip_width) grid_layout.addWidget(self.http_proxy_ip, 0, 1) grid_layout.setColumnStretch(0, 1) self.http_proxy.setLayout(grid_layout) main_layout.addWidget(self.http_proxy) main_layout.addWidget(buttonBox) self.setLayout(main_layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, fixtures_folder, parent=None): QWidget.__init__(self, parent) self.current_fixture = None self.fixtures_folder = fixtures_folder self.setWindowTitle("Frangitron DMX program editor") self.text = QPlainTextEdit() font = QFont("Monospace") font.setStyleHint(QFont.TypeWriter) font.setPixelSize(16) self.text.setFont(font) self.text.setStyleSheet( "color: white; background-color: rgb(30, 30, 30)") self.combo_fixture = QComboBox() self.frame_programs = QWidget() self.checkboxes_programs = list() self.layout_programs = QGridLayout(self.frame_programs) self.spinner_offset = QSpinBox() self.spinner_offset.setMinimum(1) self.spinner_offset.setMaximum(512) self.spinner_offset.setValue(1) self.spinner_offset.valueChanged.connect(self.address_changed) self.doc = QPlainTextEdit() self.doc.setReadOnly(True) self.doc.setFont(font) self.status = QLabel() layout = QGridLayout(self) layout.addWidget(self.combo_fixture, 0, 1) layout.addWidget(self.spinner_offset, 0, 2) layout.addWidget(self.frame_programs, 1, 1) layout.addWidget(self.text, 0, 0, 3, 1) layout.addWidget(self.doc, 2, 1, 1, 2) layout.addWidget(self.status, 3, 0, 1, 3) layout.setColumnStretch(0, 60) layout.setColumnStretch(1, 40) self.resize(1280, 800) self.streamer = Streamer(self.fixtures_folder) self.combo_fixture.addItems(sorted(self.streamer.fixtures)) self.combo_fixture.currentIndexChanged.connect(self.fixture_changed) self.timer = QTimer() self.timer.timeout.connect(self.tick) self.timer.start(500.0 / FRAMERATE) self.should_reload = True self.fixture_changed()
def __init__(self, controller, transition, parent=None): super(PreferencesWidget, self).__init__(parent) self.controller = controller self.transition = transition self.atem = controller['ATEM'] layout = QGridLayout() layout.addWidget(TitleLabel('Preferences'), 0, 0, 1, 0) mixRate = FrameRateTouchSpinner() mixRate.setValue(transition.rate) mixRate.setMaximum(250) mixRate.setMinimum(1) mixRate.valueChanged.connect(self.setMixRate) layout.addWidget(QLabel('Mix rate'), 1, 0) layout.addWidget(mixRate, 1, 1) layout.addWidget(QLabel('Joystick forward\nmeans'), 2, 0) layout.addWidget(JoystickInvertPreference(), 2, 1) layout.addWidget(QLabel('Joystick sensitivity'), 3, 0) layout.addWidget( SensitivityPreference('joystick.sensitivity.pan', 'Pan'), 3, 1) layout.addWidget( SensitivityPreference('joystick.sensitivity.zoom', 'Zoom'), 4, 0) layout.addWidget( SensitivityPreference('joystick.sensitivity.tilt', 'Tilt'), 4, 1) self.setLayout(layout)
def __init__(self, renderController, parent=None): super(RenderParameterWidget, self).__init__(parent=parent) self.renderController = renderController self.renderController.visualizationChanged.connect(self.visualizationLoaded) self.paramWidget = None self.visTypeComboBox = QComboBox() for visualizationType in self.renderController.visualizationTypes: self.visTypeComboBox.addItem(visualizationType) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.setSpacing(10) layout.setContentsMargins(10, 0, 10, 0) if len(self.renderController.visualizationTypes) > 1: layout.addWidget(QLabel("Visualization type:"), 0, 0) layout.addWidget(self.visTypeComboBox, 0, 1) self.setLayout(layout) self.scrollArea = QScrollArea() self.scrollArea.setFrameShape(QFrame.NoFrame) self.scrollArea.setAutoFillBackground(False) self.scrollArea.setAttribute(Qt.WA_TranslucentBackground) self.scrollArea.setWidgetResizable(True) self.visTypeComboBox.currentIndexChanged.connect(self.visTypeComboBoxChanged)
def __init__(self, switcherState, parent=None): super(AllInputsPanel, self).__init__(parent) self.switcherState = switcherState self.selectedInput = None self.page = 0 self.sources = [] self.layout = QGridLayout() self.input_buttons = QButtonGroup() self.btnPageUp = ExpandingButton() self.btnPageUp.setIcon(QIcon(":icons/go-up")) self.btnPageUp.clicked.connect(lambda: self.setPage(self.page - 1)) self.layout.addWidget(self.btnPageUp, 0, 5, 3, 1) self.btnPageDown = ExpandingButton() self.btnPageDown.setIcon(QIcon(":icons/go-down")) self.btnPageDown.clicked.connect(lambda: self.setPage(self.page + 1)) self.layout.addWidget(self.btnPageDown, 3, 5, 3, 1) for col in range(5): self.layout.setColumnStretch(col, 1) for row in range(3): btn = InputButton(None) self.layout.addWidget(btn, row * 2, col, 2, 1) self.input_buttons.addButton(btn) btn.clicked.connect(self.selectInput) btn.setFixedWidth(120) self.setLayout(self.layout) self.switcherState.inputsChanged.connect(self.setSources) self.setSources() self.displayInputs()
def __init__(self,parent=None): super(Form,self).__init__(parent) date = self.get_data() rates = sorted(self.rates.keys()) dateLabel = QLabel(date) self.fromComboBox = QComboBox() self.toComboBox = QComboBox() self.fromComboBox.addItems(rates) self.toComboBox.addItems(rates) self.fromSpinBox = QDoubleSpinBox() self.fromSpinBox.setRange(0.01,1000) self.fromSpinBox.setValue(1.00) self.toLabel = QLabel("1.00") layout = QGridLayout(); layout.addWidget(dateLabel,5,0) layout.addWidget(self.fromComboBox, 1,0) layout.addWidget(self.toComboBox,2,0) layout.addWidget(self.fromSpinBox,1,1) layout.addWidget(self.toLabel,2,1) self.setLayout(layout) #Connect Signal self.fromComboBox.currentIndexChanged.connect(self.update_ui) self.toComboBox.currentIndexChanged.connect(self.update_ui) self.fromSpinBox.valueChanged.connect(self.update_ui)
def getParameterWidget(self): matrixLayout = QGridLayout() matrixLayout.setAlignment(Qt.AlignTop) matrixLayout.setContentsMargins(0, 0, 0, 0) matrixLayout.setSpacing(5) matrixLayout.addWidget(QLabel("Transformation matrix:"), 0, 0, 1, 4) self.m1Edits = [QLineEdit() for _ in range(4)] self.m2Edits = [QLineEdit() for _ in range(4)] self.m3Edits = [QLineEdit() for _ in range(4)] self.m4Edits = [QLineEdit() for _ in range(4)] self.initLineEdits(self.m1Edits, matrixLayout, 1, 0) self.initLineEdits(self.m2Edits, matrixLayout, 2, 0) self.initLineEdits(self.m3Edits, matrixLayout, 3, 0) self.initLineEdits(self.m4Edits, matrixLayout, 4, 0) expandingWidget = QWidget() expandingWidget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) matrixLayout.addWidget(expandingWidget, 5, 0, 1, 4) matrixWidget = QWidget() matrixWidget.setLayout(matrixLayout) self.transformUpdated( self.renderWidget.transformations.completeTransform()) return matrixWidget
def initUi(self): self.grid = QGridLayout() self.grid.addWidget(QLabel("Connection name"), 0, 0) self.grid.addWidget(QLabel("Username"), 2, 0) self.grid.addWidget(QLabel("Password"), 4, 0) self.grid.addWidget(QLabel("Hostname"), 6, 0) self.grid.addWidget(QLabel("Port"), 8, 0) self.connectionNameInput = QLineEdit(self) self.grid.addWidget(self.connectionNameInput, 1, 0) self.userNameInput = QLineEdit(self) self.grid.addWidget(self.userNameInput, 3, 0) self.passwordInput = QLineEdit(self) self.grid.addWidget(self.passwordInput, 5, 0) self.hostnameInput = QLineEdit(self) self.grid.addWidget(self.hostnameInput, 7, 0) self.portSpinBox = QSpinBox(self) self.portSpinBox.setMinimum(1) self.portSpinBox.setMaximum(65535) self.portSpinBox.setValue(22) self.grid.addWidget(self.portSpinBox, 9, 0) self.addButton = QPushButton("Accept") self.grid.addWidget(self.addButton, 10, 0) self.setLayout(self.grid) self.addButton.clicked.connect(self.clickedAddButton) self.show()
def realize(self): """This function is part of initialization where it handles ModuleAgent creation and wiring and subclass view placement. """ # Create and wire the Agent into the Boxfish tree self.agent = self.agent_type(self.parent_frame.agent, self.parent_frame.agent.datatree) self.agent.module_scene = self.scene_type(self.agent_type, self.display_name) self.parent_frame.agent.registerChild(self.agent) # Create and place the module-specific view elements self.view = self.createView() self.centralWidget = QWidget() layout = QGridLayout() if isinstance(self.parent(), BFDockWidget): layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2) # TODO: Replace magic number with not-magic constant layout.addWidget(self.view, 100, 0, 1, 2) # Add view at bottom layout.setRowStretch(100, 5) # view has most row stretch left, top, right, bottom = layout.getContentsMargins() layout.setContentsMargins(0, 0, 0, 0) self.centralWidget.setLayout(layout) self.setCentralWidget(self.centralWidget) # Tab Dialog stuff self.enable_tab_dialog = True self.dialog = list()
def getParameterWidget(self): """ Returns a widget with sliders / fields with which properties of this volume property can be adjusted. :rtype: QWidget """ layout = QGridLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setAlignment(Qt.AlignTop) self.sliders = [] for index in range(7): slider = QSlider(Qt.Horizontal) slider.setMinimum(0) slider.setMaximum(1000) slider.setValue( int( math.pow(self.sectionsOpacity[index], 1.0 / 3.0) * slider.maximum())) slider.valueChanged.connect(self.valueChanged) self.sliders.append(slider) label = QLabel(self.sectionNames[index]) label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) layout.addWidget(label, index, 0) layout.addWidget(slider, index, 1) try: from ColumnResizer import ColumnResizer columnResizer = ColumnResizer() columnResizer.addWidgetsFromLayout(layout, 0) except Exception, e: print e
def __init__(self, ftb, atem, parent=None): super(FadeToBlackControl, self).__init__(parent) self.atem = atem self.ftb = ftb layout = QGridLayout() lblRate = QLabel("Rate") lblRate.setAlignment(Qt.AlignHCenter | Qt.AlignBottom) layout.addWidget(lblRate, 0, 0) self.rate = FrameRateTouchSpinner() self.rate.setValue(self.ftb.rate) layout.addWidget(self.rate, 1, 0) self.btnFade = ExpandingButton() self.btnFade.setText("Fade to Black") self.btnFade.setCheckable(True) self.btnFade.setChecked(self.ftb.active) layout.addWidget(self.btnFade, 1, 1) self.ftb.rateChanged.connect(self.rate.setValue) self.ftb.activeChanged.connect(self.btnFade.setChecked) if self.atem: self.rate.valueChanged.connect(self.atem.setFadeToBlackRate) self.btnFade.clicked.connect(self.atem.performFadeToBlack) layout.setRowStretch(0, 1) layout.setRowStretch(1, 1) self.setLayout(layout)
def __init__(self, attributeDict, existingFields, parent=None): super(ScrapeAttributeDialog, self).__init__(parent) self._choice_dict = {"field_name":'', "attr_name":'', "attr_value":''} self._rdbtn_label_map = {} self._field_names = existingFields layout = QGridLayout() for index, (attr_name, attr_value) in attributeDict: rdbtn_attr_name = QRadioButton(attr_name) label_attr_value = QLabel(attr_value) label_attr_value.setMaximumWidth(120) layout.addWidget(rdbtn_attr_name, index, 0) layout.addWidget(label_attr_value, index, 1, 1, 2) self._rdbtn_label_map[rdbtn_attr_name] = label_attr_value label_output_field = QLabel(self.tr("Output Field")) self.combo_output_field = SingleEditCombobox(existingFields) self._button_ok = QPushButton(self.tr("OK")) self._button_ok.clicked.connect(self._collectChoices) self._button_cancel = QPushButton(self.tr("Cancel")) self._button_cancel.clicked.connect(self.reject) index += 1 layout.addWidget(label_output_field, index, 0) layout.addWidget(self.combo_output_field, index, 1, 1, 2) index += 1 layout.addWidget(self._button_ok, index, 1) layout.addWidget(self._button_cancel, index, 2) self.setLayout(layout) self.setWindowTitle(self.tr("Choose Attributes"))
def __init__(self, parent=None): super(ExportDialog, self).__init__(parent) self._output_folder = None self.setModal(True) layout_main = QGridLayout() label_choose_format = QLabel(self.tr("Choose format")) self.combo_choose_format = QComboBox() self.combo_choose_format.setModel(QStringListModel(FileExporter.FORMATS_AVAILABLE)) label_saveto = QLabel(self.tr("Save location")) button_saveto = QPushButton(self.tr("Browse ...")) button_saveto.clicked.connect(self._openFolderChoiceDialog) self.label_output = QLabel() button_export = QPushButton(self.tr("Export")) button_export.clicked.connect(self.accept) button_cancel = QPushButton(self.tr("Cancel")) button_cancel.clicked.connect(self.reject) row = 0; col = 0; layout_main.addWidget(label_choose_format, row, col, 1, 2) col += 2 layout_main.addWidget(self.combo_choose_format, row, col, 1, 2) row += 1; col -= 2; layout_main.addWidget(label_saveto, row, col, 1, 2) col += 2 layout_main.addWidget(button_saveto, row, col, 1, 2) row += 1; col -= 2; layout_main.addWidget(self.label_output, row, col, 1, 4) row += 1; col += 2 layout_main.addWidget(button_export, row, col) col += 1 layout_main.addWidget(button_cancel, row, col) self.setWindowTitle(self.tr("Export Parameters")) self.setLayout(layout_main)
def __init__(self, width, height, grid): super(GameOfLifeWidget, self).__init__() self.setWindowTitle('Game Of Life') layout = QGridLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) main_layout = QVBoxLayout() self.buttons = [] self.grid = grid self.width = width self.height = height self.timer = QTimer() self.timer.setInterval(INTERVAL) self.timer.timeout.connect(self._handle_timeout) self.start_button = QPushButton("Start") self.start_button.clicked.connect(self._handle_start) self.clear_button = QPushButton("Clear") self.clear_button.clicked.connect(self._handle_clear) main_layout.addLayout(layout) main_layout.addWidget(self.start_button) main_layout.addWidget(self.clear_button) self.setLayout(main_layout) for y_pos in range(height): row = [] self.buttons.append(row) for x_pos in range(width): button = QPushButton() row.append(button) button.setMaximumWidth(20) button.setMaximumHeight(20) button.clicked.connect(self._handle_click) layout.addWidget(button, y_pos, x_pos) self._update_gui()
def initUI(self): self.dateEdit = QDateEdit() layout = QGridLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.dateEdit, 0, 0) layout.addItem(QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)) self.setLayout(layout)
def __init__(self, app, hub, html, debug=False): QDialog.__init__(self) self.app = app self.hub = hub self.html = addpool.html self.debug = debug self.url = "file:///" \ + os.path.join(self.app.property("ResPath"), "www/", html).replace('\\', '/') self.is_first_load = True self.view = web_core.QWebView(self) if not self.debug: self.view.setContextMenuPolicy(qt_core.Qt.NoContextMenu) self.view.setCursor(qt_core.Qt.ArrowCursor) self.view.setZoomFactor(1) self.setWindowTitle("Add/Edit Pool :: %s" % APP_NAME) self.icon = self._getQIcon('ombre_64x64.png') self.setWindowIcon(self.icon) layout = QGridLayout() layout.addWidget(self.view) self.setLayout(layout) self.setFixedSize(qt_core.QSize(660, 480)) self.center() self.view.loadFinished.connect(self._load_finished) # self.view.load(qt_core.QUrl(self.url)) self.view.setHtml(self.html, qt_core.QUrl(self.url))
def __init__(self, *args, **kwargs ): self.uiInfoPath = Window.infoBaseDir + '/Widget_ctlListGroup.json' QWidget.__init__( self, *args, **kwargs ) mainLayout = QVBoxLayout( self ) buttonLayout = QHBoxLayout() gridLayout = QGridLayout() mainLayout.addLayout( buttonLayout ) mainLayout.addLayout( gridLayout ) gridLayout.setSpacing(5) gridLayout.setVerticalSpacing(5) b_addList = QPushButton( "Add List" ) b_removeList = QPushButton( "Remove List" ) buttonLayout.addWidget( b_addList ) buttonLayout.addWidget( b_removeList ) w_ctlList = Widget_ctlList() gridLayout.addWidget( w_ctlList ) self.__gridLayout = gridLayout QtCore.QObject.connect( b_addList, QtCore.SIGNAL( "clicked()" ), self.addList ) QtCore.QObject.connect( b_removeList, QtCore.SIGNAL( "clicked()" ), self.removeList ) self.loadInfo()
def __init__(self, parent, template=LICENSE_TEXT, templateMap=LICENSE_TEMPLATE_MAP, titleText='License', flagSettingName='acceptedLicense'): ''' ''' super(OnceDialog, self).__init__(parent) self.template = template self.templateMap = templateMap self.titleText = titleText self.flagSettingName = flagSettingName self.scrollingText = QPlainTextEdit(self.filledTemplatedText(), parent=self) # buttons buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) # One scrolling text widget layout = QGridLayout() layout.addWidget(self.scrollingText) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle(self.tr(self.titleText)) # connections buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) self.setGeometry(0, 0, 600, 480)
def __init__(self): super(TwoStepLandmarkWidget, self).__init__() self.textFrame = QTextEdit( "<p>Place your mouse over the desired " "landmark point. Press 'Space' to shoot a ray through the volume. " "Move the volume around and move the mouse to move the locator. " "Press 'Space' again to define the final place of the landmark.</p>" "<p>You can also use the ray profile to define the landmark's location.</p>" ) self.textFrame.setReadOnly(True) self.textFrame.setFrameShape(QFrame.NoFrame) self.textFrame.setAutoFillBackground(False) self.textFrame.setAttribute(Qt.WA_TranslucentBackground) self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.textFrame.setStyleSheet("background: #aaa") self.histogramWidget = TrackingHistogramWidget() self.histogramWidget.setMinimumHeight(100) self.histogramWidget.setVisible(False) self.button = QPushButton("Pick current landmark position") self.button.clicked.connect(self.applyButtonClicked) self.button.setVisible(False) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.textFrame) layout.addWidget(self.histogramWidget) layout.addWidget(self.button) self.setLayout(layout)
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self): super(TransferFunctionWidget, self).__init__() self.nodes = [] self.lines = [] self.histogram = Histogram() self.histogram.enabled = False # Create a histogram widget for the background of the transfer function editor self.histogramWidget = HistogramWidget() self.histogramWidget.setHistogram(self.histogram) self.histogramWidget.setAxeMode(bottom=HistogramWidget.AxeClear, left=HistogramWidget.AxeLog) self.histogramWidget.update() self.histogramWidget._histogramItem.delegate = self Style.styleWidgetForTab(self.histogramWidget) # Invisible item that catches mouse events on top of the histogram self.transferfunctionItem = TransferFunctionItem() self.transferfunctionItem.setZValue(250) self.transferfunctionItem.delegate = self self.histogramWidget.addItem(self.transferfunctionItem) # Create a widget for editing the selected node of the transfer function self.nodeItemWidget = NodeItemWidget() self.nodeItemWidget.setEnabled(False) self.nodeItemWidget.nodeUpdated.connect(self.updateNode) self.nodeItemWidget.removePoint.connect(self.removePoint) layout = QGridLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.histogramWidget, 0, 0) layout.addWidget(self.nodeItemWidget, 1, 0) self.setLayout(layout)
def __init__(self, currentGroupNames=[], parent=None): super(GroupNameDialog, self).__init__(parent) self._current_groupnames = [ groupname.lower() for groupname in currentGroupNames ] self.setModal(True) self.setWindowTitle(self.tr("Group name")) label_prompt = QLabel(self.tr("Enter new launch group name:")) self._lineedit__groupname = QLineEdit() self._label_warning = QLabel() self._label_warning.setStyleSheet(""" QLabel { color: rgb(213, 17, 27); font-weight: bold; } """) self._button_ok = QPushButton(self.tr("OK")) button_cancel = QPushButton(self.tr("Cancel")) self._button_ok.clicked.connect(self._checkGroupName) button_cancel.clicked.connect(self.reject) layout = QGridLayout() row = 0 col = 0 layout.addWidget(label_prompt, 0, 0, 1, 4) row += 1 layout.addWidget(self._lineedit__groupname, row, col, 1, 4) row += 1 col += 2 layout.addWidget(self._button_ok, row, col) col += 1 layout.addWidget(button_cancel, row, col) self.setLayout(layout)
def setLayout(self): self.myStatusBar = QStatusBar() self.setStatusBar(self.myStatusBar) self.duckIcon = QIcon("duck.jpeg") self.happyDuckIcon = QIcon("happy-duck.jpeg") qWidget = QWidget() gridLayout = QGridLayout(qWidget) row = 0 self.setCentralWidget(qWidget) row = row + 1 self.rebootButton = QPushButton("Click to reset") #self.rebootButton.setIcon(QIcon("duck.jpeg")) self.rebootButton.setIconSize(QSize(200, 200)) gridLayout.addWidget(self.rebootButton, row, 0) self.rebootButton.clicked.connect(self.reboot) if filecmp.cmp("wpa_supplicant.conf", "wpa_supplicant.conf.orig"): self.myStatusBar.showMessage("Waiting to onboard.") self.rebootButton.setIcon(self.duckIcon) self.thread = Timer(5, self.checkFiles) self.thread.start() else: self.rebootButton.setIcon(self.happyDuckIcon) self.myStatusBar.showMessage("waiting for DHCP address") interface = "wlan1" p = subprocess.Popen(["/sbin/dhclient", interface], shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) res, err = p.communicate()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(583, 96) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QGridLayout() self.gridLayout.setObjectName("gridLayout") self.UI_label = QLabel(self.centralwidget) self.UI_label.setObjectName("UI_label") self.gridLayout.addWidget(self.UI_label, 0, 0, 1, 1) self.seleccionarUI_pushButton = QPushButton(self.centralwidget) self.seleccionarUI_pushButton.setObjectName("seleccionarUI_pushButton") self.gridLayout.addWidget(self.seleccionarUI_pushButton, 0, 2, 1, 1) self.Py_label = QLabel(self.centralwidget) self.Py_label.setObjectName("Py_label") self.gridLayout.addWidget(self.Py_label, 1, 0, 1, 1) self.rutaSalida_pushButton = QPushButton(self.centralwidget) self.rutaSalida_pushButton.setObjectName("rutaSalida_pushButton") self.gridLayout.addWidget(self.rutaSalida_pushButton, 1, 2, 1, 1) self.rutaEntrada_lineEdit = QLineEdit(self.centralwidget) self.rutaEntrada_lineEdit.setEnabled(False) self.rutaEntrada_lineEdit.setObjectName("rutaEntrada_lineEdit") self.gridLayout.addWidget(self.rutaEntrada_lineEdit, 0, 1, 1, 1) self.rutaSalida_lineEdit = QLineEdit(self.centralwidget) self.rutaSalida_lineEdit.setObjectName("rutaSalida_lineEdit") self.gridLayout.addWidget(self.rutaSalida_lineEdit, 1, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalWidget = QWidget(self.centralwidget) self.horizontalWidget.setObjectName("horizontalWidget") self.horizontalLayout = QHBoxLayout(self.horizontalWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.convertir_pushButton = QPushButton(self.horizontalWidget) self.convertir_pushButton.setObjectName("convertir_pushButton") self.horizontalLayout.addWidget(self.convertir_pushButton) self.verticalLayout.addWidget(self.horizontalWidget) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent): super(ElastixMainDialog, self).__init__(parent) self.transformation = None self.transformations = AppResources.elastixTemplates() self.radioButtons = [] for transformation in self.transformations: self.radioButtons.append(QRadioButton(transformation.name)) self.radioButtons.append(QRadioButton("Load custom parameter file...")) self.radioButtons[0].setChecked(True) self.nextButton = QPushButton("Next") self.nextButton.clicked.connect(self.next) self.cancelButton = QPushButton("Cancel") self.cancelButton.clicked.connect(self.cancel) groupLayout = QVBoxLayout() for radioButton in self.radioButtons: groupLayout.addWidget(radioButton) self.groupBox = QGroupBox("Choose parameter file") self.groupBox.setLayout(groupLayout) self.setModal(True) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.groupBox, 0, 0, 1, 2) layout.addWidget(self.cancelButton, 1, 0) layout.addWidget(self.nextButton, 1, 1) self.setLayout(layout)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.filenameLabelLabel) hbox.addWidget(self.filenameLabel, 1) hbox.addWidget(self.filenameButton) layout.addLayout(hbox) grid = QGridLayout() grid.addWidget(self.configCheckBox, 0, 0) grid.addWidget(self.autoReplaceCheckBox, 0, 1) grid.addWidget(self.spellWordsCheckBox, 1, 0) grid.addWidget(self.ignoredFirstWordsCheckBox, 1, 1) grid.addWidget(self.groupsCheckBox, 2, 0) grid.addWidget(self.customMarkupCheckBox, 2, 1) hbox = QHBoxLayout() hbox.addLayout(grid) hbox.addStretch() self.copyGroupBox.setLayout(hbox) layout.addWidget(self.copyGroupBox) layout.addStretch() buttonBox = QDialogButtonBox() buttonBox.addButton(self.newCopyButton, QDialogButtonBox.AcceptRole) buttonBox.addButton(self.cancelButton, QDialogButtonBox.RejectRole) buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) layout.addWidget(buttonBox) self.setLayout(layout)
def __init__(self, spiderName, resumable=False, parent=None): super(SpiderToolButton, self).__init__(parent) self._drag_start = None button_play = QToolButton() button_play.setIcon(QIcon("play.png")) self.triggered.connect( button_play.triggered ) # clicking the outer button run the play functionality button_play.setIconSize(QSize(32, 32)) button_resume = QToolButton() button_resume.setEnabled(resumable) button_resume.setIcon(QIcon("resume.png")) button_resume.setIconSize(QSize(32, 32)) button_pause = QToolButton() button_pause.setIcon(QIcon("pause.png")) button_pause.setIconSize(QSize(32, 32)) self.label_spidername = QLabel(spiderName) self.label_spidername.setStyleSheet(self.stylesheet_label_spidername) layout = QGridLayout() layout.addWidget(self.label_spidername, 0, 0) layout.addWidget(button_pause, 1, 1) layout.addWidget(button_resume, 1, 2) layout.addWidget(button_play, 1, 3) layout.setContentsMargins(10, 8, 10, 8) self.setLayout(layout)
def visual_proxy(self, read_only=False): view = QWidget() layout = QGridLayout() for row, attr in enumerate(["name", "surname", "age"]): layout.addWidget(QLabel(attr), row, 0) layout.addWidget(self.visual_proxy_attribute(attr, read_only), row, 1) view.setLayout(layout) return view
def __init__(self, parent): super(LabelWindow, self).__init__(parent) self.test_layout = QGridLayout() label = QLabel("Label") self.test_layout.addWidget(label, 0, 0) self.setLayout(self.test_layout) self._destroyCalled = False