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


Python Qt.QGridLayout类代码示例

本文整理汇总了Python中PyQt4.Qt.QGridLayout的典型用法代码示例。如果您正苦于以下问题:Python QGridLayout类的具体用法?Python QGridLayout怎么用?Python QGridLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ConfigWidget

class ConfigWidget(QWidget):
  'Configuration widget'
  def __init__(self):
    QWidget.__init__(self)
    self.layout = QGridLayout()
    self.layout.setSpacing(10)
    self.setLayout(self.layout)

    self.key_label = QLabel('&api key:')
    self.key_msg = QLineEdit(self)
    self.key_msg.setText(PREFS['api_key'])
    self.layout.addWidget(self.key_label, 1, 0)
    self.layout.addWidget(self.key_msg, 1, 1)
    self.key_label.setBuddy(self.key_msg)

    self.threads_label = QLabel('&worker_threads:')
    self.threads_msg = QLineEdit(self)
    self.threads_msg.setText(unicode(PREFS['worker_threads']))
    self.layout.addWidget(self.threads_label, 2, 0)
    self.layout.addWidget(self.threads_msg, 2, 1)
    self.threads_label.setBuddy(self.threads_msg)

  def save_settings(self):
    'Apply new settings value'
    PREFS['api_key'] = unicode(self.key_msg.text())
    PREFS['worker_threads'] = int(self.threads_msg.text())
    pycomicvine.api_key = PREFS['api_key']
开发者ID:0tertra,项目名称:calibre-comicvine,代码行数:27,代码来源:config.py

示例2: Footer

class Footer(QWidget):
    
    def __init__(self):
        QWidget.__init__(self)
        self.__InitUi()
        
    def __InitUi(self):
        self.setFixedHeight(160)
        SetWidgetBackgroundColor(COLOR_WIDGET_2, self)
        self.__Layout = QGridLayout()
        self.setLayout(self.__Layout)
        self.__Layout.setContentsMargins(30,30,30,30)
        self.__Layout.setHorizontalSpacing(30)
        self.__Layout.setVerticalSpacing(30)
        self.__lblProcess = LabelSmalSize("", COLOR_FONT_4, True)
        self.__Layout.addWidget(self.__lblProcess)        
        self.__pgbProgress = Progressbar()
        self.__Layout.addWidget(self.__pgbProgress)
        
    def ProcessStartet(self, strProcess):
        self.__lblProcess.setText(strProcess)
        self.__pgbProgress.setMaximum(0)
        
    def ProcessEnded(self):
        self.__lblProcess.setText("")
        self.__pgbProgress.setMaximum(100)
开发者ID:gebenedeit,项目名称:sccpy,代码行数:26,代码来源:Footer.py

示例3: __init__

    def __init__(self, show_strength=True, parent=None):
        super(PinMatrixWidget, self).__init__(parent)
        
        self.password = QLineEdit()
        self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
        self.password.setEchoMode(QLineEdit.Password)
        QObject.connect(self.password, SIGNAL('textChanged(QString)'), self._password_changed)

        self.strength = QLabel()
        self.strength.setMinimumWidth(75)
        self.strength.setAlignment(Qt.AlignCenter)
        self._set_strength(0)

        grid = QGridLayout()
        grid.setSpacing(0)
        for y in range(3)[::-1]:
            for x in range(3):
                button = PinButton(self.password, x + y * 3 + 1)
                button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
                button.setFocusPolicy(Qt.NoFocus)
                grid.addWidget(button, 3 - y, x)

        hbox = QHBoxLayout()
        hbox.addWidget(self.password)
        if show_strength:
            hbox.addWidget(self.strength)

        vbox = QVBoxLayout()
        vbox.addLayout(grid)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
开发者ID:adballar,项目名称:python-trezor,代码行数:31,代码来源:pinmatrix.py

示例4: settings_dialog

    def settings_dialog(self):
        get_label = lambda: self.wallet.get_client().features.label
        update_label = lambda: current_label_label.setText("Label: %s" % get_label())

        d = QDialog()
        layout = QGridLayout(d)
        layout.addWidget(QLabel("Trezor Options"),0,0)
        layout.addWidget(QLabel("ID:"),1,0)
        layout.addWidget(QLabel(" %s" % self.wallet.get_client().get_device_id()),1,1)

        def modify_label():
            response = QInputDialog().getText(None, "Set New Trezor Label", "New Trezor Label:  (upon submission confirm on Trezor)")
            if not response[1]:
                return
            new_label = str(response[0])
            twd.start("Please confirm label change on Trezor")
            status = self.wallet.get_client().apply_settings(label=new_label)
            twd.stop()
            update_label()

        current_label_label = QLabel()
        update_label()
        change_label_button = QPushButton("Modify")
        change_label_button.clicked.connect(modify_label)
        layout.addWidget(current_label_label,3,0)
        layout.addWidget(change_label_button,3,1)

        if d.exec_():
            return True
        else:
            return False
