本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser.moveCursor方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.moveCursor方法的具体用法?Python QTextBrowser.moveCursor怎么用?Python QTextBrowser.moveCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.moveCursor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import moveCursor [as 别名]
def __init__(self, exctype, excvalue, exctb):
super(ExceptionDialog, self).__init__()
self._tbshort = ''.join(traceback.format_exception_only(exctype, excvalue))
self._tbfull = ''.join(traceback.format_exception(exctype, excvalue, exctb))
layout = QVBoxLayout()
self.setLayout(layout)
self.errorLabel = QLabel()
layout.addWidget(self.errorLabel)
textview = QTextBrowser()
layout.addWidget(textview)
textview.setText(self._tbfull)
textview.moveCursor(QTextCursor.End)
layout.addWidget(widgets.Separator())
b = self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.button(QDialogButtonBox.Ok).setIcon(icons.get("tools-report-bug"))
layout.addWidget(b)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
self.resize(600,300)
app.translateUI(self)
self.exec_()
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import moveCursor [as 别名]
def __init__(self, title, text, image, contributors, parent=None):
super(AboutDialog, self).__init__(parent)
layout = QVBoxLayout()
titleLayout = QHBoxLayout()
name_versionLabel = QLabel(title)
contentsLayout = QHBoxLayout()
aboutBrowser = QTextBrowser()
aboutBrowser.append(text)
aboutBrowser.setOpenExternalLinks(True)
creditsBrowser = QTextBrowser()
creditsBrowser.append(contributors)
creditsBrowser.setOpenExternalLinks(True)
TabWidget = QTabWidget()
TabWidget.addTab(aboutBrowser, self.tr('About'))
TabWidget.addTab(creditsBrowser, self.tr('Contributors'))
aboutBrowser.moveCursor(QTextCursor.Start)
creditsBrowser.moveCursor(QTextCursor.Start)
imageLabel = QLabel()
imageLabel.setPixmap(QPixmap(image))
titleLayout.addWidget(imageLabel)
titleLayout.addWidget(name_versionLabel)
titleLayout.addStretch()
contentsLayout.addWidget(TabWidget)
buttonLayout = QHBoxLayout()
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
buttonLayout.addWidget(buttonBox)
layout.addLayout(titleLayout)
layout.addLayout(contentsLayout)
layout.addLayout(buttonLayout)
self.setLayout(layout)
buttonBox.clicked.connect(self.accept)
self.setMinimumSize(QSize(380, 400))
self.setWindowTitle(self.tr('About Onkyo QT'))
示例3: AboutDialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import moveCursor [as 别名]
class AboutDialog(QDialog):
def __init__(self, title="Test", message="Test Text"):
super(AboutDialog, self).__init__()
self.title = title
self.message = message
self.initUI()
def initUI(self):
"""
initUI()
"""
vbox = QVBoxLayout(self)
grid1 = QGridLayout()
grid1.setSpacing(10)
self.text = QTextBrowser()
self.text.setReadOnly(True)
self.text.setOpenExternalLinks(True)
self.text.append(self.message)
self.text.moveCursor(QTextCursor.Start)
self.text.ensureCursorVisible()
vbox.addWidget(self.text)
self.setLayout(vbox)
self.setMinimumSize(550, 450)
self.resize(550, 600)
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
self.setWindowTitle(self.title)
iconWT = QIcon()
iconWT.addPixmap(QPixmap(":images/DXF2GCODE-001.ico"),
QIcon.Normal, QIcon.Off)
self.setWindowIcon(QIcon(iconWT))
self.exec_()
示例4: Sansimera
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import moveCursor [as 别名]
class Sansimera(QMainWindow):
def __init__(self, parent=None):
super(Sansimera, self).__init__(parent)
self.settings = QSettings()
self.timer = QTimer(self)
self.timer_reminder = QTimer(self)
self.timer_reminder.timeout.connect(self.reminder_tray)
interval = self.settings.value('Interval') or '1'
if interval != '0':
self.timer_reminder.start(int(interval) * 60 * 60 * 1000)
self.tentatives = 0
self.gui()
self.lista = []
self.lista_pos = 0
self.eortazontes_shown = False
self.eortazontes_names = ''
def gui(self):
self.systray = QSystemTrayIcon()
self.icon = QIcon(':/sansimera.png')
self.systray.setIcon(self.icon)
self.systray.setToolTip('Σαν σήμερα...')
self.menu = QMenu()
self.exitAction = QAction('&Έξοδος', self)
self.refreshAction = QAction('&Ανανέωση', self)
self.aboutAction = QAction('&Σχετικά', self)
self.notification_interval = QAction('Ει&δοποίηση εορταζόντων', self)
self.menu.addAction(self.notification_interval)
self.menu.addAction(self.refreshAction)
self.menu.addAction(self.aboutAction)
self.menu.addAction(self.exitAction)
self.systray.setContextMenu(self.menu)
self.notification_interval.triggered.connect(self.interval_namedays)
self.exitAction.triggered.connect(exit)
self.refreshAction.triggered.connect(self.refresh)
self.aboutAction.triggered.connect(self.about)
self.browser = QTextBrowser()
self.browser.setOpenExternalLinks(True)
self.setGeometry(600, 500, 400, 300)
self.setWindowIcon(self.icon)
self.setWindowTitle('Σαν σήμερα...')
self.setCentralWidget(self.browser)
self.systray.show()
self.systray.activated.connect(self.activate)
self.browser.append('Λήψη...')
nicon = QIcon(':/next')
picon = QIcon(':/previous')
ricon = QIcon(':/refresh')
iicon = QIcon(':/info')
qicon = QIcon(':/exit')
inicon = QIcon(':/notifications')
self.nextAction = QAction('Επόμενο', self)
self.nextAction.setIcon(nicon)
self.previousAction = QAction('Προηγούμενο', self)
self.refreshAction.triggered.connect(self.refresh)
self.nextAction.triggered.connect(self.nextItem)
self.previousAction.triggered.connect(self.previousItem)
self.previousAction.setIcon(picon)
self.refreshAction.setIcon(ricon)
self.exitAction.setIcon(qicon)
self.aboutAction.setIcon(iicon)
self.notification_interval.setIcon(inicon)
controls = QToolBar()
self.addToolBar(Qt.BottomToolBarArea, controls)
controls.setObjectName('Controls')
controls.addAction(self.previousAction)
controls.addAction(self.nextAction)
controls.addAction(self.refreshAction)
self.restoreState(self.settings.value("MainWindow/State", QByteArray()))
self.refresh()
def interval_namedays(self):
dialog = sansimera_reminder.Reminder(self)
dialog.applied_signal['QString'].connect(self.reminder)
if dialog.exec_() == 1:
print('Apply namedays reminder interval...')
def reminder(self, time):
self.settings.setValue('Interval', time)
if time != '0':
self.timer_reminder.start(int(time) * 60 * 60 * 1000)
print('Reminder = ' + time + ' hour(s)')
else:
print('Reminder = None')
def nextItem(self):
if len(self.lista) >= 1:
self.browser.clear()
if self.lista_pos != len(self.lista)-1:
self.lista_pos += 1
else:
self.lista_pos = 0
self.browser.append(self.lista[self.lista_pos])
self.browser.moveCursor(QTextCursor.Start)
else:
return
def previousItem(self):
if len(self.lista) >= 1:
self.browser.clear()
#.........这里部分代码省略.........
示例5: onAbout
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import moveCursor [as 别名]
def onAbout(self, widget):
dialog = QDialog(self)
aboutText = self.tr("""<p>A simple applet for enable/disable webcams.</p>
<p>Website: <a href="https://github.com/abbarrasa/openbox">
https://github.com/abbarrasa/openbox</a></p>
<p>Based in <a href="https://extensions.gnome.org/extension/1477/webcam-manager/">Webcam Manager</a>.</p>
<p>If you want to report a dysfunction or a suggestion,
feel free to open an issue in <a href="https://github.com/abbarrasa/openbox/issues">
github</a>.""")
creditsText = self.tr("""(c) 2018 Alberto Buitrago <%s>""") % base64.b64decode('YWJiYXJyYXNhQGdtYWlsLmNvbQ==').decode('utf-8')
licenseText = self.tr("""<p>This program is free software: you
can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your
option) any later version.</p>
<p>This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.</p>
<p>You should have received a copy of the GNU General Public
License along with this program. If not, see
<a href="https://www.gnu.org/licenses/gpl-3.0.html">
GNU General Public License version 3</a>.</p>""")
layout = QVBoxLayout()
titleLayout = QHBoxLayout()
titleLabel = QLabel('<font size="4"><b>{0} {1}</b></font>'.format('Webcam Manager', VERSION))
contentsLayout = QHBoxLayout()
aboutBrowser = QTextBrowser()
aboutBrowser.append(aboutText)
aboutBrowser.setOpenExternalLinks(True)
creditsBrowser = QTextBrowser()
creditsBrowser.append(creditsText)
creditsBrowser.setOpenExternalLinks(True)
licenseBrowser = QTextBrowser()
licenseBrowser.append(licenseText)
licenseBrowser.setOpenExternalLinks(True)
TabWidget = QTabWidget()
TabWidget.addTab(aboutBrowser, self.tr('About'))
TabWidget.addTab(creditsBrowser, self.tr('Contributors'))
TabWidget.addTab(licenseBrowser, self.tr('License'))
aboutBrowser.moveCursor(QTextCursor.Start)
creditsBrowser.moveCursor(QTextCursor.Start)
licenseBrowser.moveCursor(QTextCursor.Start)
icon = QIcon.fromTheme('camera-web')
pixmap = icon.pixmap(QSize(64, 64))
imageLabel = QLabel()
imageLabel.setPixmap(pixmap)
titleLayout.addWidget(imageLabel)
titleLayout.addWidget(titleLabel)
titleLayout.addStretch()
contentsLayout.addWidget(TabWidget)
buttonLayout = QHBoxLayout()
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
buttonLayout.addWidget(buttonBox)
layout.addLayout(titleLayout)
layout.addLayout(contentsLayout)
layout.addLayout(buttonLayout)
buttonBox.clicked.connect(dialog.accept)
dialog.setLayout(layout)
dialog.setMinimumSize(QSize(480, 400))
dialog.setWindowTitle(self.tr('About Webcam Manager'))
dialog.setWindowIcon(QIcon.fromTheme('help-about'))
dialog.show()