当前位置: 首页>>代码示例>>Python>>正文


Python Qt.AlignRight方法代码示例

本文整理汇总了Python中qtpy.QtCore.Qt.AlignRight方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.AlignRight方法的具体用法?Python Qt.AlignRight怎么用?Python Qt.AlignRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtCore.Qt的用法示例。


在下文中一共展示了Qt.AlignRight方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_block

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def draw_block(self, painter, rect, block, first):
        """Draw the info corresponding to a given block (text line) of the text
        document."""
        pen = painter.pen()
        text = self.get_text(block.blockNumber())

        default = self.edit.currentCharFormat()
        formats = [default] * len(text)
        painter.setFont(self.edit.font())

        for index, length, format in self.highlighter.highlight(text):
            formats[index:index+length] = [format] * length

        for idx, (char, format) in enumerate(zip(text, formats)):
            rpos = len(text) - idx - 1
            pen.setColor(format.foreground().color())
            painter.setPen(pen)
            painter.drawText(rect, Qt.AlignRight, text[idx] + ' ' * rpos) 
开发者ID:marcus-oscarsson,项目名称:pyqtconsole,代码行数:20,代码来源:prompt.py

示例2: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def __init__(self, *args, **kwargs):
        super(LineEditSearch, self).__init__(*args, **kwargs)
        self._empty = True
        self._show_icons = False
        self.button_icon = ButtonSearch()

        self.button_icon.setDefault(True)
        self.button_icon.setFocusPolicy(Qt.NoFocus)

#        layout = QHBoxLayout()
#        layout.addWidget(self.button_icon, 0, Qt.AlignRight)
#        layout.setSpacing(0)
#        layout.addSpacing(2)
#        layout.setContentsMargins(0, 0, 0, 0)
#        self.setLayout(layout)

        # Signals
        self.textEdited.connect(self.update_box)
        self.button_icon.clicked.connect(self.clear_text)
        self.button_icon.setVisible(False)

        self.update_box(None)
#        self.set_icon_size(16, 16)
        self.setTabOrder(self, self.button_icon) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:26,代码来源:helperwidgets.py

示例3: _create_axis_label_widget

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def _create_axis_label_widget(self):
        """Create the axis label widget which accompanies its slider."""
        label = QLineEdit(self)
        label.setObjectName('axis_label')  # needed for _update_label
        label.setText(self.dims.axis_labels[self.axis])
        label.home(False)
        label.setToolTip('Edit to change axis label')
        label.setAcceptDrops(False)
        label.setEnabled(True)
        label.setAlignment(Qt.AlignRight)
        label.setContentsMargins(0, 0, 2, 0)
        label.textChanged.connect(self._update_label)
        label.editingFinished.connect(self._clear_label_focus)
        self.axis_label = label 
开发者ID:napari,项目名称:napari,代码行数:16,代码来源:qt_dims_slider.py

