本文整理汇总了Python中Core.Dialogs类的典型用法代码示例。如果您正苦于以下问题:Python Dialogs类的具体用法?Python Dialogs怎么用?Python Dialogs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dialogs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: emendDirectoryWithContents
def emendDirectoryWithContents(self):
try:
_path = self.checkSource(str(QuickMakeParameters[1]), "directory")
if _path is not None:
if uni.getBoolValue("isShowQuickMakeWindow"):
newEmendedName = str(self.leNewValue.text())
else:
newEmendedName = Organizer.emend(_path, fu.getObjectType(_path))
fu.activateSmartCheckIcon()
oldFileName = _path
newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
if newDirName != oldFileName:
fileAndDirectoryNames = fu.readDirectory(newDirName, "fileAndDirectory")
for fileAndDirs in fileAndDirectoryNames:
objectType = fu.getObjectType(fu.joinPath(newDirName, fileAndDirs))
fu.moveOrChange(fu.joinPath(newDirName, fileAndDirs),
fu.joinPath(newDirName, Organizer.emend(fileAndDirs, objectType)), objectType)
if uni.isActiveDirectoryCover and uni.getBoolValue(
"isActiveAutoMakeIconToDirectory") and uni.getBoolValue(
"isAutoMakeIconToDirectoryWhenFileMove"):
fu.checkIcon(newDirName)
if fu.isDir(newDirName):
fu.completeSmartCheckIcon()
Dialogs.show(translate("QuickMake", "Directory And Contents Emended"),
str(translate("QuickMake",
"\"%s\" is emended based on the criteria you set.This directory is \"%s\" now.")) %
(Organizer.getLink(_path), Organizer.getLink(newDirName)))
self.close()
except:
ReportBug.ReportBug()
示例2: checkSource
def checkSource(self, _oldPath, _objectType="fileAndDirectory", _isCheckWritable=True):
_path = fu.checkSource(_oldPath, _objectType, False)
if _path is None:
if _objectType == "file":
answer = Dialogs.ask(translate("QuickMake", "Cannot Find File"),
str(translate("FileUtils",
"\"%s\" : cannot find a file with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
elif _objectType == "directory":
answer = Dialogs.ask(translate("QuickMake", "Cannot Find Directory"),
str(translate("FileUtils",
"\"%s\" : cannot find a folder with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
else:
answer = Dialogs.ask(translate("QuickMake", "Cannot Find File Or Directory"),
str(translate("FileUtils",
"\"%s\" : cannot find a file or directory with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
if _isCheckWritable:
if fu.isWritableFileOrDir(_oldPath) is False:
return None
return _path
示例3: getTagger
def getTagger(_isAlertIfNotExist=False, _isReloadAgain=False):
global loaddedTagger
try:
if not _isReloadAgain and loaddedTagger is not None:
return loaddedTagger
preferedTaggerModule = uni.MySettings["preferedTaggerModule"]
taggerModule = __import__("Taggers." + preferedTaggerModule, globals(), locals(), ["isAvailable", "Tagger", preferedTaggerModule], 0)
if taggerModule.isAvailable:
loaddedTagger = taggerModule.Tagger()
return loaddedTagger
taggersNames = uni.getTaggersMachineNames()
for tagger in taggersNames:
taggerModule = __import__("Taggers." + tagger, globals(), locals(), ["isAvailable", "Tagger", tagger], 0)
if taggerModule.isAvailable:
uni.setMySetting("preferedTaggerModule", tagger)
loaddedTagger = taggerModule.Tagger()
return loaddedTagger
if _isAlertIfNotExist:
Dialogs.show(translate("Taggers", "You Have Not Any Tagger"),
translate("Taggers", "Not found any tagger in your system. "
"Please install a tagger module. "
"Now supporting only eyeD3 module (python-eyed3)."))
return None
except:
ReportBug.ReportBug()
示例4: refreshTable
def refreshTable(self, _path):
self.values = []
fileAndDirectoryNames = fu.readDirectory(_path, "fileAndDirectory",
uni.getBoolValue("isShowHiddensInFolderTable"))
allItemNumber = len(fileAndDirectoryNames)
uni.startThreadAction()
baseNameOfDirectory = fu.getBaseName(_path)
rowNo = 0
self.setRowCount(allItemNumber)
for baseName in fileAndDirectoryNames:
isContinueThreadAction = uni.isContinueThreadAction()
if isContinueThreadAction:
try:
if fu.isReadableFileOrDir(fu.joinPath(_path, baseName), False, True):
details = fu.getExtendedDetails(fu.joinPath(_path, baseName))
content = {}
content["path"] = fu.joinPath(_path, baseName)
content["baseNameOfDirectory"] = baseNameOfDirectory
content["baseName"] = baseName
content.update(details)
self.values.append(content)
newBaseNameOfDirectory = Organizer.emend(content["baseNameOfDirectory"], "directory")
self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
content["baseNameOfDirectory"])
newBaseName = Organizer.emend(content["baseName"], fu.getObjectType(self.values[rowNo]["path"]))
self.createItem(rowNo, "baseName", newBaseName, content["baseName"])
self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))
self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))
self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))
self.createItem(rowNo, "lastMetadataChanged",
Organizer.getCorrectedTime(content["lastMetadataChanged"]))
if not uni.isWindows:
self.createItem(rowNo, "accessRights", content["accessRights"])
self.createItem(rowNo, "userIDOfOwner", content["userIDOfOwner"])
self.createItem(rowNo, "groupIDOfOwner", content["groupIDOfOwner"])
self.createItem(rowNo, "numberOfHardLinks", content["numberOfHardLinks"])
rowNo += 1
else:
allItemNumber -= 1
except:
ReportBug.ReportBug()
allItemNumber -= 1
else:
allItemNumber = rowNo
Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
if isContinueThreadAction is False:
break
uni.finishThreadAction()
self.setRowCount(len(self.values)) # In case of Non Readable Files and Canceled process
示例5: addImage
def addImage(self):
try:
if self.isActiveAddImage is False:
self.isActiveAddImage = True
self.pbtnAddImage.setText(translate("MusicDetails", "OK"))
self.pbtnSelectImage.show()
self.leImagePath.show()
self.lblImagePath.show()
self.lblImageType.show()
self.cbImageType.show()
self.pbtnCancelAddImage.show()
self.pbtnDeleteImage.hide()
self.pbtnSaveAsImage.hide()
else:
if fu.isFile(self.leImagePath.text()):
imageType = Taggers.getTagger().getImageTypesNo()[self.cbImageType.currentIndex()]
description = str(imageType)
Musics.writeMusicFile(self.musicValues, None, True, imageType, str(self.leImagePath.text()),
description)
self.changeFile(self.musicFile)
self.cancelAddImage()
else:
Dialogs.showError(translate("MusicDetails", "Image Does Not Exist"),
str(translate("MusicDetails", "\"%s\" does not exist.")
) % Organizer.getLink(str(self.leImagePath.text())))
except:
ReportBug.ReportBug()
示例6: writeContents
def writeContents(self):
self.changedValueNumber = 0
changedArtistValues = []
uni.startThreadAction()
allItemNumber = len(self.values)
Dialogs.showState(translate("FileUtils/Musics", "Writing Music Tags"), 0, allItemNumber, True)
for rowNo in range(self.rowCount()):
isContinueThreadAction = uni.isContinueThreadAction()
if isContinueThreadAction:
try:
if self.isRowHidden(rowNo) is False:
if self.isChangeableItem(rowNo, "correctedArtist", str(self.values[rowNo]["currentArtist"])):
changedArtistValues.append({})
changedArtistValues[-1]["id"] = str(self.values[rowNo]["id"])
value = str(self.item(rowNo, 1).text())
changedArtistValues[-1]["name"] = value
Records.add(str(translate("AmarokArtistTable", "Artist")),
str(self.values[rowNo]["currentArtist"]), value)
self.changedValueNumber += 1
except:
ReportBug.ReportBug()
else:
allItemNumber = rowNo + 1
Dialogs.showState(translate("FileUtils/Musics", "Writing Music Tags"), rowNo + 1, allItemNumber, True)
if isContinueThreadAction is False:
break
uni.finishThreadAction()
Operations.changeArtistValues(changedArtistValues)
return True
示例7: getFromAmarok
def getFromAmarok(self):
try:
import Amarok
Dialogs.showState(translate("CoverTable", "Checking For Amarok..."), 0, 1)
if Amarok.checkAmarok():
from Amarok import Operations
directoriesAndValues = Operations.getDirectoriesAndValues()
Dialogs.showState(translate("CoverTable", "Values Are Being Processed"), 1, 1)
if directoriesAndValues is not None:
for rowNo in range(self.rowCount()):
if (getMainWindow().checkHiddenColumn("sourceCover") and
getMainWindow().checkHiddenColumn("destinationCover")):
if self.isChangeableItem(rowNo, "sourceCover"):
directoryPath = fu.joinPath(
fu.getDirName(fu.getDirName(self.values[rowNo]["path"])),
str(self.item(rowNo, 0).text()), str(self.item(rowNo, 1).text()))
if directoryPath in directoriesAndValues:
directoryAndValues = directoriesAndValues[directoryPath]
self.item(rowNo, 3).setText(
directoryAndValues["coverPath"][0].replace(directoryPath, "."))
self.item(rowNo, 4).setText("./" + Organizer.getIconName(
directoryAndValues["artist"][0],
directoryAndValues["album"][0],
directoryAndValues["genre"][0],
directoryAndValues["year"][0]))
except:
ReportBug.ReportBug()
示例8: checkEmbeddedDB
def checkEmbeddedDB():
global isAskEmbeddedDBConfiguration
if uni.getBoolValue("isReadOnlyAmarokDB"):
if (fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") and
fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql") and
fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf")):
return startReadOnlyEmbeddedDB()
else:
if isAskEmbeddedDBConfiguration:
isAskEmbeddedDBConfiguration = False
answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"),
translate("Amarok",
"Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?"))
if answer == Dialogs.Yes:
ReadOnlyEmbeddedDBConfigurator()
else:
return False
else:
if (fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql/db.frm") and
fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")):
return startEmbeddedDB()
else:
if isAskEmbeddedDBConfiguration:
isAskEmbeddedDBConfiguration = False
answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"),
translate("Amarok",
"Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?"))
if answer == Dialogs.Yes:
EmbeddedDBConfigurator()
else:
return False
return checkEmbeddedDB()
示例9: readMusicFile
def readMusicFile(_filePath, _isAlertWhenNotAvailable=True):
_directoryPath = fu.getDirName(_filePath)
isCanNoncompatible = False
if fu.isReadableFileOrDir(_filePath):
tagger = Taggers.getTagger()
try:
tagger.loadFile(_filePath)
except:
Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
str(translate("FileUtils/Musics",
"\"%s\" : this file has the incorrect tag so can't read tags.")
) % Organizer.getLink(_filePath))
if tagger.isAvailableFile() is False:
isCanNoncompatible = True
content = {}
content["path"] = _filePath
content["baseNameOfDirectory"] = fu.getBaseName(_directoryPath)
content["baseName"] = fu.getBaseName(_filePath)
content["artist"] = tagger.getArtist()
content["title"] = tagger.getTitle()
content["album"] = tagger.getAlbum()
content["albumArtist"] = tagger.getAlbumArtist()
content["trackNum"] = tagger.getTrackNum()
content["year"] = tagger.getYear()
content["genre"] = tagger.getGenre()
content["firstComment"] = tagger.getFirstComment()
content["firstLyrics"] = tagger.getFirstLyrics()
content["images"] = tagger.getImages()
if isCanNoncompatible and _isAlertWhenNotAvailable:
Dialogs.show(translate("FileUtils/Musics", "Possible ID3 Mismatch"),
translate("FileUtils/Musics",
"Some of the files presented in the table may not support ID3 technology.<br>Please check the files and make sure they support ID3 information before proceeding."))
return content
示例10: search
def search(self, _searchValue=""):
try:
import re
if self.setSourceToSearch(False):
if self.cckbIsRegExp.checkState() == Mt.Checked:
searchValueList = [str(self.leSearch.text())]
else:
searchValueList = self.getSearchValueList()
if len(searchValueList) != 0:
searchValueListForToolTip = ""
resultOfSearch = ""
arrayOfSource = str(self.sourceToSearch).split("\n\r")
if len(arrayOfSource) == 1: arrayOfSource = str(self.sourceToSearch).split("\n")
if len(arrayOfSource) == 1: arrayOfSource = str(self.sourceToSearch).split("<br>")
if len(arrayOfSource) == 1: arrayOfSource = str(self.sourceToSearch).split("<br/>")
if len(arrayOfSource) == 1: arrayOfSource = str(self.sourceToSearch).split("<br >")
if len(arrayOfSource) == 1: arrayOfSource = str(self.sourceToSearch).split("<br />")
for row in arrayOfSource:
for searchVal in searchValueList:
if self.cckbIsRegExp.checkState() == Mt.Checked:
try:
if self.cckbIsCaseInsensitive.checkState() == Mt.Checked:
pattern = re.compile(uni.trUnicode(searchVal), re.I | re.U)
if re.search(pattern, uni.trUnicode(row)) is not None:
resultOfSearch += row + "\n"
break
else:
pattern = re.compile(uni.trUnicode(searchVal), re.U)
if re.search(pattern, uni.trUnicode(row)) is not None:
resultOfSearch += row + "\n"
break
except:
Dialogs.show(translate("Searcher", "Incorrect Syntax"), translate("Searcher",
"Search value is not correct for Regular Expression (RegExp). Please check it and try again."))
return False
else:
if row.find(searchVal) != -1:
resultOfSearch += row + "\n"
break
if self.cckbIsCaseInsensitive.checkState() == Mt.Checked:
pattern = re.compile(re.escape(uni.trUnicode(searchVal)), re.I | re.U)
if re.search(pattern, uni.trUnicode(row)) is not None:
resultOfSearch += row + "\n"
break
else:
pattern = re.compile(re.escape(uni.trUnicode(searchVal)), re.U)
if re.search(pattern, uni.trUnicode(row)) is not None:
resultOfSearch += row + "\n"
break
for searchVal in searchValueList:
searchValueListForToolTip += "'" + searchVal + "', "
self.lblSearchListValues.setText(str(searchValueListForToolTip[0:-2]))
else:
resultOfSearch = str(self.sourceToSearch)
self.lblSearchListValues.setText(str(""))
self.teSearchResult.setText(str(resultOfSearch))
except:
ReportBug.ReportBug()
示例11: __init__
def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
global currentDialogs
_filePath = fu.checkSource(_filePath, "file")
if _filePath is not None:
if _isOpenDetailsOnNewWindow is False:
isHasOpenedDialog = False
for dialog in currentDialogs:
if dialog.isVisible():
isHasOpenedDialog = True
dialog.changeFile(_filePath)
dialog.activateWindow()
dialog.raise_()
break
if isHasOpenedDialog is False:
_isOpenDetailsOnNewWindow = True
if _isOpenDetailsOnNewWindow:
currentDialogs.append(self)
MDialog.__init__(self, MApplication.activeWindow())
if isActivePyKDE4:
self.setButtons(MDialog.NoDefault)
self.charSet = MComboBox()
self.charSet.addItems(uni.getCharSets())
self.charSet.setCurrentIndex(self.charSet.findText(uni.MySettings["fileSystemEncoding"]))
self.infoLabels = {}
self.infoValues = {}
self.fileValues = {}
pbtnClose = MPushButton(translate("TextDetails", "Close"))
pbtnSave = MPushButton(translate("TextDetails", "Save Changes"))
pbtnSave.setIcon(MIcon("Images:save.png"))
MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
MObject.connect(pbtnSave, SIGNAL("clicked()"), self.save)
self.labels = [translate("TextDetails", "File Path : "),
translate("TextDetails", "Content : ")]
self.pnlMain = MWidget()
self.vblMain = MVBoxLayout(self.pnlMain)
self.pnlClearable = None
self.changeFile(_filePath, True)
HBOXs, VBOXs = [], []
VBOXs.append(MVBoxLayout())
HBOXs.append(MHBoxLayout())
HBOXs[-1].addWidget(self.charSet, 1)
HBOXs[-1].addWidget(pbtnSave, 4)
VBOXs[0].addLayout(HBOXs[-1])
VBOXs[0].addWidget(pbtnClose)
self.vblMain.addLayout(VBOXs[0], 1)
if isActivePyKDE4:
self.setMainWidget(self.pnlMain)
else:
self.setLayout(self.vblMain)
self.show()
self.setMinimumWidth(700)
self.setMinimumHeight(500)
else:
Dialogs.showError(translate("TextDetails", "File Does Not Exist"),
str(translate("TextDetails",
"\"%s\" does not exist.<br>Table will be refreshed automatically!<br>Please retry.")
) % Organizer.getLink(str(_filePath)))
if hasattr(getMainWindow(),
"FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
示例12: showInTable
def showInTable(self):
try:
if uni.tableType in ["0", "1", "2", "3", "4", "9"]:
getMainTable().refresh(self.getCurrentDirectoryPath())
else:
Dialogs.toast(translate("Tables", "Please edit query and click to Apply Query Icon."))
getMainWindow().StatusBar.setTableInfo(uni.getTableTypesNames()[uni.tableType] + str(" : ~ "))
except:
ReportBug.ReportBug()
示例13: whatDoesSpecialCommandDo
def whatDoesSpecialCommandDo(_actionCommand, _isShowAlert=False, _isReturnDetails=False):
splitterIndex = _actionCommand.index("~||~")
leftKeys = _actionCommand[:splitterIndex]
rightKeys = _actionCommand[splitterIndex + 1:]
if len(leftKeys) > 0 and len(rightKeys) > 0:
details = ""
leftNames = ""
rightNames = ""
for objectNameAndPoint in leftKeys:
objectNameAndPointList = objectNameAndPoint.split("~|~")
objectName = objectNameAndPointList[0]
point = ""
if len(objectNameAndPointList) > 1:
point = objectNameAndPointList[1]
if objectName.find("Concatenate") == -1:
leftNames += getMainTable().getColumnNameFromKey(objectName)
else:
leftNames += translate("Organizer", "Concatenate")
if point != "":
if objectName.find("Concatenate") == -1:
leftNames += " " + (str(translate("Organizer", "(can be separated by \"%s\")")) % (point))
else:
leftNames += " " + (str(translate("Organizer", "(can be concatenated by \"%s\")")) % (point))
if leftKeys[-1] != objectNameAndPoint:
leftNames += " ,"
for objectNameAndPoint in rightKeys:
objectNameAndPointList = objectNameAndPoint.split("~|~")
objectName = objectNameAndPointList[0]
point = ""
if len(objectNameAndPointList) > 1:
point = objectNameAndPointList[1]
if objectName.find("Concatenate") == -1:
rightNames += getMainTable().getColumnNameFromKey(objectName)
else:
rightNames += translate("Organizer", "Concatenate")
if point != "":
if objectName.find("Concatenate") == -1:
rightNames += " " + (str(translate("Organizer", "(can be separated by \"%s\")")) % (point))
else:
rightNames += " " + (str(translate("Organizer", "(can be concatenated by \"%s\")")) % (point))
if rightKeys[-1] != objectNameAndPoint:
rightNames += " ,"
details = str(translate("Organizer",
"\"%s\" will be concatenated and/or separated then it will be set as \"%s\" respectively.")) % (
leftNames, rightNames)
if _isShowAlert:
Dialogs.show(translate("Organizer", "What Does This Command Do?"), str(details))
if _isReturnDetails is False:
return True
else:
return details
else:
Dialogs.showError(translate("Organizer", "Missing Command"),
translate("Organizer", "You have to add at least a \"Column\"!.."))
return False
示例14: cellDoubleClickedTable
def cellDoubleClickedTable(self, _row, _column):
try:
if uni.getBoolValue("isRunOnDoubleClick"):
self.showTableDetails(_row, _column)
except:
Dialogs.showError(translate("SubFolderTable", "Cannot Open File"),
str(translate("SubFolderTable",
"\"%s\" : cannot be opened. Please make sure that you selected a text file.")
) % Organizer.getLink(self.values[_row]["path"]))
示例15: generateReadOnlyEmbeddedD
def generateReadOnlyEmbeddedD(_isNoAlertIfSuccessfully=True):
stopReadOnlyEmbeddedDB()
if fu.isExist(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok"):
fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok")
fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/amarok",
fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok")
if _isNoAlertIfSuccessfully is False:
Dialogs.show(translate("EmbeddedDBCore", "Generated Embedded Server"),
translate("EmbeddedDBCore", "Embedded Amarok database server generated."))
return True