コード例 #1
0
ファイル: Execute.py プロジェクト: supermurat/hamsi-manager
def execute(_command=[], _executableName=None):
    if _executableName in ["HamsiManager", "HamsiManagerInstaller"]:
        pathOfExecutable = findExecutablePath(_executableName)
        if pathOfExecutable.find(".py") > -1 or pathOfExecutable.find(".py3") > -1 or pathOfExecutable.find(".pyw") > -1:
            pathOfExecutable = [getPythonPath(), pathOfExecutable]
        else:
            pathOfExecutable = [pathOfExecutable]
        _command = pathOfExecutable + _command
    if len(_command) > 1 and _command[1][0] is not "-" and _command[0].find("kdesu") > -1:
        tCommand = _command[0]
        del _command[0]
        for c in _command:
            if c.find(" ") > -1 or c.find("'") > -1:
                c = "'" + c + "'"
        tCommand += " \"" + (" ".join(_command)) + "\""
        _command = tCommand
        Records.add("Execute >>> " + str(_command))
        Records.saveAllRecords()
        return subprocess.Popen(args=uni.trEncode(_command, fu.fileSystemEncoding), stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, shell=True)
    else:
        Records.add("Execute >>> " + str(_command))
        Records.saveAllRecords()
        try: correctedCommand = uni.trEncodeList(_command, fu.fileSystemEncoding)
        except: correctedCommand = _command
        return subprocess.Popen(args=correctedCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1)
コード例 #2
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def deleteAlbum(_albumId):
    db = Amarok.checkAndGetDB()
    queryUpdate = "DELETE FROM albums WHERE id=%s" % (_albumId)
    uni.printForDevelopers("Query - deleteAlbum : " + queryUpdate)
    db.query(queryUpdate)
    db.commit()
    return True
コード例 #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()
コード例 #4
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
def getPID():
    global isStarted
    if fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysqld.pid"):
        isStarted = True
        return fu.readFromFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysqld.pid").split("\n")[0]
    isStarted = False
    return None
コード例 #5
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
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()
コード例 #6
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getAllArtistsValues(_filter=""):
    db = Amarok.checkAndGetDB()
    _filter = str(_filter).strip()
    query = """
SELECT DISTINCT
artists.id,
artists.name
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN artists ON artists.id = tracks.artist
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
LEFT JOIN years ON years.id = tracks.year
LEFT JOIN genres ON genres.id = tracks.genre
LEFT JOIN images ON images.id = albums.image
LEFT JOIN statistics ON statistics.url = tracks.url
LEFT JOIN lyrics ON lyrics.url = urls.id
"""
    query += getSQLConditionByFilter(_filter, True) + " ORDER BY artists.name "
    uni.printForDevelopers("Query - getAllArtistsValues : " + query)
    db.query(query)
    r = db.store_result()
    musicFileValues = []
    rows = r.fetch_row(0)
    for row in rows:
        musicFileValues.append({})
        musicFileValues[-1]["id"] = row[0]
        musicFileValues[-1]["name"] = row[1]
    return musicFileValues
コード例 #7
0
def changeTableTypeByType(_tableType):
    try:
        if uni.tableType != _tableType:
            if getMainTable().checkUnSavedValues() is False:
                return False
            uni.setMySetting(getMainTable().hiddenTableColumnsSettingKey,
                             getMainTable().hiddenTableColumns)
            if uni.tableType in ["2", "6", "8", "9"]:
                getMainWindow().removeToolBar(getMainWindow().PlayerBar)
                getMainWindow().PlayerBar.deleteLater()
                getMainWindow().PlayerBar = None
            try:
                getMainWindow().removeDockWidget(
                    getMainWindow().dckSpecialTools)
            except:
                pass
            getMainWindow().resetCentralWidget()
            uni.tableType = _tableType
            refreshBars()
            getMainWindow().FileManager.makeRefresh()
            MApplication.processEvents()
            return True
        else:
            return False
    except:
        ReportBug.ReportBug()
    return False
