26
26
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
27
27
"""
28
28
29
- import sys
30
29
import os
31
30
import re
32
31
import shutil
35
34
import tempfile
36
35
from xml .dom import minidom
37
36
38
- from PyQt5 .QtCore import *
39
- from PyQt5 .QtGui import QIcon , QStandardItemModel , QStandardItem , QFont
40
- from PyQt5 .QtWidgets import *
41
- from PyQt5 import uic , QtSvg , QtGui
37
+ from PyQt5 .QtCore import Qt , QTimer
38
+ from PyQt5 import QtGui
39
+ from PyQt5 .QtWidgets import (
40
+ QGraphicsScene , QMessageBox , QDialog , QColorDialog , QFontDialog ,
41
+ QPushButton , QTextEdit , QLabel
42
+ )
43
+
42
44
import openshot
43
45
44
- from classes import info , ui_util , settings , qt_types , updates
46
+ from classes import info , ui_util , settings
45
47
from classes .logger import log
46
48
from classes .app import get_app
47
49
from classes .query import File
48
- from classes .metrics import *
50
+ from classes .metrics import track_metric_screen
49
51
from windows .views .titles_listview import TitlesListView
50
52
51
53
import json
@@ -102,7 +104,7 @@ def __init__(self, edit_file_path=None, duplicate=False):
102
104
self .font_family = "Bitstream Vera Sans"
103
105
self .tspan_node = None
104
106
105
- self .qfont = QFont (self .font_family )
107
+ self .qfont = QtGui . QFont (self .font_family )
106
108
107
109
# Add titles list view
108
110
self .titlesTreeView = TitlesListView (self )
@@ -202,7 +204,7 @@ def load_svg_template(self):
202
204
self .font_family = "Bitstream Vera Sans"
203
205
if self .qfont :
204
206
del self .qfont
205
- self .qfont = QFont (self .font_family )
207
+ self .qfont = QtGui . QFont (self .font_family )
206
208
207
209
# Loop through child widgets (and remove them)
208
210
for child in self .settingsContainer .children ():
@@ -276,7 +278,6 @@ def load_svg_template(self):
276
278
widget .textChanged .connect (functools .partial (self .txtLine_changed , widget ))
277
279
self .settingsContainer .layout ().addRow (label , widget )
278
280
279
-
280
281
# Add Font button
281
282
label = QLabel ()
282
283
label .setText (_ ("Font:" ))
@@ -340,7 +341,7 @@ def writeToFile(self, xmldoc):
340
341
file .write (bytes (xmldoc .toxml (), 'UTF-8' ))
341
342
file .close ()
342
343
except IOError as inst :
343
- log .error ("Error writing SVG title" )
344
+ log .error ("Error writing SVG title: {}" . format ( inst ) )
344
345
345
346
def btnFontColor_clicked (self ):
346
347
app = get_app ()
@@ -624,7 +625,6 @@ def set_font_color_elements(self, color, alpha):
624
625
t = ";"
625
626
text_child .setAttribute ("style" , t .join (ar ))
626
627
627
-
628
628
# Loop through each TSPAN
629
629
for tspan_child in self .tspan_node :
630
630
@@ -660,8 +660,11 @@ def accept(self):
660
660
if self .txtFileName .toPlainText ().strip ():
661
661
# Do we have unsaved changes?
662
662
if os .path .exists (file_path ) and not self .edit_file_path :
663
- ret = QMessageBox .question (self , _ ("Title Editor" ), _ ("%s already exists.\n Do you want to replace it?" ) % file_name ,
664
- QMessageBox .No | QMessageBox .Yes )
663
+ ret = QMessageBox .question (
664
+ self , _ ("Title Editor" ),
665
+ _ ("%s already exists.\n Do you want to replace it?" ) % file_name ,
666
+ QMessageBox .No | QMessageBox .Yes
667
+ )
665
668
if ret == QMessageBox .No :
666
669
# Do nothing
667
670
return
@@ -682,7 +685,6 @@ def add_file(self, filepath):
682
685
filename = os .path .basename (filepath )
683
686
684
687
# Add file into project
685
- app = get_app ()
686
688
_ = get_app ()._tr
687
689
688
690
# Check for this path in our existing project data
0 commit comments