Ejemplo n.º 1
0
	def __wnode(self, node, parent):
			"""
				рекурсивный обход элементов и добавление их на форму
			"""
			# if node.ntype == "f":
			# 	# icon = QIcon(get_icon_path("document-properties.png"))
			# 	icon = qicon("empty.png")
			# elif node.ntype == "d":
			# 	icon = qicon("folder.png")
			# 	# icon = QIcon(get_icon_path("document-open.png"))
			# 	# icon = QIcon(get_icon_path("document-open.png"))
			# else:
			# 	icon = QIcon(get_icon_path("list-remove.png"))


			if node.ipack and node.icon:
				icon = QIcon(get_icon_path(node.ipack, node.icon))
			else:
				icon = QIcon(get_icon_path("empty.svg"))



			row = QStandardItem(node.name)				# элемент строки
			row.setIcon(icon)				# icon
			row.setEditable(False)							# editable - false

			row.setData(node.uuid, Qt.UserRole+1)


			


			
			parent.appendRow(row)							# добавляем

			if node.current:
				self.current_index = self.tmodel.indexFromItem(row)
				self.current_uuid = node.uuid


			if node.expanded:
				index = self.tmodel.indexFromItem(row)
				self.expand_indexes.append(index)
			# print(index)

			#--- ищем всех деток на уровень ниже(не дальше)
			# child_items = [node for node in simple_obj_list
			# 			   if (node["tree_lk"] > node_lk) and (node["tree_rk"] < node_rk) and(node["tree_level"] == node_level+1)]

			# child_items = self.tree.get_childrens(node)
			child_items = self.tree.find_childrens(node.uuid)
			# child_items = node.childrens


			#--- для каждого из деток вызываем рекурсию
			for node in child_items:
				self.__wnode(node, row)
Ejemplo n.º 2
0
    def __update_pack(self, index):
        self.current_ipack = ICON_PACKS[index]

        files = get_list_icons_pack(self.current_ipack)

        self.clist.clear()
        for f in files:

            icon = QIcon(get_icon_path(self.current_ipack, f))
            item = QListWidgetItem(icon, f)
            item.setData(Qt.UserRole + 1, f)
            self.clist.addItem(item)
Ejemplo n.º 3
0
    def __update_pack(self, index):
        """обновить список иконок для выбранного набора"""
        self.current_ipack = ICON_PACKS[index]

        files = get_list_icons_pack(self.current_ipack)

        self.clist.clear()
        for f in files:

            icon = QIcon(get_icon_path(self.current_ipack, f))
            item = QListWidgetItem(icon, f)
            item.setData(Qt.UserRole + 1, f)
            self.clist.addItem(item)

        #--- отключаем кнопку
        self.btn_select.setDisabled(True)
Ejemplo n.º 4
0
def real_icon(*args):
    """получить объект иконки по произвольному пути"""
    file_path = get_icon_path(*args)
    return PhotoImage(file=file_path)
Ejemplo n.º 5
0
def get_icon(icon_name):
	return QIcon(get_icon_path(IPACK, icon_name))
Ejemplo n.º 6
0
def get_ftype_icon(file_type_icon):
	icon = FTYPE_ICONS.get(file_type_icon, "no_icon.png")
	return QIcon(get_icon_path(IPACK, "ftypes", icon))
Ejemplo n.º 7
0
def get_volume_icon(volume_icon_type):
	icon = VOLUME_ICONS.get(volume_icon_type, "no_icon.png")
	return QIcon(get_icon_path(IPACK, "volumes", icon))