本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser.setOpenExternalLinks方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.setOpenExternalLinks方法的具体用法?Python QTextBrowser.setOpenExternalLinks怎么用?Python QTextBrowser.setOpenExternalLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.setOpenExternalLinks方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HtmlDialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
class HtmlDialog(QDialog):
def __init__(self, parent, url):
QDialog.__init__(self, parent)
self.resize(800, 600)
l = QVBoxLayout()
self.te = QTextBrowser(self)
self.te.sourceChanged.connect(self.onSourceChanged)
self.te.setOpenExternalLinks(True)
if not url.startswith('http'):
pwd = os.path.dirname(__file__)
locale = QSettings().value("locale/userLocale")[0:2]
file = "{}/doc/{}/{}".format(pwd, locale, url)
if not os.path.isfile(file):
file = "{}/doc/en/{}".format(pwd, url)
self.te.setSource(QUrl.fromLocalFile(file))
else:
self.te.setSource(QUrl(url))
btn = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
btn.clicked.connect(self.close)
l.addWidget(self.te)
l.addWidget(btn)
self.setLayout(l)
def onSourceChanged(self, url):
self.setWindowTitle(self.te.documentTitle())
示例2: createPreviewBox
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
def createPreviewBox(self):
if globalSettings.useWebKit:
return self.createWebView()
browser = QTextBrowser()
# TODO: honor globalSettings.handleWebLinks?
browser.setOpenExternalLinks(True)
return browser
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [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'))
示例4: AbouteInfo
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
class AbouteInfo(QDialog):
def __init__(self, htmlfile, name):
super(AbouteInfo, self).__init__()
self.text = QTextBrowser()
text = open(htmlfile).read()
self.text.setHtml(text)
self.text.setOpenExternalLinks(True)
self.cancelbutton = QPushButton("&Close")
self.setGeometry(100, 100, 700, 700)
buttonlayout = QHBoxLayout()
buttonlayout.addStretch()
buttonlayout.addWidget(self.cancelbutton)
layout = QVBoxLayout()
layout.addWidget(self.text)
layout.addLayout(buttonlayout)
self.setLayout(layout)
self.setWindowTitle("PyBigPixel Creator {0}-- {1}".format(__version__, name))
self.cancelbutton.clicked.connect(self.close)
示例5: AboutDialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [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_()
示例6: AboutWhat
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
class AboutWhat(QDialog):
def __init__(self, parent=None, pytesting=False):
super(AboutWhat, self).__init__(parent)
self._pytesting = pytesting
self.setWindowTitle('About %s' % __appname__)
self.setWindowIcon(icons.get_icon('master'))
self.setMinimumSize(800, 700)
self.setWindowFlags(Qt.Window |
Qt.CustomizeWindowHint |
Qt.WindowCloseButtonHint)
self.__initUI__()
def __initUI__(self):
"""Initialize the GUI."""
self.manager_updates = None
# ---- AboutTextBox
self.AboutTextBox = QTextBrowser()
self.AboutTextBox.installEventFilter(self)
self.AboutTextBox.setReadOnly(True)
self.AboutTextBox.setFixedWidth(850)
self.AboutTextBox.setFrameStyle(0)
self.AboutTextBox.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.AboutTextBox.setOpenExternalLinks(True)
self.AboutTextBox.setStyleSheet('QTextEdit {background-color:"white"}')
self.AboutTextBox.document().setDocumentMargin(0)
self.set_html_in_AboutTextBox()
# ---- toolbar
self.ok_btn = QPushButton('OK')
self.ok_btn.clicked.connect(self.close)
self.btn_check_updates = QPushButton(' Check for Updates ')
self.btn_check_updates.clicked.connect(
self._btn_check_updates_isclicked)
toolbar = QGridLayout()
toolbar.addWidget(self.btn_check_updates, 0, 1)
toolbar.addWidget(self.ok_btn, 0, 2)
toolbar.setContentsMargins(0, 0, 0, 0)
toolbar.setColumnStretch(0, 100)
# ---- Main Grid
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(self.AboutTextBox, 0, 1)
grid.addLayout(toolbar, 1, 1)
grid.setColumnStretch(1, 500)
grid.setContentsMargins(10, 10, 10, 10)
self.setLayout(grid)
self.ok_btn.setFocus()
@QSlot()
def _btn_check_updates_isclicked(self):
"""Handles when the button to check for updates is clicked."""
self.manager_updates = ManagerUpdates(self, self._pytesting)
def set_html_in_AboutTextBox(self):
"""Set the text in the About GWHAT text browser widget."""
# ---- Header logo
width = 750
filename = os.path.join(
__rootdir__, 'ressources', 'WHAT_banner_750px.png')
# http://doc.qt.io/qt-4.8/richtext-html-subset.html
if platform.system() == 'Windows':
fontfamily = "Segoe UI" # "Cambria" #"Calibri" #"Segoe UI""
elif platform.system() == 'Linux':
fontfamily = "Ubuntu"
html = """
<html>
<head>
<style>
p {font-size: 16px;
font-family: "%s";
margin-right:50px;
margin-left:50px;
}
p1 {font-size: 16px;
font-family: "%s";
margin-right:50px;
margin-left:50px;
}
</style>
</head>
<body>
""" % (fontfamily, fontfamily)
#.........这里部分代码省略.........
示例7: SquidGui
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
#.........这里部分代码省略.........
self._naOutEdit.setText('%g' % (SquidGui.defaults['Na_out']))
self._kInEdit.setText('%g' % (SquidGui.defaults['K_in']))
self._naInEdit.setText('%g' % (SquidGui.defaults['Na_in']))
self._temperatureEdit.setText('%g' % (SquidGui.defaults['temperature'] - CELSIUS_TO_KELVIN))
self._holdingVEdit.setText('%g' % (SquidGui.defaults['vclamp.holdingV']))
self._holdingTimeEdit.setText('%g' % (SquidGui.defaults['vclamp.holdingT']))
self._prePulseVEdit.setText('%g' % (SquidGui.defaults['vclamp.prepulseV']))
self._prePulseTimeEdit.setText('%g' % (SquidGui.defaults['vclamp.prepulseT']))
self._clampVEdit.setText('%g' % (SquidGui.defaults['vclamp.clampV']))
self._clampTimeEdit.setText('%g' % (SquidGui.defaults['vclamp.clampT']))
self._baseCurrentEdit.setText('%g' % (SquidGui.defaults['iclamp.baseI']))
self._firstPulseEdit.setText('%g' % (SquidGui.defaults['iclamp.firstI']))
self._firstDelayEdit.setText('%g' % (SquidGui.defaults['iclamp.firstD']))
self._firstPulseWidthEdit.setText('%g' % (SquidGui.defaults['iclamp.firstT']))
self._secondPulseEdit.setText('%g' % (SquidGui.defaults['iclamp.secondI']))
self._secondDelayEdit.setText('%g' % (SquidGui.defaults['iclamp.secondD']))
self._secondPulseWidthEdit.setText('%g' % (SquidGui.defaults['iclamp.secondT']))
self._pulseMode.setCurrentIndex(0)
def _onScroll(self, event):
if event.inaxes is None:
return
axes = event.inaxes
zoom = 0.0
if event.button == 'up':
zoom = -1.0
elif event.button == 'down':
zoom = 1.0
if zoom != 0.0:
self._plotNavigator.push_current()
axes.get_xaxis().zoom(zoom)
axes.get_yaxis().zoom(zoom)
self._plotCanvas.draw()
def closeEvent(self, event):
qApp.closeAllWindows()
def _showBioPhysicsHelp(self):
self._createHelpMessage()
self._helpMessageText.setText('<html><p>%s</p><p>%s</p><p>%s</p><p>%s</p><p>%s</p></html>' %
(tooltip_Nernst,
tooltip_Erest,
tooltip_KChan,
tooltip_NaChan,
tooltip_Im))
self._helpWindow.setVisible(True)
def _showRunningHelp(self):
self._createHelpMessage()
self._helpMessageText.setSource(QtCore.QUrl(self._helpBaseURL))
self._helpWindow.setVisible(True)
def _createHelpMessage(self):
if hasattr(self, '_helpWindow'):
return
self._helpWindow = QWidget()
self._helpWindow.setWindowFlags(QtCore.Qt.Window)
layout = QVBoxLayout()
self._helpWindow.setLayout(layout)
self._helpMessageArea = QScrollArea()
self._helpMessageText = QTextBrowser()
self._helpMessageText.setOpenExternalLinks(True)
self._helpMessageArea.setWidget(self._helpMessageText)
layout.addWidget(self._helpMessageText)
self._squidGuiPath = os.path.dirname(os.path.abspath(__file__))
self._helpBaseURL = os.path.join(self._squidGuiPath,'help.html')
self._helpMessageText.setSource(QtCore.QUrl(self._helpBaseURL))
self._helpMessageText.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self._helpMessageArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self._helpMessageText.setMinimumSize(800, 600)
self._closeHelpAction = QAction('Close', self)
self._closeHelpAction.triggered.connect(self._helpWindow.close)
# Setting the close event so that the ``Help`` button is
# unchecked when the help window is closed
self._helpWindow.closeEvent = lambda event: self._helpAction.setChecked(False)
self._helpTOCAction = QAction('Help running demo', self)
self._helpTOCAction.triggered.connect( self._jumpToHelpTOC)
# This panel is for putting two buttons using horizontal
# layout
panel = QFrame()
panel.setFrameStyle(QFrame.StyledPanel + QFrame.Raised)
layout.addWidget(panel)
layout = QHBoxLayout()
panel.setLayout(layout)
self._helpAction = QAction('Help running', self)
self._helpAction.triggered.connect(self._showRunningHelp)
self._helpBiophysicsAction = QAction('Help biophysics', self)
self._helpBiophysicsAction.triggered.connect(self._showBioPhysicsHelp)
self._helpTOCButton = QToolButton()
self._helpTOCButton.setDefaultAction(self._helpTOCAction)
self._helpBiophysicsButton = QToolButton()
self._helpBiophysicsButton.setDefaultAction(self._helpBiophysicsAction)
layout.addWidget(self._helpTOCButton)
layout.addWidget(self._helpBiophysicsButton)
self._closeHelpButton = QToolButton()
self._closeHelpButton.setDefaultAction(self._closeHelpAction)
layout.addWidget(self._closeHelpButton)
def _jumpToHelpTOC(self):
self._helpMessageText.setSource(QtCore.QUrl(self._helpBaseURL))
示例8: About
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
class About(QDialog):
ICON = util.file_path(__file__, "icon.png")
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle('About Linux Show Player')
self.setMaximumSize(500, 420)
self.setMinimumSize(500, 420)
self.resize(500, 420)
self.setLayout(QGridLayout())
self.icon = QLabel(self)
self.icon.setPixmap(QPixmap(self.ICON).scaled(100, 100,
transformMode=Qt.SmoothTransformation))
self.layout().addWidget(self.icon, 0, 0)
self.shortInfo = QLabel(self)
self.shortInfo.setAlignment(Qt.AlignCenter)
self.shortInfo.setText('<h2>Linux Show Player ' +
str(lisp.__version__) + '</h2>'
'Copyright © Francesco Ceruti')
self.layout().addWidget(self.shortInfo, 0, 1)
self.layout().addWidget(QWidget(), 1, 0, 1, 2)
# Informations tabs
self.tabWidget = QTabWidget(self)
self.layout().addWidget(self.tabWidget, 2, 0, 1, 2)
self.info = QTextBrowser(self)
self.info.setOpenExternalLinks(True)
self.info.setHtml(self.INFO)
self.tabWidget.addTab(self.info, 'Info')
self.license = QTextBrowser(self)
self.license.setOpenExternalLinks(True)
self.license.setHtml(self.LICENSE)
self.tabWidget.addTab(self.license, 'License')
self.contributors = QTextBrowser(self)
self.contributors.setOpenExternalLinks(True)
self.contributors.setHtml(self.CONTRIBUTORS)
self.tabWidget.addTab(self.contributors, 'Contributors')
# Ok button
self.buttons = QDialogButtonBox(QDialogButtonBox.Ok)
self.buttons.accepted.connect(self.accept)
self.layout().addWidget(self.buttons, 3, 1)
self.layout().setColumnStretch(0, 1)
self.layout().setColumnStretch(1, 3)
self.layout().setRowStretch(0, 6)
self.layout().setRowStretch(1, 1)
self.layout().setRowStretch(2, 16)
self.layout().setRowStretch(3, 3)
self.buttons.setFocus()
LICENSE = '''
<center>
Linux Show Player 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.<br />
<br />
Linux Show Player 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.
</center>'''
INFO = '''
<center><br />
Linux Show Player is a cue-player designed for stage productions.<br \>
</center>
<center><br />
Web site: <a href="http://linux-show-player.sourceforge.net">linux-show-player.sourceforge.net</a><br \>
User group: <a href="http://groups.google.com/group/linux-show-player---users">groups.google.com</a><br \>
Source code: <a href="https://github.com/FrancescoCeruti/linux-show-player">GitHub</a>
</center>'''
CONTRIBUTORS = '''
示例9: QChatWidget
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [as 别名]
class QChatWidget(QWidget):
def __init__(self, chat_window, nick, parent=None):
QWidget.__init__(self, parent)
self.chat_window = chat_window
self.nick = nick
self.disabled = False
self.cleared = False
self.url_regex = re.compile(URL_REGEX)
self.chat_log = QTextBrowser()
self.chat_log.setOpenExternalLinks(True)
self.chat_input = QTextEdit()
self.chat_input.textChanged.connect(self.chatInputTextChanged)
self.send_button = QPushButton("Send")
self.send_button.clicked.connect(self.sendMessage)
# Set the min height for the chatlog and a matching fixed height for the send button
chat_input_font_metrics = QFontMetrics(self.chat_input.font())
self.chat_input.setMinimumHeight(chat_input_font_metrics.lineSpacing() * 3)
self.send_button.setFixedHeight(chat_input_font_metrics.lineSpacing() * 3)
hbox = QHBoxLayout()
hbox.addWidget(self.chat_input)
hbox.addWidget(self.send_button)
# Put the chatinput and send button in a wrapper widget so they may be added to the splitter
chat_input_wrapper = QWidget()
chat_input_wrapper.setLayout(hbox)
chat_input_wrapper.setMinimumHeight(chat_input_font_metrics.lineSpacing() * 3.7)
# Put the chat log and chat input into a splitter so the user can resize them at will
splitter = QSplitter(Qt.Vertical)
splitter.addWidget(self.chat_log)
splitter.addWidget(chat_input_wrapper)
splitter.setSizes([int(parent.height()), 1])
hbox = QHBoxLayout()
hbox.addWidget(splitter)
self.setLayout(hbox)
self.typing_timer = QTimer()
self.typing_timer.setSingleShot(True)
self.typing_timer.timeout.connect(self.stoppedTyping)
def setRemoteNick(self, nick):
self.nick = nick
def chatInputTextChanged(self):
# Check if the text changed was the text box being cleared to avoid sending an invalid typing status
if self.cleared:
self.cleared = False
return
if str(self.chat_input.toPlainText())[-1:] == '\n':
self.sendMessage()
else:
# Start a timer to check for the user stopping typing
self.typing_timer.start(TYPING_TIMEOUT)
self.sendTypingStatus(TYPING_START)
def stoppedTyping(self):
self.typing_timer.stop()
if str(self.chat_input.toPlainText()) == '':
self.sendTypingStatus(TYPING_STOP_WITHOUT_TEXT)
else:
self.sendTypingStatus(TYPING_STOP_WITH_TEXT)
def sendMessage(self):
if self.disabled:
return
else:
pass
self.typing_timer.stop()
text = str(self.chat_input.toPlainText())[:-1]
# Don't send empty messages
if text == '':
return
# Convert URLs into clickable links
text = self.__linkify(text)
# Add the message to the message queue to be sent
self.chat_window.client.getSession(self.remote_id).sendChatMessage(text)
# Clear the chat input
self.wasCleared = True
self.chat_input.clear()
self.appendMessage(text, MSG_SENDER)
def sendTypingStatus(self, status):
#.........这里部分代码省略.........
示例10: Sansimera
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [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()
#.........这里部分代码省略.........
示例11: onAbout
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setOpenExternalLinks [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()