Exemplo n.º 1
0
def checkAmarok(_isAlertIfNotAvailable=True, _isUseReadOnly=True):
    global isAskEmbeddedDBConfiguration
    if isLoadedMysql and uni.isAvailableKDE4():
        if uni.getBoolValue("amarokIsUseHost"):
            if _isUseReadOnly or uni.getBoolValue(
                    "isReadOnlyAmarokDBHost") is False:
                return True
            else:
                if _isAlertIfNotAvailable:
                    answer = Dialogs.ask(
                        translate("Amarok", "This Feature Is Not Usable"),
                        translate(
                            "Amarok",
                            "This feature is not usable with read only Amarok database. <br>Are you want to give permission to read and write for Amarok database?"
                        ))
                    if answer == Dialogs.Yes:
                        uni.setMySetting("isReadOnlyAmarokDBHost", False)
                        return True
        else:
            isAskEmbeddedDBConfiguration = True
            return checkEmbeddedDB()
    else:
        if _isAlertIfNotAvailable:
            Dialogs.showError(
                translate("Amarok", "Amarok Module Is Not Usable"),
                translate("Amarok", "Please run Amarok once."))
        return False
    return False
Exemplo n.º 2
0
 def isChangeableItem(self,
                      _rowNo,
                      _columnKey,
                      _checkLikeThis=None,
                      isCanBeEmpty=True,
                      _isCheckLike=True):
     columnNo = self.getColumnNoFromKey(_columnKey)
     item = self.item(_rowNo, columnNo)
     if item is not None:
         if item.isReadOnly is False:
             if (self.isColumnHidden(columnNo) is not True and
                 (item.isSelected() == uni.getBoolValue("isChangeSelected")
                  or uni.getBoolValue("isChangeAll"))):
                 if _isCheckLike and _checkLikeThis is not None:
                     if str(_checkLikeThis) != str(item.text()):
                         if isCanBeEmpty is False:
                             if str(item.text()).strip() != "":
                                 return True
                             return False
                         else:
                             return True
                     return False
                 else:
                     if isCanBeEmpty is False:
                         if str(item.text()).strip() != "":
                             return True
                         return False
                     else:
                         return True
     return False
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
def connectAndGetDB():
    global dbConnection
    if dbConnection is None:
        if uni.getBoolValue("amarokIsUseHost"):
            dbConnection = mdb.connect(host=uni.MySettings["amarokDBHost"],
                                       port=int(
                                           uni.MySettings["amarokDBPort"]),
                                       user=uni.MySettings["amarokDBUser"],
                                       passwd=uni.MySettings["amarokDBPass"],
                                       db=uni.MySettings["amarokDBDB"])
            dbConnection.set_character_set('utf8')
            dbConnection.query('SET NAMES utf8;')
            dbConnection.query('SET CHARACTER SET utf8;')
            dbConnection.query('SET character_set_connection=utf8;')
        else:
            if uni.getBoolValue("isReadOnlyAmarokDB"):
                dbConnection = mdb.connect(
                    read_default_file=fu.pathOfSettingsDirectory +
                    "/Amarok/my.cnf",
                    read_default_group="client",
                    db="amarok")
            else:
                dbConnection = mdb.connect(
                    read_default_file=uni.getKDE4HomePath() +
                    "/share/apps/amarok/mysqle/my.cnf",
                    read_default_group="client",
                    db="amarok")
    return dbConnection
Exemplo n.º 5
0
 def fillSelectionInfo(self):
     if uni.getBoolValue("isChangeAll"):
         self.setSelectionInfo(translate("Tables", "All informations will be changed"))
     else:
         if uni.getBoolValue("isChangeSelected"):
             self.setSelectionInfo(translate("Tables", "Just selected informations will be changed"))
         else:
             self.setSelectionInfo(translate("Tables", "Just unselected informations will be changed"))
