andrej@1565: #!/usr/bin/env python andrej@1565: # -*- coding: utf-8 -*- andrej@1565: andrej@1565: # This file is part of Beremiz, a Integrated Development Environment for andrej@1565: # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. andrej@1565: # andrej@1565: # Copyright (C) 2016: Andrey Skvortsov andrej@1565: # andrej@1565: # See COPYING file for copyrights details. andrej@1565: # andrej@1565: # This program is free software; you can redistribute it and/or andrej@1565: # modify it under the terms of the GNU General Public License andrej@1565: # as published by the Free Software Foundation; either version 2 andrej@1565: # of the License, or (at your option) any later version. andrej@1565: # andrej@1565: # This program is distributed in the hope that it will be useful, andrej@1565: # but WITHOUT ANY WARRANTY; without even the implied warranty of andrej@1565: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrej@1565: # GNU General Public License for more details. andrej@1565: # andrej@1565: # You should have received a copy of the GNU General Public License andrej@1565: # along with this program; if not, write to the Free Software andrej@1565: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. andrej@1565: andrej@1565: andrej@1561: import subprocess, os andrej@1561: andrej@1561: def GetAppRevision(): andrej@1561: rev = None andrej@1561: app_dir=os.path.dirname(os.path.realpath(__file__)) andrej@1561: try: andrej@1561: pipe = subprocess.Popen( andrej@1561: ["hg", "id", "-i"], andrej@1561: stdout = subprocess.PIPE, andrej@1561: cwd = app_dir andrej@1561: ) andrej@1561: rev = pipe.communicate()[0] andrej@1561: if pipe.returncode != 0: andrej@1561: rev = None andrej@1561: except: andrej@1561: pass andrej@1561: andrej@1561: # if this is not mercurial repository andrej@1561: # try to read revision from file andrej@1561: if rev is None: andrej@1561: try: andrej@1561: f = open(os.path.join(app_dir,"revision")) andrej@1561: rev = f.readline() andrej@1561: except: andrej@1561: pass andrej@1561: return rev andrej@1561: andrej@1565: def GetAboutDialogInfo(): andrej@1565: import wx andrej@1565: info = wx.AboutDialogInfo() andrej@1565: andrej@1565: info.Name = "Beremiz" andrej@1565: info.Version = app_version andrej@1565: andrej@1565: info.Copyright = "(C) 2016 Andrey Skvortsov\n" andrej@1565: info.Copyright += "(C) 2008-2015 Eduard Tisserant\n" andrej@1565: info.Copyright += "(C) 2008-2015 Laurent Bessard" andrej@1565: andrej@1565: info.WebSite = ("http://beremiz.org", "beremiz.org") andrej@1565: andrej@1565: info.Description = _("Open Source framework for automation, " andrej@1565: "implemented IEC 61131 IDE with constantly growing set of extensions " andrej@1565: "and flexible PLC runtime.") andrej@1565: andrej@1565: info.Developers = ("Andrey Skvortsov ", andrej@1565: "Sergey Surkov ", andrej@1565: "Edouard Tisserant ", andrej@1565: "Laurent Bessard ") andrej@1565: andrej@1565: andrej@1565: info.License = ('\n This program is free software; you can redistribute it and/or\n' andrej@1565: ' modify it under the terms of the GNU General Public License\n' andrej@1565: ' as published by the Free Software Foundation; either version 2\n' andrej@1565: ' of the License, or (at your option) any later version.\n' andrej@1565: '\n' andrej@1565: ' This program is distributed in the hope that it will be useful,\n' andrej@1565: ' but WITHOUT ANY WARRANTY; without even the implied warranty of\n' andrej@1565: ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n' andrej@1565: ' GNU General Public License below for more details.\n' andrej@1565: '\n' andrej@1565: '\n' andrej@1565: '\n' andrej@1565: '') andrej@1565: andrej@1565: # read license file andrej@1565: path=os.path.join(os.path.dirname(os.path.abspath(__file__))) andrej@1565: license_path = os.path.join(path, u"COPYING") andrej@1565: license='' andrej@1565: if os.path.exists(license_path): andrej@1565: with open(license_path) as f: andrej@1565: info.License += f.read() andrej@1565: andrej@1565: info.Icon = wx.Icon(os.path.join(path, "images", "__about_brz_logo.png"), wx.BITMAP_TYPE_PNG) andrej@1565: # info.Icon = wx.Icon(os.path.join(path, "images", "about_brz_logo.png"), wx.BITMAP_TYPE_PNG) andrej@1565: andrej@1565: info.Translators = ("Russian\t- Andrey Skvortsov ", andrej@1565: "Korean\t- Reinhard Lee ", andrej@1565: "German\t- Mark Muzenhardt ", andrej@1565: "French\t- Laurent Bessard ") andrej@1565: return info andrej@1565: andrej@1561: app_version = "1.2" andrej@1561: rev = GetAppRevision() andrej@1561: if rev is not None: andrej@1561: app_version = app_version + "-" + rev.rstrip() andrej@1561: andrej@1561: andrej@1561: