|
1 #!/usr/bin/env python |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # This file is part of Beremiz, a Integrated Development Environment for |
|
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
|
6 # |
|
7 # Copyright (C) 2016: Andrey Skvortsov |
|
8 # |
|
9 # See COPYING file for copyrights details. |
|
10 # |
|
11 # This program is free software; you can redistribute it and/or |
|
12 # modify it under the terms of the GNU General Public License |
|
13 # as published by the Free Software Foundation; either version 2 |
|
14 # of the License, or (at your option) any later version. |
|
15 # |
|
16 # This program is distributed in the hope that it will be useful, |
|
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 # GNU General Public License for more details. |
|
20 # |
|
21 # You should have received a copy of the GNU General Public License |
|
22 # along with this program; if not, write to the Free Software |
|
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
24 |
|
25 |
|
26 import subprocess, os |
|
27 |
|
28 def GetAppRevision(): |
|
29 rev = None |
|
30 app_dir=os.path.dirname(os.path.realpath(__file__)) |
|
31 try: |
|
32 pipe = subprocess.Popen( |
|
33 ["hg", "id", "-i"], |
|
34 stdout = subprocess.PIPE, |
|
35 cwd = app_dir |
|
36 ) |
|
37 rev = pipe.communicate()[0] |
|
38 if pipe.returncode != 0: |
|
39 rev = None |
|
40 except: |
|
41 pass |
|
42 |
|
43 # if this is not mercurial repository |
|
44 # try to read revision from file |
|
45 if rev is None: |
|
46 try: |
|
47 f = open(os.path.join(app_dir,"revision")) |
|
48 rev = f.readline() |
|
49 except: |
|
50 pass |
|
51 return rev |
|
52 |
|
53 def GetAboutDialogInfo(): |
|
54 import wx |
|
55 info = wx.AboutDialogInfo() |
|
56 |
|
57 info.Name = "Beremiz" |
|
58 info.Version = app_version |
|
59 |
|
60 info.Copyright = "(C) 2016 Andrey Skvortsov\n" |
|
61 info.Copyright += "(C) 2008-2015 Eduard Tisserant\n" |
|
62 info.Copyright += "(C) 2008-2015 Laurent Bessard" |
|
63 |
|
64 info.WebSite = ("http://beremiz.org", "beremiz.org") |
|
65 |
|
66 info.Description = _("Open Source framework for automation, " |
|
67 "implemented IEC 61131 IDE with constantly growing set of extensions " |
|
68 "and flexible PLC runtime.") |
|
69 |
|
70 info.Developers = ("Andrey Skvortsov <andrej.skvortzov@gmail.com>", |
|
71 "Sergey Surkov <surkov.sv@summatechnology.ru>", |
|
72 "Edouard Tisserant <edouard.tisserant@gmail.com>", |
|
73 "Laurent Bessard <laurent.bessard@gmail.com>") |
|
74 |
|
75 |
|
76 info.License = ('\n This program is free software; you can redistribute it and/or\n' |
|
77 ' modify it under the terms of the GNU General Public License\n' |
|
78 ' as published by the Free Software Foundation; either version 2\n' |
|
79 ' of the License, or (at your option) any later version.\n' |
|
80 '\n' |
|
81 ' This program is distributed in the hope that it will be useful,\n' |
|
82 ' but WITHOUT ANY WARRANTY; without even the implied warranty of\n' |
|
83 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n' |
|
84 ' GNU General Public License below for more details.\n' |
|
85 '\n' |
|
86 '\n' |
|
87 '\n' |
|
88 '') |
|
89 |
|
90 # read license file |
|
91 path=os.path.join(os.path.dirname(os.path.abspath(__file__))) |
|
92 license_path = os.path.join(path, u"COPYING") |
|
93 license='' |
|
94 if os.path.exists(license_path): |
|
95 with open(license_path) as f: |
|
96 info.License += f.read() |
|
97 |
|
98 info.Icon = wx.Icon(os.path.join(path, "images", "about_brz_logo.png"), wx.BITMAP_TYPE_PNG) |
|
99 |
|
100 info.Translators = ("Russian\t- Andrey Skvortsov <andrej.skvortzov@gmail.com>", |
|
101 "Korean\t- Reinhard Lee <lij3105@gmail.com>", |
|
102 "German\t- Mark Muzenhardt <mark.muzenhardt@gmail.com>", |
|
103 "French\t- Laurent Bessard <laurent.bessard@gmail.com>") |
|
104 return info |
|
105 |
|
106 app_version = "1.2" |
|
107 rev = GetAppRevision() |
|
108 if rev is not None: |
|
109 app_version = app_version + "-" + rev.rstrip() |
|
110 |
|
111 |
|
112 |