當前位置: 首頁>>代碼示例>>Python>>正文


Python MainWindow.show_va_removal_notice方法代碼示例

本文整理匯總了Python中picard.ui.mainwindow.MainWindow.show_va_removal_notice方法的典型用法代碼示例。如果您正苦於以下問題:Python MainWindow.show_va_removal_notice方法的具體用法?Python MainWindow.show_va_removal_notice怎麽用?Python MainWindow.show_va_removal_notice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在picard.ui.mainwindow.MainWindow的用法示例。


在下文中一共展示了MainWindow.show_va_removal_notice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Tagger

# 需要導入模塊: from picard.ui.mainwindow import MainWindow [as 別名]
# 或者: from picard.ui.mainwindow.MainWindow import show_va_removal_notice [as 別名]

#.........這裏部分代碼省略.........
        self.browser_integration = BrowserIntegration()

        self.files = {}
        self.clusters = ClusterList()
        self.albums = {}
        self.release_groups = {}
        self.mbid_redirects = {}
        self.unmatched_files = UnmatchedFiles()
        self.nats = None
        self.window = MainWindow()

    def _upgrade_config(self):
        cfg = config._config

        # In version 1.0, the file naming formats for single and various
        # artist releases were merged.
        def upgrade_to_v1_0():
            def remove_va_file_naming_format(merge=True):
                if merge:
                    config.setting["file_naming_format"] = (
                        "$if($eq(%compilation%,1),\n$noop(Various Artist "
                        "albums)\n%s,\n$noop(Single Artist Albums)\n%s)" % (
                            config.setting["va_file_naming_format"].toString(),
                            config.setting["file_naming_format"]
                        ))
                config.setting.remove("va_file_naming_format")
                config.setting.remove("use_va_format")

            if ("va_file_naming_format" in config.setting and
                "use_va_format" in config.setting):

                if config.setting["use_va_format"].toBool():
                    remove_va_file_naming_format()
                    self.window.show_va_removal_notice()

                elif (config.setting["va_file_naming_format"].toString() !=
                      r"$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldis"
                      "cs%,1),%discnumber%-,)$num(%tracknumber%,2) %artist% - "
                      "%title%"):

                    if self.window.confirm_va_removal():
                        remove_va_file_naming_format(merge=False)
                    else:
                        remove_va_file_naming_format()
                else:
                    # default format, disabled
                    remove_va_file_naming_format(merge=False)

        cfg.register_upgrade_hook("1.0.0final0", upgrade_to_v1_0)

        cfg.run_upgrade_hooks()

    def move_files_to_album(self, files, albumid=None, album=None):
        """Move `files` to tracks on album `albumid`."""
        if album is None:
            album = self.load_album(albumid)
        if album.loaded:
            album.match_files(files)
        else:
            for file in list(files):
                file.move(album.unmatched_files)

    def move_file_to_album(self, file, albumid):
        """Move `file` to a track on album `albumid`."""
        self.move_files_to_album([file], albumid)
開發者ID:kepstin,項目名稱:picard,代碼行數:69,代碼來源:tagger.py

示例2: Tagger

# 需要導入模塊: from picard.ui.mainwindow import MainWindow [as 別名]
# 或者: from picard.ui.mainwindow.MainWindow import show_va_removal_notice [as 別名]

#.........這裏部分代碼省略.........
            os.makedirs(self.user_plugin_dir)
        self.pluginmanager.load_plugindir(self.user_plugin_dir)
        if hasattr(sys, "frozen"):
            self.pluginmanager.load_plugindir(os.path.join(os.path.dirname(sys.argv[0]), "plugins"))
        else:
            self.pluginmanager.load_plugindir(os.path.join(os.path.dirname(__file__), "plugins"))

        self.acoustidmanager = AcoustIDManager()
        self.browser_integration = BrowserIntegration()

        self.files = {}
        self.clusters = ClusterList()
        self.albums = {}
        self.release_groups = {}
        self.mbid_redirects = {}
        self.unmatched_files = UnmatchedFiles()
        self.nats = None
        self.window = MainWindow()

        def remove_va_file_naming_format(merge=True):
            if merge:
                self.config.setting["file_naming_format"] = \
                    "$if($eq(%compilation%,1),\n$noop(Various Artist albums)\n"+\
                    "%s,\n$noop(Single Artist Albums)\n%s)" %\
                    (self.config.setting["va_file_naming_format"].toString(),
                     self.config.setting["file_naming_format"])
            self.config.setting.remove("va_file_naming_format")
            self.config.setting.remove("use_va_format")

        if "va_file_naming_format" in self.config.setting\
                and "use_va_format" in self.config.setting:
            if self.config.setting["use_va_format"].toBool():
                remove_va_file_naming_format()
                self.window.show_va_removal_notice()
            elif self.config.setting["va_file_naming_format"].toString() !=\
                r"$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2) %artist% - %title%":
                    if self.window.confirm_va_removal():
                        remove_va_file_naming_format(merge=False)
                    else:
                        remove_va_file_naming_format()
            else:
                # default format, disabled
                remove_va_file_naming_format(merge=False)

    def setup_gettext(self, localedir):
        """Setup locales, load translations, install gettext functions."""
        ui_language = self.config.setting["ui_language"]
        if ui_language:
            os.environ['LANGUAGE'] = ''
            os.environ['LANG'] = ui_language
        if sys.platform == "win32":
            try:
                locale.setlocale(locale.LC_ALL, os.environ["LANG"])
            except KeyError:
                os.environ["LANG"] = locale.getdefaultlocale()[0]
                try:
                    locale.setlocale(locale.LC_ALL, "")
                except:
                    pass
            except:
                pass
        else:
            if sys.platform == "darwin" and not ui_language:
                try:
                    import Foundation
                    defaults = Foundation.NSUserDefaults.standardUserDefaults()
開發者ID:dukeyin,項目名稱:picard,代碼行數:70,代碼來源:tagger.py


注:本文中的picard.ui.mainwindow.MainWindow.show_va_removal_notice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。