# HG changeset patch # User Andrey Skvortsov # Date 1479379684 -10800 # Node ID 894f31f8ca64a8652abe62d5e5634065d99b6d57 # Parent 8ffd0b52c2c77e32414222c4816060de1511c91e make about dialog boxes use standard wx about dialogs Any information in dialog can be easily changed without much effort and the dialog can be easy translated. Unfortunately on Windows there is no good standard about dialog, therefore own implementation is used there. diff -r 8ffd0b52c2c7 -r 894f31f8ca64 Beremiz.py --- a/Beremiz.py Tue Nov 08 18:14:30 2016 +0300 +++ b/Beremiz.py Thu Nov 17 13:48:04 2016 +0300 @@ -159,6 +159,7 @@ from util.ProcessLogger import ProcessLogger from controls.LogViewer import LogViewer from controls.CustomStyledTextCtrl import CustomStyledTextCtrl +from dialogs.AboutDialog import ShowAboutDialog from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY, ITEM_PROJECT, ITEM_RESOURCE from ProjectController import ProjectController, GetAddMenuItems, MATIEC_ERROR_MODEL, ITEM_CONFNODE @@ -1015,8 +1016,8 @@ self.Close() def OnAboutMenu(self, event): - title=_("About Beremiz") + " " + version.app_version - OpenHtmlFrame(self, title, Bpath("doc", _("about.html")), wx.Size(550, 550)) + info = version.GetAboutDialogInfo() + ShowAboutDialog(self, info) def OnProjectTreeItemBeginEdit(self, event): selected = event.GetItem() diff -r 8ffd0b52c2c7 -r 894f31f8ca64 PLCOpenEditor.py --- a/PLCOpenEditor.py Tue Nov 08 18:14:30 2016 +0300 +++ b/PLCOpenEditor.py Thu Nov 17 13:48:04 2016 +0300 @@ -77,6 +77,7 @@ from editors.Viewer import Viewer from PLCControler import PLCControler from dialogs import ProjectDialog +from dialogs.AboutDialog import ShowAboutDialog #------------------------------------------------------------------------------- # PLCOpenEditor Main Class @@ -349,8 +350,12 @@ open_pdf(os.path.join(beremiz_dir, "plcopen", "TC6_XML_V101.pdf")) def OnAboutMenu(self, event): - title= _("About PLCOpenEditor") + " " + version.app_version - OpenHtmlFrame(self, title, os.path.join(beremiz_dir, "doc", _("plcopen_about.html")), wx.Size(350, 350)) + info = version.GetAboutDialogInfo() + info.Name = "PLCOpenEditor" + info.Description = _("PLCOpenEditor is part of Beremiz project.\n\n" + "Beremiz is an ") + info.Description + info.Icon = wx.Icon(os.path.join(beremiz_dir, "images", "aboutlogo.png"), wx.BITMAP_TYPE_PNG) + ShowAboutDialog(self, info) def SaveProject(self): result = self.Controler.SaveXMLFile() diff -r 8ffd0b52c2c7 -r 894f31f8ca64 dialogs/AboutDialog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dialogs/AboutDialog.py Thu Nov 17 13:48:04 2016 +0300 @@ -0,0 +1,173 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2009, 2010 by Steven Sproat +# +# GNU General Public Licence (GPL) +# +# Whyteboard is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# Whyteboard is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# You should have received a copy of the GNU General Public License along with +# Whyteboard; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + + +""" +This module contains classes extended from wx.Dialog used by the GUI. +""" + +import os +import sys +import time +import wx +from wx.lib.agw.hyperlink import HyperLinkCtrl + + +#---------------------------------------------------------------------- + +class AboutDialog(wx.Dialog): + """ + A replacement About Dialog for Windows, as it uses a generic frame that + well...sucks. + """ + def __init__(self, parent, info): + title = _("About") + " " + info.Name + wx.Dialog.__init__(self, parent, title=title) + self.info = info + + if parent and parent.GetIcon(): + self.SetIcon(parent.GetIcon()) + + image = None + if self.info.Icon: + bitmap = wx.BitmapFromIcon(self.info.Icon) + image = wx.StaticBitmap(self, bitmap=bitmap) + + name = wx.StaticText(self, label="%s %s" % (info.Name, info.Version)) + description = wx.StaticText(self, label=info.Description) + copyright = wx.StaticText(self, label=info.Copyright) + url = HyperLinkCtrl(self, label=info.WebSite[0], URL=info.WebSite[1]) + + font = name.GetClassDefaultAttributes().font + font.SetWeight(wx.FONTWEIGHT_BOLD) + font.SetPointSize(18) + name.SetFont(font) + + credits = wx.Button(self, id=wx.ID_ABOUT, label=_("C&redits")) + license = wx.Button(self, label=_("&License")) + close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) + + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer.Add(credits, flag=wx.CENTER | wx.LEFT | wx.RIGHT, border=5) + btnSizer.Add(license, flag=wx.CENTER | wx.RIGHT, border=5) + btnSizer.Add(close, flag=wx.CENTER | wx.RIGHT, border=5) + + sizer = wx.BoxSizer(wx.VERTICAL) + if image: + sizer.Add(image, flag=wx.CENTER | wx.TOP | wx.BOTTOM, border=5) + sizer.Add(name, flag=wx.CENTER | wx.BOTTOM, border=10) + sizer.Add(description, flag=wx.CENTER | wx.BOTTOM, border=10) + sizer.Add(copyright, flag=wx.CENTER | wx.BOTTOM, border=10) + sizer.Add(url, flag=wx.CENTER | wx.BOTTOM, border=15) + sizer.Add(btnSizer, flag=wx.CENTER | wx.BOTTOM, border=5) + + container = wx.BoxSizer(wx.VERTICAL) + container.Add(sizer, flag=wx.ALL, border=10) + self.SetSizer(container) + self.Layout() + self.Fit() + self.Centre() + self.Show(True) + self.SetEscapeId(close.GetId()) + + credits.Bind(wx.EVT_BUTTON, self.on_credits) + license.Bind(wx.EVT_BUTTON, self.on_license) + close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) + + def on_license(self, event): + LicenseDialog(self, self.info) + + def on_credits(self, event): + CreditsDialog(self, self.info) + + +#---------------------------------------------------------------------- + +class CreditsDialog(wx.Dialog): + def __init__(self, parent, info): + wx.Dialog.__init__(self, parent, title=_("Credits"), size=(475, 320), + style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) + + if parent and parent.GetIcon(): + self.SetIcon(parent.GetIcon()) + + self.SetMinSize((300, 200)) + notebook = wx.Notebook(self) + close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) + close.SetDefault() + + developer = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) + translators = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) + + developer.SetValue(u'\n'.join(info.Developers)) + translators.SetValue(u'\n'.join(info.Translators)) + + notebook.AddPage(developer, text=_("Written by")) + notebook.AddPage(translators, text=_("Translated by")) + + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer.Add(close) + + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 10) + sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) + self.SetSizer(sizer) + self.Layout() + self.Show() + self.SetEscapeId(close.GetId()) + + close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) + + +#---------------------------------------------------------------------- + +class LicenseDialog(wx.Dialog): + def __init__(self, parent, info): + wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400), + style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) + + if parent and parent.GetIcon(): + self.SetIcon(parent.GetIcon()) + + self.SetMinSize((400, 300)) + close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) + + ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) + ctrl.SetValue(info.License) + + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer.Add(close) + + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10) + sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) + self.SetSizer(sizer) + self.Layout() + self.Show() + self.SetEscapeId(close.GetId()) + + close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) + +#---------------------------------------------------------------------- + +def ShowAboutDialog(parent, info): + if os.name == "nt": + AboutDialog(parent, info) + else: + wx.AboutBox(info) diff -r 8ffd0b52c2c7 -r 894f31f8ca64 doc/about.html --- a/doc/about.html Tue Nov 08 18:14:30 2016 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - -
- -