示例4: _update_slice_labels

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def _update_slice_labels(self):
        """Update slice labels to match current dimension slider position."""
        step = self.dims.range[self.axis][2]
        self.curslice_label.setText(
            str(int(self.dims.point[self.axis] // step))
        )
        self.curslice_label.setAlignment(Qt.AlignRight) 
开发者ID:napari,项目名称:napari,代码行数:9,代码来源:qt_dims_slider.py

示例5: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def __init__(self, parent=None, icon=True):
        super(SearchLineEdit, self).__init__(parent)
        self.setTextMargins(1, 0, 20, 0)

        if icon:
            self.setTextMargins(18, 0, 20, 0)
            self._label = QLabel(self)
            self._pixmap_icon = QPixmap(get_image_path('conda_search.png'))
            self._label.setPixmap(self._pixmap_icon)
            self._label.setStyleSheet('''border: 0px; padding-bottom: 0px;
                                      padding-left: 2px;''')

        self._pixmap = QPixmap(get_image_path('conda_del.png'))
        self.button_clear = QToolButton(self)
        self.button_clear.setIcon(QIcon(self._pixmap))
        self.button_clear.setIconSize(QSize(18, 18))
        self.button_clear.setCursor(Qt.ArrowCursor)
        self.button_clear.setStyleSheet("""QToolButton
            {background: transparent;
            padding-right: 2px; border: none; margin:0px; }""")
        self.button_clear.setVisible(False)

        # Layout
        self._layout = QHBoxLayout(self)
        self._layout.addWidget(self.button_clear, 0, Qt.AlignRight)
        self._layout.setSpacing(0)
        self._layout.setContentsMargins(0, 2, 2, 0)

        # Signals and slots
        self.button_clear.clicked.connect(self.clear_text)
        self.textChanged.connect(self._toggle_visibility)
        self.textEdited.connect(self._toggle_visibility) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:34,代码来源:search.py

示例6: data

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def data(self, index, role):
        """
        Return data in `role` for item of data that `index` points to.

        If `role` is `DisplayRole`, then return string to display.
        If `role` is `TooltipRole`, then return string for tool tip.
        If `role` is `FontRole`, then return monospace font for level-2 items.
        If `role` is `BackgroundRole`, then return background color.
        If `role` is `TextAlignmentRole`, then return right-aligned for time.
        If `role` is `UserRole`, then return location of test as (file, line).
        """
        if not index.isValid():
            return None
        row = index.row()
        column = index.column()
        id = index.internalId()
        if role == Qt.DisplayRole:
            if id != TOPLEVEL_ID:
                return self.testresults[id].extra_text[index.row()]
            elif column == STATUS_COLUMN:
                return self.testresults[row].status
            elif column == NAME_COLUMN:
                return self.abbreviator.abbreviate(self.testresults[row].name)
            elif column == MESSAGE_COLUMN:
                return self.testresults[row].message
            elif column == TIME_COLUMN:
                time = self.testresults[row].time
                return '' if time is None else '{:.2f}'.format(time * 1e3)
        elif role == Qt.ToolTipRole:
            if id == TOPLEVEL_ID and column == NAME_COLUMN:
                return self.testresults[row].name
        elif role == Qt.FontRole:
            if id != TOPLEVEL_ID:
                return self.monospace_font
        elif role == Qt.BackgroundRole:
            if id == TOPLEVEL_ID:
                testresult = self.testresults[row]
                if self.is_dark_interface:
                    return COLORS_DARK[testresult.category]
                else:
                    return COLORS[testresult.category]
        elif role == Qt.TextAlignmentRole:
            if id == TOPLEVEL_ID and column == TIME_COLUMN:
                return Qt.AlignRight
        elif role == Qt.UserRole:
            if id == TOPLEVEL_ID:
                testresult = self.testresults[row]
                return (testresult.filename, testresult.lineno)
        else:
            return None 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:52,代码来源:datatree.py

示例7: main

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def main() -> None:
    """Startup function."""
    global _app
    t0 = process_time()
    exit_code = 0
    from sys import argv, exit
    from logging import shutdown
    from platform import system
    from .info import ARGUMENTS, logger
    if ARGUMENTS.cmd in {'gui', None}:
        from qtpy.QtCore import Qt, qInstallMessageHandler
        from qtpy.QtWidgets import QApplication, QSplashScreen
        from qtpy.QtGui import QPixmap
        _app = QApplication(argv)
        # Depress Qt warning
        qInstallMessageHandler(lambda _0, _1, _2: None)
        # Load QRC file
        from pyslvs_ui.icons_rc import qInitResources
        qInitResources()
        # Splash
        sp = QSplashScreen(QPixmap(":/icons/splash.png"))
        sp.showMessage(f"{__author__} {__copyright__}",
                       Qt.AlignBottom | Qt.AlignRight)
        sp.show()
        # Force enable fusion style on macOS
        if system() == 'Darwin':
            ARGUMENTS.fusion = True
        if ARGUMENTS.fusion:
            _app.setStyle('fusion')
        # Main window
        from .main_window import MainWindow
        w = MainWindow.new()
        sp.finish(w)
        sp.deleteLater()
        logger.info(f"Startup with: {process_time() - t0:.02f}s")
        if not ARGUMENTS.debug_mode:
            w.console_connect()
        del sp, w
        exit_code = _app.exec_()
    elif ARGUMENTS.cmd == 'test':
        from importlib import import_module
        import_module('pyslvs_ui.main_window')
        logger.info("All module loaded successfully.")
        logger.info(f"Loaded with: {process_time() - t0:.02f}s")
    elif ARGUMENTS.cmd == 'extract':
        logger.info(f"Start CLI: {process_time() - t0:.02f}s")
        # TODO: CLI mode
    else:
        raise ValueError(f"unknown command: {ARGUMENTS.cmd}")
    shutdown()
    exit(exit_code) 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:53,代码来源:__main__.py

示例8: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def __init__(self, parent, events):
        super().__init__(parent)
        self.setWindowTitle("Create Epochs")

        grid = QGridLayout(self)
        label = QLabel("Events:")
        label.setAlignment(Qt.AlignTop)
        grid.addWidget(label, 0, 0, 1, 1)

        self.events = QListWidget()
        self.events.insertItems(0, unique(events[:, 2]).astype(str))
        self.events.setSelectionMode(QListWidget.ExtendedSelection)
        grid.addWidget(self.events, 0, 1, 1, 2)

        grid.addWidget(QLabel("Interval around events:"), 1, 0, 1, 1)
        self.tmin = QDoubleSpinBox()
        self.tmin.setMinimum(-10000)
        self.tmin.setValue(-0.2)
        self.tmin.setSingleStep(0.1)
        self.tmin.setAlignment(Qt.AlignRight)
        self.tmax = QDoubleSpinBox()
        self.tmax.setMinimum(-10000)
        self.tmax.setValue(0.5)
        self.tmax.setSingleStep(0.1)
        self.tmax.setAlignment(Qt.AlignRight)
        grid.addWidget(self.tmin, 1, 1, 1, 1)
        grid.addWidget(self.tmax, 1, 2, 1, 1)

        self.baseline = QCheckBox("Baseline Correction:")
        self.baseline.setChecked(True)
        self.baseline.stateChanged.connect(self.toggle_baseline)
        grid.addWidget(self.baseline, 2, 0, 1, 1)
        self.a = QDoubleSpinBox()
        self.a.setMinimum(-10000)
        self.a.setValue(-0.2)
        self.a.setSingleStep(0.1)
        self.a.setAlignment(Qt.AlignRight)
        self.b = QDoubleSpinBox()
        self.b.setMinimum(-10000)
        self.b.setValue(0)
        self.b.setSingleStep(0.1)
        self.b.setAlignment(Qt.AlignRight)
        grid.addWidget(self.a, 2, 1, 1, 1)
        grid.addWidget(self.b, 2, 2, 1, 1)
        self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        grid.addWidget(self.buttonbox, 3, 0, 1, -1)
        self.events.itemSelectionChanged.connect(self.toggle_ok)
        self.toggle_ok()
        grid.setSizeConstraint(QGridLayout.SetFixedSize) 
开发者ID:cbrnr,项目名称:mnelab,代码行数:54,代码来源:epochdialog.py

示例9: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignRight [as 别名]
def __init__(self, parent, nchan, methods):
        super().__init__(parent)
        self.setWindowTitle("Run ICA")

        vbox = QVBoxLayout(self)
        grid = QGridLayout()
        grid.addWidget(QLabel("Method:"), 0, 0)
        self.method = QComboBox()
        self.method.addItems(methods)
        self.method.setCurrentIndex(0)
        self.method.currentIndexChanged.connect(self.toggle_options)
        grid.addWidget(self.method, 0, 1)

        self.extended_label = QLabel("Extended:")
        grid.addWidget(self.extended_label, 1, 0)
        self.extended = QCheckBox()
        self.extended.setChecked(True)
        grid.addWidget(self.extended, 1, 1)

        self.ortho_label = QLabel("Orthogonal:")
        grid.addWidget(self.ortho_label, 2, 0)
        self.ortho = QCheckBox()
        self.ortho.setChecked(False)
        grid.addWidget(self.ortho, 2, 1)
        if "Picard" not in methods:
            self.ortho_label.hide()
            self.ortho.hide()

        grid.addWidget(QLabel("Number of components:"), 3, 0)
        self.n_components = QSpinBox()
        self.n_components.setRange(0, nchan)
        self.n_components.setValue(nchan)
        self.n_components.setAlignment(Qt.AlignRight)
        grid.addWidget(self.n_components, 3, 1)

        grid.addWidget(QLabel("Exclude bad segments:"), 4, 0)
        self.exclude_bad_segments = QCheckBox()
        self.exclude_bad_segments.setChecked(True)
        grid.addWidget(self.exclude_bad_segments, 4, 1)

        vbox.addLayout(grid)

        buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
                                     QDialogButtonBox.Cancel)
        vbox.addWidget(buttonbox)
        buttonbox.accepted.connect(self.accept)
        buttonbox.rejected.connect(self.reject)
        vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)

        self.toggle_options() 
开发者ID:cbrnr,项目名称:mnelab,代码行数:52,代码来源:runicadialog.py


注:本文中的qtpy.QtCore.Qt.AlignRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。