本文整理汇总了Python中PySide.QtCore.QDir.root方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.root方法的具体用法?Python QDir.root怎么用?Python QDir.root使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QDir
的用法示例。
在下文中一共展示了QDir.root方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_folder
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import root [as 别名]
def create_folder(self):
"""
Crea carpeta de imagenes si no existe
"""
self.directory = QDir.root()
if not os.path.exists(self.directory.currentPath()+"/images"):
os.makedirs(self.directory.currentPath()+"/images")
示例2: __init__
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import root [as 别名]
def __init__(self, parent=None, common_name=None, image=None):
QtGui.QDialog.__init__(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
types = controller.get_types()
self.directory = QDir.root()
self.display = QGraphicsView()
self.ui.scrollArea.setWidget(self.display)
for tipo in types:
self.ui.typeBox.addItem(tipo["nombre"], tipo["id_tipo"])
if common_name is None:
self.ui.btn_done.clicked.connect(self.add)
if image is None:
self.ui.image.setPlainText(image)
else:
self.setWindowTitle(u"Editar animal")
self.common = common_name
animal_data = controller.get_animal(common_name)
self.ui.common_name.setPlainText(animal_data["nombre_comun"])
self.ui.cientific_name.setText(animal_data["nombre_cientifico"])
self.ui.data.setText(animal_data["datos"])
tipo = self.ui.typeBox.currentText()
id_type = controller_form.get_id_type(tipo)
id_animal = controller_form.get_id_animal(common_name)
self.image = controller_form.get_image(id_animal)
if self.image:
self.path = QDir.currentPath() + "/images/" + self.image[0] + self.image[1]
self.ui.image.setPlainText(self.path)
Ifile = QFileInfo(self.path)
pixImage = controller_form.get_root_image(self.path)
item = QGraphicsPixmapItem(pixImage.scaled(100,100))
scene = QGraphicsScene()
scene.addItem(item)
self.display.setScene(scene)
self.ui.image.setPlainText(self.path)
else:
noimage = controller_form.no_image()
item = QGraphicsPixmapItem(noimage.scaled(100,100))
scene = QGraphicsScene()
scene.addItem(item)
self.display.setScene(scene)
scene = QGraphicsScene()
scene.addItem(item)
self.display.setScene(scene)
self.path = ""
self.ui.image.setPlainText(self.path)
self.ui.btn_done.clicked.connect(self.edit)
self.ui.btn_delete.clicked.connect(self.delete)
self.ui.btn_open.clicked.connect(self.open)
self.ui.btn_cancel.clicked.connect(self.cancel)