开发者ID:Lexiks,项目名称:electrum,代码行数:31,代码来源:trezor.py

示例5: settings_dialog

    def settings_dialog(self):
        try:
            device_id = self.get_client().get_device_id()
        except BaseException as e:
            self.window.show_message(str(e))
            return
        get_label = lambda: self.get_client().features.label
        update_label = lambda: current_label_label.setText("Label: %s" % get_label())
        d = QDialog()
        layout = QGridLayout(d)
        layout.addWidget(QLabel("Trezor Options"), 0, 0)
        layout.addWidget(QLabel("ID:"), 1, 0)
        layout.addWidget(QLabel(" %s" % device_id), 1, 1)

        def modify_label():
            response = QInputDialog().getText(
                None, "Set New Trezor Label", "New Trezor Label:  (upon submission confirm on Trezor)"
            )
            if not response[1]:
                return
            new_label = str(response[0])
            self.handler.show_message("Please confirm label change on Trezor")
            status = self.get_client().apply_settings(label=new_label)
            self.handler.stop()
            update_label()

        current_label_label = QLabel()
        update_label()
        change_label_button = QPushButton("Modify")
        change_label_button.clicked.connect(modify_label)
        layout.addWidget(current_label_label, 3, 0)
        layout.addWidget(change_label_button, 3, 1)
        d.exec_()
开发者ID:justinvforvendetta,项目名称:electrum-boli,代码行数:33,代码来源:trezor.py

示例6: makeControlWidgets

 def makeControlWidgets(self, parent):
     """Creates control widgets for the colormap's internal parameters.
     "parent" is a parent widget.
     Returns None if no controls are required"""
     top = QWidget(parent)
     layout = QGridLayout(top)
     layout.setContentsMargins(0, 0, 0, 0)
     for irow, icol, control in ((0, 0, self.gamma), (0, 1, self.color), (1, 0, self.cycles), (1, 1, self.hue)):
         control.makeControlWidgets(top, layout, irow, icol)
         QObject.connect(control, SIGNAL("valueChanged"), self.emitChange)
         QObject.connect(control, SIGNAL("valueMoved"), self.emitPreview)
     return top
开发者ID:ska-sa,项目名称:tigger,代码行数:12,代码来源:Colormaps.py

示例7: setup_store_checks

    def setup_store_checks(self):
        first_run = self.config.get('first_run', True)

        # Add check boxes for each store so the user
        # can disable searching specific stores on a
        # per search basis.
        existing = {}
        for n in self.store_checks:
            existing[n] = self.store_checks[n].isChecked()

        self.store_checks = {}

        stores_check_widget = QWidget()
        store_list_layout = QGridLayout()
        stores_check_widget.setLayout(store_list_layout)

        icon = QIcon(I('donate.png'))
        for i, x in enumerate(sorted(self.gui.istores.keys(), key=lambda x: x.lower())):
            cbox = QCheckBox(x)
            cbox.setChecked(existing.get(x, first_run))
            store_list_layout.addWidget(cbox, i, 0, 1, 1)
            if self.gui.istores[x].base_plugin.affiliate:
                iw = QLabel(self)
                iw.setToolTip('<p>' + _('Buying from this store supports the calibre developer: %s</p>') % self.gui.istores[x].base_plugin.author + '</p>')
                iw.setPixmap(icon.pixmap(16, 16))
                store_list_layout.addWidget(iw, i, 1, 1, 1)
            self.store_checks[x] = cbox
        store_list_layout.setRowStretch(store_list_layout.rowCount(), 10)
        self.store_list.setWidget(stores_check_widget)

        self.config['first_run'] = False
开发者ID:BobPyron,项目名称:calibre,代码行数:31,代码来源:search.py

示例8: UpdateNotification

