当前位置: 首页>>代码示例>>Python>>正文


Python QVBoxLayout.insertWidget方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.insertWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.insertWidget方法的具体用法?Python QVBoxLayout.insertWidget怎么用?Python QVBoxLayout.insertWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QVBoxLayout的用法示例。


在下文中一共展示了QVBoxLayout.insertWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: InstallPage

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import insertWidget [as 别名]
class InstallPage(QWidget):
    """Settings page for the installed plugins"""
    def __init__(self, parent, repo):
        """QWidget Dictionary -> Void
        Consumes the parent and the repository dictionary and sets up the
        install page in the settings area"""
        QWidget.__init__(self, parent)
        self._userPlugins = helper.getPlugins()
        self._repo = repo

        # Add a scrollArea that if they are more plugins that fit into the
        # settings page
        scrollArea = QScrollArea(self)
        scrollArea.setWidgetResizable(True)
        scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        baseLayout = QVBoxLayout()
        baseLayout.setAlignment(Qt.AlignTop)
        self.setLayout(baseLayout)
        baseWidget = QWidget()
        scrollArea.setWidget(baseWidget)
        baseLayout.addWidget(scrollArea)

        self._vbox = QVBoxLayout()
        baseWidget.setLayout(self._vbox)

    def update(self, userPlugins):
        """ListOfUserpluginEntry -> Void
        Consume a list of UserpluginEntry and repopulates the install page"""
        for i in reversed(range(self._vbox.count())):
            try:
                self._vbox.itemAt(i).widget().setParent(None)
            except AttributeError as e:
                qWarning("Can't call setParent of None type")

        labelText = "<h2>Install Plugins</h2>"
        if (len(self._repo["plugins"]) < 1):
            labelText += "<p>It seems we could not load the plugin repository.</p>"
            labelText += "<p style='color:red'>Make shure your internet connection is working and restart Enki.</p><p></p>"
        self._vbox.addWidget(QLabel(labelText))

        for entry in self._repo["plugins"]:
            isInstalled = helper.isPluginInstalled(entry["name"], userPlugins)
            if isInstalled:
                self._vbox.addWidget(pluginspage.PluginTitlecard(isInstalled))
            else:
                self._vbox.addWidget(InstallableTitlecard(entry, self))

    def addPluginToUserPlugins(self, installableTitlecard):
        """InstallableTitlecard -> Void
        Consumes an InstallableTitlecard and insert an PluginTitleCard instead
        of itself"""
        index = self._vbox.indexOf(installableTitlecard)
        name = installableTitlecard.modulename()
        pluginEntry = helper.initPlugin(name)

        if pluginEntry:
            self._userPlugins.append(pluginEntry)
            self._vbox.insertWidget(index,
                                    pluginspage.PluginTitlecard(pluginEntry))
开发者ID:bjones1,项目名称:enki,代码行数:61,代码来源:installpage.py

示例2: LateralPanel

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import insertWidget [as 别名]
class LateralPanel(QWidget):

    def __init__(self, parent=None):
        super(LateralPanel, self).__init__(parent)
        self.has_component = False
        self.vbox = QVBoxLayout(self)
        self.vbox.setContentsMargins(0, 0, 0, 0)
        self.vbox.setSpacing(0)
        # hbox = QHBoxLayout()
        # hbox.setContentsMargins(0, 0, 0, 0)
        # hbox.setSpacing(0)
        # self.combo = QComboBox()
        # ui_tools.ComboBoxButton(self.combo, self.combo.clear,
        #    self.style().standardPixmap(self.style().SP_TrashIcon))
        # FIXME: translations
        # self.combo.setToolTip("Select the item from the Paste "
        #    "History list.\nYou can Copy items into this list with: "
        #    "%s\nor Paste them using: {}".format(
        #        resources.get_shortcut("History-Copy").toString(
        #            QKeySequence.NativeText),
        #        resources.get_shortcut("History-Paste").toString(
        #            QKeySequence.NativeText)))
        # self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        # hbox.addWidget(self.combo)
        # self.vbox.addLayout(hbox)

    def add_component(self, widget):
        self.vbox.insertWidget(0, widget)
        self.has_component = True

    def add_new_copy(self, copy):
        pass
        # self.combo.insertItem(0, copy)
        # self.combo.setCurrentIndex(0)
        # if self.combo.count() > settings.COPY_HISTORY_BUFFER:
        #    self.combo.removeItem(self.combo.count() - 1)

    def get_paste(self):
        pass
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:41,代码来源:central_widget.py

