Skip to content

Commit

Permalink
Merge pull request OpenShot#4726 from ferdnyc/title-update-singleshot
Browse files Browse the repository at this point in the history
Small Title Editor fixes
  • Loading branch information
ferdnyc authored Mar 31, 2022
2 parents ff03c02 + 88e992f commit e52f9c1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/windows/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,20 @@ class TitleEditor(QDialog):

def __init__(self, *args, edit_file_path=None, duplicate=False, **kwargs):

# Create dialog class
super().__init__(*args, **kwargs)

# A timer to pause until user input stops before updating the svg
self.update_timer = QTimer()
self.update_timer = QTimer(self)
self.update_timer.setInterval(300)
self.update_timer.setSingleShot(True)
self.update_timer.timeout.connect(self.save_and_reload)

# Create dialog class
super().__init__(*args, **kwargs)

self.app = get_app()
self.project = self.app.project
self.edit_file_path = edit_file_path
self.duplicate = duplicate

# Get translation object
_ = self.app._tr

# Load UI from designer
ui_util.load_ui(self, self.ui_path)

Expand Down Expand Up @@ -295,7 +293,7 @@ def load_svg_template(self, filename_field=None):
ard = style_to_dict(s)
fs = ard.get("font-size")
if fs and fs.endswith("px"):
self.qfont.setPixelSize(float(fs[:-2]))
self.qfont.setPixelSize(int(float(fs[:-2])))
elif fs and fs.endswith("pt"):
self.qfont.setPointSizeF(float(fs[:-2]))

Expand Down Expand Up @@ -369,7 +367,6 @@ def writeToFile(self, xmldoc):

def save_and_reload(self):
"""Something changed, so update temp SVG and redisplay"""
self.update_timer.stop()
self.writeToFile(self.xmldoc)
self.display_svg()

Expand Down

0 comments on commit e52f9c1

Please sign in to comment.