224 """Go ahead and create the relevant files. """
226 if self.
ui.e_name_of_script.text().strip() ==
"":
237 menu_entry = self.
ui.e_menu_entry.text()
238 if menu_entry.strip() ==
"":
239 menu_entry = self.
ui.e_name_of_script.text()
241 comment = self.
ui.e_comment.text()
242 if comment.strip() ==
"":
243 comment =
"Replace this text with your description"
246 SCRIPT_NAME: self.
ui.e_name_of_script.text(),
247 SCRIPT_COMMENT: comment,
249 SCRIPT_TYPE: SCRIPT_DOCKER
if self.
ui.rb_docker.isChecked()
else SCRIPT_EXTENSION,
250 MENU_ENTRY: menu_entry,
259 os.mkdir(package_directory)
260 except FileExistsError:
267 with open(fn,
'w+t')
as f:
268 f.write(DESKTOP_TEMPLATE.format(**values))
271 with open(fn,
'w+t')
as f:
272 if self.
ui.rb_docker.isChecked():
273 f.write(INIT_TEMPLATE_DOCKER.format(**values))
275 f.write(INIT_TEMPLATE_EXTENSION.format(**values))
281 if self.
ui.rb_docker.isChecked():
282 with open(fn,
'w+t')
as f:
283 f.write(DOCKER_TEMPLATE.format(**values))
286 with open(fn,
'w+t')
as f:
287 f.write(EXTENSION_TEMPLATE.format(**values))
291 with open(fn,
'w+t')
as f:
292 f.write(MANUAL_TEMPLATE.format(**values))
295 if self.
ui.cb_enable_script.isChecked():
296 Application.writeSetting(SCRIPT_SETTINGS,
'enable_'+self.
package_name,
'true')
300 title =
"Krita Script files created"
302 message.append(
"<h3>Directory</h3>")
303 message.append(
"Project files were created in the directory<p>%s"
306 "<h3>Files Created</h3>The following files were created:<p>")
308 message.append(
"%s<p>" % f)
310 message.append(
"<h3>Location of script</h3>")
311 message.append(
"Open this file to edit your script:<p>")
313 message.append(
"%s<p>" % script_path)
314 message.append(
"Open this file to edit your Manual:<p>")
316 message.append(
"%s<p>" % script_path)
317 message.append(
"<h3>Record these locations</h3>")
319 "Make a note of these locations before you click ok.<p>")
320 message =
"\n".join(message)
324 msgbox = QMessageBox()
326 msgbox = QMessageBox(self)
327 msgbox.setWindowTitle(title)
328 msgbox.setText(message)
329 msgbox.setStandardButtons(QMessageBox.StandardButton.Ok)
330 msgbox.setDefaultButton(QMessageBox.StandardButton.Ok)
331 msgbox.setIcon(QMessageBox.Icon.Information)