コード例 #8
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 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
コード例 #9
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getAllMusicFilePathsByAlbumArtistId(_artistId):
    db = Amarok.checkAndGetDB()
    query = """
SELECT
    REPLACE(
        CONCAT(
            CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
            SUBSTRING( urls.rpath , 2 )),
        CONCAT('/',
                CONCAT( CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
                    SUBSTRING( urls.rpath , 2 )))
    , '') AS 'filePath'
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
WHERE albums.artist=""" + str(_artistId) + " ORDER BY filePath "
    uni.printForDevelopers("Query - getAllMusicFilePathsByArtistId : " + query)
    db.query(query)
    r = db.store_result()
    musicFileValues = []
    rows = r.fetch_row(0)
    for row in rows:
        musicFileValues.append(row[0])
    return musicFileValues
コード例 #10
0
 def destinationClicked(self):
     imagePath = Dialogs.getSaveFileName(translate("ImageDetails", "Save As"),
                                         self.lePathOfDestination.text(), str(
             translate("ImageDetails", "Images (*.%s)") % uni.getStringFromList(uni.getListValue("imageExtensions"),
                                                                                " *.")), 0)
     if imagePath is not None:
         self.lePathOfDestination.setText(imagePath)
コード例 #11
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
def getTagger(_isAlertIfNotExist=False, _isReloadAgain=False):
    global loaddedTagger
    try:
        if not _isReloadAgain and loaddedTagger is not None:
            return loaddedTagger
        preferedTaggerModule = uni.MySettings["preferedTaggerModule"]
        taggerModule = __import__("Taggers." + preferedTaggerModule, globals(), locals(), ["isAvailable", "Tagger", preferedTaggerModule], 0)
        if taggerModule.isAvailable:
            loaddedTagger = taggerModule.Tagger()
            return loaddedTagger

        taggersNames = uni.getTaggersMachineNames()
        for tagger in taggersNames:
            taggerModule = __import__("Taggers." + tagger, globals(), locals(), ["isAvailable", "Tagger", tagger], 0)
            if taggerModule.isAvailable:
                uni.setMySetting("preferedTaggerModule", tagger)
                loaddedTagger = taggerModule.Tagger()
                return loaddedTagger
        if _isAlertIfNotExist:
            Dialogs.show(translate("Taggers", "You Have Not Any Tagger"),
                         translate("Taggers", "Not found any tagger in your system. "
                                              "Please install a tagger module. "
                                              "Now supporting only eyeD3 module (python-eyed3)."))
        return None
    except:
        ReportBug.ReportBug()
コード例 #12
0
def installKDE4Languages():
    if uni.isAvailableKDE4():
        for langCode in uni.getInstalledLanguagesCodes():
            installKDE4Language(langCode)
        uni.setMySetting("isInstalledKDE4Language", True)
        return True
    return False
コード例 #13
0
 def valueChanged(self, _action=None):
     try:
         senderAction = self.sender()
         if senderAction.parent().objectName() in self.keysOfSettings:
             indexNo = self.keysOfSettings.index(
                 senderAction.parent().objectName())
         else:
             indexNo = self.keysOfSettings.index(senderAction.objectName())
         selectedValue = None
         if self.typesOfValues[indexNo] == "Yes/No":
             if senderAction.isChecked():
                 selectedValue = True
             else:
                 selectedValue = False
         elif self.typesOfValues[indexNo][0] == "options":
             valueIndex = int(_action.objectName().split(";")[1])
             selectedValue = self.valuesOfOptionsKeys[
                 self.typesOfValues[indexNo][1]][valueIndex]
         uni.setMySetting(self.keysOfSettings[indexNo], selectedValue)
         self.checkEnableStates()
         getMainWindow().StatusBar.fillSelectionInfo()
         if getMainTable() is not None:
             getMainTable().fillSelectionInfo()
     except:
         ReportBug.ReportBug()
