minor changes in component adding

This commit is contained in:
Jakub Trllo 2019-04-17 17:18:44 +02:00
parent 61026da1a4
commit 74b11b98ee
2 changed files with 37 additions and 10 deletions

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 56 56" style="enable-background:new 0 0 56 56;" xml:space="preserve">
<g>
<path d="M28,0C12.561,0,0,12.561,0,28s12.561,28,28,28s28-12.561,28-28S43.439,0,28,0z M28,54C13.663,54,2,42.336,2,28
S13.663,2,28,2s26,11.664,26,26S42.337,54,28,54z"/>
<path d="M40,16H16c-0.553,0-1,0.448-1,1s0.447,1,1,1h24c0.553,0,1-0.448,1-1S40.553,16,40,16z"/>
<path d="M40,27H16c-0.553,0-1,0.448-1,1s0.447,1,1,1h24c0.553,0,1-0.448,1-1S40.553,27,40,27z"/>
<path d="M40,38H16c-0.553,0-1,0.448-1,1s0.447,1,1,1h24c0.553,0,1-0.448,1-1S40.553,38,40,38z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 823 B

View file

@ -67,7 +67,6 @@ class DropDataFrame(QtWidgets.QFrame):
paths.append(local_path)
else:
print('Invalid input: "{}"'.format(local_path))
return paths
def _add_components(self, paths):
@ -158,20 +157,16 @@ class DropDataFrame(QtWidgets.QFrame):
def _process_collection(self, collection):
file_base = os.path.basename(collection.head)
folder_path = os.path.dirname(collection.head)
if file_base[-1] in ['.']:
if file_base[-1] in ['.', '_']:
file_base = file_base[:-1]
file_ext = collection.tail
repr_name = file_ext.replace('.', '')
range = self._get_ranges(collection.indexes)
range = collection.format('{ranges}')
files = []
for file in os.listdir(folder_path):
if file.startswith(file_base) and file.endswith(file_ext):
files.append(os.path.sep.join([folder_path, file]))
actions = []
data = {
'files': files,
'files': [file for file in collection],
'name': file_base,
'ext': file_ext,
'file_info': range,
@ -245,7 +240,10 @@ class DropDataFrame(QtWidgets.QFrame):
if data['is_sequence']:
icon += 's'
data['icon'] = icon
data['thumb'] = ext in self.presets['thumbnailable']
data['thumb'] = (
ext in self.presets['thumbnailable'] and
data['is_sequence'] is False
)
data['prev'] = ext in self.presets['extensions']['video_file']
found = False
@ -260,9 +258,18 @@ class DropDataFrame(QtWidgets.QFrame):
# If both are single files
if not new_is_seq and not ex_is_seq:
if data['name'] != item.in_data['name']:
if data['name'] == item.in_data['name']:
found = True
break
paths = data['files']
paths.extend(item.in_data['files'])
c, r = clique.assemble(paths)
if len(c) == 0:
continue
found = True
self._remove_item(item)
self._process_collection(c[0])
break
# If new is sequence and ex is single file
elif new_is_seq and not ex_is_seq:
@ -279,6 +286,7 @@ class DropDataFrame(QtWidgets.QFrame):
paths = data['files']
paths.append(ex_file)
collections, remainders = clique.assemble(paths)
self._remove_item(item)
self._process_collection(collections[0])
break
# If new is single file existing is sequence
@ -288,6 +296,13 @@ class DropDataFrame(QtWidgets.QFrame):
new_file = data['files'][0]
found = True
if new_file in item.in_data['files']:
paths = []
for path in item.in_data['files']:
if os.path.exists(path):
paths.append(path)
if len(paths) == 1:
self._remove_item(item)
found = False
break
paths = item.in_data['files']
paths.append(new_file)