コード例 #1
0
    def layerWasAdded(self,layers):
        if self.settingsWidget.checkBoxPolygon.isChecked():
            poly_checked = False
        else:
            poly_checked = True

        if self.settingsWidget.checkBoxLine.isChecked():
            line_checked = False
        else:
            line_checked = True

        for l in layers:
            if  l.type() == 0:
                if l.geometryType() == 1 or l.geometryType() == 2:
                    self.layers.append([l,l.id(),l.geometryType()])

                    item = QListWidgetItem(l.name())
                    item.setCheckState(Qt.Unchecked)
                    self.settingsWidget.listWidget.addItem(item)

                    if l.geometryType() == 1:
                        item.setHidden (line_checked)
                    elif l.geometryType() == 2:
                        item.setHidden (poly_checked)    
                        self.settingsWidget.comboBox_targetLayer.addItem(l.name())                  
コード例 #2
0
ファイル: _pkg.py プロジェクト: everyskills/Kangaroo
def add_item(obj,
             icon: str = "",
             text: str = "",
             tooltip: str = "",
             selectable: bool = False,
             select: bool = False,
             checkable: bool = False,
             check: bool = False,
             hide: bool = False,
             font_size: int = 12,
             icon_size=(25, 25)):

    font = QFont()
    font.setPointSize(font_size)

    att = QListWidgetItem()
    att.setText(text)
    att.setHidden(hide)
    att.setFont(font)

    if icon:
        att.setIcon(icon)
    if tooltip:
        att.setToolTip(tooltip)
    if checkable:
        att.setCheckState(check)
    if selectable:
        att.setSelected(select)

    obj.setIconSize(QSize(icon_size[0], icon_size[1]))

    return att
コード例 #3
0
ファイル: error_list.py プロジェクト: ennsk/fort-pymdwizard
    def add_error(self, error_msg, xpath):
        action = QListWidgetItem()
        action.setText(error_msg)
        action.setHidden(False)
        action.setData(1, xpath)

        self.ui.listWidget.addItem(action)
        self.errors.append((error_msg, xpath))
コード例 #4
0
ファイル: MeeTouch.py プロジェクト: BulinLiang/AssloudTools
 def _initAssloudItems(self):
     for i in range(len(self.item_list)):
         box = QCheckBox()  # 实例化一个QCheckBox,吧文字传进去
         item = QListWidgetItem()  # 实例化一个Item,QListWidget,不能直接加入QCheckBox
         item.setSizeHint(QSize(0, 25))
         self.item_list[i] = item
         self.__ui.lwAssloudList.addItem(item)  # 把QListWidgetItem加入QListWidget
         self.__ui.lwAssloudList.setItemWidget(item, box)  # 再把QCheckBox加入QListWidgetItem
         # 初始化隐藏item列表
         item.setHidden(True)
コード例 #5
0
    def set_item(self, item_info):
        image = item_info["image"]
        if not item_info.get('image') or not os.path.exists(
                item_info['image']):
            image = self.parent.asset_type[item_info['type']]['image']

        item = QListWidgetItem(item_info['asset'])
        item.setIcon(QIcon(image))
        item.info = item_info

        image = item_info['image']

        tags = [t for t in item_info['tags'].split(',') if len(t)]
        search = self.parent.search_bar.text()
        item_visibility = filtering_keyword(item_info["asset"], search, tags)

        self.addItem(item)
        item.setHidden(item_visibility)

        return (item)
コード例 #6
0
    def rebuildListWidget(self):
        self.settingsWidget.listWidget.clear()
        if self.settingsWidget.checkBoxPolygon.isChecked():
            poly_checked = False
        else:
            poly_checked = True

        if self.settingsWidget.checkBoxLine.isChecked():
            line_checked = False
        else:
            line_checked = True

        for l in self.layers:
            item = QListWidgetItem(l[0].name())
            item.setCheckState(Qt.Unchecked)
            self.settingsWidget.listWidget.addItem(item)

            if l[2] == 1:
                item.setHidden (line_checked)
            elif l[2] == 2:
                item.setHidden (poly_checked)
コード例 #7
0
    def __init__(self, *args, **kwargs):
        super(LeftWindow, self).__init__(*args, **kwargs)
        warn = QListWidgetItem(self)
        warn_btn = TabButton(warn, top[0])
        self.setItemWidget(warn, warn_btn)
        # 被折叠控件
        warn_item = QListWidgetItem(self)
        # 通过按钮的选中来隐藏下面的item
        warn_btn.toggled.connect(warn_item.setHidden)
        self.warn_widget = LeftWidget(warn_item, tab[:3])
        self.setItemWidget(warn_item, self.warn_widget)
        warn_item.setHidden(True)  # 默认不展开

        device = QListWidgetItem(self)
        device_btn = TabButton(device, top[1])
        self.setItemWidget(device, device_btn)
        # 被折叠控件
        device_item = QListWidgetItem(self)
        # 通过按钮的选中来隐藏下面的item
        device_btn.toggled.connect(device_item.setHidden)
        self.device_widget = LeftWidget(device_item, [tab[3]])
        self.setItemWidget(device_item, self.device_widget)
        device_item.setHidden(True)  # 默认不展开

        system = QListWidgetItem(self)
        system_btn = TabButton(system, top[2])
        self.setItemWidget(system, system_btn)
        # 被折叠控件
        system_item = QListWidgetItem(self)
        # 通过按钮的选中来隐藏下面的item
        system_btn.toggled.connect(system_item.setHidden)
        self.system_widget = LeftWidget(system_item, [tab[4]])
        self.setItemWidget(system_item, self.system_widget)
        system_item.setHidden(True)  # 默认不展开