コード例 #14
0
 def writeContents(self):
     self.changedValueNumber = 0
     changedArtistValues = []
     uni.startThreadAction()
     allItemNumber = len(self.values)
     Dialogs.showState(translate("FileUtils/Musics", "Writing Music Tags"), 0, allItemNumber, True)
     for rowNo in range(self.rowCount()):
         isContinueThreadAction = uni.isContinueThreadAction()
         if isContinueThreadAction:
             try:
                 if self.isRowHidden(rowNo) is False:
                     if self.isChangeableItem(rowNo, "correctedArtist", str(self.values[rowNo]["currentArtist"])):
                         changedArtistValues.append({})
                         changedArtistValues[-1]["id"] = str(self.values[rowNo]["id"])
                         value = str(self.item(rowNo, 1).text())
                         changedArtistValues[-1]["name"] = value
                         Records.add(str(translate("AmarokArtistTable", "Artist")),
                                     str(self.values[rowNo]["currentArtist"]), value)
                         self.changedValueNumber += 1
             except:
                 ReportBug.ReportBug()
         else:
             allItemNumber = rowNo + 1
         Dialogs.showState(translate("FileUtils/Musics", "Writing Music Tags"), rowNo + 1, allItemNumber, True)
         if isContinueThreadAction is False:
             break
     uni.finishThreadAction()
     Operations.changeArtistValues(changedArtistValues)
     return True
