Ejemplo n.º 1
0
 def __init__(self, parent, sInitText):
     wx.Dialog.__init__(self, parent, -1, 'About NXP Zigbee License Installer')
     html = wx.html.HtmlWindow(self, -1, size=(320, -1))
     html.SetPage(self.text % sInitText)
     btn = html.FindWindowById(wx.ID_OK)
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 2
0
    def __init__(self, parent, config):
        wx.Dialog.__init__(self, parent, -1, 'About EvilScribe version ' +
                           config.app_version)

        html = wx.html.HtmlWindow(self, -1, size=(640, -1))
        html.LoadPage('http://www.evilscribe.net')
        ir = html.GetInternalRepresentation()
        html.SetSize((ir.GetWidth()+24, ir.GetHeight()+25))
        self.SetClientSize(html.GetSize())
        self.CentreOnParent(wx.BOTH)
Ejemplo n.º 3
0
 def __init__(self, parent):
     wx.Dialog.__init__(self, parent, wx.ID_ANY, "About BrewFlasher")
     html = HtmlWindow(self, wx.ID_ANY, size=(420, -1))
     if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
         html.SetStandardFonts()
     txt = self.text.format(self._get_bundle_dir(), __version__)
     html.SetPage(txt)
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 4
0
 def __init__(self, parent):
     wx.Dialog.__init__(self,
                        parent,
                        -1,
                        u'关于 PMManager v1.0',
                        style=wx.DEFAULT_DIALOG_STYLE)
     html = HtmlWin(self)
     html.SetPage(self.text)
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 20, ir.GetHeight() + 5))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 5
0
    def _create_contents(self, parent):
        if parent.GetParent() is not None:
            title = parent.GetParent().GetTitle()

        else:
            title = ""

        # Set the title.
        self.title = "About %s" % title

        # Load the image to be displayed in the about box.
        image = self.image.create_image()
        path = self.image.absolute_path

        # The additional strings.
        additions = '<br />'.join(self.additions)

        # The width of a wx HTML window is fixed (and  is given in the
        # constructor). We set it to the width of the image plus a fudge
        # factor! The height of the window depends on the content.
        width = image.GetWidth() + 80
        html = wx.html.HtmlWindow(parent, -1, size=(width, -1))

        # Get the version numbers.
        py_version = sys.version[0:sys.version.find("(")]
        wx_version = wx.VERSION_STRING

        # Get the text of the OK button.
        if self.ok_label is None:
            ok = "OK"
        else:
            ok = self.ok_label

        # Set the page contents.
        html.SetPage(_DIALOG_TEXT %
                     (path, additions, py_version, wx_version, ok))

        # Make the 'OK' button the default button.
        ok_button = parent.FindWindowById(
            wx.ID_OK)  #html.Window.FindWindowById(wx.ID_OK)
        ok_button.SetDefault()

        # Set the height of the HTML window to match the height of the content.
        internal = html.GetInternalRepresentation()
        html.SetSize((-1, internal.GetHeight()))

        # Make the dialog client area big enough to display the HTML window.
        # We add a fudge factor to the height here, although I'm not sure why
        # it should be necessary, the HTML window should report its required
        # size!?!
        width, height = html.GetSize().Get()
        parent.SetClientSize((width, height + 10))
Ejemplo n.º 6
0
 def __init__(self, parent, size=(400, 200)):
     wx.Dialog.__init__(self,
                        parent,
                        -1,
                        u'关于 Web Publisher v1.1',
                        size=size,
                        style=wx.DEFAULT_DIALOG_STYLE)
     html = HtmlWin(self)
     html.SetPage(self.text)
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 20, ir.GetHeight() + 5))
     #html.SetSize( (400, 320) )
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 7
0
 def __init__(self, parent):
     wx.Dialog.__init__(self, parent, -1, 'About the wxPython demo',)
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     py_version = sys.version.split()[0]
     html.SetPage(self.text % (wx.VERSION_STRING,
                               ", ".join(wx.PlatformInfo[1:]),
                               py_version
                               ))
     btn = html.FindWindowById(wx.ID_OK)
     ir = html.GetInternalRepresentation()
     html.SetSize( (ir.GetWidth()+25, ir.GetHeight()+25) )
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 8
0
 def __init__(self, parent, program_name, program_version, program_author,
              program_copyright, program_contact):
     wx.Dialog.__init__(self, parent, -1, 'About %s' % program_name,
                        style=wx.TAB_TRAVERSAL)
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     html.SetPage(self.text % (program_name, program_version,
                               program_author,
                               program_copyright, program_contact))
     btn = html.FindWindowById(wx.ID_OK)
     btn.SetDefault()
     btn.SetFocus() #this set the focus to the button when dialog pops up
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth()+25, ir.GetHeight()+25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 9
0
 def __init__(self, parent):
     wx.Dialog.__init__(
         self,
         parent,
         -1,
         'About the wxPython demo',
     )
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     py_version = sys.version.split()[0]
     html.SetPage(self.text % ("0.1", wx.VERSION_STRING))
     btn = html.FindWindowById(wx.ID_OK)
     ##btn.SetDefault()
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 10
0
 def __init__(self, parent):
     wx.Dialog.__init__(
         self,
         parent,
         -1,
         'Help: repoman CVS commits',
     )
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     py_version = sys.version.split()[0]
     html.SetPage(self.text %
                  (__version__.version, py_version, wx.VERSION_STRING))
     btn = html.FindWindowById(wx.ID_OK)
     btn.SetDefault()
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 11
0
    def __init__(self, parent, htmlText):
        """ display author note about the SC4M file"""
        wx.Dialog.__init__(
            self,
            parent,
            -1,
            'SC4M Author notes',
        )
        html = MyHtmlWindow(self, -1, size=(420, -1))
        #html.LoadPage( "about.html" )
        print type(htmlText)
        html.SetPage(htmlText)

        btn = html.FindWindowById(wx.ID_OK)
        ir = html.GetInternalRepresentation()
        html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
        self.SetClientSize(html.GetSize())
        self.CentreOnParent(wx.BOTH)
