提交 074a0fcb 编写于 作者: J Jonathan Thomas

Improved transitions to remove suffix #'s from translations, which removes...

Improved transitions to remove suffix #'s from translations, which removes hundreds of translatable strings! =) Sorry if anyone already translated some of these. Also fixed the various places in the app which iterate through transitions, to work with this new translation syntax. Also, fixed a bug with transition thumbnails not showing up on the 'Add to Timeline' dialog.
上级 4a44bb50
此差异已折叠。
......@@ -230,9 +230,19 @@ for file in os.listdir(transitions_path):
full_subfile_path = os.path.join(full_file_path, sub_file)
(fileBaseName, fileExtension) = os.path.splitext(sub_file)
# split the name into parts (looking for a number)
suffix_number = None
name_parts = fileBaseName.split("_")
if name_parts[-1].isdigit():
suffix_number = name_parts[-1]
# get transition name
name = fileBaseName.replace("_", " ").capitalize()
# replace suffix number with placeholder (if any)
if suffix_number:
name = name.replace(suffix_number, "%s")
# add text to list
transitions_text[name] = full_subfile_path
......
......@@ -493,11 +493,29 @@ class AddToTimeline(QDialog):
if filename[0] == "." or "thumbs.db" in filename.lower():
continue
# split the name into parts (looking for a number)
suffix_number = None
name_parts = fileBaseName.split("_")
if name_parts[-1].isdigit():
suffix_number = name_parts[-1]
# get name of transition
trans_name = fileBaseName.replace("_", " ").capitalize()
# Generate thumbnail for file (if needed)
thumb_path = os.path.join(info.CACHE_PATH, "{}.png".format(fileBaseName))
# replace suffix number with placeholder (if any)
if suffix_number:
trans_name = trans_name.replace(suffix_number, "%s")
trans_name = self.app._tr(trans_name) % suffix_number
else:
trans_name = self.app._tr(trans_name)
# Check for thumbnail path (in build-in cache)
thumb_path = os.path.join(info.IMAGES_PATH, "cache", "{}.png".format(fileBaseName))
# Check built-in cache (if not found)
if not os.path.exists(thumb_path):
# Check user folder cache
thumb_path = os.path.join(info.CACHE_PATH, "{}.png".format(fileBaseName))
# Add item
self.transitions.append(path)
......
......@@ -102,16 +102,29 @@ class TransitionsModel():
if filename[0] == "." or "thumbs.db" in filename.lower():
continue
# split the name into parts (looking for a number)
suffix_number = None
name_parts = fileBaseName.split("_")
if name_parts[-1].isdigit():
suffix_number = name_parts[-1]
# get name of transition
trans_name = fileBaseName.replace("_", " ").capitalize()
# replace suffix number with placeholder (if any)
if suffix_number:
trans_name = trans_name.replace(suffix_number, "%s")
trans_name = self.app._tr(trans_name) % suffix_number
else:
trans_name = self.app._tr(trans_name)
if not win.actionTransitionsShowAll.isChecked():
if win.actionTransitionsShowCommon.isChecked():
if not type == "common":
continue # to next file, didn't match filter
if win.transitionsFilter.text() != "":
if not win.transitionsFilter.text().lower() in self.app._tr(trans_name).lower():
if not win.transitionsFilter.text().lower() in trans_name.lower():
continue
# Check for thumbnail path (in build-in cache)
......@@ -150,15 +163,15 @@ class TransitionsModel():
# Append thumbnail
col = QStandardItem()
col.setIcon(QIcon(thumb_path))
col.setText(self.app._tr(trans_name))
col.setToolTip(self.app._tr(trans_name))
col.setText(trans_name)
col.setToolTip(trans_name)
col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled)
row.append(col)
# Append Filename
col = QStandardItem("Name")
col.setData(self.app._tr(trans_name), Qt.DisplayRole)
col.setText(self.app._tr(trans_name))
col.setData(trans_name, Qt.DisplayRole)
col.setText(trans_name)
col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled)
row.append(col)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册