コード例 #15
0
def createReadOnlyEmbeddedDB(_isNoAlertIfSuccessfully=True):
    stopReadOnlyEmbeddedDB()
    if fu.isDir(fu.pathOfSettingsDirectory + "/Amarok"):
        fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok")
    fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle")
    fu.copyFileOrDir(
        fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql",
        fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql",
    )
    fu.copyFileOrDir(
        fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my-readOnly.cnf",
        fu.pathOfSettingsDirectory + "/Amarok/my.cnf")
    MyConfigure.reConfigureFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf")
    fu.makeDirs(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok")
    fu.copyFileOrDir(
        uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile0",
        fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile0")
    fu.copyFileOrDir(
        uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ib_logfile1",
        fu.pathOfSettingsDirectory + "/Amarok/mysqle/ib_logfile1")
    fu.copyFileOrDir(
        uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/ibdata1",
        fu.pathOfSettingsDirectory + "/Amarok/mysqle/ibdata1")
    generateReadOnlyEmbeddedD()
    if _isNoAlertIfSuccessfully is False:
        Dialogs.show(
            translate("EmbeddedDBCore", "Created Embedded Server"),
            translate(
                "EmbeddedDBCore",
                "Embedded Amarok database server created and generated."))
    return True
コード例 #16
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
コード例 #17
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getDevices():
    db = Amarok.checkAndGetDB()
    query = "SELECT id,lastmountpoint FROM devices"
    uni.printForDevelopers("Query - getDevices : " + query)
    db.query(query)
    r = db.store_result()
    return r.fetch_row(0)
コード例 #18
0
 def closeEvent(self, _event):
     try:
         self.player.stop()
         uni.setMySetting("isPlayNow", self.isPlayNow.isChecked())
     except:
         pass
     self.closeCurrenctImageDialogs()
コード例 #19
0
ファイル: EyeD3Tagger.py プロジェクト: sahwar/hamsi-manager
 def loadFile(self, _filePath, _tagVersion=None):
     if _tagVersion is None:
         _tagVersion = id3.ID3_V2_4
     self.tag = None
     self.info = None
     self.filePath = _filePath
     self.isCorrect = False
     self.isSave = False
     self.isNeedUpdate = False
     try:
         self.tag = id3.TagFile(
             uni.trEncode(self.filePath, fu.fileSystemEncoding),
             _tagVersion).tag
         self.info = mp3.Mp3AudioFile(
             uni.trEncode(self.filePath, fu.fileSystemEncoding)).info
     except:
         self.tag = id3.TagFile(self.filePath, _tagVersion).tag
         self.info = mp3.Mp3AudioFile(self.filePath).info
     if self.tag is None:
         self.isNeedUpdate = True
         self.isSave = True
         self.tag = id3.Tag()
         self.tag.parse(self.filePath, id3.ID3_ANY_VERSION)
     elif not self.tag.isV2():
         self.isNeedUpdate = True
         self.isSave = True
コード例 #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
コード例 #21
0
 def closeEvent(self, _event):
     try:
         self.player.stop()
         uni.setMySetting("isPlayNow", self.isPlayNow.isChecked())
     except:
         pass
     self.closeCurrenctImageDialogs()
コード例 #22
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def changeArtistWithAnother(_currentArtistId, _artistWillBeSelectedId):
    db = Amarok.checkAndGetDB()
    queryUpdate1 = "UPDATE tracks SET artist=%s WHERE artist=%s" % (_artistWillBeSelectedId, _currentArtistId)
    uni.printForDevelopers("Query - changeArtistWithAnother - queryUpdate1 : " + queryUpdate1)
    db.query(queryUpdate1)
    db.commit()
    try:
        db = Amarok.checkAndGetDB()
        queryUpdate2 = "UPDATE albums SET artist=%s WHERE artist=%s" % (_artistWillBeSelectedId, _currentArtistId)
        uni.printForDevelopers("Query - changeArtistWithAnother - queryUpdate2 : " + queryUpdate2)
        db.query(queryUpdate2)

        db.commit()
    except Amarok.getMySQLModule().IntegrityError as error:
        db = Amarok.checkAndGetDB()
        db.query("SELECT * FROM albums WHERE name IN (SELECT name FROM albums WHERE artist=%s) AND artist=%s" % (
                _artistWillBeSelectedId, _currentArtistId))
        r = db.store_result()
        rows = r.fetch_row(0)
        for row in rows:
            currentAlbumId = row[0]
            currentAlbumName = row[1]
            db = Amarok.checkAndGetDB()
            db.query("SELECT * FROM albums WHERE name='%s' AND artist=%s" % (currentAlbumName, _artistWillBeSelectedId))
            r = db.store_result()
            srows = r.fetch_row(0)
            if len(srows) > 0:
                albumWillBeSelectedId = srows[0][0]
                changeAlbumWithAnother(currentAlbumId, albumWillBeSelectedId)
                deleteAlbum(currentAlbumId)
    return True
コード例 #23
0
 def loadFile(self, _filePath):
     self.tags = None
     self.info = None
     self.filePath = _filePath
     self.isCorrect = False
     self.isSave = False
     self.isNeedUpdate = False
     try:
         self.tags = id3.ID3(
             uni.trEncode(self.filePath, fu.fileSystemEncoding))
         self.info = mp3.MP3(
             uni.trEncode(self.filePath, fu.fileSystemEncoding)).info
     except id3.error:
         self.isNeedUpdate = True
         self.isSave = True
         self.tags = id3.ID3()
         self.tags.add(id3.TPE1(encoding=3, text=""))
         self.tags.save(uni.trEncode(self.filePath, fu.fileSystemEncoding))
         self.tags = id3.ID3(
             uni.trEncode(self.filePath, fu.fileSystemEncoding))
         self.info = mp3.MP3(
             uni.trEncode(self.filePath, fu.fileSystemEncoding)).info
     except:
         self.tags = id3.ID3(self.filePath)
         self.info = mp3.MP3(self.filePath).info
     if self.tags.version is not (2, 4, 0):
         self.isNeedUpdate = True
         self.isSave = True
コード例 #24
0
ファイル: GoogleEngine.py プロジェクト: sahwar/hamsi-manager
    def startSearch(self):
        try:
            if self.isCheckSingleFile:
                self.prgbState.setRange(0, 1)
                self.rows = list(
                    range(getMainTable().currentRow(),
                          getMainTable().currentRow() + 1))
                self.heightValue = 150
            else:
                self.prgbState.setRange(0, getMainTable().rowCount())
                self.rows = list(range(getMainTable().rowCount()))
                if getMainTable().rowCount() < 7:
                    self.heightValue = 300
                else:
                    self.heightValue = 500
            valuesOfFiles = []
            for rowNo in self.rows:
                valuesOfFiles.append(
                    [str(getMainTable().item(rowNo, 1).text()), rowNo])
            uni.startThreadAction()
            self.emit(SIGNAL("changedProgressBarValue"), 0)
            for valuesOfFile in valuesOfFiles:
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    try:
                        from ThirdPartyModules import google

                        searchResults = google.search(valuesOfFile[0],
                                                      lang='tr',
                                                      stop=5,
                                                      only_standard=True)
                        isOK = False
                        if len(searchResults) != 0:
                            for result in searchResults:
                                if str(result.title).lower() == str(
                                        valuesOfFile[0]).lower():
                                    self.trueFiles.append(valuesOfFile)
                                    isOK = True
                                    break
                            if not isOK:
                                self.falseFiles.append(
                                    [searchResults, valuesOfFile])
                        else:
                            self.nullFiles.append(valuesOfFile)
                    except Exception as err:
                        # Dialogs.showError(translate("SearchEngines", "An Error Occured"),
                        #                   str(translate("SearchEngines",
                        #                                 "Fetching information for the music file that caused the error is canceled.<br>If you receive the same error, please try the other search engines.<br><b>Error details:</b><br>%s")) % (
                        #                       str(err)))
                        print(err)
                        self.incorrectFiles.append(valuesOfFile)
                    self.emit(SIGNAL("changedProgressBarValue"),
                              valuesOfFile[1] + 1)
                if isContinueThreadAction is False:
                    break
            uni.finishThreadAction()
            return True
        except:
            ReportBug.ReportBug()
            return False
コード例 #25
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getOrInsertAlbum(_album, _artistId):
    db = Amarok.checkAndGetDB()
    for sqlCommand in Databases.getAmendedSQLSelectOrInsertAndSelectQueries("albums", "id", {
        "name": "'" + Databases.correctForSql(_album) + "'", "artist": "'" + _artistId + "'"}):
        uni.printForDevelopers("Query - getOrInsertAlbum : " + sqlCommand)
        db.query(sqlCommand)
    r = db.store_result()
    return str(r.fetch_row(0)[0][0])
コード例 #26
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
 def cckbMStateChanged(self, _index=None):
     if self.settingKey is not None:
         if self.checkState() == Mt.Checked:
             uni.setMySetting(self.settingKey, True)
         else:
             uni.setMySetting(self.settingKey, False)
     if self.stateChanged is not None:
         self.stateChanged()
コード例 #27
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getOrInsertGenre(_genre):
    db = Amarok.checkAndGetDB()
    for sqlCommand in Databases.getAmendedSQLSelectOrInsertAndSelectQueries("genres", "id", {
        "name": "'" + Databases.correctForSql(_genre) + "'"}):
        uni.printForDevelopers("Query - getOrInsertGenre : " + sqlCommand)
        db.query(sqlCommand)
    r = db.store_result()
    return str(r.fetch_row(0)[0][0])
コード例 #28
0
ファイル: StatusBar.py プロジェクト: sahwar/hamsi-manager
 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"))
コード例 #29
0
def backupEmbeddedDB():
    if fu.isDir(uni.getKDE4HomePath() +
                "/share/apps/amarok/mysqle_backup_for_hamsi"):
        fu.removeFileOrDir(uni.getKDE4HomePath() +
                           "/share/apps/amarok/mysqle_backup_for_hamsi")
    fu.copyFileOrDir(
        uni.getKDE4HomePath() + "/share/apps/amarok/mysqle",
        uni.getKDE4HomePath() + "/share/apps/amarok/mysqle_backup_for_hamsi")
コード例 #30
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 def getThisTableType(_tableType):
     if _tableType in uni.getTableTypesNames():
         return _tableType
     else:
         for x, name in uni.getTableTypesNames().items():
             if str(name) == str(_tableType):
                 return x
     return "1"
コード例 #31
0
ファイル: Dialogs.py プロジェクト: supermurat/hamsi-manager
def getOpenFileNames(_caption, _directory, _filter, _isUseLastPathKeyType=1, _lastPathKey=None):
    pathKey = uni.getLastPathKey(_caption, _directory, _filter, _isUseLastPathKeyType, _lastPathKey)
    if pathKey is not None: _directory = uni.getLastPathByEvent(pathKey, _directory)
    filePaths = QFileDialog.getOpenFileNames(getActiveWindow(), str(_caption),
                                             str(_directory), str(_filter))
    if not filePaths:
        return None
    if pathKey is not None: uni.setLastPathByEvent(pathKey, str(filePaths[-1]))
    return list(filePaths)
コード例 #32
0
ファイル: Dialogs.py プロジェクト: supermurat/hamsi-manager
def getExistingDirectory(_caption, _directory, _isUseLastPathKeyType=1, _lastPathKey=None):
    pathKey = uni.getLastPathKey(_caption, _directory, "", _isUseLastPathKeyType, _lastPathKey)
    if pathKey is not None: _directory = uni.getLastPathByEvent(pathKey, _directory)
    filePath = QFileDialog.getExistingDirectory(getActiveWindow(), str(_caption),
                                                str(_directory))
    if filePath == "":
        return None
    if pathKey is not None: uni.setLastPathByEvent(pathKey, str(filePath))
    return str(filePath)
コード例 #33
0
ファイル: CoverDetails.py プロジェクト: sahwar/hamsi-manager
 def sourceClicked(self):
     imagePath = Dialogs.getOpenFileName(
         translate("ImageDetails", "Choose Image"),
         self.lePathOfSource.text(),
         str(translate("ImageDetails", "Images (*.%s)")) %
         uni.getStringFromList(uni.getListValue("imageExtensions"), " *."),
         0)
     if imagePath is not None:
         self.lePathOfSource.setText(imagePath)
コード例 #34
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
 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()
コード例 #35
0
ファイル: Execute.py プロジェクト: supermurat/hamsi-manager
def executeAsRoot(_command=[], _executableName=None):
    if uni.isRunableAsRoot():
        pathOfExecutable = None
        if _executableName in ["HamsiManager", "HamsiManagerInstaller"]:
            pathOfExecutable = findExecutablePath(_executableName)
        if pathOfExecutable is not None:
            _command = [pathOfExecutable] + _command
        return execute([fu.joinPath(uni.getLibraryDirectoryPath(), "kde4", "libexec", "kdesu")] + _command)
    return False
コード例 #36
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 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())))
コード例 #37
0
ファイル: CoverDetails.py プロジェクト: sahwar/hamsi-manager
 def destinationClicked(self):
     imagePath = Dialogs.getSaveFileName(
         translate("ImageDetails", "Save As"),
         self.lePathOfDestination.text(),
         str(
             translate("ImageDetails", "Images (*.%s)") %
             uni.getStringFromList(uni.getListValue("imageExtensions"),
                                   " *.")), 0)
     if imagePath is not None:
         self.lePathOfDestination.setText(imagePath)