class UpdateNotification(QDialog):

    def __init__(self, calibre_version, plugin_updates, parent=None):
        QDialog.__init__(self, parent)
        self.setAttribute(Qt.WA_QuitOnClose, False)
        self.resize(400, 250)
        self.l = QGridLayout()
        self.setLayout(self.l)
        self.logo = QLabel()
        self.logo.setMaximumWidth(110)
        self.logo.setPixmap(QPixmap(I('lt.png')).scaled(100, 100,
            Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
        ver = calibre_version
        if ver.endswith('.0'):
            ver = ver[:-2]
        self.label = QLabel(('<p>'+
            _('New version <b>%(ver)s</b> of %(app)s is available for download. '
            'See the <a href="http://calibre-ebook.com/whats-new'
            '">new features</a>.'))%dict(
                app=__appname__, ver=ver))
        self.label.setOpenExternalLinks(True)
        self.label.setWordWrap(True)
        self.setWindowTitle(_('Update available!'))
        self.setWindowIcon(QIcon(I('lt.png')))
        self.l.addWidget(self.logo, 0, 0)
        self.l.addWidget(self.label, 0, 1)
        self.cb = QCheckBox(
            _('Show this notification for future updates'), self)
        self.l.addWidget(self.cb, 1, 0, 1, -1)
        self.cb.setChecked(config.get('new_version_notification'))
        self.cb.stateChanged.connect(self.show_future)
        self.bb = QDialogButtonBox(self)
        b = self.bb.addButton(_('&Get update'), self.bb.AcceptRole)
        b.setDefault(True)
        b.setIcon(QIcon(I('arrow-down.png')))
        if plugin_updates > 0:
            b = self.bb.addButton(_('Update &plugins'), self.bb.ActionRole)
            b.setIcon(QIcon(I('plugins/plugin_updater.png')))
            b.clicked.connect(self.get_plugins, type=Qt.QueuedConnection)
        self.bb.addButton(self.bb.Cancel)
        self.l.addWidget(self.bb, 2, 0, 1, -1)
        self.bb.accepted.connect(self.accept)
        self.bb.rejected.connect(self.reject)
        dynamic.set('update to version %s'%calibre_version, False)

    def get_plugins(self):
        from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog,
            FILTER_UPDATE_AVAILABLE)
        d = PluginUpdaterDialog(self.parent(),
                initial_filter=FILTER_UPDATE_AVAILABLE)
        d.exec_()

    def show_future(self, *args):
        config.set('new_version_notification', bool(self.cb.isChecked()))

    def accept(self):
        open_url(QUrl(get_download_url()))

        QDialog.accept(self)
开发者ID:089git,项目名称:calibre,代码行数:59,代码来源:update.py

示例9: Widget

class Widget(QWidget, ScreenWidget):
    name = "network"

    def __init__(self):
        QWidget.__init__(self)
        self.layout = QGridLayout(self)
        self.networkConnector = pds.container.PNetworkManager(self)
        self.layout.addWidget(self.networkConnector)

    def shown(self):
        self.networkConnector.startNetworkManager()

    def execute(self):
        self.networkConnector._proc.terminate()
        ctx.mainScreen.disableBack()
        return True
开发者ID:Pardus-Linux,项目名称:yali,代码行数:16,代码来源:ScrNetwork.py

示例10: __init__

    def __init__(self):
        QWidget.__init__(self)
        self.l = QGridLayout()
        self.setLayout(self.l)

        self.newFormatCheckboxLabel = QLabel("Generate new format data (SQLite3)")
        self.l.addWidget(self.newFormatCheckboxLabel, 0, 0, 1, 1)
        self.newFormatCheckbox = QCheckBox(self)
        self.l.addWidget(self.newFormatCheckbox, 0, 1, 1, 1)
        self.newFormatCheckbox.setChecked(prefs["newFormat"])

        # ARTTBD Maybe should be a native directory picker?  Works for now..
        self.cacheDirLabel = QLabel("Caching directory (optional, useful if re-running for a given book)")
        self.l.addWidget(self.cacheDirLabel, 1, 0, 1, 1)
        self.cacheDirEdit = QLineEdit(self)
        self.l.addWidget(self.cacheDirEdit, 1, 1, 1, 1)
        self.cacheDirEdit.setText(prefs["cacheDir"])

        self.autoExpandAliasesLabel = QLabel("Auto-generate aliases from character names")
        self.l.addWidget(self.autoExpandAliasesLabel, 2, 0, 1, 1)
        self.autoExpandAliasesCheckbox = QCheckBox(self)
        self.l.addWidget(self.autoExpandAliasesCheckbox, 2, 1, 1, 1)
        self.autoExpandAliasesCheckbox.setChecked(prefs["autoExpandAliases"])

        self.logfileLabel = QLabel("Log file (optional)")
        self.l.addWidget(self.logfileLabel, 3, 0, 1, 1)
        self.logfileEdit = QLineEdit(self)
        self.l.addWidget(self.logfileEdit, 3, 1, 1, 1)
        self.logfileEdit.setText(prefs["logfile"])
开发者ID:stoduk,项目名称:calibre_plugin_xray,代码行数:29,代码来源:xray_config.py

示例11: __init__

    def __init__(self, parent, db, author, series=None):
        QDialog.__init__(self, parent)
        self.db = db

        self.setWindowTitle(_('How many empty books?'))

        self._layout = QGridLayout(self)
        self.setLayout(self._layout)

        self.qty_label = QLabel(_('How many empty books should be added?'))
        self._layout.addWidget(self.qty_label, 0, 0, 1, 2)

        self.qty_spinbox = QSpinBox(self)
        self.qty_spinbox.setRange(1, 10000)
        self.qty_spinbox.setValue(1)
        self._layout.addWidget(self.qty_spinbox, 1, 0, 1, 2)

        self.author_label = QLabel(_('Set the author of the new books to:'))
        self._layout.addWidget(self.author_label, 2, 0, 1, 2)

        self.authors_combo = EditWithComplete(self)
        self.authors_combo.setSizeAdjustPolicy(
                self.authors_combo.AdjustToMinimumContentsLengthWithIcon)
        self.authors_combo.setEditable(True)
        self._layout.addWidget(self.authors_combo, 3, 0, 1, 1)
        self.initialize_authors(db, author)

        self.clear_button = QToolButton(self)
        self.clear_button.setIcon(QIcon(I('trash.png')))
        self.clear_button.setToolTip(_('Reset author to Unknown'))
        self.clear_button.clicked.connect(self.reset_author)
        self._layout.addWidget(self.clear_button, 3, 1, 1, 1)

        self.series_label = QLabel(_('Set the series of the new books to:'))
        self._layout.addWidget(self.series_label, 4, 0, 1, 2)

        self.series_combo = EditWithComplete(self)
        self.authors_combo.setSizeAdjustPolicy(
                self.authors_combo.AdjustToMinimumContentsLengthWithIcon)
        self.series_combo.setEditable(True)
        self._layout.addWidget(self.series_combo, 5, 0, 1, 1)
        self.initialize_series(db, series)

        self.sclear_button = QToolButton(self)
        self.sclear_button.setIcon(QIcon(I('trash.png')))
        self.sclear_button.setToolTip(_('Reset series'))
        self.sclear_button.clicked.connect(self.reset_series)
        self._layout.addWidget(self.sclear_button, 5, 1, 1, 1)

        self.create_epub = c = QCheckBox(_('Create an empty EPUB file as well'))
        c.setChecked(gprefs.get('create_empty_epub_file', False))
        c.setToolTip(_('Also create an empty EPUB file that you can subsequently edit'))
        self._layout.addWidget(c, 6, 0, 1, -1)

        button_box = self.bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.accept)
        button_box.rejected.connect(self.reject)
        self._layout.addWidget(button_box, 7, 0, 1, -1)
        self.resize(self.sizeHint())