Ejemplo n.º 12
0
 def __init__(self, parent, title, error_msg):
     wx.Dialog.__init__(
         self,
         parent,
         -1,
         'System Error',
     )
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     py_version = sys.version.split()[0]
     txt = self.text % (title, error_msg)
     html.SetPage(txt)
     btn = html.FindWindowById(wx.ID_OK)
     ir = html.GetInternalRepresentation()
     html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
     self.SetClientSize(html.GetSize())
     self.CentreOnParent(wx.BOTH)
Ejemplo n.º 13
0
    def __init__(self, parent, text):
        wx.Dialog.__init__(
            self,
            parent,
            -1,
            'GWiz Help',
        )
        html = wx.html.HtmlWindow(self, -1, size=(420, -1))
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        map = {
            'PY_VERSION': sys.version.split()[0],
            'WX_VERSION': wx.VERSION_STRING,
            'WX_PLATFORM': wx.PlatformInfo[1:]
        }

        #!!!KL modify this to scroll the text so that long help files will be
        #supported

        htmlCode = self.preamble + text + self.postamble

        t = Template(htmlCode)
        ##         print "htmlCode before:%s" % htmlCode
        try:
            htmlCode = t.safe_substitute(map)
        except TypeError:
            #!!!KL safe_substitue seems to throw an exception
            ##             print "exception TypeError"
            pass

##         print "htmlCode after:%s" % htmlCode

        html.SetPage(htmlCode)
        btn = html.FindWindowById(wx.ID_OK)
        ir = html.GetInternalRepresentation()
        html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
        self.SetClientSize(html.GetSize())
        self.CenterOnParent(wx.BOTH)
Ejemplo n.º 14
0
    def _create_contents(self, parent):
        if parent.GetParent() is not None:
            title = parent.GetParent().GetTitle()

        else:
            title = ""

        # Set the title.
        self.title = "About %s" % title

        # Load the image to be displayed in the about box.
        image = self.image.create_image()

        # The width of a wx HTML window is fixed (and  is given in the
        # constructor). We set it to the width of the image plus a fudge
        # factor! The height of the window depends on the content.
        width = image.GetWidth() + 80
        html = wx.html.HtmlWindow(parent, -1, size=(width, -1))

        # Set the page contents.
        html.SetPage(self._create_html())

        # Make the 'OK' button the default button.
        ok_button = parent.FindWindowById(
            wx.ID_OK
        )  # html.Window.FindWindowById(wx.ID_OK)
        ok_button.SetDefault()

        # Set the height of the HTML window to match the height of the content.
        internal = html.GetInternalRepresentation()
        html.SetSize((-1, internal.GetHeight()))

        # Make the dialog client area big enough to display the HTML window.
        # We add a fudge factor to the height here, although I'm not sure why
        # it should be necessary, the HTML window should report its required
        # size!?!
        width, height = html.GetSize().Get()
        parent.SetClientSize((width, height + 10))
Ejemplo n.º 15
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, _('About Wammu'))

        copyrightline = u'Copyright &copy; 2003 - 2011 Michal Čihař'

        # default system colours
        bgc = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)
        fgc = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT)
        hfgc = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)

        colours = 'text="#%02x%02x%02x" bgcolor="#%02x%02x%02x" link="#%02x%02x%02x"' % (
            fgc.Red(), fgc.Green(), fgc.Blue(),
            bgc.Red(), bgc.Green(), bgc.Blue(),
            hfgc.Red(), hfgc.Green(), hfgc.Blue())

        text = '''
<html>
<body %s>
<center><font color="#ffffff"><table bgcolor="#458154" width="100%%" cellspacing="0"
cellpadding="0" border="1">
<tr>
    <td align="center">
    %s
    </td>
</tr>
</table></font>

<p>%s</p>

<p>
<font size=-3>
%s
<br><br>
%s
<br><br>
%s
</font>
</p>
<p>
<wxp module="wx" class="Button">
    <param name="id"    value="ID_OK">
</wxp>
</p>
</center>
</body>
</html>

''' % (colours, '''<img src="%s"><br><h2> Wammu %s</h2>
    %s<br>
    %s<br>
    %s<br>
''' % (Wammu.Paths.AppIconPath('wammu'),
            Wammu.__version__,
            _('Running on Python %s') % sys.version.split()[0],
            _('Using wxPython %s') % wx.VERSION_STRING,
            _('Using python-gammu %(python_gammu_version)s and Gammu %(gammu_version)s') % {
                'python_gammu_version': gammu.Version()[1],
                'gammu_version': gammu.Version()[0]
            }),
            _('<b>Wammu</b> is a wxPython based GUI for Gammu.'),
            copyrightline,
            _('''
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
'''),
            _('''
This program 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.
'''))

        html = wx.html.HtmlWindow(self, -1, size=(500, -1))
        html.SetPage(text)
        btn = html.FindWindowById(wx.ID_OK)
        if btn is not None:
            btn.SetDefault()
        representation = html.GetInternalRepresentation()
        html.SetSize(
            (representation.GetWidth() + 25, representation.GetHeight() + 25)
        )
        self.SetClientSize(html.GetSize())
        self.CentreOnParent(wx.BOTH)