Exemplo n.º 6
0
 def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
     try:
         if uni.getBoolValue("isForceOpenWithDefaultApplication"):
             _path = fu.checkSource(_filePath)
             Execute.openWith([_path])
         else:
             _path = fu.checkSource(_filePath, "file", False)
             if _path is not None:
                 isOpened = False
                 mtype = fu.getMimeType(_path)
                 if mtype[0] is not None:
                     if mtype[0].split("/")[0] == "text":
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif mtype[0].split("/")[0] == "audio":
                         if Taggers.getTagger(True) is not None:
                             MusicDetails.MusicDetails(_path, _isOpenDetailsOnNewWindow)
                             isOpened = True
                     elif mtype[0].split("/")[0] == "image":
                         ImageDetails.ImageDetails(_path, "file", _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 else:
                     if fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 if isOpened is False:
                     if uni.getBoolValue("isOpenWithDefaultApplication"):
                         Execute.openWith([_path])
                     else:
                         Dialogs.showError(translate("Details", "File Is Not Supported"),
                                           str(translate("Details",
                                                         "\"%s\" couldn't opened. This file is not supported.")) % Organizer.getLink(
                                               str(_path)))
             elif fu.isDir(_filePath):
                 if uni.getBoolValue("isOpenWithDefaultApplication"):
                     Execute.openWith([_filePath])
                 else:
                     Dialogs.showError(translate("Details", "Directories Is Not Supported"),
                                       str(translate("Details",
                                                     "\"%s\" couldn't opened. Directories is not supported to show details.")) % Organizer.getLink(
                                           str(_filePath)))
             else:
                 Dialogs.showError(translate("Details", "File Is Not Exist"),
                                   str(translate("Details",
                                                 "\"%s\" couldn't opened. This file is not exist.")) % Organizer.getLink(
                                       str(_filePath)))
     except:
         answer = Dialogs.askSpecial(translate("Details", "File Couldn't Opened"),
                                     str(translate("Details",
                                                   "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us.")) % Organizer.getLink(
                                         str(_filePath)),
                                     translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None)
         if answer == translate("QuickMake", "Report This Bug"):
             ReportBug.ReportBug()
Exemplo n.º 7
0
def setTitle(_title):
    global isSetTitle, recordContents
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue("isSaveActions"):
        recordContents += str(_title) + "\n"
    if uni.loggingLevel == logging.DEBUG:
        print (_title)
    isSetTitle = True
Exemplo n.º 8
0
def add(_action, _previous="", _now=None):
    global recordContents
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue(
            "isSaveActions"):
        if recordType == 0 or (recordType == 1
                               and uni.loggingLevel == logging.DEBUG):
            if _now is not None:
                recordContents += str(_action + " ::::::: '") + str(
                    _previous) + "' >>>>>>>> '" + str(
                        _now) + "' <<<<<<< " + str(
                            time.strftime("%d.%m.%Y %H:%M:%S")) + "\n"
            else:
                recordContents += str(
                    _action + " ::::::: '") + str(_previous) + "' " + str(
                        time.strftime("%d.%m.%Y %H:%M:%S")) + "\n"
    if uni.loggingLevel == logging.DEBUG:
        if _now is not None:
            print(
                str(_action + " ::::::: '") + str(_previous) + "' >>>>>>>> '" +
                str(_now) + "' <<<<<<< " +
                str(time.strftime("%d.%m.%Y %H:%M:%S")) + "\n")
        else:
            print(
                str(_action + " ::::::: '") + str(_previous) + "' " +
                str(time.strftime("%d.%m.%Y %H:%M:%S")) + "\n")
Exemplo n.º 9
0
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()
Exemplo n.º 10
0
 def showTableDetails(self, _fileNo, _infoNo):
     directoryPathOfCover = self.values[_fileNo]["path"]
     coverValues = [directoryPathOfCover,
                    fu.getRealPath(str(self.item(_fileNo, 2).text()), directoryPathOfCover),
                    fu.getRealPath(str(self.item(_fileNo, 3).text()), directoryPathOfCover),
                    fu.getRealPath(str(self.item(_fileNo, 4).text()), directoryPathOfCover)]
     CoverDetails.CoverDetails(coverValues, uni.getBoolValue("isOpenDetailsInNewWindow"), _infoNo)
Exemplo n.º 11
0
 def createActions(self):
     for x, keyValue in enumerate(self.keysOfSettings):
         if keyValue not in self.hiddenKeys:
             if self.typesOfValues[x][0] == "options":
                 actionLabelList = self.valuesOfOptions[self.typesOfValues[x][1]]
                 selectedIndex = self.valuesOfOptionsKeys[self.typesOfValues[x][1]].index(uni.MySettings[keyValue])
                 self.values.append(MMenu(self.labels[x], self))
                 actgActionGroupTableTypes = MActionGroup(self.values[-1])
                 for y, actionLabel in enumerate(actionLabelList):
                     actAction = actgActionGroupTableTypes.addAction(actionLabel)
                     actAction.setCheckable(True)
                     actAction.setObjectName(str(self.keysOfSettings[x] + ";" + str(y)))
                     if selectedIndex == y:
                         actAction.setChecked(True)
                 self.values[-1].addActions(actgActionGroupTableTypes.actions())
                 self.addAction(self.values[-1].menuAction())
                 MObject.connect(actgActionGroupTableTypes, SIGNAL("selected(QAction *)"), self.valueChanged)
             elif self.typesOfValues[x] == "Yes/No":
                 self.values.append(MAction(self.labels[x], self))
                 self.values[-1].setCheckable(True)
                 self.values[-1].setChecked(uni.getBoolValue(keyValue))
                 self.addAction(self.values[-1])
                 MObject.connect(self.values[-1], SIGNAL("changed()"), self.valueChanged)
             self.values[-1].setObjectName(self.keysOfSettings[x])
             self.values[-1].setToolTip(self.toolTips[x])
             self.values[-1].setStatusTip(self.toolTips[x])
     else:
             self.values.append(None)
Exemplo n.º 12
0
    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
Exemplo n.º 13
0
 def checkUnSavedValues(self, _isForceToCheck=False):
     if uni.getBoolValue("isCheckUnSavedValues") or _isForceToCheck:
         isClose = True
         for rowNo in range(self.rowCount()):
             if isClose is False:
                 break
             if self.isRowHidden(rowNo):
                 isClose = False
                 break
             for columnNo in range(len(self.tableColumns)):
                 if self.isColumnHidden(columnNo) is False:
                     if self.item(rowNo, columnNo) is not None:
                         if self.item(rowNo,
                                      columnNo).background() == MBrush(
                                          MColor(142, 199, 255)):
                             isClose = False
                             break
                     else:
                         break
         if isClose is False:
             answer = Dialogs.ask(
                 translate("Tables", "There Are Unsaved Values"),
                 translate(
                     "Tables",
                     "Do you want to save these values?<br>If you click to Yes : Table will be saved without any other question or option.<br>If you click to No : Application will be closed without doing any process.<br>If you click to Cancel : Application won't be closed."
                 ), True)
             if answer == Dialogs.Yes:
                 self.save()
             elif answer == Dialogs.Cancel:
                 return False
     return True
Exemplo n.º 14
0
    def continueSave(self, _returned=None):
        try:
            if _returned:
                from Core import Records

                if uni.tableType in ["0", "1", "2", "3", "4", "9"]:
                    if uni.getBoolValue("isClearEmptyDirectoriesWhenSave"):
                        fu.checkEmptyDirectories(
                            self.currentDirectoryPath, True, True,
                            uni.getBoolValue("isAutoCleanSubFolderWhenSave"))
                fu.completeSmartCheckEmptyDirectories(True, True)
                isDirStillExist = fu.isDir(self.currentDirectoryPath)
                if uni.tableType in ["0", "1", "2", "3", "9"]:
                    if (uni.isActiveDirectoryCover and
                            uni.getBoolValue("isActiveAutoMakeIconToDirectory")
                            and uni.getBoolValue(
                                "isAutoMakeIconToDirectoryWhenSave")):
                        if isDirStillExist:
                            fu.checkIcon(self.currentDirectoryPath)
                        if self.currentDirectoryPath != self.newDirectoryPath:
                            fu.checkIcon(self.newDirectoryPath)
                fu.completeSmartCheckIcon()
                Records.saveAllRecords()
                if self.changedValueNumber == 0:
                    Dialogs.show(
                        translate("Tables", "Did Not Change Any Things"),
                        translate(
                            "Tables",
                            "Did not change any things in this table.Please check the criteria you select."
                        ))
                else:
                    if uni.getBoolValue("isShowTransactionDetails"):
                        Dialogs.show(
                            translate("Tables", "Transaction Details"),
                            str(translate("Tables", "%s value(s) changed.")) %
                            self.changedValueNumber)
                if not isDirStillExist and self.currentDirectoryPath == self.newDirectoryPath:
                    getMainWindow().FileManager.goUp()
                elif not isDirStillExist and self.currentDirectoryPath != self.newDirectoryPath:
                    getMainWindow().FileManager.makeRefresh(
                        self.newDirectoryPath)
                else:
                    getMainWindow().FileManager.makeRefresh("")
                    if uni.tableType in ["5", "6", "7", "8"]:
                        self.refresh(self.newDirectoryPath)
        except:
            ReportBug.ReportBug()
Exemplo n.º 15
0
def setTitle(_title):
    global isSetTitle, recordContents
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue(
            "isSaveActions"):
        recordContents += str(_title) + "\n"
    if uni.loggingLevel == logging.DEBUG:
        print(_title)
    isSetTitle = True
Exemplo n.º 16
0
 def reFillCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         self.specialActions.reFillCompleters()
         self.searchAndReplace.reFillCompleters()
         self.fill.reFillCompleters()
         self.clear.reFillCompleters()
         self.characterState.reFillCompleters()
         self.characterEncoding.reFillCompleters()
         self.quickFill.reFillCompleters()
Exemplo n.º 17
0
 def reFillCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         self.specialActions.reFillCompleters()
         self.searchAndReplace.reFillCompleters()
         self.fill.reFillCompleters()
         self.clear.reFillCompleters()
         self.characterState.reFillCompleters()
         self.characterEncoding.reFillCompleters()
         self.quickFill.reFillCompleters()
Exemplo n.º 18
0
 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"]))
Exemplo n.º 19
0
    def doBeforeCloseProcesses(self):
        from Core import UpdateControl

        if uni.getBoolValue("isDontDeleteFileAndDirectory"):
            fu.checkSizeOfDeletedFiles()
        if UpdateControl.UpdateControl.isMakeUpdateControl():
            UpdateControl.UpdateControl(self, _isCloseParent=True)
            return False
        return True
Exemplo n.º 20
0
def connectAndGetDB():
    global dbConnection
    if dbConnection is None:
        if uni.getBoolValue("amarokIsUseHost"):
            dbConnection = mdb.connect(host=uni.MySettings["amarokDBHost"], port=int(uni.MySettings["amarokDBPort"]),
                                       user=uni.MySettings["amarokDBUser"], passwd=uni.MySettings["amarokDBPass"],
                                       db=uni.MySettings["amarokDBDB"])
            dbConnection.set_character_set('utf8')
            dbConnection.query('SET NAMES utf8;')
            dbConnection.query('SET CHARACTER SET utf8;')
            dbConnection.query('SET character_set_connection=utf8;')
        else:
            if uni.getBoolValue("isReadOnlyAmarokDB"):
                dbConnection = mdb.connect(read_default_file=fu.pathOfSettingsDirectory + "/Amarok/my.cnf",
                                           read_default_group="client", db="amarok")
            else:
                dbConnection = mdb.connect(read_default_file=uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf",
                                           read_default_group="client", db="amarok")
    return dbConnection
Exemplo n.º 21
0
def saveAllRecords():
    global recordContents, isSetTitle
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue("isSaveActions"):
        if fu.isFile(fu.recordFilePath) is False:
            create()
        setRecordType(1)
        fu.addToFile(fu.recordFilePath, recordContents)
        restoreRecordType()
    recordContents = ""
    isSetTitle = False
Exemplo n.º 22
0
 def continueRefresh(self, _returned=None):
     for rowNo in range(self.rowCount()):
         if self.isRowHidden(rowNo):
             self.showRow(rowNo)
     self.refreshShowedAndHiddenColumns()
     if uni.getBoolValue("isResizeTableColumnsToContents"):
         self.resizeColumnsToContents()
     getMainWindow().StatusBar.setTableInfo(
         uni.getTableTypesNames()[uni.tableType] + str(" : ") +
         str(str(self.rowCount())))
Exemplo n.º 23
0
def saveAllRecords():
    global recordContents, isSetTitle
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue(
            "isSaveActions"):
        if fu.isFile(fu.recordFilePath) is False:
            create()
        setRecordType(1)
        fu.addToFile(fu.recordFilePath, recordContents)
        restoreRecordType()
    recordContents = ""
    isSetTitle = False
Exemplo n.º 24
0
 def checkEnableStates(self):
     if uni.getBoolValue("isActiveClearGeneral"):
         actED = self.getActionByKey("isClearEmptyDirectoriesWhenSave")
         if actED is not None:
             actED.setEnabled(True)
         if uni.getBoolValue("isClearEmptyDirectoriesWhenSave"):
             actSF = self.getActionByKey("isAutoCleanSubFolderWhenSave")
             if actSF is not None:
                 actSF.setEnabled(True)
         else:
             actSF = self.getActionByKey("isAutoCleanSubFolderWhenSave")
             if actSF is not None:
                 actSF.setEnabled(False)
     else:
         actED = self.getActionByKey("isClearEmptyDirectoriesWhenSave")
         if actED is not None:
             actED.setEnabled(False)
         actSF = self.getActionByKey("isAutoCleanSubFolderWhenSave")
         if actSF is not None:
             actSF.setEnabled(False)
Exemplo n.º 25
0
 def fillSelectionInfo(self):
     try:
         if uni.getBoolValue("isChangeAll"):
             self.pbtnSave.setText(translate("Tables", "Write To Disc"))
             self.pbtnSave.setToolTip(
                 translate("Tables", "All informations will be changed"))
         else:
             self.pbtnSave.setText(
                 str(" ! " + translate("Tables", "Write To Disc") + " ! "))
             if uni.getBoolValue("isChangeSelected"):
                 self.pbtnSave.setToolTip(
                     translate(
                         "Tables",
                         "Just selected informations will be changed"))
             else:
                 self.pbtnSave.setToolTip(
                     translate(
                         "Tables",
                         "Just unselected informations will be changed"))
     except:
         ReportBug.ReportBug()
Exemplo n.º 26
0
def setCompleter(_object, _objectName=None):
    from Core import Universals as uni

    if uni.getBoolValue("isShowAllForCompleter"):
        _objectName = "%*%"
    from Databases import CompleterTable

    if _objectName is None:
        _objectName = _object.objectName()
    _objectName = str(_objectName)
    cmpCompleter = MCompleter(CompleterTable.fetchAllByObjectName(_objectName))
    cmpCompleter.setCaseSensitivity(Mt.CaseInsensitive)
    _object.setCompleter(cmpCompleter)
Exemplo n.º 27
0
 def __init__(self, _parent, _text, _defaultState=0, _settingKey=None, _stateChanged=None):
     MCheckBox.__init__(self, _text, _parent)
     self.settingKey = _settingKey
     self.stateChanged = _stateChanged
     if _settingKey is not None:
         if uni.getBoolValue(_settingKey, _defaultState):
             self.setCheckState(Mt.Checked)
         else:
             self.setCheckState(Mt.Unchecked)
     else:
         self.setCheckState(_defaultState)
     if _stateChanged is not None or _settingKey is not None:
         MObject.connect(self, SIGNAL("stateChanged(int)"), self.cckbMStateChanged)
Exemplo n.º 28
0
 def checkEnableStates(self):
     if uni.getBoolValue("isForceOpenWithDefaultApplication"):
         actED = self.getActionByKey("isOpenDetailsInNewWindow")
         if actED is not None:
             actED.setEnabled(False)
         actED = self.getActionByKey("isOpenWithDefaultApplication")
         if actED is not None:
             actED.setEnabled(False)
     else:
         actED = self.getActionByKey("isOpenDetailsInNewWindow")
         if actED is not None:
             actED.setEnabled(True)
         actED = self.getActionByKey("isOpenWithDefaultApplication")
         if actED is not None:
             actED.setEnabled(True)
     if uni.getBoolValue("isChangeAll"):
         actED = self.getActionByKey("isChangeSelected")
         if actED is not None:
             actED.setEnabled(False)
     else:
         actED = self.getActionByKey("isChangeSelected")
         if actED is not None:
             actED.setEnabled(True)
Exemplo n.º 29
0
 def showTableDetails(self, _fileNo, _infoNo):
     directoryPathOfCover = self.values[_fileNo]["path"]
     coverValues = [
         directoryPathOfCover,
         fu.getRealPath(str(self.item(_fileNo, 2).text()),
                        directoryPathOfCover),
         fu.getRealPath(str(self.item(_fileNo, 3).text()),
                        directoryPathOfCover),
         fu.getRealPath(str(self.item(_fileNo, 4).text()),
                        directoryPathOfCover)
     ]
     CoverDetails.CoverDetails(coverValues,
                               uni.getBoolValue("isOpenDetailsInNewWindow"),
                               _infoNo)
Exemplo n.º 30
0
def checkAmarok(_isAlertIfNotAvailable=True, _isUseReadOnly=True):
    global isAskEmbeddedDBConfiguration
    if isLoadedMysql and uni.isAvailableKDE4():
        if uni.getBoolValue("amarokIsUseHost"):
            if _isUseReadOnly or uni.getBoolValue("isReadOnlyAmarokDBHost") is False:
                return True
            else:
                if _isAlertIfNotAvailable:
                    answer = Dialogs.ask(translate("Amarok", "This Feature Is Not Usable"),
                                         translate("Amarok",
                                                   "This feature is not usable with read only Amarok database. <br>Are you want to give permission to read and write for Amarok database?"))
                    if answer == Dialogs.Yes:
                        uni.setMySetting("isReadOnlyAmarokDBHost", False)
                        return True
        else:
            isAskEmbeddedDBConfiguration = True
            return checkEmbeddedDB()
    else:
        if _isAlertIfNotAvailable:
            Dialogs.showError(translate("Amarok", "Amarok Module Is Not Usable"),
                              translate("Amarok", "Please run Amarok once."))
        return False
    return False
Exemplo n.º 31
0
 def checkEnableStates(self):
     if uni.getBoolValue("isForceOpenWithDefaultApplication"):
         actED = self.getActionByKey("isOpenDetailsInNewWindow")
         if actED is not None:
             actED.setEnabled(False)
         actED = self.getActionByKey("isOpenWithDefaultApplication")
         if actED is not None:
             actED.setEnabled(False)
     else:
         actED = self.getActionByKey("isOpenDetailsInNewWindow")
         if actED is not None:
             actED.setEnabled(True)
         actED = self.getActionByKey("isOpenWithDefaultApplication")
         if actED is not None:
             actED.setEnabled(True)
     if uni.getBoolValue("isChangeAll"):
         actED = self.getActionByKey("isChangeSelected")
         if actED is not None:
             actED.setEnabled(False)
     else:
         actED = self.getActionByKey("isChangeSelected")
         if actED is not None:
             actED.setEnabled(True)
Exemplo n.º 32
0
    def doAfterRunProcessesStep1(self):
        if str(fu.defaultFileSystemEncoding) != str(uni.MySettings["fileSystemEncoding"]):
            answer = Dialogs.ask(
                translate("HamsiManager", "Your System's \"File System Encoding\" Type Different"),
                translate("HamsiManager",
                          "Your system's \"File System Encoding\" type different from the settings you select. Are you sure you want to continue?If you are not sure press the \"No\"."),
                False, "Your System's \"File System Encoding\" Type Different")
            if answer == Dialogs.No:
                OptionsForm.OptionsForm(self, _focusTo="fileSystemEncoding")
        if uni.getBoolValue("isMakeAutoDesign"):
            self.TableToolsBar.setVisible(False)
            self.ToolsBar.setVisible(False)
            if isActivePyKDE4:
                self.Browser.setVisible(False)
                self.TreeBrowser.setVisible(False)
                self.FileManager.urlNavigator.setMinimumWidth(150)
                self.FileManager.tbarBrowserToolsFull.setVisible(False)
                self.tabifyDockWidget(self.Browser, self.Places)
                self.tabifyDockWidget(self.Browser, self.TreeBrowser)
                self.tabifyDockWidget(self.Browser, self.DirOperator)
            geometries = uni.getListValue("MainWindowGeometries")
            self.setGeometry(int(geometries[0]), int(geometries[1]), 900, 600)
            uni.setMySetting("isMakeAutoDesign", "False")
        if uni.isShowVerifySettings and (uni.changedDefaultValuesKeys != [] or uni.newSettingsKeys != []):
            answer = Dialogs.ask(translate("HamsiManager", "Added New Options And New Features"),
                                 translate("HamsiManager",
                                           "New options and new features added to Hamsi Manager. Are you want to change or verify new options?"),
                                 False, "Added New Options And New Features")
            if answer == Dialogs.Yes:
                newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
                OptionsForm.OptionsForm(self, "Normal", None, newOrChangedKeys)
        elif uni.getBoolValue("isShowReconfigureWizard") and uni.isBuilt() is False:
            from Tools import Configurator

            Configurator.Configurator()
            uni.setMySetting("isShowReconfigureWizard", "False")
Exemplo n.º 33
0
def add(_action, _previous="", _now=None):
    global recordContents
    if "isSaveActions" not in uni.MySettings.keys() or uni.getBoolValue("isSaveActions"):
        if recordType == 0 or (recordType == 1 and uni.loggingLevel == logging.DEBUG):
            if _now is not None:
                recordContents += str(_action + " ::::::: '") + str(_previous) + "' >>>>>>>> '" + str(
                    _now) + "' <<<<<<< " + str(time.strftime("%d.%m.%Y %H:%M:%S")) + "\n"
            else:
                recordContents += str(_action + " ::::::: '") + str(_previous) + "' " + str(
                    time.strftime("%d.%m.%Y %H:%M:%S")) + "\n"
    if uni.loggingLevel == logging.DEBUG:
        if _now is not None:
            print (str(_action + " ::::::: '") + str(_previous) + "' >>>>>>>> '" + str(_now) + "' <<<<<<< " + str(
                time.strftime("%d.%m.%Y %H:%M:%S")) + "\n")
        else:
            print (str(_action + " ::::::: '") + str(_previous) + "' " + str(time.strftime("%d.%m.%Y %H:%M:%S")) + "\n")
Exemplo n.º 34
0
 def emendDirectory(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))
             oldFileName = _path
             newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
             if newDirName != oldFileName:
                 Dialogs.show(translate("QuickMake", "Directory 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()
Exemplo n.º 35
0
    def goTo(self, _path, _isRemember=True, _isOnlyBrowser=False):
        try:
            _path = fu.checkSource(str(_path))
            if _path is not None:
                if fu.isReadableFileOrDir(_path):
                    if fu.isDir(_path):
                        if _isRemember:
                            self.future = []
                            self.history.append(self.currentDirectory)
                        if len(_path) > 1 and _path[-1] == fu.sep:
                            _path = _path[:-1]
                        self.currentDirectory = str(_path)
                        if isActivePyKDE4:
                            self.dirLister.openUrl(MUrl(self.currentDirectory))
                            self.trvFileManager.setCurrentIndex(
                                self.dirModelForTree.index(_path))
                            self.isGoToFromUrlNavigator = False
                            self.urlNavigator.setUrl(
                                MUrl(self.currentDirectory))
                            self.isGoToFromUrlNavigator = True
                            self.isGoToFromDirOperator = False
                            self.dirOperator.setUrl(
                                MUrl(self.currentDirectory), False)
                            self.isGoToFromDirOperator = True
                        else:
                            self.lstvFileManager.setRootIndex(
                                self.dirModel.index(_path))
                            self.trvFileManager.setCurrentIndex(
                                self.dirModelForTree.index(_path))
                        self.actForward.setEnabled(False)
                        if _isOnlyBrowser is False:
                            self.showInTable()
                        self.actBack.setEnabled(True)
                        if str(self.currentDirectory) == fu.sep:
                            self.actUp.setEnabled(False)
                        else:
                            self.actUp.setEnabled(True)
                    elif fu.isFile(_path):
                        from Details import Details

                        Details(str(_path),
                                uni.getBoolValue("isOpenDetailsInNewWindow"))
        except:
            ReportBug.ReportBug()
Exemplo n.º 36
0
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()
Exemplo n.º 37
0
    def goTo(self, _path, _isRemember=True, _isOnlyBrowser=False):
        try:
            _path = fu.checkSource(str(_path))
            if _path is not None:
                if fu.isReadableFileOrDir(_path):
                    if fu.isDir(_path):
                        if _isRemember:
                            self.future = []
                            self.history.append(self.currentDirectory)
                        if len(_path) > 1 and _path[-1] == fu.sep:
                            _path = _path[:-1]
                        self.currentDirectory = str(_path)
                        if isActivePyKDE4:
                            self.dirLister.openUrl(MUrl(self.currentDirectory))
                            self.trvFileManager.setCurrentIndex(self.dirModelForTree.index(_path))
                            self.isGoToFromUrlNavigator = False
                            self.urlNavigator.setUrl(MUrl(self.currentDirectory))
                            self.isGoToFromUrlNavigator = True
                            self.isGoToFromDirOperator = False
                            self.dirOperator.setUrl(MUrl(self.currentDirectory), False)
                            self.isGoToFromDirOperator = True
                        else:
                            self.lstvFileManager.setRootIndex(self.dirModel.index(_path))
                            self.trvFileManager.setCurrentIndex(self.dirModelForTree.index(_path))
                        self.actForward.setEnabled(False)
                        if _isOnlyBrowser is False:
                            self.showInTable()
                        self.actBack.setEnabled(True)
                        if str(self.currentDirectory) == fu.sep:
                            self.actUp.setEnabled(False)
                        else:
                            self.actUp.setEnabled(True)
                    elif fu.isFile(_path):
                        from Details import Details

                        Details(str(_path), uni.getBoolValue("isOpenDetailsInNewWindow"))
        except:
            ReportBug.ReportBug()
Exemplo n.º 38
0
 def createActions(self):
     for x, keyValue in enumerate(self.keysOfSettings):
         if keyValue not in self.hiddenKeys:
             if self.typesOfValues[x][0] == "options":
                 actionLabelList = self.valuesOfOptions[
                     self.typesOfValues[x][1]]
                 selectedIndex = self.valuesOfOptionsKeys[
                     self.typesOfValues[x][1]].index(
                         uni.MySettings[keyValue])
                 self.values.append(MMenu(self.labels[x], self))
                 actgActionGroupTableTypes = MActionGroup(self.values[-1])
                 for y, actionLabel in enumerate(actionLabelList):
                     actAction = actgActionGroupTableTypes.addAction(
                         actionLabel)
                     actAction.setCheckable(True)
                     actAction.setObjectName(
                         str(self.keysOfSettings[x] + ";" + str(y)))
                     if selectedIndex == y:
                         actAction.setChecked(True)
                 self.values[-1].addActions(
                     actgActionGroupTableTypes.actions())
                 self.addAction(self.values[-1].menuAction())
                 MObject.connect(actgActionGroupTableTypes,
                                 SIGNAL("selected(QAction *)"),
                                 self.valueChanged)
             elif self.typesOfValues[x] == "Yes/No":
                 self.values.append(MAction(self.labels[x], self))
                 self.values[-1].setCheckable(True)
                 self.values[-1].setChecked(uni.getBoolValue(keyValue))
                 self.addAction(self.values[-1])
                 MObject.connect(self.values[-1], SIGNAL("changed()"),
                                 self.valueChanged)
             self.values[-1].setObjectName(self.keysOfSettings[x])
             self.values[-1].setToolTip(self.toolTips[x])
             self.values[-1].setStatusTip(self.toolTips[x])
     else:
         self.values.append(None)
Exemplo n.º 39
0
 def showTableDetails(self, _fileNo, _infoNo):
     Details(self.values[_fileNo]["path"], uni.getBoolValue("isOpenDetailsInNewWindow"))
Exemplo n.º 40
0
    def writeContents(self):
        self.changedValueNumber = 0
        oldAndNewPathValues = []
        if uni.isActiveAmarok and uni.getBoolValue("isSubFolderTableValuesChangeInAmarokDB"):
            import Amarok

            if Amarok.checkAmarok(True, False) is False:
                return False
        uni.startThreadAction()
        allItemNumber = len(self.values)
        Dialogs.showState(translate("FileUtils/SubFolders", "Writing File Informations"), 0, allItemNumber, True)
        for rowNo in range(self.rowCount()):
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isWritableFileOrDir(self.values[rowNo]["path"], False, True):
                        if self.isRowHidden(rowNo):
                            fu.removeFileOrDir(self.values[rowNo]["path"])
                            self.changedValueNumber += 1
                        else:
                            baseNameOfDirectory = str(self.values[rowNo]["baseNameOfDirectory"])
                            baseName = str(self.values[rowNo]["baseName"])
                            if self.isChangeableItem(rowNo, "baseNameOfDirectory", baseNameOfDirectory):
                                baseNameOfDirectory = str(self.item(rowNo, 0).text())
                                self.changedValueNumber += 1
                                newDirectoryPath = fu.joinPath(
                                    fu.getDirName(fu.getDirName(self.values[rowNo]["path"])),
                                    baseNameOfDirectory)
                                self.setNewDirectory(newDirectoryPath)
                            if self.isChangeableItem(rowNo, "baseName", baseName, False):
                                baseName = str(self.item(rowNo, 1).text())
                                self.changedValueNumber += 1
                            newFilePath = fu.joinPath(str(self.values[rowNo]["path"]).replace(
                                fu.joinPath(str(self.values[rowNo]["baseNameOfDirectory"]),
                                            str(self.values[rowNo]["baseName"])), ""),
                                                      baseNameOfDirectory, baseName)
                            oldFilePath = fu.getRealPath(self.values[rowNo]["path"])
                            newFilePath = fu.getRealPath(newFilePath)
                            if oldFilePath != newFilePath:
                                oldAndNewPaths = {}
                                oldAndNewPaths["oldPath"] = oldFilePath
                                oldAndNewPaths["newPath"] = fu.moveOrChange(oldFilePath, newFilePath, "file")
                                if oldFilePath != oldAndNewPaths["newPath"]:
                                    oldAndNewPathValues.append(oldAndNewPaths)
                                    oldDirName = fu.getDirName(oldFilePath)
                                    if uni.getBoolValue("isClearEmptyDirectoriesWhenFileMove"):
                                        fu.checkEmptyDirectories(oldDirName, True, True,
                                                                 uni.getBoolValue("isAutoCleanSubFolderWhenFileMove"))
                                    if (uni.isActiveDirectoryCover and
                                            uni.getBoolValue("isActiveAutoMakeIconToDirectory") and
                                            uni.getBoolValue("isAutoMakeIconToDirectoryWhenFileMove")):
                                        fu.checkIcon(oldDirName)
                                        fu.checkIcon(fu.getDirName(oldAndNewPaths["newPath"]))
                except:
                    ReportBug.ReportBug()
            else:
                allItemNumber = rowNo + 1
            Dialogs.showState(translate("FileUtils/SubFolders", "Writing File Informations"), rowNo + 1, allItemNumber,
                              True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        if (uni.isActiveAmarok and
                uni.getBoolValue("isSubFolderTableValuesChangeInAmarokDB") and
                len(oldAndNewPathValues) > 0):
            import Amarok
            from Amarok import Operations

            Operations.changePaths(oldAndNewPathValues, "file")
        return True
Exemplo n.º 41
0
 def reFillCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         setCompleter(self.leFill, self.lblFill.text())
Exemplo n.º 42
0
 def checkCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         CompleterTable.insert(self.lblFill.text(), self.leFill.text())
Exemplo n.º 43
0
 def __init__(self, _parent):
     MWidget.__init__(self, _parent)
     self.tbAddToBefore = MToolButton(self)
     self.btChange = MToolButton(self)
     self.tbAddToAfter = MToolButton(self)
     self.isShowAdvancedSelections = uni.getBoolValue("isShowAdvancedSelections")
     self.tabwTabs = MTabWidget(self)
     self.specialActions = SpecialActions.SpecialActions(self)
     self.searchAndReplace = SearchAndReplace.SearchAndReplace(self)
     self.fill = Fill.Fill(self)
     self.clear = Clear.Clear(self)
     self.characterState = CharacterState.CharacterState(self)
     self.characterEncoding = CharacterEncoding.CharacterEncoding(self)
     self.quickFill = QuickFill.QuickFill(self)
     self.pbtnAdvancedSelections = MPushButton("Simple")
     self.pbtnApply = MPushButton(translate("SpecialTools", "Apply"))
     self.pbtnApply.setIcon(MIcon("Images:apply.png"))
     self.pbtnApply.setObjectName("pbtnApply")
     self.pbtnApply.setMinimumHeight(35)
     self.tbAddToBefore.setToolTip(translate("SpecialTools", "Add In Front"))
     self.btChange.setToolTip(translate("SpecialTools", "Change"))
     self.tbAddToAfter.setToolTip(translate("SpecialTools", "Append"))
     self.tbAddToBefore.setIcon(MIcon("Images:addToBefore.png"))
     self.btChange.setIcon(MIcon("Images:change.png"))
     self.tbAddToAfter.setIcon(MIcon("Images:addToAfter.png"))
     self.tbAddToBefore.setAutoRaise(True)
     self.btChange.setAutoRaise(True)
     self.tbAddToAfter.setAutoRaise(True)
     self.tbAddToBefore.setCheckable(True)
     self.btChange.setCheckable(True)
     self.tbAddToAfter.setCheckable(True)
     self.btChange.setChecked(True)
     MObject.connect(self.tbAddToBefore, SIGNAL("clicked()"), self.changeTypeChanged)
     MObject.connect(self.btChange, SIGNAL("clicked()"), self.changeTypeChanged)
     MObject.connect(self.tbAddToAfter, SIGNAL("clicked()"), self.changeTypeChanged)
     self.tabwTabs.addTab(self.specialActions, translate("SpecialTools", "Special Actions"))
     self.tabwTabs.addTab(self.searchAndReplace, translate("SpecialTools", "Search - Replace"))
     self.tabwTabs.addTab(self.fill, translate("SpecialTools", "Fill"))
     self.tabwTabs.addTab(self.clear, translate("SpecialTools", "Clear"))
     self.tabwTabs.addTab(self.characterState, translate("SpecialTools", "Character State"))
     self.tabwTabs.addTab(self.characterEncoding, translate("SpecialTools", "Character Encoding"))
     self.tabwTabs.addTab(self.quickFill, translate("SpecialTools", "Quick Fill"))
     HBox0 = MHBoxLayout()
     HBox0.addWidget(self.tbAddToBefore)
     HBox0.addWidget(self.btChange)
     HBox0.addWidget(self.tbAddToAfter)
     lblX = MLabel(translate("SpecialTools", "X : "))
     lblY = MLabel(translate("SpecialTools", "Y : "))
     self.cbInformationSection = MComboBox()
     self.cbInformationSection.addItems([translate("SpecialTools", "All"),
                                         translate("SpecialTools", "Before X"),
                                         translate("SpecialTools", "After X"),
                                         translate("SpecialTools", "From Last, Before X"),
                                         translate("SpecialTools", "From Last After X"),
                                         translate("SpecialTools", "Between X And Y"),
                                         translate("SpecialTools", "Not Between X And Y")])
     self.cbInformationSectionX = MSpinBox()
     self.cbInformationSectionX.setRange(1, 100)
     self.cbInformationSectionX.setValue(3)
     self.cbInformationSectionY = MSpinBox()
     self.cbInformationSectionY.setRange(1, 100)
     self.cbInformationSectionY.setValue(5)
     self.pnlAdvancedSelections = MWidget()
     VBox = MVBoxLayout()
     self.pnlAdvancedSelections.setLayout(VBox)
     VBox1 = MVBoxLayout()
     VBox1.addWidget(self.pbtnAdvancedSelections)
     VBox.addWidget(self.cbInformationSection)
     HBoxs1 = MHBoxLayout()
     HBoxs1.addWidget(lblX)
     HBoxs1.addWidget(self.cbInformationSectionX)
     HBoxs1.addWidget(lblY)
     HBoxs1.addWidget(self.cbInformationSectionY)
     VBox.addLayout(HBoxs1)
     VBox.addLayout(HBox0)
     VBox1.addWidget(self.pnlAdvancedSelections)
     VBox1.addWidget(self.pbtnApply)
     HBox = MHBoxLayout()
     HBox.addWidget(self.tabwTabs)
     HBox.addLayout(VBox1)
     self.setLayout(HBox)
     _parent.dckSpecialTools = MDockWidget(translate("SpecialTools", "Special Tools"))
     _parent.dckSpecialTools.setObjectName("Special Tools")
     _parent.dckSpecialTools.setWidget(self)
     _parent.dckSpecialTools.setAllowedAreas(Mt.AllDockWidgetAreas)
     _parent.dckSpecialTools.setFeatures(MDockWidget.AllDockWidgetFeatures)
     _parent.addDockWidget(Mt.BottomDockWidgetArea, _parent.dckSpecialTools)
     self.cbInformationSectionX.setEnabled(False)
     self.cbInformationSectionY.setEnabled(False)
     self.cbInformationSection.setFixedWidth(175)
     self.tabwTabs.setCurrentIndex(int(uni.MySettings["activeTabNoOfSpecialTools"]))
     self.tabChanged(int(uni.MySettings["activeTabNoOfSpecialTools"]))
     MObject.connect(self.pbtnApply, SIGNAL("clicked()"), self.apply)
     MObject.connect(self.pbtnAdvancedSelections, SIGNAL("clicked()"), self.showOrHideAdvancedSelections)
     MObject.connect(self.tabwTabs, SIGNAL("currentChanged(int)"), self.tabChanged)
     MObject.connect(self.cbInformationSection, SIGNAL("currentIndexChanged(int)"), self.InformationSectionChanged)
     self.refreshForColumns()
     self.reFillCompleters()
Exemplo n.º 44
0
    def writeContents(self):
        self.changedValueNumber = 0
        oldAndNewPathValues = []
        startRowNo, rowStep = 0, 1
        uni.startThreadAction()
        allItemNumber = len(self.values)
        Dialogs.showState(translate("FileUtils/Covers", "Writing Cover Informations"), 0, allItemNumber, True)
        for rowNo in range(startRowNo, self.rowCount(), rowStep):
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isWritableFileOrDir(self.values[rowNo]["path"], False, True):
                        if self.isRowHidden(rowNo):
                            fu.removeFileOrDir(self.values[rowNo]["path"])
                            self.changedValueNumber += 1
                        else:
                            pathOfParentDirectory = str(
                                self.values[rowNo]["pathOfParentDirectory"])
                            baseName = str(self.values[rowNo]["baseName"])
                            if self.isChangeableItem(rowNo, "sourceCover") or self.isChangeableItem(rowNo, "destinationCover"):
                                sourcePath = self.values[rowNo]["sourceCover"]
                                destinationPath = self.values[rowNo]["destinationCover"]
                                if self.isChangeableItem(rowNo, "sourceCover"):
                                    sourcePath = str(self.item(rowNo, 3).text()).strip()
                                if self.isChangeableItem(rowNo, "destinationCover"):
                                    destinationPath = str(self.item(rowNo, 4).text()).strip()
                                if (str(self.item(rowNo,
                                                  2).text()) != sourcePath or sourcePath != destinationPath or str(
                                    self.item(rowNo, 2).text()) != destinationPath) or (
                                            str(self.item(rowNo, 2).text()) !=
                                            self.values[rowNo]["currentCover"] and (
                                                str(self.item(rowNo, 2).text()) != sourcePath and str(
                                            self.item(rowNo, 2).text()) != destinationPath)):
                                    if str(self.item(rowNo, 3).text()).strip() != "":
                                        sourcePath = fu.getRealPath(sourcePath,
                                                                    self.values[rowNo]["path"])
                                        sourcePath = fu.checkSource(sourcePath, "file")
                                        if sourcePath is not None:
                                            if destinationPath != "":
                                                destinationPath = fu.getRealPath(destinationPath,
                                                                                 self.values[
                                                                                     rowNo]["path"])
                                                if sourcePath != destinationPath:
                                                    destinationPath = fu.moveOrChange(sourcePath, destinationPath)
                                            else:
                                                destinationPath = sourcePath
                                            fu.setIconToDirectory(self.values[rowNo]["path"],
                                                                  destinationPath)
                                            self.changedValueNumber += 1
                                    else:
                                        fu.setIconToDirectory(self.values[rowNo]["path"], "")
                                        self.changedValueNumber += 1
                            if self.isChangeableItem(rowNo, "baseNameOfDirectory", pathOfParentDirectory):
                                pathOfParentDirectory = str(self.item(rowNo, 0).text())
                                self.changedValueNumber += 1
                            if self.isChangeableItem(rowNo, "baseName", baseName, False):
                                baseName = str(self.item(rowNo, 1).text())
                                self.changedValueNumber += 1
                            newFilePath = fu.joinPath(pathOfParentDirectory, baseName)
                            oldFilePath = fu.getRealPath(self.values[rowNo]["path"])
                            newFilePath = fu.getRealPath(newFilePath)
                            if oldFilePath != newFilePath:
                                oldAndNewPaths = {}
                                oldAndNewPaths["oldPath"] = oldFilePath
                                oldAndNewPaths["newPath"] = fu.moveOrChange(oldFilePath, newFilePath, "directory")
                                if oldFilePath != oldAndNewPaths["newPath"]:
                                    oldAndNewPathValues.append(oldAndNewPaths)
                                    oldDirName = fu.getDirName(oldFilePath)
                                    if uni.getBoolValue("isClearEmptyDirectoriesWhenFileMove"):
                                        fu.checkEmptyDirectories(oldDirName, True, True,
                                                                 uni.getBoolValue("isAutoCleanSubFolderWhenFileMove"))
                except:
                    ReportBug.ReportBug()
            else:
                allItemNumber = rowNo + 1
            Dialogs.showState(translate("FileUtils/Covers", "Writing Cover Informations"), rowNo + 1, allItemNumber,
                              True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        if len(oldAndNewPathValues) > 0:
            from Amarok import Operations

            Operations.changePaths(oldAndNewPathValues)
        return True
Exemplo n.º 45
0
 def checkCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         CompleterTable.insert(self.lblClear.text(), self.leClear.text())
Exemplo n.º 46
0
    def refreshTable(self, _path):
        self.values = []
        allFilesAndDirectories = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                          int(uni.MySettings["subDirectoryDeep"]),
                                                                          "file", uni.getBoolValue(
                "isShowHiddensInSubFolderTable"))
        allItemNumber = len(allFilesAndDirectories)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for baseName in allFilesAndDirectories:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(baseName, False, True):
                        details = fu.getExtendedDetails(fu.joinPath(_path, baseName))
                        content = {}
                        content["path"] = baseName
                        content["baseNameOfDirectory"] = str(
                            str(fu.getBaseName(_path)) + str(fu.getDirName(baseName)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(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"], "file")
                        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
Exemplo n.º 47
0
 def reFillCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         setCompleter(self.leReplace, self.lblReplace.text())
         setCompleter(self.leSearch, self.lblSearch.text())
Exemplo n.º 48
0
 def checkCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         CompleterTable.insert(self.lblSearch.text(), self.leSearch.text())
         CompleterTable.insert(self.lblReplace.text(), self.leReplace.text())
Exemplo n.º 49
0
 def reFillCompleters(self):
     if uni.getBoolValue("isActiveCompleter"):
         setCompleter(self.leClear, self.lblClear.text())
Exemplo n.º 50
0
    def closeEvent(self, _event):
        try:
            if uni.isRaisedAnError is False:
                if uni.isContinueThreadAction():
                    uni.cancelThreadAction()
                    _event.ignore()
            uni.isStartedCloseProcess = True
            uni.printForDevelopers("Started closeEvent")
            MApplication.setQuitOnLastWindowClosed(True)
            try:
                self.PlayerBar.MusicPlayer.stop()
            except:
                pass
            Details.closeAllDialogs()
            uni.printForDevelopers("Closed Dialogs")
            if uni.isRaisedAnError is False:
                if self.Table.checkUnSavedValues() is False:
                    uni.isStartedCloseProcess = False
                    uni.printForDevelopers("Close ignored")
                    _event.ignore()
            uni.printForDevelopers("Before self.doBeforeCloseProcesses")
            if self.doBeforeCloseProcesses() is False:
                _event.ignore()
                return None
            uni.printForDevelopers("After self.doBeforeCloseProcesses")
            if isActivePyKDE4:
                uni.printForDevelopers("Before Save KDE Configs")
                kconf = MGlobal.config()
                kconfGroup = MConfigGroup(kconf, "DirectoryOperator")
                self.FileManager.dirOperator.writeConfig(kconfGroup)
                self.FileManager.actCollection.writeSettings(kconfGroup)
                uni.printForDevelopers("After Save KDE Configs")
            uni.printForDevelopers("Before Save Configs")
            uni.setMySetting(self.Table.hiddenTableColumnsSettingKey,
                             self.Table.hiddenTableColumns)
            Bars.setAllBarsStyleToMySettings()
            Records.setRecordType(1)
            fu.writeToBinaryFile(
                fu.joinPath(fu.pathOfSettingsDirectory, "LastState"), self.saveState())
            Records.restoreRecordType()
            geometry = [self.geometry().x(), self.geometry().y(), self.geometry().width(),
                        self.geometry().height()]
            uni.setMySetting("MainWindowGeometries", geometry)
            uni.setMySetting("lastDirectory", self.FileManager.currentDirectory)
            uni.setMySetting("isMainWindowMaximized", self.isMaximized())
            uni.setMySetting("isShowAdvancedSelections", self.SpecialTools.isShowAdvancedSelections)
            uni.setMySetting("tableType", uni.tableType)
            uni.setMySetting("activeTabNoOfSpecialTools", self.SpecialTools.tabwTabs.currentIndex())
            uni.saveSettings()
            Settings.saveUniversalSettings()
            if uni.isActiveAmarok and uni.getBoolValue("amarokIsUseHost") is False:
                import Amarok

                uni.printForDevelopers("Before Amarok.stopEmbeddedDB")
                Amarok.stopEmbeddedDB()
                uni.printForDevelopers("After Amarok.stopEmbeddedDB")
            uni.printForDevelopers("After Save Configs")
            uni.printForDevelopers("Before self.doAfterCloseProcesses")
            self.doAfterCloseProcesses()
            uni.printForDevelopers("After self.doAfterCloseProcesses")
        except:
            if ReportBug.isClose is False:
                ReportBug.ReportBug()
                _event.ignore()