本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser.append方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.append方法的具体用法?Python QTextBrowser.append怎么用?Python QTextBrowser.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.append方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [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'))
示例2: App
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
class App(QWidget):
def __init__(self, room):
super().__init__()
vbox = QVBoxLayout()
self.text_browser = QTextBrowser()
vbox.addWidget(self.text_browser)
self.text_entry = Entry(room)
self.text_entry.setFocus()
vbox.addWidget(self.text_entry)
self.setLayout(vbox)
self.messages_future = None
self._run(room)
def closeEvent(self, e):
if self.messages_future:
self.messages_future.cancel()
super().closeEvent(e)
def _run(self, room):
@coroutine
def logger():
while True:
message = (yield)
self.text_browser.append(message['text'])
self.messages_future = asyncio.ensure_future(
room.get_messages(logger()))
示例3: Window
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
class Window(QWidget):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
model = FileListModel(self)
model.setDirPath(QLibraryInfo.location(QLibraryInfo.PrefixPath))
label = QLabel("Directory")
lineEdit = QLineEdit()
label.setBuddy(lineEdit)
view = QListView()
view.setModel(model)
self.logViewer = QTextBrowser()
self.logViewer.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
lineEdit.textChanged.connect(model.setDirPath)
lineEdit.textChanged.connect(self.logViewer.clear)
model.numberPopulated.connect(self.updateLog)
layout = QGridLayout()
layout.addWidget(label, 0, 0)
layout.addWidget(lineEdit, 0, 1)
layout.addWidget(view, 1, 0, 1, 2)
layout.addWidget(self.logViewer, 2, 0, 1, 2)
self.setLayout(layout)
self.setWindowTitle("Fetch More Example")
def updateLog(self, number):
self.logViewer.append("%d items added." % number)
示例4: Form
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
class Form(QDialog):
def __init__(self,parent=None):
super(Form,self).__init__(parent)
self.browser = QTextBrowser()
self.browser.setFont(QFont("Consolas",12,QFont.StyleItalic))
self.lineedit = QLineEdit('Type an express and press Enter')
self.lineedit.selectAll()
layout = QVBoxLayout()
layout.addWidget(self.browser)
layout.addWidget(self.lineedit)
self.setLayout(layout)
self.lineedit.setFocus()
# self.connect(self.lineedit,SIGNAL('returnPressed()'),self.updateUi)
self.lineedit.returnPressed.connect(self.updateUi)
self.setWindowTitle('Calculate')
def updateUi(self):
try:
text = self.lineedit.text()
self.browser.append('%s = %s' % (text, eval(text)))
except:
self.browser.append('%s is invalid!' % text)
示例5: AboutDialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [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: Dialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
class Dialog(QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self._info = None
self._text = ''
self._convertedtext = ''
self._encoding = None
self.mainwindow = parent
self.fromVersionLabel = QLabel()
self.fromVersion = QLineEdit()
self.reason = QLabel()
self.toVersionLabel = QLabel()
self.toVersion = QLineEdit()
self.lilyChooser = lilychooser.LilyChooser()
self.messages = QTextBrowser()
self.diff = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
self.uni_diff = QTextBrowser(lineWrapMode=QTextBrowser.NoWrap)
self.copyCheck = QCheckBox(checked=
QSettings().value('convert_ly/copy_messages', True, bool))
self.tabw = QTabWidget()
self.tabw.addTab(self.messages, '')
self.tabw.addTab(self.diff, '')
self.tabw.addTab(self.uni_diff, '')
self.buttons = QDialogButtonBox(
QDialogButtonBox.Reset | QDialogButtonBox.Save |
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttons.button(QDialogButtonBox.Ok).clicked .connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.buttons.button(QDialogButtonBox.Reset).clicked.connect(self.run)
self.buttons.button(QDialogButtonBox.Save).clicked.connect(self.saveFile)
layout = QVBoxLayout()
self.setLayout(layout)
grid = QGridLayout()
grid.addWidget(self.fromVersionLabel, 0, 0)
grid.addWidget(self.fromVersion, 0, 1)
grid.addWidget(self.reason, 0, 2, 1, 3)
grid.addWidget(self.toVersionLabel, 1, 0)
grid.addWidget(self.toVersion, 1, 1)
grid.addWidget(self.lilyChooser, 1, 3, 1, 2)
layout.addLayout(grid)
layout.addWidget(self.tabw)
layout.addWidget(self.copyCheck)
layout.addWidget(widgets.Separator())
layout.addWidget(self.buttons)
app.translateUI(self)
qutil.saveDialogSize(self, 'convert_ly/dialog/size', QSize(600, 300))
app.settingsChanged.connect(self.readSettings)
self.readSettings()
self.finished.connect(self.saveCopyCheckSetting)
self.lilyChooser.currentIndexChanged.connect(self.slotLilyPondVersionChanged)
self.slotLilyPondVersionChanged()
def translateUI(self):
self.fromVersionLabel.setText(_("From version:"))
self.toVersionLabel.setText(_("To version:"))
self.copyCheck.setText(_("Save convert-ly messages in document"))
self.copyCheck.setToolTip(_(
"If checked, the messages of convert-ly are appended as a "
"comment to the end of the document."))
self.tabw.setTabText(0, _("&Messages"))
self.tabw.setTabText(1, _("&Changes"))
self.tabw.setTabText(2, _("&Diff"))
self.buttons.button(QDialogButtonBox.Reset).setText(_("Run Again"))
self.buttons.button(QDialogButtonBox.Save).setText(_("Save as file"))
self.setCaption()
def saveCopyCheckSetting(self):
QSettings().setValue('convert_ly/copy_messages', self.copyCheck.isChecked())
def readSettings(self):
font = textformats.formatData('editor').font
self.diff.setFont(font)
diffFont = QFont("Monospace")
diffFont.setStyleHint(QFont.TypeWriter)
self.uni_diff.setFont(diffFont)
def slotLilyPondVersionChanged(self):
self.setLilyPondInfo(self.lilyChooser.lilyPondInfo())
def setCaption(self):
version = self._info and self._info.versionString() or _("<unknown>")
title = _("Convert-ly from LilyPond {version}").format(version=version)
self.setWindowTitle(app.caption(title))
def setLilyPondInfo(self, info):
self._info = info
self.setCaption()
self.toVersion.setText(info.versionString())
self.setConvertedText()
self.setDiffText()
self.messages.clear()
#.........这里部分代码省略.........
示例7: QChatWidget
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [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):
#.........这里部分代码省略.........
示例8: Sansimera
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [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()
#.........这里部分代码省略.........
示例9: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
#.........这里部分代码省略.........
error_number += 1
continue
self.__tabView.setTabText(0, '匹配结果(%d)' % match_files_count)
# self.__queue_result.put()
self.__lab_state.setText('搜索完毕!成功匹配 %d 个文件,处理 %s 个文件,失败 %s 文件。' % (match_files_count, pass_file_count, error_number))
self.__searching = False
# 单击选择路径按钮
def choose_path(self):
path = QFileDialog.getExistingDirectory()
if path != '':
path = sep.join(path.split('/'))
self.__ln_file_path.setText(path)
# 选择打开文件工具
def choose_open_tool(self):
path = QFileDialog.getOpenFileName()
if path[0] != '':
self.__ln_open_tool.setText(path[0])
# 显示搜索结果
def show_search_result(self):
"""将搜索结果加载到界面,供用户查看和操作"""
line_block = [] # 定义临时列表,成批加载,避免刷新频率过高造成界面闪烁
block_size = 10 # 一次性加载的个数
while self.__searching or self.__queue_result.qsize():
# kill subThread
if self.__thread_killer == True:
return
# if self.__searching or self.__queue_result.qsize() >= block_size: // 永远记住这个 bug (生产者-消费者 问题)
if self.__queue_result.qsize() >= block_size: # 如果队列中不小于 block_size 个项
for i in range(block_size): # 取出 block_size 个项
line_block.append(self.__queue_result.get()) # 出队操作
self.__browser_result.addItems(line_block) # 一次性添加 block_size 个条目
line_block.clear() # 清空临时列表
elif self.__queue_result.qsize() >= 0: # 如果队列中小于 block_size 各项
item = self.__queue_result.get() # 出队一项
self.__browser_result.addItem(QListWidgetItem(item)) # 加载到界面
#self.__browser.setCurrentRow(self.__browser.count()-1) # 设置列表中最后一项为当前项,使列表不停滚动
sleep(0.05) # 给界面事件循环腾出时间,避免界面冻结
#self.__pbn_search.setEnabled(True)
# 显示出错结果
def show_error_result(self):
"""打印略过的文件和出错原因,多为 I/O Error"""
count = 0
while self.__queue_error.qsize() or self.__searching:
# kill subThread
if self.__thread_killer == True:
return
if self.__queue_error.qsize() <= 0:
continue
self.__browser_error.append(self.__queue_error.get())
count += 1
self.__tabView.setTabText(1, '错误结果(%d)' % count)
# 单击检索按钮
def pbn_search_clicked(self):
"""To search allow the arguments from UI"""
# 获取 UI 数据
file_path = self.__ln_file_path.text()
file_name = self.__ln_file_name.text()
# 检查参数
示例10: Chat
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [as 别名]
class Chat(QMainWindow):
def __init__(self):
super(Chat, self).__init__()
self.setWindowTitle('chat')
self.createActions()
self.createQWidget()
self.createAboutQWidget()
def about(self):
self.bar.showMessage('about')
self.aboutArea.show()
def logout(self):
self.outputArea.clear()
self.loginArea.show()
self.hide()
def set_thing(self):
self.bar.showMessage('set')
def createActions(self):
aboutAct = QAction("&about", self)
aboutAct.triggered.connect(self.about)
setAct = QAction("&set", self)
setAct.triggered.connect(self.set_thing)
logoutAct = QAction("&logout", self)
logoutAct.triggered.connect(self.logout)
self.bar = self.statusBar()
self.bar.showMessage('hello')
self.aboutmenu = self.menuBar()
self.aboutmenu.addMenu('&about').addAction(aboutAct)
self.aboutmenu.addMenu('&set').addAction(setAct)
self.aboutmenu.addMenu('&logout').addAction(logoutAct)
# this is ubuntu special thing, so you should input this to stop origin ubuntu menubar
self.aboutmenu.setNativeMenuBar(False)
def createQWidget(self):
self.talkArea = QWidget()
self.setCentralWidget(self.talkArea) #let QWidget in QMainWindwos
#qtextbrowser and qpushbutton and qlineedit of self is self.talkArea
self.outputArea = QTextBrowser(self.talkArea)
self.pushButton = QPushButton("push", self.talkArea)
self.inputtext = QLineEdit(self.talkArea)
self.hbox = QHBoxLayout()
self.hbox.addWidget(self.inputtext)
self.hbox.addWidget(self.pushButton)
#because qwidget only have setlayout, so use self.talkArea to set
self.talkArea.setLayout(QVBoxLayout())
self.talkArea.layout().addWidget(self.outputArea)
self.talkArea.layout().addLayout(self.hbox)
self.pushButton.clicked.connect(self.push)
self.talkArea.show()
def push(self):
self.outputArea.append(self.inputtext.text())
self.bar.showMessage(self.inputtext.text())
self.inputtext.clear()
def loginQWidget(self):
self.loginArea = QWidget()
self.loginArea.setWindowTitle('login')
self.label = QLabel('輸入ip:', self.loginArea)
self.ip_input = QLineEdit(self.loginArea)
self.login_button = QPushButton('login', self.loginArea)
self.loginArea.setLayout(QVBoxLayout())
self.loginArea.layout().addWidget(self.label)
self.loginArea.layout().addWidget(self.ip_input)
self.loginArea.layout().addWidget(self.login_button)
self.login_button.clicked.connect(self.login)
self.loginArea.show()
def login(self):
self.show()
self.ip_input.clear()
self.loginArea.hide()
def createAboutQWidget(self):
self.aboutArea = QWidget()
self.aboutArea.setWindowTitle('about')
self.about_label = QLabel('這是我在工程獅計劃中的作品之一', self.aboutArea)
#.........这里部分代码省略.........
示例11: onAbout
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import append [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()