示例#1
0
def __read_json():
    file_settings = get_files().file_settings
    if not os.path.isfile(file_settings):
        __write_json()

    with open(file_settings) as df:
        json_values: Dict = json.load(df)

    for json_setting in SettingJson:
        json_setting._value = json_values.get(json_setting.identifier,
                                              json_setting.default_value)
示例#2
0
    def __update_ui_language(self) -> None:
        from src import get_files

        i18n = get_files().dir_i18n
        if i18n.is_dir():
            self.application.removeTranslator(self.__translator)
            self.__translator.load(
                settings.Setting_Custom_Language_LANGUAGE.value, str(i18n))
            self.application.installTranslator(self.__translator)
            settings.Setting_Custom_General_COMMENT_TYPES.update()
            self.widget_context_menu.update_entries()
            self.__ui.retranslateUi(self)
            self.user_settings.setup_languages(self.__ui.menuLanguage,
                                               self.__update_ui_language)
            self.widget_comments.resize_column_type_column()
示例#3
0
    def __init__(self, parent, qc_manager: QcManager):
        super().__init__(parent)

        self.__qc_manager = qc_manager
        self.__backup_directory = str(get_files().dir_backup)

        self.__ui = Ui_BackupDialog()
        self.__ui.setupUi(self)

        self.__ui.checkBox.setEnabled(
            settings.Setting_Custom_QcDocument_AUTOSAVE_ENABLED.value)
        self.__ui.spinBox.setValue(
            settings.Setting_Custom_QcDocument_AUTOSAVE_INTERVAL.value)

        self.__ui.backupPathLabel.setText(self.__backup_directory)
        self.__ui.openButton.pressed.connect(self.__open_backup_directory)
示例#4
0
def __write_json():
    dictionary = {}
    for s in SettingJson:
        # noinspection PyProtectedMember
        dictionary.update({
            s.identifier:
            s._value if s._value is not None else s.default_value
        })

    with io.open(get_files().file_settings, 'w', encoding='utf8') as file:
        str_ = json.dumps(dictionary,
                          indent=4,
                          separators=(',', ': '),
                          sort_keys=True,
                          ensure_ascii=False)
        file.write(str(str_))
示例#5
0
文件: _mpvframe.py 项目: cN3rd/mpvQC
    def __init__(self, main_handler: MainHandler):
        super(MpvWidget, self).__init__(main_handler)
        self.__main_handler = main_handler

        self.cursor_timer = QTimer(self)
        self.cursor_timer.setSingleShot(True)
        # noinspection PyUnresolvedReferences
        self.cursor_timer.timeout.connect(
            lambda arg=False, f=self.__main_handler.display_mouse_cursor: f(arg
                                                                            ))

        self.setStyleSheet("background-color:black;")
        self.setMouseTracking(True)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.setFocusPolicy(Qt.ClickFocus)

        from src import get_files
        files = get_files()

        __mpv = MPV(
            wid=str(int(self.winId())),
            keep_open="yes",
            idle="yes",
            osc="yes",
            cursor_autohide="no",
            input_cursor="no",
            input_default_bindings="no",
            config="yes",
            config_dir=files.dir_config,
            screenshot_directory=files.dir_screenshots,
            ytdl="yes",
            log_handler=logging.mpv_log_handler,
        )

        self.player = MpvPlayer(__mpv)
        MpvPropertyObserver(__mpv)

        from src.uihandler import AboutDialog
        AboutDialog.VERSION_MPV = self.player.version_mpv()
        AboutDialog.VERSION_FFMPEG = self.player.ffmpeg_version()
示例#6
0
def write_auto_save(video_path, file_content):
    """
    Writes a qc file into the auto save zip.

    :param video_path: the name of the current video file
    :param file_content: the content to write
    """

    today = str(datetime.today())

    zip_name = "{}.zip".format("-".join(today.split("-")[:2]))
    zip_path = path.join(get_files().dir_backup, zip_name)
    zip_file = ZipFile(zip_path,
                       "a" if path.isfile(zip_path) else "w",
                       compression=ZIP_DEFLATED)

    file_name = "{}-{}.txt".format(
        today.replace(":", "-").replace(" ", "_"),
        path.splitext(path.basename(video_path))[0])

    try:
        zip_file.writestr(file_name, file_content)
    finally:
        zip_file.close()
示例#7
0
Setting_Custom_QcDocument_AUTOSAVE_ENABLED = \
    Entry("custom_qcdocument_autosave_enabled", True)

Setting_Custom_QcDocument_AUTOSAVE_INTERVAL = \
    Entry("custom_qcdocument_autosave_interval", 150)  # in seconds

Setting_Custom_QcDocument_WRITE_VIDEO_PATH_TO_FILE = \
    Entry("custom_qcdocument_write_video_path_to_file", True)

Setting_Custom_QcDocument_WRITE_NICK_TO_FILE = \
    Entry("custom_qcdocument_write_nick_to_file", True)

######################################################################## PREFERENCES -> CONFIGURATION ### CUSTOMIZATION

Setting_Custom_Configuration_INPUT = \
    Entry(get_files().file_input_conf, CFG_INPUT)

Setting_Custom_Configuration_MPV = \
    Entry(get_files().file_mpv_conf, CFG_MPV)

########################################################################### PREFERENCES -> APPEARANCE ### CUSTOMIZATION

Setting_Custom_Appearance_General_WINDOW_TITLE = \
    Entry("custom_appearance_general_window_title_nothing_name_full", 0)
"""0: Default Window Title; 1: Current File name only; 2: Full path"""

Setting_Custom_Appearance_General_DARK_THEME = \
    Entry("custom_appearance_general_dark_theme", True if platform.system() == "Windows" else False)

#######################################################################################################################