def pack(self): try: _path = self.checkSource(str(QuickMakeParameters[1]), "directory", False) if _path is not None: from Tools import Packager self.newDialog = Packager.Packager(_path) except: ReportBug.ReportBug()
def contextMenuEvent(self, _event): try: currentItem = self.currentItem() if currentItem is not None: self.mContextMenu.setGeometry(_event.globalX(), _event.globalY(), 1, 1) selectedItem = self.mContextMenu.exec_() if selectedItem is not None: selectedKey = selectedItem.objectName() if ((selectedKey in [ self.mContextMenuActionNames[0], self.mContextMenuActionNames[2], self.mContextMenuActionNames[3] ]) and self.checkReadOnlyColumn(currentItem.columnKey) is False): return False if selectedKey == self.mContextMenuActionNames[0]: self.createHistoryPoint() MApplication.clipboard().setText(currentItem.text()) currentItem.setText("") elif selectedKey == self.mContextMenuActionNames[1]: MApplication.clipboard().setText(currentItem.text()) elif selectedKey == self.mContextMenuActionNames[2]: self.createHistoryPoint() currentItem.setText(MApplication.clipboard().text()) elif selectedKey == self.mContextMenuActionNames[3]: self.editItem(currentItem) elif selectedKey == self.mContextMenuActionNames[4]: self.createHistoryPoint() for rowNo in self.getSelectedRows(): self.hideRow(rowNo) elif selectedKey == "Open Details": self.showDetails() elif selectedKey == self.mContextMenuOpenWithNames[0]: from Core import Execute Execute.openWith([ fu.getRealDirName( self.values[currentItem.row()]["path"]) ]) elif selectedKey == self.mContextMenuOpenWithNames[1]: from Core import Execute Execute.openWith( [self.values[currentItem.row()]["path"]]) elif uni.isWindows is False and selectedKey == self.mContextMenuOpenWithNames[ 2]: from Core import Execute Execute.execute([ "konsole", "--workdir", fu.getRealDirName( self.values[currentItem.row()]["path"]) ]) except: ReportBug.ReportBug()
def search(self): try: _path = self.checkSource(str(QuickMakeParameters[1]), "fileAndDirectory", False) if _path is not None: from Tools import Searcher searchList = [_path] + QuickMakeParameters[2] self.newDialog = Searcher.Searcher(searchList) except: ReportBug.ReportBug()
def copyPath(self): try: _path = self.checkSource(str(QuickMakeParameters[1]), "fileAndDirectory", False) if _path is not None: MApplication.clipboard().setText(str(_path)) Dialogs.show(translate("QuickMake", "Copied To Clipboard"), str(translate("QuickMake", "\"%s\" copied to clipboard.")) % Organizer.getLink(_path)) self.close() except: ReportBug.ReportBug()
def goBack(self): try: self.future.append(self.currentDirectory) self.currentDirectory = self.history.pop() self.goTo(self.currentDirectory, False) self.actForward.setEnabled(True) if len(self.history) == 0: self.actBack.setEnabled(False) except: ReportBug.ReportBug()
def selectDestinationDir(self): try: destinationDirPath = Dialogs.getExistingDirectory( translate("AmarokCopyTable", "Please Select Destination Directory"), self.leDestinationDirPath.text(), 0) if destinationDirPath is not None: self.leDestinationDirPath.setText(str(destinationDirPath)) except: ReportBug.ReportBug()
def makeRefresh(self): try: self.clear() for fav in BookmarksOfDirectories.fetchAll(): self.addAction(str(fav[1])).setObjectName(str(fav[1])) self.addAction( translate("BookmarksMenu", "Edit Bookmarks")).setObjectName("Edit Bookmarks") except: ReportBug.ReportBug()
def deleteBookmark(self): try: if self.cbBookmarks.currentIndex() != -1: info = BookmarksOfDirectories.fetchAll()[ self.cbBookmarks.currentIndex()] BookmarksOfDirectories.delete(str(info[0])) self.makeRefresh() getMainWindow().FileManager.bookmarksMenu.makeRefresh() except: ReportBug.ReportBug()
def refreshScriptList(self): try: self.scriptList = Scripts.getScriptList() self.lwScriptList.refresh(self.scriptList) scriptFileName = None if len(self.scriptList) > 0: scriptFileName = self.scriptList[self.lwScriptList.currentRow()] self.currentScriptFileName = scriptFileName except: ReportBug.ReportBug()
def delete(self): try: answer = Dialogs.ask(translate("ScriptManager", "Your Script Will Be Deleted!.."), translate("ScriptManager", "Your script will be deleted. Are you sure you want to delete current script?")) if answer == Dialogs.Yes: fu.removeFile(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName)) self.refreshScriptList() except: ReportBug.ReportBug()
def selectPackagePath(self): try: self.teHashDigest.setText("") PathOfPackage = Dialogs.getOpenFileName( translate("Hasher", "Please Select The Pack To Be Created"), self.lePathOfPackage.text(), translate("Hasher", "All Files (*.*)")) if PathOfPackage is not None: self.lePathOfPackage.setText(str(PathOfPackage)) except: ReportBug.ReportBug()
def selectImage(self): try: imagePath = Dialogs.getOpenFileName( translate("MusicDetails", "Choose Image"), fu.getDirName(self.musicValues["path"]), str(translate("MusicDetails", "Images")) + " " + uni.imageExtStringOnlyPNGAndJPG, 0) if imagePath is not None: self.leImagePath.setText(imagePath) except: ReportBug.ReportBug()
def selectProjectPath(self): try: ProjectPath = Dialogs.getExistingDirectory(translate("Cleaner", "Please Select Directory"), self.lePathOfProject.text(), 0) if ProjectPath is not None: self.lePathOfProject.setText(str(ProjectPath)) except: ReportBug.ReportBug()
def getFromRecordList(self, _index=None): try: if self.cbRecordsList.currentIndex() == 0: self.setRecordsFile() else: recordFilePath = self.recordsList[ self.cbRecordsList.currentIndex()] self.setRecordsFile( fu.joinPath(fu.oldRecordsDirectoryPath, recordFilePath)) except: ReportBug.ReportBug()
def saveBookmark(self): try: info = BookmarksOfDirectories.fetchAll()[ self.cbBookmarks.currentIndex()] BookmarksOfDirectories.update(info[0], str(self.cbBookmarks.currentText()), str(self.pathOfBookmark.text())) self.makeRefresh() getMainWindow().FileManager.bookmarksMenu.makeRefresh() except: ReportBug.ReportBug()
def deleteImage(self): try: if self.lstwImages.currentRow() != -1: description = self.musicValues["images"][ self.lstwImages.currentRow()][4] Musics.writeMusicFile( self.musicValues, None, True, self.musicValues["images"][ self.lstwImages.currentRow()][0], False, description) self.changeFile(self.musicFile) except: ReportBug.ReportBug()
def setMyCurrentIndexByTree(self, _index): try: while 1 == 1: selected = str(self.getPathOfIndexByTree(_index)) if fu.isDir(selected) or fu.isFile(selected): self.makeRefreshOnlyFileListByTree(_index) break else: _index = _index.parent() self.goTo(self.getPathOfIndexByTree(_index)) except: ReportBug.ReportBug()
def goForward(self): try: self.history.append(self.currentDirectory) try: self.currentDirectory = self.future.pop() except: pass self.goTo(self.currentDirectory, False) if len(self.future) == 0: self.actForward.setEnabled(False) except: ReportBug.ReportBug()
def checkIcon(self): try: _path = self.checkSource(str(QuickMakeParameters[1]), "directory") if _path is not None: fu.checkIcon(_path) Dialogs.show(translate("QuickMake", "Directory Icon Checked"), str(translate("QuickMake", "\"%s\"`s icon checked.<br>The default action based on the data is executed.")) % Organizer.getLink( _path)) self.close() except: ReportBug.ReportBug()
def subDirectoryDeepChanged(self, _action=None): try: selectedDeep = str(self.SubDirectoryDeeps[_action]) if self.checkUnSavedValues(): uni.setMySetting("subDirectoryDeep", int(selectedDeep)) self.refreshForColumns() getMainWindow().SpecialTools.refreshForColumns() self.refresh(getMainWindow().FileManager.getCurrentDirectoryPath()) self.cbSubDirectoryDeep.setCurrentIndex( self.cbSubDirectoryDeep.findText(str(uni.MySettings["subDirectoryDeep"]))) except: ReportBug.ReportBug()
def clearIgnoreds(self): try: _path = self.checkSource(str(QuickMakeParameters[1]), "directory") if _path is not None: fu.clearIgnoreds(_path) Dialogs.show(translate("QuickMake", "Directory Cleaned"), str(translate("QuickMake", "\"%s\" is cleaned based on the criteria you set.")) % Organizer.getLink( _path)) self.close() except: ReportBug.ReportBug()
def showDetails(self): try: rowNo = self.currentRow() if rowNo != -1: self.showTableDetails(rowNo, self.currentColumn()) else: Dialogs.toast( translate("Tables", "Please Select A Row"), translate("Tables", "Please select a row to show details.")) except: ReportBug.ReportBug()
def changeTableType(_action): try: selectedType = Tables.Tables.getThisTableType(_action.objectName()) if _action.isChecked() and uni.tableType != selectedType: isChanged = changeTableTypeByType(selectedType) if isChanged is False: _action.setChecked(False) return False else: _action.setChecked(True) except: ReportBug.ReportBug()
def finishSearch(self, _isContinue): try: if _isContinue: self.prgbState.setVisible(False) self.prgbStateLabel.setVisible(False) self.showInList() self.pbtnCancel.setVisible(False) self.pbtnClose.setVisible(True) self.pbtnApply.setVisible(True) self.setMinimumSize(670, self.heightValue + 50) self.saPanel.setFixedSize(645, self.heightValue) except: ReportBug.ReportBug()
def searchAfter(self, _searchValue=""): try: if self.cckbIsRegExp.checkState() != Mt.Checked: if self.tmrSearchAfter is not None: self.tmrSearchAfter.stop() self.tmrSearchAfter.deleteLater() self.tmrSearchAfter = MTimer(self) self.tmrSearchAfter.setSingleShot(True) self.connect(self.tmrSearchAfter, SIGNAL("timeout()"), self.search) self.tmrSearchAfter.start(500) except: ReportBug.ReportBug()
def selectSearchDirectoryPath(self): try: lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1] SearchPath = Dialogs.getExistingDirectory( translate("Searcher", "Please Select Directory To Search"), lastPath) if SearchPath is not None: self.lePathToSeach.setText(str(SearchPath)) if self.setSourceToSearch(True, True): self.search() except: ReportBug.ReportBug()
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()
def save(self): try: from Core import Records Records.setTitle(uni.getTableTypesNames()[uni.tableType]) fu.activateSmartCheckIcon() fu.activateSmartCheckEmptyDirectories() from Core import MyThread myProcs = MyThread.MyThread(self.saveTable, self.continueSave) myProcs.run() except: ReportBug.ReportBug()
def getTaggerNames(): try: allTaggerMachineNames = uni.getTaggersMachineNames() names, taggerMachineNames = [], [] for tagger in allTaggerMachineNames: taggerModule = __import__("Taggers." + tagger, globals(), locals(), ["isAvailable", "Tagger"], 0) if taggerModule.isAvailable: names.append(taggerModule.Tagger().pluginName) taggerMachineNames.append(tagger) return taggerMachineNames, names except: ReportBug.ReportBug() return [], []
def cbTaggerChanged(self, _action=None): try: tagger = self.cbTagger.currentData() if self.checkUnSavedValues(): uni.setMySetting("preferedTaggerModule", tagger) t = Taggers.getTagger(True, True) self.refreshForColumns() getMainWindow().SpecialTools.refreshForColumns() self.refresh(getMainWindow().FileManager.getCurrentDirectoryPath()) self.cbTagger.setCurrentIndex( self.cbTagger.findText(Taggers.getTaggerName(uni.MySettings["preferedTaggerModule"]))) except: ReportBug.ReportBug()