本文整理匯總了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)