本文整理汇总了Python中PySide.QtCore.QDir.currentPath方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.currentPath方法的具体用法?Python QDir.currentPath怎么用?Python QDir.currentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QDir
的用法示例。
在下文中一共展示了QDir.currentPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: no_image
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def no_image():
"""
Si no existe imagen carga una por defecto
"""
path = QDir.currentPath() + "/images/noimage.jpg"
pixMap = QPixmap(path)
return pixMap
示例2: fileOpen
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def fileOpen(self, lineEdit, filters):
openFile = QFileDialog.getOpenFileName(self, "Find Files", QDir.currentPath(), filters="*." + filters)
uiDebug(openFile)
if openFile != None :
lineEdit.setText(openFile[0])
self.setUserConfig()
self.showConfig()
示例3: loadConfig
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def loadConfig(self):
'''加载配置文件'''
configfile = QFileDialog.getOpenFileName(self, "Load Config File", QDir.currentPath(), filter="*.cfg")
uiDebug(configfile)
if configfile != None :
self.readConfig(configfile)
self.stopServer()
self.startServer()
self.showConfig()
uiDebug("loadConfig")
示例4: __init__
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [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)
示例5: get_image_pix
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def get_image_pix(id_animal):
"""
Carga la imagen ya almacenada en la base de datos
"""
con = controller.connect()
c = con.cursor()
query = """SELECT ubicacion, formato FROM imagen WHERE fk_id_animal=?"""
c.execute(query,[id_animal])
result = c.fetchone()
if result:
path = result[0]
format = result[1]
image = QDir.currentPath()+"/images/"+path+format
pixMap = QPixmap(image)
return pixMap
示例6: ReadTagsFromConfiguration
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def ReadTagsFromConfiguration():
try:
map = {}
dom_file = os.path.join(QDir.currentPath(),"Data","swn_tag_data.xml")
print "fetching data from ", dom_file
dom = parse(dom_file)
map["Tags"] = __parseTags(dom)
map["Atmosphere"] = __parseTable(dom.getElementsByTagName("Atmosphere")[0])
map["Biosphere"] = __parseTable(dom.getElementsByTagName("Biosphere")[0])
map["Tech"] = __parseTable(dom.getElementsByTagName("Tech")[0])
map["Temperature"] = __parseTable(dom.getElementsByTagName("Temperature")[0])
map["Population"] = __parseTable1(dom.getElementsByTagName("Population")[0])
return map
except Exception as inst:
print "Some error occurred: %s", inst
return None
示例7: _create_control
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def _create_control ( self, parent ):
# If the caller provided a default path instead of a default directory
# and filename, split the path into it directory and filename
# components.
if ((len( self.default_path ) != 0) and
(len( self.default_directory ) == 0) and
(len( self.default_filename ) == 0)):
default_directory, default_filename = \
os.path.split( self.default_path )
else:
default_directory = self.default_directory
default_filename = self.default_filename
# Convert the filter:
keep = True
filters = []
for f in self.wildcard.split( '|' ):
if keep and f:
filters.append( f )
keep = not keep
# Set the default directory:
if not default_directory:
default_directory = QDir.currentPath()
dlg = QFileDialog( parent, self.title, default_directory )
dlg.setViewMode( QFileDialog.Detail )
dlg.selectFile( default_filename )
dlg.setFilters( filters )
if self.wildcard_index < filters.count():
dlg.selectFilter( filters[ self.wildcard_index ] )
if self.action == 'open':
dlg.setAcceptMode( QFileDialog.AcceptOpen )
dlg.setFileMode( QFileDialog.ExistingFile )
elif self.action == 'open files':
dlg.setAcceptMode( QFileDialog.AcceptOpen )
dlg.setFileMode( QFileDialog.ExistingFiles )
else:
dlg.setAcceptMode( QFileDialog.AcceptSave )
dlg.setFileMode( QFileDialog.AnyFile )
return dlg
示例8: load_animals
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def load_animals(self, animals=None):
"""
Carga los animales en pantalla
"""
if animals is None:
animals = controller.get_animals()
self.model = QtGui.QStandardItemModel(len(animals), 1)
self.model.setHorizontalHeaderItem(0, QtGui.QStandardItem(u"Imagen"))
self.model.setHorizontalHeaderItem(1, QtGui.QStandardItem(u"Animal"))
r = 0
self.display = QGraphicsView()
for row in animals:
index = self.model.index(r, 1, QtCore.QModelIndex())
self.model.setData(index, row['nombre_comun'])
index = self.model.index(r, 0, QtCore.QModelIndex())
id_animal = controller_form.get_id_animal(animals[r][1])
self.image = controller_form.get_image(id_animal)
if self.image:
self.path = QDir.currentPath() + "/images/" + self.image[0] + self.image[1]
Ifile = QFileInfo(self.path)
pixImage = controller_form.get_root_image(self.path)
item = QGraphicsPixmapItem(pixImage.scaled(25,25))
scene = QGraphicsScene()
scene.addItem(item)
self.display.setScene(scene)
self.model.setData(index, self.display.setScene(scene))
else:
noimage = controller_form.no_image()
item = QGraphicsPixmapItem(noimage.scaled(25,25))
scene = QGraphicsScene()
scene.addItem(item)
self.display.setScene(scene)
self.model.setData(index, self.display.setScene(scene))
r += 1
self.ui.tableView.setModel(self.model)
self.ui.tableView.setColumnWidth(0, 105)
self.ui.tableView.setColumnWidth(1, 325)
示例9: browse_folder
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def browse_folder(self):
# fname = QtWidgets.QFileDialog.getOpenFileName()
fname = QtGui.QFileDialog.getOpenFileName()
currentDir = QDir(QDir.currentPath())
self.leInputFile.setText(currentDir.relativeFilePath(fname[0]))
示例10: _create_navigator
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import currentPath [as 别名]
def _create_navigator(self):
tree = Navigator(QDir.currentPath() + '/test')
self.add_dock_widget('Navigator', tree, Qt.LeftDockWidgetArea)
tree.activated.connect(self.tree_item_selected)
return tree