开发者ID:HaraldGustafsson,项目名称:calibre,代码行数:59,代码来源:add_empty_book.py

示例12: __init__

 def __init__(self, movie):
     self.movie = movie
     QDialog.__init__(self, None)
     self.setObjectName("movie_warning")
     self.text_browser = QTextBrowser(self)
     self.text_browser.setObjectName("movie_warning_textbrowser")
     self.text_browser.setMinimumSize(400, 40)
     self.setWindowTitle('Rewind your movie?')
     self.text_browser.setPlainText( #bruce 080827 revised text
         "You may want to rewind the movie now. The atoms move as the movie "
         "progresses, and saving the part without rewinding will save the "
         "current positions, which is sometimes useful, but will make the "
         "movie invalid, because .dpb files only store deltas relative to "
         "the initial atom positions, and don't store the initial positions "
         "themselves." )
     self.ok_button = QPushButton(self)
     self.ok_button.setObjectName("ok_button")
     self.ok_button.setText("Rewind movie")
     self.cancel_button = QPushButton(self)
     self.cancel_button.setObjectName("cancel_button")
     self.cancel_button.setText("Exit command without rewinding") #bruce 080827 revised text
         # Note: this is not, in fact, a cancel button --
         # there is no option in the caller to prevent exiting the command.
         # There is also no option to "forward to final position",
         # though for a minimize movie, that might be most useful.
         # [bruce 080827 comment]
     layout = QGridLayout(self)
     layout.addWidget(self.text_browser, 0, 0, 0, 1)
     layout.addWidget(self.ok_button, 1, 0)
     layout.addWidget(self.cancel_button, 1, 1)
     self.connect(self.ok_button, SIGNAL("clicked()"), self.rewindMovie)
     self.connect(self.cancel_button, SIGNAL("clicked()"), self.noThanks)
