svghmi/svghmi.py
branchwxPython4
changeset 3572 b46af5b80c7d
parent 3526 074046800624
child 3573 1ee56fb544fc
equal deleted inserted replaced
3571:fdd4b171ac6c 3572:b46af5b80c7d
   719         res += (("runtime_%s_svghmi.py" % location_str, open(runtimefile_path, "rb")),)
   719         res += (("runtime_%s_svghmi.py" % location_str, open(runtimefile_path, "rb")),)
   720 
   720 
   721         return res
   721         return res
   722 
   722 
   723     def _ImportSVG(self):
   723     def _ImportSVG(self):
   724         dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "",  _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN)
   724         dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "",  _("SVG files (*.svg)|*.svg|All files|*.*"), wx.FD_OPEN)
   725         if dialog.ShowModal() == wx.ID_OK:
   725         if dialog.ShowModal() == wx.ID_OK:
   726             svgpath = dialog.GetPath()
   726             svgpath = dialog.GetPath()
   727             if os.path.isfile(svgpath):
   727             if os.path.isfile(svgpath):
   728                 shutil.copy(svgpath, self._getSVGpath())
   728                 shutil.copy(svgpath, self._getSVGpath())
   729             else:
   729             else:
   763             open_pofile(POFile)
   763             open_pofile(POFile)
   764 
   764 
   765     def _EditPO(self):
   765     def _EditPO(self):
   766         """ Select a specific translation and edit it with POEdit """
   766         """ Select a specific translation and edit it with POEdit """
   767         project_path = self.CTNPath()
   767         project_path = self.CTNPath()
   768         dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a PO file"), project_path, "",  _("PO files (*.po)|*.po"), wx.OPEN)
   768         dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a PO file"), project_path, "",  _("PO files (*.po)|*.po"), wx.FD_OPEN)
   769         if dialog.ShowModal() == wx.ID_OK:
   769         if dialog.ShowModal() == wx.ID_OK:
   770             POFile = dialog.GetPath()
   770             POFile = dialog.GetPath()
   771             if os.path.isfile(POFile):
   771             if os.path.isfile(POFile):
   772                 if os.path.relpath(POFile, project_path) == os.path.basename(POFile):
   772                 if os.path.relpath(POFile, project_path) == os.path.basename(POFile):
   773                     self._StartPOEdit(POFile)
   773                     self._StartPOEdit(POFile)
   789         dialog = wx.FileDialog(
   789         dialog = wx.FileDialog(
   790             self.GetCTRoot().AppFrame,
   790             self.GetCTRoot().AppFrame,
   791             _("Choose a font"),
   791             _("Choose a font"),
   792             os.path.expanduser("~"),
   792             os.path.expanduser("~"),
   793             "",
   793             "",
   794             _("Font files (*.ttf;*.otf;*.woff;*.woff2)|*.ttf;*.otf;*.woff;*.woff2"), wx.OPEN)
   794             _("Font files (*.ttf;*.otf;*.woff;*.woff2)|*.ttf;*.otf;*.woff;*.woff2"), wx.FD_OPEN)
   795 
   795 
   796         if dialog.ShowModal() == wx.ID_OK:
   796         if dialog.ShowModal() == wx.ID_OK:
   797             fontfile = dialog.GetPath()
   797             fontfile = dialog.GetPath()
   798             if os.path.isfile(fontfile):
   798             if os.path.isfile(fontfile):
   799                 familyname, uniquename, formatname, mimetype = GetFontTypeAndFamilyName(fontfile)
   799                 familyname, uniquename, formatname, mimetype = GetFontTypeAndFamilyName(fontfile)
   826         dialog = wx.FileDialog(
   826         dialog = wx.FileDialog(
   827             self.GetCTRoot().AppFrame,
   827             self.GetCTRoot().AppFrame,
   828             _("Choose a font to remove"),
   828             _("Choose a font to remove"),
   829             fontdir,
   829             fontdir,
   830             "",
   830             "",
   831             _("Font files (*.ttf;*.otf;*.woff;*.woff2)|*.ttf;*.otf;*.woff;*.woff2"), wx.OPEN)
   831             _("Font files (*.ttf;*.otf;*.woff;*.woff2)|*.ttf;*.otf;*.woff;*.woff2"), wx.FD_OPEN)
   832         if dialog.ShowModal() == wx.ID_OK:
   832         if dialog.ShowModal() == wx.ID_OK:
   833             fontfile = dialog.GetPath()
   833             fontfile = dialog.GetPath()
   834             if os.path.isfile(fontfile):
   834             if os.path.isfile(fontfile):
   835                 if os.path.relpath(fontfile, fontdir) == os.path.basename(fontfile):
   835                 if os.path.relpath(fontfile, fontdir) == os.path.basename(fontfile):
   836                     os.remove(fontfile) 
   836                     os.remove(fontfile)