本文整理汇总了Python中PyQt5.QtSvg.QSvgWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtSvg.QSvgWidget方法的具体用法?Python QtSvg.QSvgWidget怎么用?Python QtSvg.QSvgWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtSvg
的用法示例。
在下文中一共展示了QtSvg.QSvgWidget方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(
self,
jobs_ctx,
workspace_fs,
path,
reload_timestamped_signal,
update_version_list,
close_version_list,
):
super().__init__()
self.setupUi(self)
self.jobs_ctx = jobs_ctx
update_version_list.connect(self.reset_dialog)
self.get_versions_success.connect(self.on_get_version_success)
self.get_versions_error.connect(self.on_get_version_error)
self.button_load_more_entries.clicked.connect(self.load_more)
self.workspace_fs = workspace_fs
self.version_lister = workspace_fs.get_version_lister()
self.spinner = QSvgWidget(":/icons/images/icons/spinner.svg")
self.spinner.setFixedSize(100, 100)
self.spinner_layout.addWidget(self.spinner, Qt.AlignCenter)
self.spinner_layout.setAlignment(Qt.AlignCenter)
self.set_loading_in_progress(False)
self.reset_dialog(workspace_fs, self.version_lister, path)
示例2: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.resize(800, 600)
self.setFrameShape(self.NoFrame)
self.setWidgetResizable(True)
self.setAlignment(Qt.AlignCenter)
self._loadStart = False
# 网格窗口
self._widget = GridWidget(self)
self._widget.loadStarted.connect(self.setLoadStarted)
self.setWidget(self._widget)
# 连接竖着的滚动条滚动事件
self.verticalScrollBar().actionTriggered.connect(self.onActionTriggered)
# 进度条
self.loadWidget = QSvgWidget(
self, minimumHeight=120, minimumWidth=120, visible=False)
self.loadWidget.load(Svg_icon_loading)
示例3: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, parent=None):
QtSvg.QSvgWidget.__init__(self, parent)
示例4: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, cover_path, figure_info, figure_title,
figure_score, figure_desc, figure_count, video_url, cover_url, img_path, manager, *args, **kwargs):
super(ItemWidget, self).__init__(*args, **kwargs)
self.setMaximumSize(220, 420)
self.setMaximumSize(220, 420)
self.img_path = img_path
self.cover_url = cover_url
self._manager = manager
layout = QVBoxLayout(self)
layout.setContentsMargins(10, 20, 10, 0)
# 图片label
self.clabel = CoverLabel(cover_path, figure_info, video_url, self)
layout.addWidget(self.clabel)
# 片名和分数
flayout = QHBoxLayout()
flayout.addWidget(QLabel(figure_title, self))
flayout.addItem(QSpacerItem(
20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
flayout.addWidget(QLabel(figure_score, self, styleSheet="color: red;"))
layout.addLayout(flayout)
# 主演
layout.addWidget(
QLabel(figure_desc, self, styleSheet="color: #999999;", openExternalLinks=True))
# 播放量
blayout = QHBoxLayout()
count_icon = QSvgWidget(self)
count_icon.setMaximumSize(16, 16)
count_icon.load(Svg_icon_play_sm)
blayout.addWidget(count_icon)
blayout.addWidget(
QLabel(figure_count, self, styleSheet="color: #999999;"))
layout.addLayout(blayout)
示例5: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, path, w=None, h=None, click=None):
"""
Create a QSvgWidget from the SVG file in the icons directory. The SVG
will display at its designated pixel size if no dimensions are
specified. If only one dimension is specified, the aspect ratio will be
maintained for the other dimension.
Args:
path (str): Full path for non-tinywallet files. Otherwise, the
basename of the file in the icons folder.
w (int): optional. Pixel width of the resulting pixmap.
h (int): optional. Pixel height of the resulting pixmap.
click (func): optional. A function to call when the widget is
clicked.
Returns:
QPixmap: A sized pixmap created from the scaled SVG file.
"""
if not path.endswith(".svg"):
path = os.path.join(UI_DIR, "icons", path + ".svg")
QtSvg.QSvgWidget.__init__(self, path)
Clicker.__init__(self, click)
size = self.sizeHint()
x, y = size.width(), size.height()
if w and h:
pass
elif w:
h = w * y / x
elif h:
w = h * x / y
else:
w, h = x, y
self.w = w
self.h = h
self.setFixedSize(w, h)
示例6: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, parent, persepolis_setting):
super().__init__(parent)
self.persepolis_setting = persepolis_setting
# set ui direction
ui_direction = self.persepolis_setting.value('ui_direction')
if ui_direction == 'rtl':
self.setLayoutDirection(Qt.RightToLeft)
elif ui_direction in 'ltr':
self.setLayoutDirection(Qt.LeftToRight)
# set size
self.resize(QSize(400, 80))
self.setFixedWidth(400)
# show this widget as ToolTip widget
self.setWindowFlags(Qt.ToolTip)
# find bottom right position
bottom_right_screen = QDesktopWidget().availableGeometry().bottomRight()
bottom_right_notification = QRect(QPoint(0, 0), QSize(410, 120))
bottom_right_notification.moveBottomRight(bottom_right_screen)
self.move(bottom_right_notification.topLeft())
# get persepolis icon path
icons = ':/' + \
str(self.persepolis_setting.value('settings/icons')) + '/'
notification_horizontalLayout = QHBoxLayout(self)
# persepolis icon
svgWidget = QtSvg.QSvgWidget(':/persepolis.svg')
svgWidget.setFixedSize(QSize(64, 64))
notification_horizontalLayout.addWidget(svgWidget)
notification_verticalLayout = QVBoxLayout()
# 2 labels for notification messages
self.label1 = QLabel(self)
self.label1.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.label1.setStyleSheet("font-weight: bold")
self.label1.setWordWrap(True)
self.label2 = QLabel(self)
self.label2.setWordWrap(True)
self.label2.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
notification_verticalLayout.addWidget(self.label1)
notification_verticalLayout.addWidget(self.label2)
notification_horizontalLayout.addLayout(notification_verticalLayout)
示例7: __init__
# 需要导入模块: from PyQt5 import QtSvg [as 别名]
# 或者: from PyQt5.QtSvg import QSvgWidget [as 别名]
def __init__(self, parent=None):
super(About, self).__init__(parent)
self.resize(550, 385)
self.setWindowTitle("About")
logo = QtSvg.QSvgWidget('/usr/lib/resetter/data/icons/resetter-logo.svg')
about_font = QtGui.QFont()
about_font.setBold(True)
about_label = QLabel(self)
desc_label = QLabel(self)
desc_label.setAlignment(QtCore.Qt.AlignCenter)
desc_label.setWordWrap(True)
cr_label = QLabel(self)
cr_label.setAlignment(QtCore.Qt.AlignCenter)
donate_label = QLabel(self)
donate_label.setAlignment(QtCore.Qt.AlignCenter)
donate_label.setWordWrap(True)
more_label = QLabel(self)
more_label.setAlignment(QtCore.Qt.AlignCenter)
more_label.setWordWrap(True)
donate_label.setToolTip("Right click to copy link")
more_label.setToolTip("Right Click to copy link")
version_label = QLabel(self)
version_label.setAlignment(QtCore.Qt.AlignCenter)
about_label.setAlignment(QtCore.Qt.AlignCenter)
cr_text = u"© 2019 Jonathan Soivilus"
desc_text = "Built With Python3/PyQt5\n\n " \
"This is a great utility software that will help you reset your Linux installation its stock state" \
" among other things."
version = UsefulTools().getVersion()
version_text = "Version: {}-stable".format(version)
donate_text = 'If you liked my project, please ' \
'<a href="https://github.com/gaining/Resetter/blob/master/DONATE.md">Donate </a>'
more_text = 'To find out more about this project, please visit my github:' \
' <a href="https://github.com/gaining/resetter"> Resetter</a>'
desc_label.setText(desc_text)
cr_label.setText(cr_text)
donate_label.setText(donate_text)
more_label.setText(more_text)
version_label.setText(version_text)
self.close_button = QPushButton()
self.close_button.setText("Close")
self.close_button.setMaximumSize(QtCore.QSize(100, 30))
self.close_button.clicked.connect(self.close)
self.liscence_button = QPushButton(self)
self.liscence_button.setText("License")
self.liscence_button.clicked.connect(self.showLicence)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.addWidget(logo)
self.verticalLayout.addWidget(about_label)
self.verticalLayout.addWidget(desc_label)
self.verticalLayout.addWidget(donate_label)
self.verticalLayout.addWidget(more_label)
self.verticalLayout.addWidget(version_label)
self.verticalLayout.addWidget(cr_label)
self.verticalLayout.addWidget(self.close_button, 0, QtCore.Qt.AlignRight)
self.verticalLayout.addWidget(self.liscence_button, 0, QtCore.Qt.AlignRight)