OpenShot Video Editor  2.0.0
qt_types.py
Go to the documentation of this file.
1 ##
2 #
3 # @file
4 # @brief This file contains helper functions for Qt types (string to base64)
5 # @author Noah Figg <eggmunkee@hotmail.com>
6 # @author Jonathan Thomas <jonathan@openshot.org>
7 # @author Olivier Girard <eolinwen@gmail.com>
8 #
9 # @section LICENSE
10 #
11 # Copyright (c) 2008-2016 OpenShot Studios, LLC
12 # (http://www.openshotstudios.com). This file is part of
13 # OpenShot Video Editor (http://www.openshot.org), an open-source project
14 # dedicated to delivering high quality video editing and animation solutions
15 # to the world.
16 #
17 # OpenShot Video Editor is free software: you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation, either version 3 of the License, or
20 # (at your option) any later version.
21 #
22 # OpenShot Video Editor is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29 #
30 
31 from PyQt5.QtCore import QByteArray
32 
33 
34 # Utility functions for handling qt types
35 
36 # QByteArray helpers
37 ##
38 # This is required to save Qt byte arrays into a base64 string (to save screen preferences)
39 def str_to_bytes(string):
40  return QByteArray.fromBase64(string.encode("utf-8"))
41 
42 
43 ##
44 # This is required to load base64 Qt byte array strings into a Qt byte array (to load screen preferences)
45 def bytes_to_str(bytes):
46  return bytes.toBase64().data().decode("utf-8")
def str_to_bytes(string)
This is required to save Qt byte arrays into a base64 string (to save screen preferences) ...
Definition: qt_types.py:39
def bytes_to_str(bytes)
This is required to load base64 Qt byte array strings into a Qt byte array (to load screen preference...
Definition: qt_types.py:45