开发者ID:elfion,项目名称:nanoengineer,代码行数:32,代码来源:movieMode.py

示例13: __init__

 def __init__(self, movie):
     self.movie = movie
     QDialog.__init__(self, None)
     self.setObjectName("movie_warning")
     self.text_browser = QTextBrowser(self)
     self.text_browser.setObjectName("movie_warning_textbrowser")
     self.text_browser.setMinimumSize(400, 40)
     self.setWindowTitle('Rewind your movie?')
     self.text_browser.setPlainText(
         "You may want to rewind the movie now. If you save the part without " +
         "rewinding the movie, the movie file will become invalid because it " +
         "depends upon the initial atom positions. The atoms move as the movie " +
         "progresses, and saving the part now will save the final positions, " +
         "which are incorrect for the movie you just watched.")
     self.ok_button = QPushButton(self)
     self.ok_button.setObjectName("ok_button")
     self.ok_button.setText("Rewind movie")
     self.cancel_button = QPushButton(self)
     self.cancel_button.setObjectName("cancel_button")
     self.cancel_button.setText("No thanks")
     layout = QGridLayout(self)
     layout.addWidget(self.text_browser,0,0,0,1)
     layout.addWidget(self.ok_button,1,0)
     layout.addWidget(self.cancel_button,1,1)
     self.connect(self.ok_button,SIGNAL("clicked()"),self.rewindMovie)
     self.connect(self.cancel_button,SIGNAL("clicked()"),self.noThanks)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:26,代码来源:movieMode.py

示例14: __InitUi

 def __InitUi(self):
     self.setFixedHeight(160)
     SetWidgetBackgroundColor(COLOR_WIDGET_2, self)
     self.__Layout = QGridLayout()
     self.setLayout(self.__Layout)
     self.__Layout.setContentsMargins(30,30,30,30)
     self.__Layout.setHorizontalSpacing(30)
     self.__Layout.setVerticalSpacing(30)
     self.__lblProcess = LabelSmalSize("", COLOR_FONT_4, True)
     self.__Layout.addWidget(self.__lblProcess)        
     self.__pgbProgress = Progressbar()
     self.__Layout.addWidget(self.__pgbProgress)
开发者ID:gebenedeit,项目名称:sccpy,代码行数:12,代码来源:Footer.py

示例15: __init__

    def __init__(self):
        QWidget.__init__(self, ctx.mainScreen)
        self.setObjectName("InformationWindow")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setFixedHeight(50)
        self.setMaximumWidth(800)
        self.setStyleSheet("""
            QFrame#frame { border: 1px solid rgba(255,255,255,30);
                           /*border-radius: 4px;*/
                           background-color: rgba(0,0,0,100);}

            QLabel { border:none;
                     color:#FFFFFF;}

            QProgressBar { border: 1px solid white;}

            QProgressBar::chunk { background-color: #F1610D;
                                  width: 0.5px;}
        """)

        self.gridlayout = QGridLayout(self)
        self.frame = QFrame(self)
        self.frame.setObjectName("frame")
        self.horizontalLayout = QHBoxLayout(self.frame)
        self.horizontalLayout.setContentsMargins(10, 0, 10, 0)

        # Spinner
        self.spinner = QLabel(self.frame)
        self.spinner.setMinimumSize(QSize(16, 16))
        self.spinner.setMaximumSize(QSize(16, 16))
        self.spinner.setIndent(6)
        self.movie = QMovie(':/images/working.mng')
        self.spinner.setMovie(self.movie)
        self.movie.start()
        self.horizontalLayout.addWidget(self.spinner)

        # Message
        self.label = QLabel(self.frame)
        self.label.setAlignment(Qt.AlignCenter)
        self.label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.icon = QLabel(self.frame)
        self.icon.setFixedWidth(16)
        self.icon.setFixedHeight(16)
        self.horizontalLayout.setSpacing(10)
        self.horizontalLayout.addWidget(self.icon)
        self.horizontalLayout.addWidget(self.label)

        self.gridlayout.addWidget(self.frame,0,0,1,1)
开发者ID:Pardus-Linux,项目名称:yali,代码行数:48,代码来源:YaliDialog.py


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