コード例 #38
0
def getPID():
    global isStarted
    if fu.isFile(uni.getKDE4HomePath() +
                 "/share/apps/amarok/mysqle/mysqld.pid"):
        isStarted = True
        return fu.readFromFile(uni.getKDE4HomePath() +
                               "/share/apps/amarok/mysqle/mysqld.pid").split(
                                   "\n")[0]
    isStarted = False
    return None
コード例 #39
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getArtistId(_artist):
    db = Amarok.checkAndGetDB()
    query = "SELECT id FROM artists WHERE name='%s'" % (Databases.correctForSql(_artist))
    uni.printForDevelopers("Query - getArtistId : " + query)
    db.query(query)
    r = db.store_result()
    rows = r.fetch_row(0)
    if len(rows) > 0:
        return str(rows[0][0])
    return None
コード例 #40
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getArtistName(_artistId):
    db = Amarok.checkAndGetDB()
    query = "SELECT name FROM artists WHERE id=%s" % _artistId
    uni.printForDevelopers("Query - getArtistName : " + query)
    db.query(query)
    r = db.store_result()
    musicFileValues = []
    rows = r.fetch_row(0)
    if len(rows) > 0:
        return str(rows[0][0])
    return None
コード例 #41
0
 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()
コード例 #42
0
ファイル: __init__.py プロジェクト: supermurat/hamsi-manager
def configureEmbeddedDB(_isNoAlertIfSuccessfully=True):
    stopEmbeddedDB()
    backupEmbeddedDB()
    fu.copyDirContent(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/mysql",
                      uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql")
    fu.copyFileOrDir(fu.HamsiManagerDirectory + "/Amarok/EmbeddedDBFiles/my.cnf",
                     uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")
    MyConfigure.reConfigureFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")
    if _isNoAlertIfSuccessfully is False:
        Dialogs.show(translate("EmbeddedDBCore", "Created Embedded Server"),
                     translate("EmbeddedDBCore", "Embedded Amarok database server created and generated."))
    return True
コード例 #43
0
ファイル: Commands.py プロジェクト: supermurat/hamsi-manager
def getAllMusicFileValuesWithNames(_filter="", _artistId=None):
    db = Amarok.checkAndGetDB()
    query = """
SELECT tracks.id,
    REPLACE(
        CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
            SUBSTRING( urls.rpath , 2 )),
        CONCAT('/',
                CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
                    SUBSTRING( urls.rpath , 2 )))
    , '') AS 'filePath',
tracks.title,
tracks.artist AS 'artistId',
tracks.album AS 'albumId',
albums.artist AS 'albumArtistId',
tracks.year AS 'yearId',
tracks.genre AS 'genreId',
tracks.tracknumber AS 'trackNumber',
tracks.comment AS 'comment',
artists.name AS 'artist',
albums.name AS 'album',
albumartists.name AS 'albumArtist',
years.name AS 'year',
genres.name AS 'genre',
images.path AS 'imagePath',
statistics.rating,
lyrics.lyrics
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN artists ON artists.id = tracks.artist
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
LEFT JOIN years ON years.id = tracks.year
LEFT JOIN genres ON genres.id = tracks.genre
LEFT JOIN images ON images.id = albums.image
LEFT JOIN statistics ON statistics.url = tracks.url
LEFT JOIN lyrics ON lyrics.url = urls.id
"""
    isAddWhere = True
    if _artistId:
        query += " WHERE (tracks.artist=" + str(_artistId) + " OR albums.artist=" + str(_artistId) + ") "
        isAddWhere = False
    query += getSQLConditionByFilter(_filter, isAddWhere) + " ORDER BY filePath "
    uni.printForDevelopers("Query - getAllMusicFileValuesWithNames : " + query)
    c = db.cursor(Amarok.getCursors().DictCursor)
    c.execute(query)
    musicFileValues = []
    for rows in c.fetchall():
        musicFileValues.append({})
        for key in rows.keys():
            musicFileValues[-1][key] = Databases.correctForUser(rows[key])
    return musicFileValues
コード例 #44
0
ファイル: Execute.py プロジェクト: sahwar/hamsi-manager
def executeAsRoot(_command=[], _executableName=None):
    if uni.isRunableAsRoot():
        pathOfExecutable = None
        if _executableName in ["HamsiManager", "HamsiManagerInstaller"]:
            pathOfExecutable = findExecutablePath(_executableName)
        if pathOfExecutable is not None:
            _command = [pathOfExecutable] + _command
        return execute([
            fu.joinPath(uni.getLibraryDirectoryPath(), "kde4", "libexec",
                        "kdesu")
        ] + _command)
    return False
コード例 #45
0
ファイル: Searcher.py プロジェクト: supermurat/hamsi-manager
 def selectSearchFilePath(self):
     try:
         lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1]
         SearchPaths = Dialogs.getOpenFileNames(translate("Searcher", "Please Select A Text File To Search"),
                                                lastPath,
                                                translate("Searcher", "All Files (*.*)"))
         if SearchPaths is not None:
             self.lePathToSeach.setText(uni.getStringFromList(SearchPaths, ";"))
             if self.setSourceToSearch(True, True):
                 self.search()
     except:
         ReportBug.ReportBug()
コード例 #46
0
 def isMakeUpdateControl():
     lastUpdateControlTime = uni.getDateValue("lastUpdateControlDate")
     updateInterval = int(uni.MySettings["updateInterval"])
     if (lastUpdateControlTime + timedelta(days=updateInterval)).strftime("%Y%m%d%H%M%S") < datetime.now().strftime(
         "%Y%m%d%H%M%S"):
         return True
     lastUpdateControlTime = uni.getDateValue("remindMeLaterShowDateForUpdate")
     updateInterval = int(uni.MySettings["remindMeLaterForUpdate"])
     if updateInterval != -1:
         if (lastUpdateControlTime + timedelta(days=updateInterval)).strftime(
             "%Y%m%d%H%M%S") < datetime.now().strftime("%Y%m%d%H%M%S"):
             return True
     return False
コード例 #47
0
 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()
コード例 #48
0
 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()
コード例 #49
0
ファイル: Searcher.py プロジェクト: sahwar/hamsi-manager
 def selectSearchFilePath(self):
     try:
         lastPath = uni.getListFromListString(self.lePathToSeach.text(),
                                              ";")[-1]
         SearchPaths = Dialogs.getOpenFileNames(
             translate("Searcher", "Please Select A Text File To Search"),
             lastPath, translate("Searcher", "All Files (*.*)"))
         if SearchPaths is not None:
             self.lePathToSeach.setText(
                 uni.getStringFromList(SearchPaths, ";"))
             if self.setSourceToSearch(True, True):
                 self.search()
     except:
         ReportBug.ReportBug()
コード例 #50
0
def installKDE4Language(_language="tr_TR"):
    if uni.isAvailableKDE4():
        KDELocalateDir = fu.joinPath(uni.getKDE4HomePath(), "share", "locale", str(_language[:2]), "LC_MESSAGES")
        if uni.isRunningAsRoot():
            KDELocalateDir = fu.joinPath("/usr", "share", "locale", str(_language[:2]), "LC_MESSAGES")
        KDELocalateDir = str(KDELocalateDir)
        langFile = fu.joinPath(fu.HamsiManagerDirectory, "Languages", "DontTranslate", str(_language),
                               "HamsiManager.mo")
        if fu.isFile(fu.joinPath(KDELocalateDir, "HamsiManager.mo")) is False:
            if fu.isFile(langFile):
                if fu.isDir(KDELocalateDir) is False:
                    fu.makeDirs(KDELocalateDir)
                fu.copyFileOrDir(langFile, fu.joinPath(KDELocalateDir, "HamsiManager.mo"))
        return True
    return False
コード例 #51
0
ファイル: UpdateControl.py プロジェクト: sahwar/hamsi-manager
 def isMakeUpdateControl():
     lastUpdateControlTime = uni.getDateValue("lastUpdateControlDate")
     updateInterval = int(uni.MySettings["updateInterval"])
     if (lastUpdateControlTime + timedelta(days=updateInterval)).strftime(
             "%Y%m%d%H%M%S") < datetime.now().strftime("%Y%m%d%H%M%S"):
         return True
     lastUpdateControlTime = uni.getDateValue(
         "remindMeLaterShowDateForUpdate")
     updateInterval = int(uni.MySettings["remindMeLaterForUpdate"])
     if updateInterval != -1:
         if (lastUpdateControlTime + timedelta(days=updateInterval)
             ).strftime("%Y%m%d%H%M%S") < datetime.now().strftime(
                 "%Y%m%d%H%M%S"):
             return True
     return False
コード例 #52
0
ファイル: taglibTagger.py プロジェクト: sahwar/hamsi-manager
 def loadFileForWrite(self, _filePath, _isCorrect=True):
     self.tags = None
     self.tagFile = None
     self.filePath = _filePath
     self.isCorrect = _isCorrect
     self.isSave = False
     self.isNeedUpdate = False
     try:
         self.tagFile = taglib.File(
             uni.trEncode(self.filePath, fu.fileSystemEncoding))
         self.tags = self.tagFile.tags
     except:
         self.tagFile = taglib.File(
             uni.trEncode(self.filePath, fu.fileSystemEncoding))
         self.tags = self.tagFile.tags
コード例 #53
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 def initByTable(self):
     self.hiddenTableColumns = uni.getListValue(
         self.hiddenTableColumnsSettingKey)
     self.mContextMenuColumns = MMenu()
     self.mContextMenuColumns.setTitle(translate("Tables", "Show Fields"))
     self.mContextMenuOpenWith = MMenu()
     self.mContextMenuOpenWith.setTitle(translate("Tables", "Open With"))
     self.refreshForColumns()
     self.mContextMenuActionNames = [
         translate("Tables", "Cut"),
         translate("Tables", "Copy"),
         translate("Tables", "Paste"),
         translate("Tables", "Modify"),
         translate("Tables", "Remove From System")
     ]
     for actName in self.mContextMenuActionNames:
         self.mContextMenu.addAction(actName).setObjectName(actName)
     self.mContextMenuOpenWithNames = [
         translate("Tables", "File Manager"),
         translate("Tables", "Default Application")
     ]
     if uni.isWindows is False:
         self.mContextMenuOpenWithNames.append(
             translate("Tables", "Konsole"))
     for actName in self.mContextMenuOpenWithNames:
         self.mContextMenuOpenWith.addAction(actName).setObjectName(actName)
     self.mContextMenu.addMenu(self.mContextMenuColumns)
     self.mContextMenu.addAction(translate(
         "Tables", "Open Details")).setObjectName("Open Details")
     self.mContextMenu.addMenu(self.mContextMenuOpenWith)
     self.checkActionsStates()
     self.fillSelectionInfo()
コード例 #54
0
ファイル: __init__.py プロジェクト: sahwar/hamsi-manager
 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