1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import os.path
20
21 import wx
22
23 from timelinelib.wxgui.utils import _ask_question
24 from timelinelib.wxgui.utils import WildcardHelper
25
26
28 images_wildcard_helper = WildcardHelper(
29 _("Image files"), [("png", wx.BITMAP_TYPE_PNG)])
30 wildcard = images_wildcard_helper.wildcard_string()
31 dialog = wx.FileDialog(main_frame, message=_("Export to Image"),
32 wildcard=wildcard, style=wx.FD_SAVE)
33 if dialog.ShowModal() == wx.ID_OK:
34 path = images_wildcard_helper.get_path(dialog)
35 overwrite_question = _("File '%s' exists. Overwrite?") % path
36 if (not os.path.exists(path) or
37 _ask_question(overwrite_question, main_frame) == wx.YES):
38 bitmap = main_frame.main_panel.drawing_area.get_current_image()
39 image = wx.ImageFromBitmap(bitmap)
40 type = images_wildcard_helper.get_extension_data(path)
41 image.SaveFile(path, type)
42 dialog.Destroy()
43