コード例 #8
0
ファイル: main.py プロジェクト: QvQQ/pyModule
    def listprint(self, head, msg):
        print(self.sctl.handleError())
        brush = QBrush(QColor(255, 213, 214))
        brush.setStyle(Qt.SolidPattern)
        item1 = QListWidgetItem()
        item1.setBackground(brush)
        item1.setText(
            QCoreApplication.translate("Ui_MainWindow", '{}:'.format(head)))

        brush = QBrush(QColor(205, 232, 255))
        brush.setStyle(Qt.SolidPattern)
        item2 = QListWidgetItem()
        item2.setBackground(brush)
        item2.setText(
            QCoreApplication.translate("Ui_MainWindow",
                                       '        {}'.format(msg)))
        self.listWidget_danmaku.addItem(item1)
        self.listWidget_danmaku.addItem(item2)
        self.listWidget_danmaku.addItem('')
        item2.setHidden(False)
        item1.setHidden(False)
        for i in range(2):
            self.listWidget_danmaku.scrollToBottom()
            time.sleep(0.1)
コード例 #9
0
class LeftItem(QListWidget):
    __qss = None
    __iconlist = None
    __itemper = None
    __btheight = None

    def __init__(self, btname, listname):
        super(LeftItem, self).__init__()
        self.btname = btname
        self.itemlist = listname
        self.setContentsMargins(0, 0, 0, 0)
        self.setStyleSheet("border:0px")
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)

    def c_ui(self):
        self.t_icon_fold = self.__iconlist[0][0]
        self.t_icon_unfold = self.__iconlist[0][1]

        self.top_obj_0 = QListWidgetItem(self)
        self.btn_0 = TopButton(self.top_obj_0, self.btname[0],
                               self.t_icon_fold, self.t_icon_unfold)
        self.btn_0.setObjectName("menu_0")
        self.btn_0.setFixedHeight(self.__btheight)
        self.btn_0.setStyleSheet(self.__qss)
        self.setItemWidget(self.top_obj_0, self.btn_0)
        if self.itemlist[0]:
            self.sub_obj = QListWidgetItem(self)
            self.btn_0.toggled.connect(self.sub_obj.setHidden)
            self.item_0 = ItemWidget(self.sub_obj, self.itemlist[0],
                                     self.__qss, self.__itemper,
                                     self.__btheight)
            self.setItemWidget(self.sub_obj, self.item_0)
            self.sub_obj.setHidden(True)
        else:
            pass

        self.top_obj_1 = QListWidgetItem(self)
        self.btn_1 = TopButton(self.top_obj_1, self.btname[1],
                               self.t_icon_fold, self.t_icon_unfold)
        self.btn_1.setObjectName("menu_0")
        self.btn_1.setFixedHeight(self.__btheight)
        self.btn_1.setStyleSheet(self.__qss)
        self.setItemWidget(self.top_obj_1, self.btn_1)
        if self.itemlist[1]:
            self.sub_obj = QListWidgetItem(self)
            self.btn_1.toggled.connect(self.sub_obj.setHidden)
            self.item_1 = ItemWidget(self.sub_obj, self.itemlist[1],
                                     self.__qss, self.__itemper,
                                     self.__btheight)
            self.setItemWidget(self.sub_obj, self.item_1)
            self.sub_obj.setHidden(True)
        else:
            pass

        self.top_obj_2 = QListWidgetItem(self)
        self.btn_2 = TopButton(self.top_obj_2, self.btname[2],
                               self.t_icon_fold, self.t_icon_unfold)
        self.btn_2.setObjectName("menu_0")
        self.btn_2.setFixedHeight(self.__btheight)
        self.btn_2.setStyleSheet(self.__qss)
        self.setItemWidget(self.top_obj_2, self.btn_2)
        if self.itemlist[2]:
            self.sub_obj = QListWidgetItem(self)
            self.btn_2.toggled.connect(self.sub_obj.setHidden)
            self.item_2 = ItemWidget(self.sub_obj, self.itemlist[2],
                                     self.__qss, self.__itemper,
                                     self.__btheight)
            self.setItemWidget(self.sub_obj, self.item_2)
            self.sub_obj.setHidden(True)
        else:
            pass

    def setqss(self, qss):
        self.__qss = qss

    def seticon(self, icon):
        self.__iconlist = icon

    def setitemper(self, per):
        self.__itemper = per

    def setbtheight(self, per):
        self.__btheight = per