@@ -111,13 +111,27 @@ def __init__(self, filePath=None, parent=None):
111
111
self .btnReplace .clicked .connect (self .replace )
112
112
self .lastSearch = None
113
113
114
- self .filePath = filePath
115
- if self . filePath is not None :
116
- self ._loadFile (self . filePath )
114
+ self .filePath = None
115
+ if filePath is not None :
116
+ self ._loadFile (filePath )
117
117
118
118
self .needUpdate = False
119
119
self .setHasChanged (False )
120
120
121
+ def update_dialog_title (self ):
122
+ """
123
+ Updates the script editor dialog title
124
+ """
125
+ if self .filePath :
126
+ path , file_name = os .path .split (self .filePath )
127
+ else :
128
+ file_name = self .tr ('Untitled Script' )
129
+
130
+ if self .hasChanged :
131
+ file_name = '*' + file_name
132
+
133
+ self .setWindowTitle (self .tr ('{} - Processing Script Editor' ).format (file_name ))
134
+
121
135
def closeEvent (self , event ):
122
136
settings = QgsSettings ()
123
137
settings .setValue ("/Processing/stateScriptEditor" , self .saveState ())
@@ -165,7 +179,6 @@ def openScript(self):
165
179
166
180
with OverrideCursor (Qt .WaitCursor ):
167
181
self ._loadFile (fileName )
168
- self .filePath = fileName
169
182
170
183
def save (self ):
171
184
self .saveScript (False )
@@ -205,6 +218,7 @@ def saveScript(self, saveAs):
205
218
def setHasChanged (self , hasChanged ):
206
219
self .hasChanged = hasChanged
207
220
self .actionSaveScript .setEnabled (hasChanged )
221
+ self .update_dialog_title ()
208
222
209
223
def runAlgorithm (self ):
210
224
d = {}
@@ -275,3 +289,6 @@ def _loadFile(self, filePath):
275
289
self .hasChanged = False
276
290
self .editor .setModified (False )
277
291
self .editor .recolor ()
292
+
293
+ self .filePath = filePath
294
+ self .update_dialog_title ()
0 commit comments