本文整理汇总了Python中PyQt5.Qt.QFrame类的典型用法代码示例。如果您正苦于以下问题:Python QFrame类的具体用法?Python QFrame怎么用?Python QFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginConfig
class PluginConfig(QWidget): # {{{
finished = pyqtSignal()
def __init__(self, plugin, parent):
QWidget.__init__(self, parent)
self.plugin = plugin
self.l = l = QVBoxLayout()
self.setLayout(l)
self.c = c = QLabel(_('<b>Configure %(name)s</b><br>%(desc)s') % dict(
name=plugin.name, desc=plugin.description))
c.setAlignment(Qt.AlignHCenter)
l.addWidget(c)
self.config_widget = plugin.config_widget()
self.l.addWidget(self.config_widget)
self.bb = QDialogButtonBox(
QDialogButtonBox.Save|QDialogButtonBox.Cancel,
parent=self)
self.bb.accepted.connect(self.finished)
self.bb.rejected.connect(self.finished)
self.bb.accepted.connect(self.commit)
l.addWidget(self.bb)
self.f = QFrame(self)
self.f.setFrameShape(QFrame.HLine)
l.addWidget(self.f)
def commit(self):
self.plugin.save_settings(self.config_widget)
示例2: __init__
def __init__(self, parent, closeButton=True):
QFrame.__init__(self, parent)
self.setMaximumSize(QSize(9999999,22))
self.setObjectName("windowTitle")
self.hboxlayout = QHBoxLayout(self)
self.hboxlayout.setSpacing(0)
self.hboxlayout.setContentsMargins(0,0,4,0)
self.label = QLabel(self)
self.label.setObjectName("label")
self.label.setStyleSheet("padding-left:4px; font:bold 11px; color: #FFFFFF;")
self.hboxlayout.addWidget(self.label)
spacerItem = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
self.hboxlayout.addItem(spacerItem)
if closeButton:
self.pushButton = QPushButton(self)
self.pushButton.setFocusPolicy(Qt.NoFocus)
self.pushButton.setObjectName("pushButton")
self.pushButton.setStyleSheet("font:bold;")
self.pushButton.setText("X")
self.hboxlayout.addWidget(self.pushButton)
self.dragPosition = None
self.mainwidget = self.parent()
self.setStyleSheet("""
QFrame#windowTitle {background-color:#222222;color:#FFF;}
""")
# Initial position to top left
self.dragPosition = self.mainwidget.frameGeometry().topLeft()
示例3: __init__
def __init__(self, horizontal=False, size=48, parent=None):
QFrame.__init__(self, parent)
if horizontal:
size = 24
self.pi = ProgressIndicator(self, size)
self._jobs = QLabel('<b>'+_('Jobs:')+' 0')
self._jobs.mouseReleaseEvent = self.mouseReleaseEvent
self.shortcut = 'Shift+Alt+J'
if horizontal:
self.setLayout(QHBoxLayout())
self.layout().setDirection(self.layout().RightToLeft)
else:
self.setLayout(QVBoxLayout())
self._jobs.setAlignment(Qt.AlignHCenter|Qt.AlignBottom)
self.layout().addWidget(self.pi)
self.layout().addWidget(self._jobs)
if not horizontal:
self.layout().setAlignment(self._jobs, Qt.AlignHCenter)
self._jobs.setMargin(0)
self.layout().setContentsMargins(0, 0, 0, 0)
self._jobs.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
self.setCursor(Qt.PointingHandCursor)
b = _('Click to see list of jobs')
self.setToolTip(b + u' (%s)'%self.shortcut)
self.action_toggle = QAction(b, parent)
parent.addAction(self.action_toggle)
self.action_toggle.setShortcut(self.shortcut)
self.action_toggle.triggered.connect(self.toggle)
示例4: _initialize_file_type_settings
def _initialize_file_type_settings(self, layout):
'''Initialize file creation/sending type settings'''
separator_b = QFrame()
separator_b.setFrameStyle(QFrame.HLine)
separator_b.setFrameShadow(QFrame.Sunken)
layout.addWidget(separator_b)
book_types_to_create = QGroupBox()
book_types_to_create.setTitle('Book types to create files for:')
book_types_to_create.setLayout(QHBoxLayout(book_types_to_create))
self._settings['mobi'] = QCheckBox('MOBI')
self._settings['mobi'].setChecked('mobi' in __prefs__['formats'])
book_types_to_create.layout().addWidget(self._settings['mobi'])
self._settings['azw3'] = QCheckBox('AZW3')
self._settings['azw3'].setChecked('azw3' in __prefs__['formats'])
book_types_to_create.layout().addWidget(self._settings['azw3'])
layout.addWidget(book_types_to_create)
file_preference_layout = QGroupBox()
file_preference_layout.setTitle('If device has both (mobi and azw3) formats, prefer:')
file_preference_layout.setLayout(QHBoxLayout(file_preference_layout))
file_preference_group = QButtonGroup()
self._settings['file_preference_mobi'] = QRadioButton('MOBI')
self._settings['file_preference_mobi'].setChecked(__prefs__['file_preference'] == 'mobi')
file_preference_group.addButton(self._settings['file_preference_mobi'])
file_preference_layout.layout().addWidget(self._settings['file_preference_mobi'])
self._settings['file_preference_azw3'] = QRadioButton('AZW3')
self._settings['file_preference_azw3'].setChecked(__prefs__['file_preference'] == 'azw3')
file_preference_group.addButton(self._settings['file_preference_azw3'])
file_preference_layout.layout().addWidget(self._settings['file_preference_azw3'])
layout.addWidget(file_preference_layout)
示例5: _intialize_file_settings
def _intialize_file_settings(self, layout):
'''Initialize file creation/sending settings'''
separator_a = QFrame()
separator_a.setFrameStyle(QFrame.HLine)
separator_a.setFrameShadow(QFrame.Sunken)
layout.addWidget(separator_a)
files_to_create = QGroupBox()
files_to_create.setTitle('Files to create/send')
files_to_create.setLayout(QGridLayout(files_to_create))
self._settings['create_send_xray'] = QCheckBox('X-Ray')
self._settings['create_send_xray'].setChecked(__prefs__['create_send_xray'])
files_to_create.layout().addWidget(self._settings['create_send_xray'], 0, 0)
self._settings['create_send_author_profile'] = QCheckBox('Author Profile')
self._settings['create_send_author_profile'].setChecked(__prefs__['create_send_author_profile'])
files_to_create.layout().addWidget(self._settings['create_send_author_profile'], 1, 0)
self._settings['create_send_start_actions'] = QCheckBox('Start Actions')
self._settings['create_send_start_actions'].setChecked(__prefs__['create_send_start_actions'])
files_to_create.layout().addWidget(self._settings['create_send_start_actions'], 0, 1)
self._settings['create_send_end_actions'] = QCheckBox('End Actions')
self._settings['create_send_end_actions'].setChecked(__prefs__['create_send_end_actions'])
files_to_create.layout().addWidget(self._settings['create_send_end_actions'], 1, 1)
layout.addWidget(files_to_create)
示例6: timerEvent
def timerEvent(self, event):
if event.timerId() == self.timer.timerId():
if self.isWaitingAfterLine:
self.isWaitingAfterLine = False
self.newPiece()
else:
self.oneLineDown()
else:
QFrame.timerEvent(self, event)
示例7: __init__
def __init__(self, parent=None):
QFrame.__init__(self, parent)
self.setFrameShape(self.StyledPanel)
self.search_index = -1
self.search = {}
self.original_name = None
self.l = l = QVBoxLayout(self)
self.title = la = QLabel('<h2>Edit...')
self.ht = h = QHBoxLayout()
l.addLayout(h)
h.addWidget(la)
self.cb = cb = QToolButton(self)
cb.setIcon(QIcon(I('window-close.png')))
cb.setToolTip(_('Abort editing of search'))
h.addWidget(cb)
cb.clicked.connect(self.abort_editing)
self.search_name = n = QLineEdit('', self)
n.setPlaceholderText(_('The name with which to save this search'))
self.la1 = la = QLabel(_('&Name:'))
la.setBuddy(n)
self.h3 = h = QHBoxLayout()
h.addWidget(la), h.addWidget(n)
l.addLayout(h)
self.find = f = QPlainTextEdit('', self)
self.la2 = la = QLabel(_('&Find:'))
la.setBuddy(f)
l.addWidget(la), l.addWidget(f)
self.replace = r = QPlainTextEdit('', self)
self.la3 = la = QLabel(_('&Replace:'))
la.setBuddy(r)
l.addWidget(la), l.addWidget(r)
self.case_sensitive = c = QCheckBox(_('Case sensitive'))
self.h = h = QHBoxLayout()
l.addLayout(h)
h.addWidget(c)
self.dot_all = d = QCheckBox(_('Dot matches all'))
h.addWidget(d), h.addStretch(2)
self.h2 = h = QHBoxLayout()
l.addLayout(h)
self.mode_box = m = ModeBox(self)
m.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.la4 = la = QLabel(_('&Mode:'))
la.setBuddy(m)
h.addWidget(la), h.addWidget(m), h.addStretch(2)
self.done_button = b = QPushButton(QIcon(I('ok.png')), _('&Done'))
b.setToolTip(_('Finish editing of search'))
h.addWidget(b)
b.clicked.connect(self.emit_done)
示例8: eventFilter
def eventFilter(self, obj, event):
if self.capture == 0 or obj not in (self.button1, self.button2):
return QFrame.eventFilter(self, obj, event)
t = event.type()
if t == event.ShortcutOverride:
event.accept()
return True
if t == event.KeyPress:
self.key_press_event(event, 1 if obj is self.button1 else 2)
return True
return QFrame.eventFilter(self, obj, event)
示例9: setup_select_libraries_panel
def setup_select_libraries_panel(self):
self.imported_lib_widgets = []
self.frames = []
l = self.slp.layout()
for lpath in sorted(self.importer.metadata['libraries'], key=lambda x:numeric_sort_key(os.path.basename(x))):
f = QFrame(self)
self.frames.append(f)
l.addWidget(f)
f.setFrameShape(f.HLine)
w = ImportLocation(lpath, self.slp)
l.addWidget(w)
self.imported_lib_widgets.append(w)
l.addStretch()
示例10: __init__
def __init__(self, name, plugins, gui_name, parent=None):
QWidget.__init__(self, parent)
self._layout = QVBoxLayout()
self.setLayout(self._layout)
self.label = QLabel(gui_name)
self.sep = QFrame(self)
self.bf = QFont()
self.bf.setBold(True)
self.label.setFont(self.bf)
self.sep.setFrameShape(QFrame.HLine)
self._layout.addWidget(self.label)
self._layout.addWidget(self.sep)
self.plugins = plugins
self.bar = QToolBar(self)
self.bar.setStyleSheet(
'QToolBar { border: none; background: none }')
self.bar.setIconSize(QSize(32, 32))
self.bar.setMovable(False)
self.bar.setFloatable(False)
self.bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
self._layout.addWidget(self.bar)
self.actions = []
for p in plugins:
target = partial(self.triggered, p)
ac = self.bar.addAction(QIcon(p.icon), p.gui_name, target)
ac.setToolTip(textwrap.fill(p.description))
ac.setWhatsThis(textwrap.fill(p.description))
ac.setStatusTip(p.description)
self.actions.append(ac)
w = self.bar.widgetForAction(ac)
w.setCursor(Qt.PointingHandCursor)
w.setAutoRaise(True)
w.setMinimumWidth(100)
示例11: __init__
def __init__(self, parent=None):
QFrame.__init__(self, parent)
self.setFocusPolicy(Qt.StrongFocus)
self.setAutoFillBackground(True)
self.capture = 0
self.setFrameShape(self.StyledPanel)
self.setFrameShadow(self.Raised)
self._layout = l = QGridLayout(self)
self.setLayout(l)
self.header = QLabel('')
l.addWidget(self.header, 0, 0, 1, 2)
self.use_default = QRadioButton('')
self.use_custom = QRadioButton(_('Custom'))
l.addWidget(self.use_default, 1, 0, 1, 3)
l.addWidget(self.use_custom, 2, 0, 1, 3)
self.use_custom.toggled.connect(self.custom_toggled)
off = 2
for which in (1, 2):
text = _('&Shortcut:') if which == 1 else _('&Alternate shortcut:')
la = QLabel(text)
la.setStyleSheet('QLabel { margin-left: 1.5em }')
l.addWidget(la, off+which, 0, 1, 3)
setattr(self, 'label%d'%which, la)
button = QPushButton(_('None'), self)
button.clicked.connect(partial(self.capture_clicked, which=which))
button.keyPressEvent = partial(self.key_press_event, which=which)
setattr(self, 'button%d'%which, button)
clear = QToolButton(self)
clear.setIcon(QIcon(I('clear_left.png')))
clear.clicked.connect(partial(self.clear_clicked, which=which))
setattr(self, 'clear%d'%which, clear)
l.addWidget(button, off+which, 1, 1, 1)
l.addWidget(clear, off+which, 2, 1, 1)
la.setBuddy(button)
self.done_button = doneb = QPushButton(_('Done'), self)
l.addWidget(doneb, 0, 2, 1, 1)
doneb.clicked.connect(lambda : self.editing_done.emit(self))
l.setColumnStretch(0, 100)
self.custom_toggled(False)
示例12: __init__
def __init__(self, index, dup_check, parent=None):
QFrame.__init__(self, parent)
self.setupUi(self)
self.data_model = index.model()
self.setFocusPolicy(Qt.StrongFocus)
self.setAutoFillBackground(True)
self.custom.toggled.connect(self.custom_toggled)
self.custom_toggled(False)
self.capture = 0
self.key = None
self.shorcut1 = self.shortcut2 = None
self.dup_check = dup_check
for x in (1, 2):
button = getattr(self, "button%d" % x)
button.clicked.connect(partial(self.capture_clicked, which=x))
button.keyPressEvent = partial(self.key_press_event, which=x)
clear = getattr(self, "clear%d" % x)
clear.clicked.connect(partial(self.clear_clicked, which=x))
示例13: Category
class Category(QWidget): # {{{
plugin_activated = pyqtSignal(object)
def __init__(self, name, plugins, gui_name, parent=None):
QWidget.__init__(self, parent)
self._layout = QVBoxLayout()
self.setLayout(self._layout)
self.label = QLabel(gui_name)
self.sep = QFrame(self)
self.bf = QFont()
self.bf.setBold(True)
self.label.setFont(self.bf)
self.sep.setFrameShape(QFrame.HLine)
self._layout.addWidget(self.label)
self._layout.addWidget(self.sep)
self.plugins = plugins
self.bar = QToolBar(self)
self.bar.setStyleSheet(
'QToolBar { border: none; background: none }')
lh = QApplication.instance().line_height
self.bar.setIconSize(QSize(2*lh, 2*lh))
self.bar.setMovable(False)
self.bar.setFloatable(False)
self.bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
self._layout.addWidget(self.bar)
self.actions = []
for p in plugins:
target = partial(self.triggered, p)
ac = self.bar.addAction(QIcon(p.icon), p.gui_name.replace('&', '&&'), target)
ac.setToolTip(textwrap.fill(p.description))
ac.setWhatsThis(textwrap.fill(p.description))
ac.setStatusTip(p.description)
self.actions.append(ac)
w = self.bar.widgetForAction(ac)
w.setCursor(Qt.PointingHandCursor)
if hasattr(w, 'setAutoRaise'):
w.setAutoRaise(True)
w.setMinimumWidth(100)
def triggered(self, plugin, *args):
self.plugin_activated.emit(plugin)
示例14: create_template_widget
def create_template_widget(title, which, button):
attr = which + '_template'
heading = QLabel('<h2>' + title)
setattr(tp, attr + '_heading', heading)
l.addWidget(heading)
la = QLabel()
setattr(self, attr, la)
l.addWidget(la), la.setTextFormat(Qt.PlainText), la.setStyleSheet('QLabel {font-family: monospace}')
la.setWordWrap(True)
b = QPushButton(button)
b.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
b.clicked.connect(partial(self.change_template, which))
setattr(self, attr + '_button', b)
l.addWidget(b)
if which != 'footer':
f = QFrame(tp)
setattr(tp, attr + '_sep', f), f.setFrameShape(QFrame.HLine)
l.addWidget(f)
l.addSpacing(10)
示例15: __init__
def __init__(self, index, dup_check, parent=None):
QFrame.__init__(self, parent)
self.setFrameShape(self.StyledPanel)
self.setFrameShadow(self.Raised)
self.setFocusPolicy(Qt.StrongFocus)
self.setAutoFillBackground(True)
self.l = l = QVBoxLayout(self)
self.header = la = QLabel(self)
la.setWordWrap(True)
l.addWidget(la)
self.default_shortcuts = QRadioButton(_("&Default"), self)
self.custom = QRadioButton(_("&Custom"), self)
self.custom.toggled.connect(self.custom_toggled)
l.addWidget(self.default_shortcuts)
l.addWidget(self.custom)
for which in 1, 2:
la = QLabel(_("&Shortcut:") if which == 1 else _("&Alternate shortcut:"))
setattr(self, 'label%d' % which, la)
h = QHBoxLayout()
l.addLayout(h)
h.setContentsMargins(25, -1, -1, -1)
h.addWidget(la)
b = QPushButton(_("Click to change"), self)
la.setBuddy(b)
b.clicked.connect(partial(self.capture_clicked, which=which))
b.installEventFilter(self)
setattr(self, 'button%d' % which, b)
h.addWidget(b)
c = QToolButton(self)
c.setIcon(QIcon(I('clear_left.png')))
c.setToolTip(_('Clear'))
h.addWidget(c)
c.clicked.connect(partial(self.clear_clicked, which=which))
setattr(self, 'clear%d' % which, c)
self.data_model = index.model()
self.capture = 0
self.key = None
self.shorcut1 = self.shortcut2 = None
self.dup_check = dup_check
self.custom_toggled(False)