-Beremiz is an Open Source framework for automation. -

-http://www.beremiz.org/ -

- - - - - - - - -
- Contributor : - - University of Porto
- http://www.fe.up.pt/si/web_page.inicial -
-


- Beremiz is distrubuted under the term
of the - GNU - General Public License (GPL) version 2 or -
(at your option) any later version. -
-
- - diff -r 8ffd0b52c2c7 -r 894f31f8ca64 doc/about.ru.html --- a/doc/about.ru.html Tue Nov 08 18:14:30 2016 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ - - - - О Beremiz - - -
- -

- Beremiz - это свободное программное обеспечение для автоматизации. -

- http://www.beremiz.org/ -

- - - - - - - - -
- Спонсор разработки: - - Университет Порту
- http://www.fe.up.pt/si/web_page.inicial -
-


- Beremiz распространяется на условиях
- Стандартной - общественной лицензии GNU (GPL) версии 2 -
или (на ваше усмотрение) более поздней версии. -
-
- - diff -r 8ffd0b52c2c7 -r 894f31f8ca64 doc/plcopen_about.html --- a/doc/plcopen_about.html Tue Nov 08 18:14:30 2016 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - -
- -

-The PLCopen Editor saves and loads XML projects,
accordingly to PLCopen TC6-XML Schemes.
-

-More informations on : -http://www.beremiz.org/ -

-
- - \ No newline at end of file diff -r 8ffd0b52c2c7 -r 894f31f8ca64 doc/plcopen_about.ru.html --- a/doc/plcopen_about.ru.html Tue Nov 08 18:14:30 2016 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - О PLCOpen Editor - - -
- -

-PLCopen Editor сохраняет и загружает XML - проекты,
созданные согласно PLCopen TC6-XML схемам.
-

-За подробной информацией обращаться: -http://www.beremiz.org/ -

-
- - diff -r 8ffd0b52c2c7 -r 894f31f8ca64 images/about_brz_logo.png Binary file images/about_brz_logo.png has changed diff -r 8ffd0b52c2c7 -r 894f31f8ca64 images/icons.svg --- a/images/icons.svg Tue Nov 08 18:14:30 2016 +0300 +++ b/images/icons.svg Thu Nov 17 13:48:04 2016 +0300 @@ -15,7 +15,7 @@ height="1052.3622" id="svg2" sodipodi:version="0.32" - inkscape:version="0.48.3.1 r9886" + inkscape:version="0.91 r13725" sodipodi:docname="icons.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + style="fill:#84c225;fill-rule:evenodd;stroke:#5d9d35;stroke-width:2.82220006" /> + style="fill:#84c225;fill-rule:evenodd;stroke:#5d9d35;stroke-width:2.82220006" /> + cx="0" /> + cx="0" /> + cx="0" /> + cx="0" /> + cx="0" /> + style="fill:#84c225;fill-rule:evenodd;stroke:#5d9d35;stroke-width:2.82220006" /> + %% about_brz_logo %% +