Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
7cd3ce78
Commit
7cd3ce78
authored
Jun 27, 2023
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added file datatype to handle shared files
parent
baf0b743
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
datatypes.py
blink/configuration/datatypes.py
+37
-1
No files found.
blink/configuration/datatypes.py
View file @
7cd3ce78
...
@@ -8,11 +8,12 @@ from urllib.parse import urlparse
...
@@ -8,11 +8,12 @@ from urllib.parse import urlparse
from
application.python.types
import
MarkerType
from
application.python.types
import
MarkerType
from
sipsimple.configuration.datatypes
import
Hostname
,
List
from
sipsimple.configuration.datatypes
import
Hostname
,
List
from
sipsimple.configuration.settings
import
SIPSimpleSettings
from
blink.resources
import
ApplicationData
from
blink.resources
import
ApplicationData
__all__
=
[
'ApplicationDataPath'
,
'DefaultPath'
,
'SoundFile'
,
'CustomSoundFile'
,
'HTTPURL'
,
'FileURL'
,
'IconDescriptor'
,
'PresenceState'
,
'PresenceStateList'
,
'GraphTimeScale'
]
__all__
=
[
'ApplicationDataPath'
,
'DefaultPath'
,
'SoundFile'
,
'CustomSoundFile'
,
'HTTPURL'
,
'FileURL'
,
'IconDescriptor'
,
'PresenceState'
,
'PresenceStateList'
,
'GraphTimeScale'
,
'File'
]
class
ApplicationDataPath
(
str
):
class
ApplicationDataPath
(
str
):
...
@@ -211,3 +212,38 @@ class GraphTimeScale(int):
...
@@ -211,3 +212,38 @@ class GraphTimeScale(int):
return
value
return
value
class
File
(
object
):
def
__init__
(
self
,
name
,
size
,
sender
,
hash
,
id
,
until
=
None
,
url
=
None
,
type
=
None
):
self
.
name
=
os
.
path
.
join
(
SIPSimpleSettings
()
.
file_transfer
.
directory
.
normalized
,
name
)
if
type
is
not
None
and
type
.
startswith
(
'image/'
):
self
.
name
=
os
.
path
.
join
(
ApplicationData
.
get
(
'transfer_images'
),
id
,
name
)
self
.
original_name
=
self
.
name
self
.
size
=
size
self
.
contact
=
sender
self
.
hash
=
hash
self
.
id
=
id
self
.
until
=
until
self
.
url
=
url
self
.
type
=
type
@
property
def
encrypted
(
self
):
return
self
.
original_name
.
endswith
(
'.asc'
)
@
property
def
decrypted_filename
(
self
):
if
self
.
name
.
endswith
(
'.asc'
):
return
self
.
name
.
rsplit
(
'.'
,
1
)[
0
]
return
self
.
name
@
property
def
already_exists
(
self
):
if
os
.
path
.
exists
(
self
.
decrypted_filename
):
return
True
for
number
in
range
(
self
.
decrypted_filename
.
count
(
"_"
)):
if
os
.
path
.
exists
(
self
.
decrypted_filename
.
replace
(
'_'
,
' '
,
number
)):
self
.
name
=
self
.
decrypted_filename
.
replace
(
'_'
,
' '
,
number
)
return
True
return
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment