本文整理汇总了Python中PyQt5.Qt.QFrame.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QFrame.__init__方法的具体用法?Python QFrame.__init__怎么用?Python QFrame.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QFrame
的用法示例。
在下文中一共展示了QFrame.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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)
示例4: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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)
示例5: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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))
示例6: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
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)
示例7: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
def __init__(self, parent):
QFrame.__init__(self, parent)
self.setFrameShape(QFrame.StyledPanel)
self.setMinimumWidth(250)
self.stack = s = QStackedWidget(self)
self.l = l = QVBoxLayout()
self.setLayout(l)
l.addWidget(s)
self.root_pane = rp = QWidget(self)
self.item_pane = ip = QWidget(self)
self.current_item = None
s.addWidget(rp)
s.addWidget(ip)
self.l1 = la = QLabel('<p>'+_(
'You can edit existing entries in the Table of Contents by clicking them'
' in the panel to the left.')+'<p>'+_(
'Entries with a green tick next to them point to a location that has '
'been verified to exist. Entries with a red dot are broken and may need'
' to be fixed.'))
la.setStyleSheet('QLabel { margin-bottom: 20px }')
la.setWordWrap(True)
l = rp.l = QVBoxLayout()
rp.setLayout(l)
l.addWidget(la)
self.add_new_to_root_button = b = QPushButton(_('Create a &new entry'))
b.clicked.connect(self.add_new_to_root)
l.addWidget(b)
l.addStretch()
self.cfmhb = b = QPushButton(_('Generate ToC from &major headings'))
b.clicked.connect(self.create_from_major_headings)
b.setToolTip(textwrap.fill(_(
'Generate a Table of Contents from the major headings in the book.'
' This will work if the book identifies its headings using HTML'
' heading tags. Uses the <h1>, <h2> and <h3> tags.')))
l.addWidget(b)
self.cfmab = b = QPushButton(_('Generate ToC from &all headings'))
b.clicked.connect(self.create_from_all_headings)
b.setToolTip(textwrap.fill(_(
'Generate a Table of Contents from all the headings in the book.'
' This will work if the book identifies its headings using HTML'
' heading tags. Uses the <h1-6> tags.')))
l.addWidget(b)
self.lb = b = QPushButton(_('Generate ToC from &links'))
b.clicked.connect(self.create_from_links)
b.setToolTip(textwrap.fill(_(
'Generate a Table of Contents from all the links in the book.'
' Links that point to destinations that do not exist in the book are'
' ignored. Also multiple links with the same destination or the same'
' text are ignored.'
)))
l.addWidget(b)
self.cfb = b = QPushButton(_('Generate ToC from &files'))
b.clicked.connect(self.create_from_files)
b.setToolTip(textwrap.fill(_(
'Generate a Table of Contents from individual files in the book.'
' Each entry in the ToC will point to the start of the file, the'
' text of the entry will be the "first line" of text from the file.'
)))
l.addWidget(b)
self.xpb = b = QPushButton(_('Generate ToC from &XPath'))
b.clicked.connect(self.create_from_user_xpath)
b.setToolTip(textwrap.fill(_(
'Generate a Table of Contents from arbitrary XPath expressions.'
)))
l.addWidget(b)
self.fal = b = QPushButton(_('&Flatten the ToC'))
b.clicked.connect(self.flatten_toc)
b.setToolTip(textwrap.fill(_(
'Flatten the Table of Contents, putting all entries at the top level'
)))
l.addWidget(b)
l.addStretch()
self.w1 = la = QLabel(_('<b>WARNING:</b> calibre only supports the '
'creation of linear ToCs in AZW3 files. In a '
'linear ToC every entry must point to a '
'location after the previous entry. If you '
'create a non-linear ToC it will be '
'automatically re-arranged inside the AZW3 file.'
))
la.setWordWrap(True)
l.addWidget(la)
l = ip.l = QGridLayout()
ip.setLayout(l)
la = ip.heading = QLabel('')
l.addWidget(la, 0, 0, 1, 2)
la.setWordWrap(True)
la = ip.la = QLabel(_(
'You can move this entry around the Table of Contents by drag '
'and drop or using the up and down buttons to the left'))
la.setWordWrap(True)
l.addWidget(la, 1, 0, 1, 2)
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
def __init__(self, parent):
QFrame.__init__(self, parent)
self.setFrameStyle(QFrame.NoFrame if gprefs['tag_browser_old_look'] else QFrame.StyledPanel)
self._parent = parent
self._layout = QVBoxLayout(self)
self._layout.setContentsMargins(0,0,0,0)
# Set up the find box & button
self.tb_bar = tbb = TagBrowserBar(self)
self.alter_tb, self.item_search, self.search_button = tbb.alter_tb, tbb.item_search, tbb.search_button
self.toggle_search_button = tbb.toggle_search_button
self._layout.addWidget(tbb)
self.current_find_position = None
self.search_button.clicked.connect(self.find)
self.item_search.lineEdit().textEdited.connect(self.find_text_changed)
self.item_search.activated[str].connect(self.do_find)
# The tags view
parent.tags_view = TagsView(parent)
self.tags_view = parent.tags_view
self._layout.insertWidget(0, parent.tags_view)
# Now the floating 'not found' box
l = QLabel(self.tags_view)
self.not_found_label = l
l.setFrameStyle(QFrame.StyledPanel)
l.setAutoFillBackground(True)
l.setText('<p><b>'+_('No More Matches.</b><p> Click Find again to go to first match'))
l.setAlignment(Qt.AlignVCenter)
l.setWordWrap(True)
l.resize(l.sizeHint())
l.move(10,20)
l.setVisible(False)
self.not_found_label_timer = QTimer()
self.not_found_label_timer.setSingleShot(True)
self.not_found_label_timer.timeout.connect(self.not_found_label_timer_event,
type=Qt.QueuedConnection)
# The Alter Tag Browser button
l = self.alter_tb
self.collapse_all_action = ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser collapse all',
_('Collapse all'), default_keys=(),
action=ac, group=_('Tag browser'))
connect_lambda(ac.triggered, self, lambda self: self.tags_view.collapseAll())
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser alter',
_('Configure Tag browser'), default_keys=(),
action=ac, group=_('Tag browser'))
ac.triggered.connect(l.showMenu)
sb = l.m.addAction(_('Sort by'))
sb.m = l.sort_menu = QMenu(l.m)
sb.setMenu(sb.m)
sb.bg = QActionGroup(sb)
# Must be in the same order as db2.CATEGORY_SORTS
for i, x in enumerate((_('Name'), _('Number of books'),
_('Average rating'))):
a = sb.m.addAction(x)
sb.bg.addAction(a)
a.setCheckable(True)
if i == 0:
a.setChecked(True)
sb.setToolTip(
_('Set the sort order for entries in the Tag browser'))
sb.setStatusTip(sb.toolTip())
ma = l.m.addAction(_('Search type when selecting multiple items'))
ma.m = l.match_menu = QMenu(l.m)
ma.setMenu(ma.m)
ma.ag = QActionGroup(ma)
# Must be in the same order as db2.MATCH_TYPE
for i, x in enumerate((_('Match any of the items'), _('Match all of the items'))):
a = ma.m.addAction(x)
ma.ag.addAction(a)
a.setCheckable(True)
if i == 0:
a.setChecked(True)
ma.setToolTip(
_('When selecting multiple entries in the Tag browser '
'match any or all of them'))
ma.setStatusTip(ma.toolTip())
mt = l.m.addAction(_('Manage authors, tags, etc.'))
mt.setToolTip(_('All of these category_managers are available by right-clicking '
'on items in the tag browser above'))
mt.m = l.manage_menu = QMenu(l.m)
mt.setMenu(mt.m)
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser toggle item',
_("'Click' found item"), default_keys=(),
action=ac, group=_('Tag browser'))
ac.triggered.connect(self.toggle_item)
示例9: __init__
# 需要导入模块: from PyQt5.Qt import QFrame [as 别名]
# 或者: from PyQt5.Qt.QFrame import __init__ [as 别名]
def __init__(self, parent):
QFrame.__init__(self, parent)
self.setFrameStyle(QFrame.NoFrame)
self.setObjectName('search_bar')
self._layout = l = QHBoxLayout(self)
l.setContentsMargins(0, 4, 0, 4)
x = parent.virtual_library = QToolButton(self)
x.setCursor(Qt.PointingHandCursor)
x.setPopupMode(x.InstantPopup)
x.setText(_('Virtual library'))
x.setAutoRaise(True)
x.setIcon(QIcon(I('lt.png')))
x.setObjectName("virtual_library")
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
l.addWidget(x)
x = QToolButton(self)
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
x.setAutoRaise(True)
x.setIcon(QIcon(I('minus.png')))
x.setObjectName('clear_vl')
l.addWidget(x)
x.setVisible(False)
x.setToolTip(_('Close the Virtual library'))
parent.clear_vl = x
self.vl_sep = QFrame(self)
self.vl_sep.setFrameStyle(QFrame.VLine | QFrame.Sunken)
l.addWidget(self.vl_sep)
parent.sort_sep = QFrame(self)
parent.sort_sep.setFrameStyle(QFrame.VLine | QFrame.Sunken)
parent.sort_sep.setVisible(False)
parent.sort_button = self.sort_button = sb = QToolButton(self)
sb.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
sb.setToolTip(_('Change how the displayed books are sorted'))
sb.setCursor(Qt.PointingHandCursor)
sb.setPopupMode(QToolButton.InstantPopup)
sb.setAutoRaise(True)
sb.setText(_('Sort'))
sb.setIcon(QIcon(I('sort.png')))
sb.setMenu(QMenu())
sb.menu().aboutToShow.connect(self.populate_sort_menu)
sb.setVisible(False)
l.addWidget(sb)
l.addWidget(parent.sort_sep)
x = parent.search = SearchBox2(self)
x.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
x.setObjectName("search")
x.setToolTip(_("<p>Search the list of books by title, author, publisher, "
"tags, comments, etc.<br><br>Words separated by spaces are ANDed"))
x.setMinimumContentsLength(10)
l.addWidget(x)
parent.advanced_search_toggle_action = ac = parent.search.add_action('gear.png', QLineEdit.LeadingPosition)
parent.addAction(ac)
ac.setToolTip(_('Advanced search'))
parent.keyboard.register_shortcut('advanced search toggle',
_('Advanced search'), default_keys=("Shift+Ctrl+F",),
action=ac)
self.search_button = QToolButton()
self.search_button.setToolButtonStyle(Qt.ToolButtonTextOnly)
self.search_button.setIcon(QIcon(I('search.png')))
self.search_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self.search_button.setText(_('Search'))
self.search_button.setAutoRaise(True)
self.search_button.setCursor(Qt.PointingHandCursor)
l.addWidget(self.search_button)
self.search_button.setSizePolicy(QSizePolicy.Minimum,
QSizePolicy.Minimum)
self.search_button.clicked.connect(parent.do_search_button)
self.search_button.setToolTip(
_('Do Quick Search (you can also press the Enter key)'))
x = parent.highlight_only_button = QToolButton(self)
x.setAutoRaise(True)
x.setText(_('Highlight'))
x.setCursor(Qt.PointingHandCursor)
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
x.setIcon(QIcon(I('arrow-down.png')))
l.addWidget(x)
x = parent.saved_search = SavedSearchBox(self)
x.setMaximumSize(QSize(150, 16777215))
x.setMinimumContentsLength(10)
x.setObjectName("saved_search")
l.addWidget(x)
x.setVisible(tweaks['show_saved_search_box'])
x = parent.copy_search_button = QToolButton(self)
x.setAutoRaise(True)
x.setCursor(Qt.PointingHandCursor)
x.setIcon(QIcon(I("search_copy_saved.png")))
x.setObjectName("copy_search_button")
l.addWidget(x)
x.setToolTip(_("Copy current search text (instead of search name)"))
x.setVisible(tweaks['show_saved_search_box'])
#.........这里部分代码省略.........