示例3: LateralPanel

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import insertWidget [as 别名]
class LateralPanel(QWidget):
    splitEditor = pyqtSignal('QObject*', 'QObject*', bool)
    closeSplit = pyqtSignal(QWidget)
    def __init__(self, parent=None):
        super(LateralPanel, self).__init__(parent)
        self.has_component = False
        self.vbox = QVBoxLayout(self)
        self.vbox.setContentsMargins(0, 0, 0, 0)
        hbox = QHBoxLayout()
        hbox.setContentsMargins(0, 0, 5, 5)
        self.combo = QComboBox()
        ui_tools.ComboBoxButton(self.combo, self.combo.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self.combo.setToolTip(self.tr("Select the item from the Paste "
            "History list.\nYou can Copy items into this list with: "
            "%s\nor Paste them using: %s") %
                (resources.get_shortcut("History-Copy").toString(
                    QKeySequence.NativeText),
                resources.get_shortcut("History-Paste").toString(
                    QKeySequence.NativeText)))
        self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        hbox.addWidget(self.combo)
        self.vbox.addLayout(hbox)

    def add_component(self, widget):
        self.vbox.insertWidget(0, widget)
        self.has_component = True

    def add_new_copy(self, copy):
        self.combo.insertItem(0, copy)
        self.combo.setCurrentIndex(0)
        if self.combo.count() > settings.COPY_HISTORY_BUFFER:
            self.combo.removeItem(self.combo.count() - 1)

    def get_paste(self):
        return self.combo.currentText()
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:38,代码来源:central_widget.py

示例4: PlotWindow

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import insertWidget [as 别名]
class PlotWindow(QWidget):
    def __init__(self, tab):
        super(PlotWindow, self).__init__()
        self.tab = tab
        self.allAxes = {}
        self.curveList = []
        self.extraLines = []
        self.layout = QHBoxLayout()
        self.graph_layout = QVBoxLayout()
        self.gbox_layout = QVBoxLayout()

        self.tabGBActor = QTabWidget()

        self.dateplot = DatePlot(self)
        self.customize = Customize(self)
        self.button_arrow = self.ButtonArrow()
        self.button_del_graph = self.ButtonDelete()

        self.gbox_layout.addWidget(self.dateplot)
        self.gbox_layout.addWidget(self.customize)
        self.gbox_layout.addWidget(self.tabGBActor)
        self.gbox_layout.addWidget(self.button_del_graph)

        self.layout.addLayout(self.graph_layout)
        self.layout.addWidget(self.button_arrow)
        self.layout.addLayout(self.gbox_layout)

        for widget in [self.dateplot, self.customize, self.tabGBActor]:
            widget.setMaximumWidth(400)

        self.setLayout(self.layout)

    @property
    def mainwindow(self):
        return self.tab.mainwindow

    @property
    def config(self):
        return self.dateplot.config

    @property
    def axes2curves(self):
        d = {ax: [] for ax in [None] + list(self.allAxes.values())}

        for curve in self.curveList:
            d[curve.getAxes()].append(curve)

        return d

    @property
    def line2Curve(self):
        return {curve.line: curve for curve in self.curveList}

    @property
    def axes2id(self):
        d = {ax: id for id, ax in self.allAxes.items()}
        d[None] = None
        return d

    def createGraph(self, custom):
        try:
            self.graph.close()
            self.graph_layout.removeWidget(self.graph)
            self.graph.deleteLater()
        except AttributeError:
            pass

        self.graph = Graph(self, custom)
        self.graph_layout.insertWidget(0, self.graph)

    def getAxes(self, newType, i=-1):

        for i, ax in self.allAxes.items():
            try:
                curve = self.axes2curves[ax][0]
                if curve.type == newType:
                    return ax
            except IndexError:
                return ax

            if i == 3:
                raise ValueError('No Axe available')
        return i + 1

    def setAxes(self, allAxes):
        for idAxes, oldAxes in list(self.allAxes.items()):
            self.unsetLines(oldAxes, allAxes)
            self.allAxes.pop(idAxes, None)

        self.allAxes = allAxes

    def unsetLines(self, axes, newAxes):
        while axes.lines:
            line = axes.lines[0]
            axes.lines.remove(line)
            try:
                curve = self.line2Curve[line]
                curve.line = False
                if curve.getAxes() not in newAxes.values():
                    curve.setAxes(None)
#.........这里部分代码省略.........
开发者ID:Subaru-PFS,项目名称:ics_sps_engineering_plotData,代码行数:103,代码来源:plot_window.py

示例5: notifyTab

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import insertWidget [as 别名]
class notifyTab(QWidget):

	def __init__(self,parent_):
		super(notifyTab,self).__init__(parent_)
		self.parent_=parent_
		self.obj=parent_.obj
		self.initUI()

	def initUI(self):
		self.btn = []
		self.notif_lbl = []
		self.tag_lbl = []
		self.nFrames =[]
		self.d_ = False

		for i in range(0,len(self.obj.notif)):
			pixmap=QPixmap(self.obj.tagDict[self.obj.notif[i].tag])
			pixmap = pixmap.scaled(45, 45)
			self.tag_lbl.append(QLabel(self))
			self.tag_lbl[i].setPixmap(pixmap)

		for i1 in range(0,len(self.obj.notif)):
			self.notif_lbl.append(QLabel(self))
			self.notif_lbl[i1].setScaledContents(False)
			self.notif_lbl[i1].setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
			self.notif_lbl[i1].setText(self.obj.notif[i1].notif_text)
			self.notif_lbl[i1].setObjectName("nlbl")
			self.btn.append(QPushButton('Get Link'))
			self.btn[i1].setObjectName("btn")

		for i2 in range(0,len(self.obj.notif)):
			self.nFrames.append(notifyFrames(self.notif_lbl[i2],self.tag_lbl[i2],self.btn[i2]))
			tag = self.obj.notif[i2].tag
			if tag ==2 or tag==3 or tag==4:
				self.nFrames[i2].setObjectName('nFrameOdd')
			else:
				self.nFrames[i2].setObjectName('nFrameEven')

		self.widget = QWidget(self)
		self.vbox = QVBoxLayout()

		for index, frame in enumerate(self.nFrames):
			self.vbox.addWidget(frame)

		if len(self.nFrames)<4:
			self.dframe = QFrame()
			self.dframe.setObjectName('nFrameDummy')
			self.vbox.addWidget(self.dframe)
			self.d_ = True

		self.vbox.setContentsMargins(0,0,0,0)
		self.vbox.setSpacing(3)

		self.widget.setLayout(self.vbox)
		self.scroll = QScrollArea(self)
		self.scroll.setWidget(self.widget)
		self.scroll.setWidgetResizable(True)
		self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
		self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)

		vbox1 = QVBoxLayout()
		vbox1.setContentsMargins(0,0,0,0)
		vbox1.setSpacing(0)

		vbox1.addWidget(self.scroll)
		self.setLayout(vbox1)


	def updater(self):
		marker=len(self.nFrames)
		marker1 = len(self.nFrames)

		for i in range(0,len(self.obj.notif)):
			pixmap=QPixmap(self.obj.tagDict[self.obj.notif[i].tag])
			pixmap = pixmap.scaled(45, 45)
			self.tag_lbl.append(QLabel(self))
			self.tag_lbl[marker].setPixmap(pixmap)
			marker=marker+1

		marker=marker1
		for i1 in range(0,len(self.obj.notif)):
			self.notif_lbl.append(QLabel(self))
			self.notif_lbl[marker].setScaledContents(False)
			self.notif_lbl[marker].setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
			self.notif_lbl[marker].setText(self.obj.notif[i1].notif_text)
			self.notif_lbl[marker].setObjectName("nlbl")
			self.btn.append(QPushButton('Get Link'))
			self.btn[marker].setObjectName("btn")
			marker+=1

		marker=marker1

		for i2 in range(0,len(self.obj.notif)):
			self.nFrames.append(notifyFrames(self.notif_lbl[marker],self.tag_lbl[marker],self.btn[marker]))
			marker+=1

		marker=marker1

		for i3 in range(len(self.nFrames)-1,marker-1,-1):
			self.vbox.insertWidget(0,self.nFrames[i3])
#.........这里部分代码省略.........
开发者ID:AkshayAgarwal007,项目名称:Moodly,代码行数:103,代码来源:view.py


注:本文中的PyQt5.QtWidgets.QVBoxLayout.insertWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。