def changeFile(self, _filePath, _isNew=False): self.fileValues = fu.readTextFile(_filePath, uni.MySettings["fileSystemEncoding"]) self.setWindowTitle(str(fu.getBaseName(self.fileValues["path"]))) if self.pnlClearable is not None: clearAllChildren(self.pnlClearable, True) self.pnlClearable = MWidget() self.vblMain.insertWidget(0, self.pnlClearable, 20) vblClearable = MVBoxLayout(self.pnlClearable) self.infoLabels["path"] = MLabel(self.labels[0]) self.infoLabels["content"] = MLabel(self.labels[1]) dirPath = fu.getDirName(self.fileValues["path"]) baseName = fu.getBaseName(self.fileValues["path"]) self.infoValues["path"] = MLineEdit(str(fu.joinPath(dirPath, Organizer.emend(baseName, "file")))) self.infoValues["content"] = MPlainTextEdit( str(Organizer.emend(self.fileValues["content"], "text", False, True))) self.infoValues["content"].setLineWrapMode(MPlainTextEdit.NoWrap) self.sourceCharSet = MComboBox() self.sourceCharSet.addItems(uni.getCharSets()) self.sourceCharSet.setCurrentIndex(self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"])) MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"), self.sourceCharSetChanged) HBOXs = [] HBOXs.append(MHBoxLayout()) HBOXs[-1].addWidget(self.infoLabels["path"]) HBOXs[-1].addWidget(self.infoValues["path"]) HBOXs[-1].addWidget(self.sourceCharSet) for hbox in HBOXs: vblClearable.addLayout(hbox) vblClearable.addWidget(self.infoLabels["content"]) vblClearable.addWidget(self.infoValues["content"])
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()
def __init__(self, _parent): MWidget.__init__(self, _parent) self.specialTools = _parent self.cckbCorrectText = MCheckBox( translate("SpecialTools", "Character Encoding")) lblColumns = MLabel(translate("SpecialTools", "Column: ")) lblSourceValues = MLabel(translate("SpecialTools", "Source Values : ")) lblSourceEncoding = MLabel( translate("SpecialTools", "Source Encoding : ")) lblDestinationEncoding = MLabel( translate("SpecialTools", "Destination Encoding : ")) self.columns = MyComboBox() self.cbSourceEncoding = MComboBox() self.cbSourceEncoding.addItems(uni.getCharSets()) self.cbDestinationEncoding = MComboBox() self.cbDestinationEncoding.addItems(uni.getCharSets()) self.cbSourceEncoding.setCurrentIndex( self.cbSourceEncoding.findText( uni.MySettings["fileSystemEncoding"])) self.cbDestinationEncoding.setCurrentIndex( self.cbDestinationEncoding.findText( uni.MySettings["fileSystemEncoding"])) self.cbSourceValues = MComboBox() self.cbSourceValues.addItems([ translate("Options", "Real Values"), translate("Options", "Table Contents") ]) HBoxs = [MHBoxLayout(), MHBoxLayout()] HBoxs[0].addWidget(lblColumns) HBoxs[0].addWidget(self.columns) HBoxs[0].addWidget(lblSourceValues) HBoxs[0].addWidget(self.cbSourceValues) HBoxs[1].addWidget(lblSourceEncoding) HBoxs[1].addWidget(self.cbSourceEncoding) HBoxs[1].addWidget(lblDestinationEncoding) HBoxs[1].addWidget(self.cbDestinationEncoding) vblCharacterEncoding = MVBoxLayout() vblCharacterEncoding.addLayout(HBoxs[0]) vblCharacterEncoding.addLayout(HBoxs[1]) self.setLayout(vblCharacterEncoding) lblColumns.setFixedWidth(60)
def __init__(self, _filePath): MyDialog.__init__(self, MyParent) if MyDialogType == "MDialog": if isActivePyKDE4: self.setButtons(MyDialog.NoDefault) elif MyDialogType == "MMainWindow": self.setObjectName("Cleaner") setMainWindow(self) newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys wOptionsPanel = OptionsForm.OptionsForm(None, "textCorrector", None, newOrChangedKeys) self.setWindowTitle(translate("TextCorrector", "Text Corrector")) self.fileValues = None self.isChangeSourceCharSetChanged = False self.charSet = MComboBox() self.charSet.addItems(uni.getCharSets()) self.charSet.setCurrentIndex(self.charSet.findText(uni.MySettings["fileSystemEncoding"])) self.sourceCharSet = MComboBox() self.sourceCharSet.addItems(uni.getCharSets()) self.sourceCharSet.setCurrentIndex(self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"])) self.pbtnSelectFilePath = MPushButton(translate("TextCorrector", "Browse")) self.connect(self.pbtnSelectFilePath, SIGNAL("clicked()"), self.selectFilePath) pbtnClose = MPushButton(translate("TextCorrector", "Close")) self.pbtnSave = MPushButton(translate("TextCorrector", "Save Changes")) self.pbtnSave.setIcon(MIcon("Images:save.png")) MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close) MObject.connect(self.pbtnSave, SIGNAL("clicked()"), self.save) self.labels = [translate("TextCorrector", "File Path : "), translate("TextCorrector", "Content : ")] pnlMain = MWidget(self) tabwTabs = MTabWidget() pnlMain2 = MWidget(tabwTabs) vblMain2 = MVBoxLayout(pnlMain2) vblMain = MVBoxLayout(pnlMain) self.lblFilePath = MLabel(self.labels[0]) self.lblFileContent = MLabel(self.labels[1]) self.leFilePath = MLineEdit(str(_filePath)) self.pteFileContent = MPlainTextEdit(str("")) self.pteFileContent.setLineWrapMode(MPlainTextEdit.NoWrap) self.fillValues() MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"), self.sourceCharSetChanged) self.isChangeSourceCharSetChanged = True hbFilePath = MHBoxLayout() hbFilePath.addWidget(self.lblFilePath) hbFilePath.addWidget(self.leFilePath) hbFilePath.addWidget(self.pbtnSelectFilePath) hbFilePath.addWidget(self.sourceCharSet) vblMain2.addLayout(hbFilePath) vblMain2.addWidget(self.lblFileContent) vblMain2.addWidget(self.pteFileContent) hbControls = MHBoxLayout() hbControls.addWidget(self.charSet, 1) hbControls.addWidget(self.pbtnSave, 4) hbControls.addWidget(pbtnClose, 1) vblMain2.addLayout(hbControls, 1) self.leFilePath.setEnabled(False) tabwTabs.addTab(pnlMain2, translate("Searcher", "Search")) tabwTabs.addTab(wOptionsPanel, translate("Searcher", "Quick Options")) vblMain.addWidget(tabwTabs) if MyDialogType == "MDialog": if isActivePyKDE4: self.setMainWidget(pnlMain) else: self.setLayout(vblMain) elif MyDialogType == "MMainWindow": self.setCentralWidget(pnlMain) moveToCenter(self) self.show() self.setMinimumWidth(700) self.setMinimumHeight(500)
def getValueTypesAndValues(): return { "lastDirectory": "str", "isMainWindowMaximized": "bool", "isShowAdvancedSelections": "bool", "isRunOnDoubleClick": "bool", "isChangeSelected": "bool", "isChangeAll": "bool", "isOpenDetailsInNewWindow": "bool", "hiddenFolderTableColumns": "list", "hiddenFileTableColumns": "list", "hiddenMusicTableColumns": "list", "hiddenSubFolderTableColumns": "list", "hiddenCoverTableColumns": "list", "hiddenAmarokMusicTableColumns": "list", "hiddenAmarokCoverTableColumns": "list", "hiddenAmarokArtistTableColumns": "list", "hiddenAmarokCopyTableColumns": "list", "hiddenSubFolderMusicTableColumns": "list", "isPlayNow": "bool", "MainWindowGeometries": ["intStaticListLen", 4], "tableType": ["options", uni.getTableTypesNames().keys()], "activeTabNoOfSpecialTools": ["int", list(range(0, 7))], "unneededFiles": "list", "ignoredFiles": "list", "imageExtensions": "list", "musicExtensions": "list", "priorityIconNames": "list", "unneededFileExtensions": "list", "ignoredFileExtensions": "list", "fileReNamerType": ["options", uni.fileReNamerTypeNamesKeys], "validSentenceStructure": ["options", uni.validSentenceStructureKeys], "mplayerPath": "str", "mplayerArgs": "str", "mplayerAudioDevicePointer": "str", "mplayerAudioDevice": ["options", uni.mplayerSoundDevices], "isSaveActions": "bool", "fileSystemEncoding": ["options", uni.getCharSets()], "applicationStyle": ["options", uni.getStyles()], "playerName": ["options", uni.getAvailablePlayers()], "isMinimumWindowMode": "bool", "packagerUnneededFileExtensions": "list", "packagerUnneededFiles": "list", "packagerUnneededDirectories": "list", "lastUpdateControlDate": "date", "updateInterval": ["int", list(range(0, 32))], "isCloseOnCleanAndPackage": "bool", "TableToolsBarButtonStyle": ["int", list(range(0, 4))], "ToolsBarButtonStyle": ["int", list(range(0, 4))], "PlayerBarButtonStyle": ["int", list(range(0, 4))], "language": ["options", uni.getInstalledLanguagesCodes()], "isShowQuickMakeWindow": "bool", "isChangeExistIcon": "bool", "isClearFirstAndLastSpaceChars": "bool", "isEmendIncorrectChars": "bool", "validSentenceStructureForFile": ["options", uni.validSentenceStructureKeys], "validSentenceStructureForDirectory": ["options", uni.validSentenceStructureKeys], "validSentenceStructureForFileExtension": ["options", uni.validSentenceStructureKeys], "isCorrectFileNameWithSearchAndReplaceTable": "bool", "isCorrectValueWithSearchAndReplaceTable": "bool", "isCorrectDoubleSpaceChars": "bool", "fileExtensionIs": ["options", uni.fileExtensionIsKeys], "settingsVersion": ["options", [uni.settingVersion]], "subDirectoryDeep": ["int", list(range(-1, 10))], "maxRecordFileSize": "int", "themeName": ["options", uni.getInstalledThemes()], "unneededDirectories": "list", "ignoredDirectories": "list", "unneededDirectoriesIfIsEmpty": "list", "isClearEmptyDirectoriesWhenPath": "bool", "isAutoCleanSubFolderWhenPath": "bool", "cleanerUnneededFileExtensions": "list", "cleanerUnneededFiles": "list", "cleanerUnneededDirectories": "list", "isClearEmptyDirectoriesWhenClear": "bool", "isAutoCleanSubFolderWhenClear": "bool", "isClearEmptyDirectoriesWhenSave": "bool", "isClearEmptyDirectoriesWhenMoveOrChange": "bool", "isClearEmptyDirectoriesWhenCopyOrChange": "bool", "isClearEmptyDirectoriesWhenFileMove": "bool", "isAutoCleanSubFolderWhenSave": "bool", "isAutoCleanSubFolderWhenMoveOrChange": "bool", "isAutoCleanSubFolderWhenCopyOrChange": "bool", "isAutoCleanSubFolderWhenFileMove": "bool", "isAutoMakeIconToDirectoryWhenSave": "bool", "isAutoMakeIconToDirectoryWhenMoveOrChange": "bool", "isAutoMakeIconToDirectoryWhenCopyOrChange": "bool", "isAutoMakeIconToDirectoryWhenFileMove": "bool", "isDeleteEmptyDirectories": "bool", "isCleanerDeleteEmptyDirectories": "bool", "isPackagerDeleteEmptyDirectories": "bool", "remindMeLaterForUpdate": ["int", list(range(-1, 7))], "remindMeLaterShowDateForUpdate": "date", "isShowTransactionDetails": "bool", "isInstalledKDE4Language": "bool", "isMakeAutoDesign": "bool", "isShowReconfigureWizard": "bool", "isAskIfHasManyImagesInAlbumDirectory": "bool", "isDeleteOtherImages": "bool", "CoversSubDirectoryDeep": ["int", [x for x in range(-1, 10) if x != 0]], "amarokDBHost": "str", "amarokDBPort": "int", "amarokDBUser": "******", "amarokDBPass": "******", "amarokDBDB": "str", "amarokIsUseHost": "bool", "iconNameFormat": "str", "iconFileType": ["options", ["png", "jpg"]], "pathOfMysqldSafe": "str", "isActiveCompleter": "bool", "isShowAllForCompleter": "bool", "isActiveClearGeneral": "bool", "colorSchemes": "Default", "isActiveAutoMakeIconToDirectory": "bool", "isDontDeleteFileAndDirectory": "bool", "pathOfDeletedFilesAndDirectories": "str", "isReadOnlyAmarokDB": "bool", "isReadOnlyAmarokDBHost": "bool", "isResizeTableColumnsToContents": "bool", "AmarokFilterAmarokCoverTable": "str", "AmarokFilterAmarokCopyTable": "str", "AmarokFilterArtistTable": "str", "AmarokFilterAmarokMusicTable": "str", "isAppendFileSizeToFileTree": "bool", "isAppendLastModifiedToFileTree": "bool", "isMusicTableValuesChangeInAmarokDB": "bool", "isSubFolderTableValuesChangeInAmarokDB": "bool", "isFileTableValuesChangeInAmarokDB": "bool", "isFolderTableValuesChangeInAmarokDB": "bool", "isSubFolderMusicTableValuesChangeInAmarokDB": "bool", "isShowHiddensInSubFolderTable": "bool", "isShowHiddensInFolderTable": "bool", "isShowHiddensInFileTable": "bool", "isShowHiddensInMusicTable": "bool", "isShowHiddensInCoverTable": "bool", "isShowHiddensInSubFolderMusicTable": "bool", "isShowHiddensInFileTree": "bool", "isDecodeURLStrings": "bool", "isCheckUnSavedValues": "bool", "isAutoSaveScripts": "bool", "maxDeletedDirectorySize": "int", "preferedTaggerModule": ["options", uni.getTaggersMachineNames()] }
def __init__(self, _filePath): MyDialog.__init__(self, MyParent) if MyDialogType == "MDialog": if isActivePyKDE4: self.setButtons(MyDialog.NoDefault) elif MyDialogType == "MMainWindow": self.setObjectName("Cleaner") setMainWindow(self) newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys wOptionsPanel = OptionsForm.OptionsForm(None, "textCorrector", None, newOrChangedKeys) self.setWindowTitle(translate("TextCorrector", "Text Corrector")) self.fileValues = None self.isChangeSourceCharSetChanged = False self.charSet = MComboBox() self.charSet.addItems(uni.getCharSets()) self.charSet.setCurrentIndex( self.charSet.findText(uni.MySettings["fileSystemEncoding"])) self.sourceCharSet = MComboBox() self.sourceCharSet.addItems(uni.getCharSets()) self.sourceCharSet.setCurrentIndex( self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"])) self.pbtnSelectFilePath = MPushButton( translate("TextCorrector", "Browse")) self.connect(self.pbtnSelectFilePath, SIGNAL("clicked()"), self.selectFilePath) pbtnClose = MPushButton(translate("TextCorrector", "Close")) self.pbtnSave = MPushButton(translate("TextCorrector", "Save Changes")) self.pbtnSave.setIcon(MIcon("Images:save.png")) MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close) MObject.connect(self.pbtnSave, SIGNAL("clicked()"), self.save) self.labels = [ translate("TextCorrector", "File Path : "), translate("TextCorrector", "Content : ") ] pnlMain = MWidget(self) tabwTabs = MTabWidget() pnlMain2 = MWidget(tabwTabs) vblMain2 = MVBoxLayout(pnlMain2) vblMain = MVBoxLayout(pnlMain) self.lblFilePath = MLabel(self.labels[0]) self.lblFileContent = MLabel(self.labels[1]) self.leFilePath = MLineEdit(str(_filePath)) self.pteFileContent = MPlainTextEdit(str("")) self.pteFileContent.setLineWrapMode(MPlainTextEdit.NoWrap) self.fillValues() MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"), self.sourceCharSetChanged) self.isChangeSourceCharSetChanged = True hbFilePath = MHBoxLayout() hbFilePath.addWidget(self.lblFilePath) hbFilePath.addWidget(self.leFilePath) hbFilePath.addWidget(self.pbtnSelectFilePath) hbFilePath.addWidget(self.sourceCharSet) vblMain2.addLayout(hbFilePath) vblMain2.addWidget(self.lblFileContent) vblMain2.addWidget(self.pteFileContent) hbControls = MHBoxLayout() hbControls.addWidget(self.charSet, 1) hbControls.addWidget(self.pbtnSave, 4) hbControls.addWidget(pbtnClose, 1) vblMain2.addLayout(hbControls, 1) self.leFilePath.setEnabled(False) tabwTabs.addTab(pnlMain2, translate("Searcher", "Search")) tabwTabs.addTab(wOptionsPanel, translate("Searcher", "Quick Options")) vblMain.addWidget(tabwTabs) if MyDialogType == "MDialog": if isActivePyKDE4: self.setMainWidget(pnlMain) else: self.setLayout(vblMain) elif MyDialogType == "MMainWindow": self.setCentralWidget(pnlMain) moveToCenter(self) self.show() self.setMinimumWidth(700) self.setMinimumHeight(500)